1dbdf9cedSTony Lindgren /* 2dbdf9cedSTony Lindgren * linux/arch/arm/mach-omap1/board-osk.c 3dbdf9cedSTony Lindgren * 4dbdf9cedSTony Lindgren * Board specific init for OMAP5912 OSK 5dbdf9cedSTony Lindgren * 6dbdf9cedSTony Lindgren * Written by Dirk Behme <dirk.behme@de.bosch.com> 7dbdf9cedSTony Lindgren * 8dbdf9cedSTony Lindgren * This program is free software; you can redistribute it and/or modify it 9dbdf9cedSTony Lindgren * under the terms of the GNU General Public License as published by the 10dbdf9cedSTony Lindgren * Free Software Foundation; either version 2 of the License, or (at your 11dbdf9cedSTony Lindgren * option) any later version. 12dbdf9cedSTony Lindgren * 13dbdf9cedSTony Lindgren * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 14dbdf9cedSTony Lindgren * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15dbdf9cedSTony Lindgren * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 16dbdf9cedSTony Lindgren * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17dbdf9cedSTony Lindgren * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18dbdf9cedSTony Lindgren * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 19dbdf9cedSTony Lindgren * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20dbdf9cedSTony Lindgren * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21dbdf9cedSTony Lindgren * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22dbdf9cedSTony Lindgren * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23dbdf9cedSTony Lindgren * 24dbdf9cedSTony Lindgren * You should have received a copy of the GNU General Public License along 25dbdf9cedSTony Lindgren * with this program; if not, write to the Free Software Foundation, Inc., 26dbdf9cedSTony Lindgren * 675 Mass Ave, Cambridge, MA 02139, USA. 27dbdf9cedSTony Lindgren */ 28dbdf9cedSTony Lindgren 29dbdf9cedSTony Lindgren #include <linux/kernel.h> 30dbdf9cedSTony Lindgren #include <linux/init.h> 31d052d1beSRussell King #include <linux/platform_device.h> 32a524626bSTony Lindgren #include <linux/interrupt.h> 33d533c128SThomas Gleixner #include <linux/irq.h> 348056c6cbSDavid Brownell #include <linux/i2c.h> 357c38cf02STony Lindgren 367c38cf02STony Lindgren #include <linux/mtd/mtd.h> 377c38cf02STony Lindgren #include <linux/mtd/partitions.h> 38dbdf9cedSTony Lindgren 396d16bfb5SDavid Brownell #include <linux/i2c/tps65010.h> 406d16bfb5SDavid Brownell 41dbdf9cedSTony Lindgren #include <asm/hardware.h> 428056c6cbSDavid Brownell #include <asm/gpio.h> 438056c6cbSDavid Brownell 44dbdf9cedSTony Lindgren #include <asm/mach-types.h> 45dbdf9cedSTony Lindgren #include <asm/mach/arch.h> 46dbdf9cedSTony Lindgren #include <asm/mach/map.h> 477c38cf02STony Lindgren #include <asm/mach/flash.h> 48dbdf9cedSTony Lindgren 49dbdf9cedSTony Lindgren #include <asm/arch/usb.h> 50dbdf9cedSTony Lindgren #include <asm/arch/mux.h> 51dbdf9cedSTony Lindgren #include <asm/arch/tc.h> 52d48af15eSTony Lindgren #include <asm/arch/common.h> 539b6553cdSTony Lindgren #include <asm/arch/mcbsp.h> 549b6553cdSTony Lindgren #include <asm/arch/omap-alsa.h> 559b6553cdSTony Lindgren 567c38cf02STony Lindgren static struct mtd_partition osk_partitions[] = { 577c38cf02STony Lindgren /* bootloader (U-Boot, etc) in first sector */ 587c38cf02STony Lindgren { 597c38cf02STony Lindgren .name = "bootloader", 607c38cf02STony Lindgren .offset = 0, 617c38cf02STony Lindgren .size = SZ_128K, 627c38cf02STony Lindgren .mask_flags = MTD_WRITEABLE, /* force read-only */ 637c38cf02STony Lindgren }, 647c38cf02STony Lindgren /* bootloader params in the next sector */ 657c38cf02STony Lindgren { 667c38cf02STony Lindgren .name = "params", 677c38cf02STony Lindgren .offset = MTDPART_OFS_APPEND, 687c38cf02STony Lindgren .size = SZ_128K, 697c38cf02STony Lindgren .mask_flags = 0, 707c38cf02STony Lindgren }, { 717c38cf02STony Lindgren .name = "kernel", 727c38cf02STony Lindgren .offset = MTDPART_OFS_APPEND, 737c38cf02STony Lindgren .size = SZ_2M, 747c38cf02STony Lindgren .mask_flags = 0 757c38cf02STony Lindgren }, { 767c38cf02STony Lindgren .name = "filesystem", 777c38cf02STony Lindgren .offset = MTDPART_OFS_APPEND, 787c38cf02STony Lindgren .size = MTDPART_SIZ_FULL, 797c38cf02STony Lindgren .mask_flags = 0 807c38cf02STony Lindgren } 81dbdf9cedSTony Lindgren }; 82dbdf9cedSTony Lindgren 837c38cf02STony Lindgren static struct flash_platform_data osk_flash_data = { 847c38cf02STony Lindgren .map_name = "cfi_probe", 857c38cf02STony Lindgren .width = 2, 867c38cf02STony Lindgren .parts = osk_partitions, 877c38cf02STony Lindgren .nr_parts = ARRAY_SIZE(osk_partitions), 887c38cf02STony Lindgren }; 897c38cf02STony Lindgren 907c38cf02STony Lindgren static struct resource osk_flash_resource = { 917c38cf02STony Lindgren /* this is on CS3, wherever it's mapped */ 927c38cf02STony Lindgren .flags = IORESOURCE_MEM, 937c38cf02STony Lindgren }; 947c38cf02STony Lindgren 957c38cf02STony Lindgren static struct platform_device osk5912_flash_device = { 967c38cf02STony Lindgren .name = "omapflash", 977c38cf02STony Lindgren .id = 0, 987c38cf02STony Lindgren .dev = { 997c38cf02STony Lindgren .platform_data = &osk_flash_data, 1007c38cf02STony Lindgren }, 1017c38cf02STony Lindgren .num_resources = 1, 1027c38cf02STony Lindgren .resource = &osk_flash_resource, 1037c38cf02STony Lindgren }; 104dbdf9cedSTony Lindgren 105dbdf9cedSTony Lindgren static struct resource osk5912_smc91x_resources[] = { 106dbdf9cedSTony Lindgren [0] = { 107dbdf9cedSTony Lindgren .start = OMAP_OSK_ETHR_START, /* Physical */ 108dbdf9cedSTony Lindgren .end = OMAP_OSK_ETHR_START + 0xf, 109dbdf9cedSTony Lindgren .flags = IORESOURCE_MEM, 110dbdf9cedSTony Lindgren }, 111dbdf9cedSTony Lindgren [1] = { 112dbdf9cedSTony Lindgren .start = OMAP_GPIO_IRQ(0), 113dbdf9cedSTony Lindgren .end = OMAP_GPIO_IRQ(0), 114e7b3dc7eSRussell King .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 115dbdf9cedSTony Lindgren }, 116dbdf9cedSTony Lindgren }; 117dbdf9cedSTony Lindgren 118dbdf9cedSTony Lindgren static struct platform_device osk5912_smc91x_device = { 119dbdf9cedSTony Lindgren .name = "smc91x", 120dbdf9cedSTony Lindgren .id = -1, 121dbdf9cedSTony Lindgren .num_resources = ARRAY_SIZE(osk5912_smc91x_resources), 122dbdf9cedSTony Lindgren .resource = osk5912_smc91x_resources, 123dbdf9cedSTony Lindgren }; 124dbdf9cedSTony Lindgren 125dbdf9cedSTony Lindgren static struct resource osk5912_cf_resources[] = { 126dbdf9cedSTony Lindgren [0] = { 127dbdf9cedSTony Lindgren .start = OMAP_GPIO_IRQ(62), 128dbdf9cedSTony Lindgren .end = OMAP_GPIO_IRQ(62), 129dbdf9cedSTony Lindgren .flags = IORESOURCE_IRQ, 130dbdf9cedSTony Lindgren }, 131dbdf9cedSTony Lindgren }; 132dbdf9cedSTony Lindgren 133dbdf9cedSTony Lindgren static struct platform_device osk5912_cf_device = { 134dbdf9cedSTony Lindgren .name = "omap_cf", 135dbdf9cedSTony Lindgren .id = -1, 136dbdf9cedSTony Lindgren .dev = { 137dbdf9cedSTony Lindgren .platform_data = (void *) 2 /* CS2 */, 138dbdf9cedSTony Lindgren }, 139dbdf9cedSTony Lindgren .num_resources = ARRAY_SIZE(osk5912_cf_resources), 140dbdf9cedSTony Lindgren .resource = osk5912_cf_resources, 141dbdf9cedSTony Lindgren }; 142dbdf9cedSTony Lindgren 1439b6553cdSTony Lindgren #define DEFAULT_BITPERSAMPLE 16 1449b6553cdSTony Lindgren 1459b6553cdSTony Lindgren static struct omap_mcbsp_reg_cfg mcbsp_regs = { 1469b6553cdSTony Lindgren .spcr2 = FREE | FRST | GRST | XRST | XINTM(3), 1479b6553cdSTony Lindgren .spcr1 = RINTM(3) | RRST, 1489b6553cdSTony Lindgren .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) | 1499b6553cdSTony Lindgren RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0), 1509b6553cdSTony Lindgren .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16), 1519b6553cdSTony Lindgren .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) | 1529b6553cdSTony Lindgren XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG, 1539b6553cdSTony Lindgren .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16), 1549b6553cdSTony Lindgren .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1), 1559b6553cdSTony Lindgren .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1), 1569b6553cdSTony Lindgren /*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/ /* mcbsp: master */ 1579b6553cdSTony Lindgren .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */ 1589b6553cdSTony Lindgren }; 1599b6553cdSTony Lindgren 1609b6553cdSTony Lindgren static struct omap_alsa_codec_config alsa_config = { 1619b6553cdSTony Lindgren .name = "OSK AIC23", 1629b6553cdSTony Lindgren .mcbsp_regs_alsa = &mcbsp_regs, 163*6e2d4107SDavid Cohen .codec_configure_dev = NULL, /* aic23_configure, */ 164*6e2d4107SDavid Cohen .codec_set_samplerate = NULL, /* aic23_set_samplerate, */ 165*6e2d4107SDavid Cohen .codec_clock_setup = NULL, /* aic23_clock_setup, */ 166*6e2d4107SDavid Cohen .codec_clock_on = NULL, /* aic23_clock_on, */ 167*6e2d4107SDavid Cohen .codec_clock_off = NULL, /* aic23_clock_off, */ 168*6e2d4107SDavid Cohen .get_default_samplerate = NULL, /* aic23_get_default_samplerate, */ 1699b6553cdSTony Lindgren }; 1709b6553cdSTony Lindgren 1717c38cf02STony Lindgren static struct platform_device osk5912_mcbsp1_device = { 1729b6553cdSTony Lindgren .name = "omap_alsa_mcbsp", 1737c38cf02STony Lindgren .id = 1, 1749b6553cdSTony Lindgren .dev = { 1759b6553cdSTony Lindgren .platform_data = &alsa_config, 1769b6553cdSTony Lindgren }, 1779b6553cdSTony Lindgren }; 1789b6553cdSTony Lindgren 179dbdf9cedSTony Lindgren static struct platform_device *osk5912_devices[] __initdata = { 1807c38cf02STony Lindgren &osk5912_flash_device, 181dbdf9cedSTony Lindgren &osk5912_smc91x_device, 182dbdf9cedSTony Lindgren &osk5912_cf_device, 1837c38cf02STony Lindgren &osk5912_mcbsp1_device, 184dbdf9cedSTony Lindgren }; 185dbdf9cedSTony Lindgren 1868056c6cbSDavid Brownell static struct i2c_board_info __initdata osk_i2c_board_info[] = { 1878056c6cbSDavid Brownell { 1888056c6cbSDavid Brownell I2C_BOARD_INFO("tps65010", 0x48), 1898056c6cbSDavid Brownell .type = "tps65010", 1908056c6cbSDavid Brownell .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), 1918056c6cbSDavid Brownell }, 1928056c6cbSDavid Brownell /* TODO when driver support is ready: 1938056c6cbSDavid Brownell * - aic23 audio chip at 0x1a 1948056c6cbSDavid Brownell * - on Mistral, 24c04 eeprom at 0x50 1958056c6cbSDavid Brownell * - optionally on Mistral, ov9640 camera sensor at 0x30 1968056c6cbSDavid Brownell */ 1978056c6cbSDavid Brownell }; 1988056c6cbSDavid Brownell 199dbdf9cedSTony Lindgren static void __init osk_init_smc91x(void) 200dbdf9cedSTony Lindgren { 201dbdf9cedSTony Lindgren if ((omap_request_gpio(0)) < 0) { 202dbdf9cedSTony Lindgren printk("Error requesting gpio 0 for smc91x irq\n"); 203dbdf9cedSTony Lindgren return; 204dbdf9cedSTony Lindgren } 205dbdf9cedSTony Lindgren 206dbdf9cedSTony Lindgren /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 2073179a019STony Lindgren EMIFS_CCS(1) |= 0x3; 208dbdf9cedSTony Lindgren } 209dbdf9cedSTony Lindgren 210dbdf9cedSTony Lindgren static void __init osk_init_cf(void) 211dbdf9cedSTony Lindgren { 212dbdf9cedSTony Lindgren omap_cfg_reg(M7_1610_GPIO62); 213dbdf9cedSTony Lindgren if ((omap_request_gpio(62)) < 0) { 214dbdf9cedSTony Lindgren printk("Error requesting gpio 62 for CF irq\n"); 215dbdf9cedSTony Lindgren return; 216dbdf9cedSTony Lindgren } 2177c38cf02STony Lindgren /* the CF I/O IRQ is really active-low */ 2187c38cf02STony Lindgren set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING); 219dbdf9cedSTony Lindgren } 220dbdf9cedSTony Lindgren 2217c38cf02STony Lindgren static void __init osk_init_irq(void) 222dbdf9cedSTony Lindgren { 22387bd63f6STony Lindgren omap1_init_common_hw(); 224dbdf9cedSTony Lindgren omap_init_irq(); 225dbdf9cedSTony Lindgren omap_gpio_init(); 226dbdf9cedSTony Lindgren osk_init_smc91x(); 227dbdf9cedSTony Lindgren osk_init_cf(); 228dbdf9cedSTony Lindgren } 229dbdf9cedSTony Lindgren 230dbdf9cedSTony Lindgren static struct omap_usb_config osk_usb_config __initdata = { 231dbdf9cedSTony Lindgren /* has usb host connector (A) ... for development it can also 232dbdf9cedSTony Lindgren * be used, with a NONSTANDARD gender-bending cable/dongle, as 233dbdf9cedSTony Lindgren * a peripheral. 234dbdf9cedSTony Lindgren */ 235dbdf9cedSTony Lindgren #ifdef CONFIG_USB_GADGET_OMAP 236dbdf9cedSTony Lindgren .register_dev = 1, 237dbdf9cedSTony Lindgren .hmc_mode = 0, 238dbdf9cedSTony Lindgren #else 239dbdf9cedSTony Lindgren .register_host = 1, 240dbdf9cedSTony Lindgren .hmc_mode = 16, 241dbdf9cedSTony Lindgren .rwc = 1, 242dbdf9cedSTony Lindgren #endif 243dbdf9cedSTony Lindgren .pins[0] = 2, 244dbdf9cedSTony Lindgren }; 245dbdf9cedSTony Lindgren 2463179a019STony Lindgren static struct omap_uart_config osk_uart_config __initdata = { 2473179a019STony Lindgren .enabled_uarts = (1 << 0), 2483179a019STony Lindgren }; 2493179a019STony Lindgren 25078762841SDavid Brownell #ifdef CONFIG_OMAP_OSK_MISTRAL 2513179a019STony Lindgren static struct omap_lcd_config osk_lcd_config __initdata = { 2523179a019STony Lindgren .ctrl_name = "internal", 2533179a019STony Lindgren }; 25478762841SDavid Brownell #endif 2553179a019STony Lindgren 256dbdf9cedSTony Lindgren static struct omap_board_config_kernel osk_config[] = { 257dbdf9cedSTony Lindgren { OMAP_TAG_USB, &osk_usb_config }, 2583179a019STony Lindgren { OMAP_TAG_UART, &osk_uart_config }, 25978762841SDavid Brownell #ifdef CONFIG_OMAP_OSK_MISTRAL 2603179a019STony Lindgren { OMAP_TAG_LCD, &osk_lcd_config }, 26178762841SDavid Brownell #endif 262dbdf9cedSTony Lindgren }; 263dbdf9cedSTony Lindgren 2647c38cf02STony Lindgren #ifdef CONFIG_OMAP_OSK_MISTRAL 2657c38cf02STony Lindgren 26678762841SDavid Brownell #include <linux/input.h> 26778762841SDavid Brownell #include <linux/spi/spi.h> 26878762841SDavid Brownell #include <linux/spi/ads7846.h> 26978762841SDavid Brownell 27078762841SDavid Brownell #include <asm/arch/keypad.h> 27178762841SDavid Brownell 27278762841SDavid Brownell static const int osk_keymap[] = { 27378762841SDavid Brownell /* KEY(col, row, code) */ 27478762841SDavid Brownell KEY(0, 0, KEY_F1), /* SW4 */ 27578762841SDavid Brownell KEY(0, 3, KEY_UP), /* (sw2/up) */ 27678762841SDavid Brownell KEY(1, 1, KEY_LEFTCTRL), /* SW5 */ 27778762841SDavid Brownell KEY(1, 2, KEY_LEFT), /* (sw2/left) */ 27878762841SDavid Brownell KEY(2, 0, KEY_SPACE), /* SW3 */ 27978762841SDavid Brownell KEY(2, 1, KEY_ESC), /* SW6 */ 28078762841SDavid Brownell KEY(2, 2, KEY_DOWN), /* (sw2/down) */ 28178762841SDavid Brownell KEY(3, 2, KEY_ENTER), /* (sw2/select) */ 28278762841SDavid Brownell KEY(3, 3, KEY_RIGHT), /* (sw2/right) */ 28378762841SDavid Brownell 0 28478762841SDavid Brownell }; 28578762841SDavid Brownell 28678762841SDavid Brownell static struct omap_kp_platform_data osk_kp_data = { 28778762841SDavid Brownell .rows = 8, 28878762841SDavid Brownell .cols = 8, 28978762841SDavid Brownell .keymap = (int *) osk_keymap, 2904d24607bSKomal Shah .keymapsize = ARRAY_SIZE(osk_keymap), 2914d24607bSKomal Shah .delay = 9, 29278762841SDavid Brownell }; 29378762841SDavid Brownell 29478762841SDavid Brownell static struct resource osk5912_kp_resources[] = { 29578762841SDavid Brownell [0] = { 29678762841SDavid Brownell .start = INT_KEYBOARD, 29778762841SDavid Brownell .end = INT_KEYBOARD, 29878762841SDavid Brownell .flags = IORESOURCE_IRQ, 29978762841SDavid Brownell }, 30078762841SDavid Brownell }; 30178762841SDavid Brownell 30278762841SDavid Brownell static struct platform_device osk5912_kp_device = { 30378762841SDavid Brownell .name = "omap-keypad", 30478762841SDavid Brownell .id = -1, 30578762841SDavid Brownell .dev = { 30678762841SDavid Brownell .platform_data = &osk_kp_data, 30778762841SDavid Brownell }, 30878762841SDavid Brownell .num_resources = ARRAY_SIZE(osk5912_kp_resources), 30978762841SDavid Brownell .resource = osk5912_kp_resources, 31078762841SDavid Brownell }; 31178762841SDavid Brownell 3124dcc6d24SDavid Brownell static struct omap_backlight_config mistral_bl_data = { 3134dcc6d24SDavid Brownell .default_intensity = 0xa0, 3144dcc6d24SDavid Brownell }; 3154dcc6d24SDavid Brownell 3164dcc6d24SDavid Brownell static struct platform_device mistral_bl_device = { 3174dcc6d24SDavid Brownell .name = "omap-bl", 3184dcc6d24SDavid Brownell .id = -1, 3194dcc6d24SDavid Brownell .dev = { 3204dcc6d24SDavid Brownell .platform_data = &mistral_bl_data, 3214dcc6d24SDavid Brownell }, 3224dcc6d24SDavid Brownell }; 3234dcc6d24SDavid Brownell 32478762841SDavid Brownell static struct platform_device osk5912_lcd_device = { 32578762841SDavid Brownell .name = "lcd_osk", 32678762841SDavid Brownell .id = -1, 32778762841SDavid Brownell }; 32878762841SDavid Brownell 32978762841SDavid Brownell static struct platform_device *mistral_devices[] __initdata = { 33078762841SDavid Brownell &osk5912_kp_device, 3314dcc6d24SDavid Brownell &mistral_bl_device, 33278762841SDavid Brownell &osk5912_lcd_device, 33378762841SDavid Brownell }; 33478762841SDavid Brownell 335e8cdf7bdSDavid Brownell static int mistral_get_pendown_state(void) 336e8cdf7bdSDavid Brownell { 337e8cdf7bdSDavid Brownell return !omap_get_gpio_datain(4); 338e8cdf7bdSDavid Brownell } 339e8cdf7bdSDavid Brownell 34078762841SDavid Brownell static const struct ads7846_platform_data mistral_ts_info = { 34178762841SDavid Brownell .model = 7846, 34278762841SDavid Brownell .vref_delay_usecs = 100, /* internal, no capacitor */ 34378762841SDavid Brownell .x_plate_ohms = 419, 34478762841SDavid Brownell .y_plate_ohms = 486, 345e8cdf7bdSDavid Brownell .get_pendown_state = mistral_get_pendown_state, 34678762841SDavid Brownell }; 34778762841SDavid Brownell 34878762841SDavid Brownell static struct spi_board_info __initdata mistral_boardinfo[] = { { 34978762841SDavid Brownell /* MicroWire (bus 2) CS0 has an ads7846e */ 35078762841SDavid Brownell .modalias = "ads7846", 35178762841SDavid Brownell .platform_data = &mistral_ts_info, 35278762841SDavid Brownell .irq = OMAP_GPIO_IRQ(4), 35378762841SDavid Brownell .max_speed_hz = 120000 /* max sample rate at 3V */ 35478762841SDavid Brownell * 26 /* command + data + overhead */, 35578762841SDavid Brownell .bus_num = 2, 35678762841SDavid Brownell .chip_select = 0, 35778762841SDavid Brownell } }; 35878762841SDavid Brownell 3597c38cf02STony Lindgren #ifdef CONFIG_PM 3607c38cf02STony Lindgren static irqreturn_t 3610cd61b68SLinus Torvalds osk_mistral_wake_interrupt(int irq, void *ignored) 3627c38cf02STony Lindgren { 3637c38cf02STony Lindgren return IRQ_HANDLED; 3647c38cf02STony Lindgren } 3657c38cf02STony Lindgren #endif 3667c38cf02STony Lindgren 3677c38cf02STony Lindgren static void __init osk_mistral_init(void) 3687c38cf02STony Lindgren { 36978762841SDavid Brownell /* NOTE: we could actually tell if there's a Mistral board 3707c38cf02STony Lindgren * attached, e.g. by trying to read something from the ads7846. 37178762841SDavid Brownell * But this arch_init() code is too early for that, since we 37278762841SDavid Brownell * can't talk to the ads or even the i2c eeprom. 3737c38cf02STony Lindgren */ 3747c38cf02STony Lindgren 375c72d8950SDavid Brownell /* parallel camera interface */ 376c72d8950SDavid Brownell omap_cfg_reg(J15_1610_CAM_LCLK); 377c72d8950SDavid Brownell omap_cfg_reg(J18_1610_CAM_D7); 378c72d8950SDavid Brownell omap_cfg_reg(J19_1610_CAM_D6); 379c72d8950SDavid Brownell omap_cfg_reg(J14_1610_CAM_D5); 380c72d8950SDavid Brownell omap_cfg_reg(K18_1610_CAM_D4); 381c72d8950SDavid Brownell omap_cfg_reg(K19_1610_CAM_D3); 382c72d8950SDavid Brownell omap_cfg_reg(K15_1610_CAM_D2); 383c72d8950SDavid Brownell omap_cfg_reg(K14_1610_CAM_D1); 384c72d8950SDavid Brownell omap_cfg_reg(L19_1610_CAM_D0); 385c72d8950SDavid Brownell omap_cfg_reg(L18_1610_CAM_VS); 386c72d8950SDavid Brownell omap_cfg_reg(L15_1610_CAM_HS); 387c72d8950SDavid Brownell omap_cfg_reg(M19_1610_CAM_RSTZ); 388c72d8950SDavid Brownell omap_cfg_reg(Y15_1610_CAM_OUTCLK); 389c72d8950SDavid Brownell 390c72d8950SDavid Brownell /* serial camera interface */ 391c72d8950SDavid Brownell omap_cfg_reg(H19_1610_CAM_EXCLK); 392c72d8950SDavid Brownell omap_cfg_reg(W13_1610_CCP_CLKM); 393c72d8950SDavid Brownell omap_cfg_reg(Y12_1610_CCP_CLKP); 394c72d8950SDavid Brownell /* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */ 395*6e2d4107SDavid Cohen /* omap_cfg_reg(Y14_1610_CCP_DATAM); */ 396c72d8950SDavid Brownell omap_cfg_reg(W14_1610_CCP_DATAP); 397c72d8950SDavid Brownell 398c72d8950SDavid Brownell /* CAM_PWDN */ 399c72d8950SDavid Brownell if (omap_request_gpio(11) == 0) { 400c72d8950SDavid Brownell omap_cfg_reg(N20_1610_GPIO11); 401c72d8950SDavid Brownell omap_set_gpio_direction(11, 0 /* out */); 402c72d8950SDavid Brownell omap_set_gpio_dataout(11, 0 /* off */); 403c72d8950SDavid Brownell } else 404c72d8950SDavid Brownell pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); 405c72d8950SDavid Brownell 406c72d8950SDavid Brownell 407*6e2d4107SDavid Cohen /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */ 408*6e2d4107SDavid Cohen omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ 40978762841SDavid Brownell set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); 41078762841SDavid Brownell spi_register_board_info(mistral_boardinfo, 41178762841SDavid Brownell ARRAY_SIZE(mistral_boardinfo)); 41278762841SDavid Brownell 4137c38cf02STony Lindgren /* the sideways button (SW1) is for use as a "wakeup" button */ 4147c38cf02STony Lindgren omap_cfg_reg(N15_1610_MPUIO2); 4157c38cf02STony Lindgren if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { 4167c38cf02STony Lindgren int ret = 0; 4177c38cf02STony Lindgren omap_set_gpio_direction(OMAP_MPUIO(2), 1); 4187c38cf02STony Lindgren set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); 4197c38cf02STony Lindgren #ifdef CONFIG_PM 4207c38cf02STony Lindgren /* share the IRQ in case someone wants to use the 4217c38cf02STony Lindgren * button for more than wakeup from system sleep. 4227c38cf02STony Lindgren */ 4237c38cf02STony Lindgren ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), 4247c38cf02STony Lindgren &osk_mistral_wake_interrupt, 42552e405eaSThomas Gleixner IRQF_SHARED, "mistral_wakeup", 4267c38cf02STony Lindgren &osk_mistral_wake_interrupt); 4277c38cf02STony Lindgren if (ret != 0) { 4287c38cf02STony Lindgren omap_free_gpio(OMAP_MPUIO(2)); 4297c38cf02STony Lindgren printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", 4307c38cf02STony Lindgren ret); 4317c38cf02STony Lindgren } else 4327c38cf02STony Lindgren enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2))); 4337c38cf02STony Lindgren #endif 4347c38cf02STony Lindgren } else 4357c38cf02STony Lindgren printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); 43678762841SDavid Brownell 4374dcc6d24SDavid Brownell /* LCD: backlight, and power; power controls other devices on the 4384dcc6d24SDavid Brownell * board, like the touchscreen, EEPROM, and wakeup (!) switch. 4394dcc6d24SDavid Brownell */ 4404dcc6d24SDavid Brownell omap_cfg_reg(PWL); 4414dcc6d24SDavid Brownell if (omap_request_gpio(2) == 0) { 4424dcc6d24SDavid Brownell omap_set_gpio_direction(2, 0 /* out */); 4434dcc6d24SDavid Brownell omap_set_gpio_dataout(2, 1 /* on */); 4444dcc6d24SDavid Brownell } 4454dcc6d24SDavid Brownell 44678762841SDavid Brownell platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); 4477c38cf02STony Lindgren } 4487c38cf02STony Lindgren #else 4497c38cf02STony Lindgren static void __init osk_mistral_init(void) { } 4507c38cf02STony Lindgren #endif 4517c38cf02STony Lindgren 4529b6553cdSTony Lindgren #define EMIFS_CS3_VAL (0x88013141) 4539b6553cdSTony Lindgren 454dbdf9cedSTony Lindgren static void __init osk_init(void) 455dbdf9cedSTony Lindgren { 4569b6553cdSTony Lindgren /* Workaround for wrong CS3 (NOR flash) timing 4579b6553cdSTony Lindgren * There are some U-Boot versions out there which configure 4589b6553cdSTony Lindgren * wrong CS3 memory timings. This mainly leads to CRC 4596cbdc8c5SSimon Arlott * or similar errors if you use NOR flash (e.g. with JFFS2) 4609b6553cdSTony Lindgren */ 4619b6553cdSTony Lindgren if (EMIFS_CCS(3) != EMIFS_CS3_VAL) 4629b6553cdSTony Lindgren EMIFS_CCS(3) = EMIFS_CS3_VAL; 4639b6553cdSTony Lindgren 4647c38cf02STony Lindgren osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 4657c38cf02STony Lindgren osk_flash_resource.end += SZ_32M - 1; 466dbdf9cedSTony Lindgren platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 467dbdf9cedSTony Lindgren omap_board_config = osk_config; 468dbdf9cedSTony Lindgren omap_board_config_size = ARRAY_SIZE(osk_config); 469dbdf9cedSTony Lindgren USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 4707c38cf02STony Lindgren 4718056c6cbSDavid Brownell /* irq for tps65010 chip */ 4728056c6cbSDavid Brownell /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ 4738056c6cbSDavid Brownell if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0) 4748056c6cbSDavid Brownell gpio_direction_input(OMAP_MPUIO(1)); 4758056c6cbSDavid Brownell 4768056c6cbSDavid Brownell i2c_register_board_info(1, osk_i2c_board_info, 4778056c6cbSDavid Brownell ARRAY_SIZE(osk_i2c_board_info)); 4788056c6cbSDavid Brownell 4793179a019STony Lindgren omap_serial_init(); 4807c38cf02STony Lindgren osk_mistral_init(); 481dbdf9cedSTony Lindgren } 482dbdf9cedSTony Lindgren 483dbdf9cedSTony Lindgren static void __init osk_map_io(void) 484dbdf9cedSTony Lindgren { 48587bd63f6STony Lindgren omap1_map_common_io(); 486dbdf9cedSTony Lindgren } 487dbdf9cedSTony Lindgren 4888056c6cbSDavid Brownell #ifdef CONFIG_TPS65010 4898056c6cbSDavid Brownell static int __init osk_tps_init(void) 4908056c6cbSDavid Brownell { 4918056c6cbSDavid Brownell if (!machine_is_omap_osk()) 4928056c6cbSDavid Brownell return 0; 4938056c6cbSDavid Brownell 4948056c6cbSDavid Brownell /* Let LED1 (D9) blink */ 4958056c6cbSDavid Brownell tps65010_set_led(LED1, BLINK); 4968056c6cbSDavid Brownell 4978056c6cbSDavid Brownell /* Disable LED 2 (D2) */ 4988056c6cbSDavid Brownell tps65010_set_led(LED2, OFF); 4998056c6cbSDavid Brownell 5008056c6cbSDavid Brownell /* Set GPIO 1 HIGH to disable VBUS power supply; 5018056c6cbSDavid Brownell * OHCI driver powers it up/down as needed. 5028056c6cbSDavid Brownell */ 5038056c6cbSDavid Brownell tps65010_set_gpio_out_value(GPIO1, HIGH); 5048056c6cbSDavid Brownell 5058056c6cbSDavid Brownell /* Set GPIO 2 low to turn on LED D3 */ 5068056c6cbSDavid Brownell tps65010_set_gpio_out_value(GPIO2, HIGH); 5078056c6cbSDavid Brownell 5088056c6cbSDavid Brownell /* Set GPIO 3 low to take ethernet out of reset */ 5098056c6cbSDavid Brownell tps65010_set_gpio_out_value(GPIO3, LOW); 5108056c6cbSDavid Brownell 5118056c6cbSDavid Brownell /* gpio4 for VDD_DSP */ 5128056c6cbSDavid Brownell /* FIXME send power to DSP iff it's configured */ 5138056c6cbSDavid Brownell 5148056c6cbSDavid Brownell /* Enable LOW_PWR */ 5158056c6cbSDavid Brownell tps65010_set_low_pwr(ON); 5168056c6cbSDavid Brownell 5178056c6cbSDavid Brownell /* Switch VLDO2 to 3.0V for AIC23 */ 5188056c6cbSDavid Brownell tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V 5198056c6cbSDavid Brownell | TPS_LDO1_ENABLE); 5208056c6cbSDavid Brownell 5218056c6cbSDavid Brownell return 0; 5228056c6cbSDavid Brownell } 5238056c6cbSDavid Brownell fs_initcall(osk_tps_init); 5248056c6cbSDavid Brownell #endif 5258056c6cbSDavid Brownell 526dbdf9cedSTony Lindgren MACHINE_START(OMAP_OSK, "TI-OSK") 527dbdf9cedSTony Lindgren /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ 528dbdf9cedSTony Lindgren .phys_io = 0xfff00000, 529dbdf9cedSTony Lindgren .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 530dbdf9cedSTony Lindgren .boot_params = 0x10000100, 531dbdf9cedSTony Lindgren .map_io = osk_map_io, 532dbdf9cedSTony Lindgren .init_irq = osk_init_irq, 533dbdf9cedSTony Lindgren .init_machine = osk_init, 534dbdf9cedSTony Lindgren .timer = &omap_timer, 535dbdf9cedSTony Lindgren MACHINE_END 536