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> 32d533c128SThomas Gleixner #include <linux/irq.h> 33ffd22b8eSDavid Brownell #include <linux/interrupt.h> 347c38cf02STony Lindgren 357c38cf02STony Lindgren #include <linux/mtd/mtd.h> 367c38cf02STony Lindgren #include <linux/mtd/partitions.h> 37dbdf9cedSTony Lindgren 38dbdf9cedSTony Lindgren #include <asm/hardware.h> 39dbdf9cedSTony Lindgren #include <asm/mach-types.h> 40dbdf9cedSTony Lindgren #include <asm/mach/arch.h> 41dbdf9cedSTony Lindgren #include <asm/mach/map.h> 427c38cf02STony Lindgren #include <asm/mach/flash.h> 43dbdf9cedSTony Lindgren 44dbdf9cedSTony Lindgren #include <asm/arch/gpio.h> 45dbdf9cedSTony Lindgren #include <asm/arch/usb.h> 46dbdf9cedSTony Lindgren #include <asm/arch/mux.h> 47dbdf9cedSTony Lindgren #include <asm/arch/tc.h> 48d48af15eSTony Lindgren #include <asm/arch/common.h> 499b6553cdSTony Lindgren #include <asm/arch/mcbsp.h> 509b6553cdSTony Lindgren #include <asm/arch/omap-alsa.h> 519b6553cdSTony Lindgren 527c38cf02STony Lindgren static struct mtd_partition osk_partitions[] = { 537c38cf02STony Lindgren /* bootloader (U-Boot, etc) in first sector */ 547c38cf02STony Lindgren { 557c38cf02STony Lindgren .name = "bootloader", 567c38cf02STony Lindgren .offset = 0, 577c38cf02STony Lindgren .size = SZ_128K, 587c38cf02STony Lindgren .mask_flags = MTD_WRITEABLE, /* force read-only */ 597c38cf02STony Lindgren }, 607c38cf02STony Lindgren /* bootloader params in the next sector */ 617c38cf02STony Lindgren { 627c38cf02STony Lindgren .name = "params", 637c38cf02STony Lindgren .offset = MTDPART_OFS_APPEND, 647c38cf02STony Lindgren .size = SZ_128K, 657c38cf02STony Lindgren .mask_flags = 0, 667c38cf02STony Lindgren }, { 677c38cf02STony Lindgren .name = "kernel", 687c38cf02STony Lindgren .offset = MTDPART_OFS_APPEND, 697c38cf02STony Lindgren .size = SZ_2M, 707c38cf02STony Lindgren .mask_flags = 0 717c38cf02STony Lindgren }, { 727c38cf02STony Lindgren .name = "filesystem", 737c38cf02STony Lindgren .offset = MTDPART_OFS_APPEND, 747c38cf02STony Lindgren .size = MTDPART_SIZ_FULL, 757c38cf02STony Lindgren .mask_flags = 0 767c38cf02STony Lindgren } 77dbdf9cedSTony Lindgren }; 78dbdf9cedSTony Lindgren 797c38cf02STony Lindgren static struct flash_platform_data osk_flash_data = { 807c38cf02STony Lindgren .map_name = "cfi_probe", 817c38cf02STony Lindgren .width = 2, 827c38cf02STony Lindgren .parts = osk_partitions, 837c38cf02STony Lindgren .nr_parts = ARRAY_SIZE(osk_partitions), 847c38cf02STony Lindgren }; 857c38cf02STony Lindgren 867c38cf02STony Lindgren static struct resource osk_flash_resource = { 877c38cf02STony Lindgren /* this is on CS3, wherever it's mapped */ 887c38cf02STony Lindgren .flags = IORESOURCE_MEM, 897c38cf02STony Lindgren }; 907c38cf02STony Lindgren 917c38cf02STony Lindgren static struct platform_device osk5912_flash_device = { 927c38cf02STony Lindgren .name = "omapflash", 937c38cf02STony Lindgren .id = 0, 947c38cf02STony Lindgren .dev = { 957c38cf02STony Lindgren .platform_data = &osk_flash_data, 967c38cf02STony Lindgren }, 977c38cf02STony Lindgren .num_resources = 1, 987c38cf02STony Lindgren .resource = &osk_flash_resource, 997c38cf02STony Lindgren }; 100dbdf9cedSTony Lindgren 101dbdf9cedSTony Lindgren static struct resource osk5912_smc91x_resources[] = { 102dbdf9cedSTony Lindgren [0] = { 103dbdf9cedSTony Lindgren .start = OMAP_OSK_ETHR_START, /* Physical */ 104dbdf9cedSTony Lindgren .end = OMAP_OSK_ETHR_START + 0xf, 105dbdf9cedSTony Lindgren .flags = IORESOURCE_MEM, 106dbdf9cedSTony Lindgren }, 107dbdf9cedSTony Lindgren [1] = { 108dbdf9cedSTony Lindgren .start = OMAP_GPIO_IRQ(0), 109dbdf9cedSTony Lindgren .end = OMAP_GPIO_IRQ(0), 110dbdf9cedSTony Lindgren .flags = IORESOURCE_IRQ, 111dbdf9cedSTony Lindgren }, 112dbdf9cedSTony Lindgren }; 113dbdf9cedSTony Lindgren 114dbdf9cedSTony Lindgren static struct platform_device osk5912_smc91x_device = { 115dbdf9cedSTony Lindgren .name = "smc91x", 116dbdf9cedSTony Lindgren .id = -1, 117dbdf9cedSTony Lindgren .num_resources = ARRAY_SIZE(osk5912_smc91x_resources), 118dbdf9cedSTony Lindgren .resource = osk5912_smc91x_resources, 119dbdf9cedSTony Lindgren }; 120dbdf9cedSTony Lindgren 121dbdf9cedSTony Lindgren static struct resource osk5912_cf_resources[] = { 122dbdf9cedSTony Lindgren [0] = { 123dbdf9cedSTony Lindgren .start = OMAP_GPIO_IRQ(62), 124dbdf9cedSTony Lindgren .end = OMAP_GPIO_IRQ(62), 125dbdf9cedSTony Lindgren .flags = IORESOURCE_IRQ, 126dbdf9cedSTony Lindgren }, 127dbdf9cedSTony Lindgren }; 128dbdf9cedSTony Lindgren 129dbdf9cedSTony Lindgren static struct platform_device osk5912_cf_device = { 130dbdf9cedSTony Lindgren .name = "omap_cf", 131dbdf9cedSTony Lindgren .id = -1, 132dbdf9cedSTony Lindgren .dev = { 133dbdf9cedSTony Lindgren .platform_data = (void *) 2 /* CS2 */, 134dbdf9cedSTony Lindgren }, 135dbdf9cedSTony Lindgren .num_resources = ARRAY_SIZE(osk5912_cf_resources), 136dbdf9cedSTony Lindgren .resource = osk5912_cf_resources, 137dbdf9cedSTony Lindgren }; 138dbdf9cedSTony Lindgren 1399b6553cdSTony Lindgren #define DEFAULT_BITPERSAMPLE 16 1409b6553cdSTony Lindgren 1419b6553cdSTony Lindgren static struct omap_mcbsp_reg_cfg mcbsp_regs = { 1429b6553cdSTony Lindgren .spcr2 = FREE | FRST | GRST | XRST | XINTM(3), 1439b6553cdSTony Lindgren .spcr1 = RINTM(3) | RRST, 1449b6553cdSTony Lindgren .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) | 1459b6553cdSTony Lindgren RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0), 1469b6553cdSTony Lindgren .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16), 1479b6553cdSTony Lindgren .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) | 1489b6553cdSTony Lindgren XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG, 1499b6553cdSTony Lindgren .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16), 1509b6553cdSTony Lindgren .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1), 1519b6553cdSTony Lindgren .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1), 1529b6553cdSTony Lindgren /*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/ /* mcbsp: master */ 1539b6553cdSTony Lindgren .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */ 1549b6553cdSTony Lindgren }; 1559b6553cdSTony Lindgren 1569b6553cdSTony Lindgren static struct omap_alsa_codec_config alsa_config = { 1579b6553cdSTony Lindgren .name = "OSK AIC23", 1589b6553cdSTony Lindgren .mcbsp_regs_alsa = &mcbsp_regs, 1599b6553cdSTony Lindgren .codec_configure_dev = NULL, // aic23_configure, 1609b6553cdSTony Lindgren .codec_set_samplerate = NULL, // aic23_set_samplerate, 1619b6553cdSTony Lindgren .codec_clock_setup = NULL, // aic23_clock_setup, 1629b6553cdSTony Lindgren .codec_clock_on = NULL, // aic23_clock_on, 1639b6553cdSTony Lindgren .codec_clock_off = NULL, // aic23_clock_off, 1649b6553cdSTony Lindgren .get_default_samplerate = NULL, // aic23_get_default_samplerate, 1659b6553cdSTony Lindgren }; 1669b6553cdSTony Lindgren 1677c38cf02STony Lindgren static struct platform_device osk5912_mcbsp1_device = { 1689b6553cdSTony Lindgren .name = "omap_alsa_mcbsp", 1697c38cf02STony Lindgren .id = 1, 1709b6553cdSTony Lindgren .dev = { 1719b6553cdSTony Lindgren .platform_data = &alsa_config, 1729b6553cdSTony Lindgren }, 1739b6553cdSTony Lindgren }; 1749b6553cdSTony Lindgren 175dbdf9cedSTony Lindgren static struct platform_device *osk5912_devices[] __initdata = { 1767c38cf02STony Lindgren &osk5912_flash_device, 177dbdf9cedSTony Lindgren &osk5912_smc91x_device, 178dbdf9cedSTony Lindgren &osk5912_cf_device, 1797c38cf02STony Lindgren &osk5912_mcbsp1_device, 180dbdf9cedSTony Lindgren }; 181dbdf9cedSTony Lindgren 182dbdf9cedSTony Lindgren static void __init osk_init_smc91x(void) 183dbdf9cedSTony Lindgren { 184dbdf9cedSTony Lindgren if ((omap_request_gpio(0)) < 0) { 185dbdf9cedSTony Lindgren printk("Error requesting gpio 0 for smc91x irq\n"); 186dbdf9cedSTony Lindgren return; 187dbdf9cedSTony Lindgren } 188dbdf9cedSTony Lindgren 189dbdf9cedSTony Lindgren /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 1903179a019STony Lindgren EMIFS_CCS(1) |= 0x3; 191dbdf9cedSTony Lindgren } 192dbdf9cedSTony Lindgren 193dbdf9cedSTony Lindgren static void __init osk_init_cf(void) 194dbdf9cedSTony Lindgren { 195dbdf9cedSTony Lindgren omap_cfg_reg(M7_1610_GPIO62); 196dbdf9cedSTony Lindgren if ((omap_request_gpio(62)) < 0) { 197dbdf9cedSTony Lindgren printk("Error requesting gpio 62 for CF irq\n"); 198dbdf9cedSTony Lindgren return; 199dbdf9cedSTony Lindgren } 2007c38cf02STony Lindgren /* the CF I/O IRQ is really active-low */ 2017c38cf02STony Lindgren set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING); 202dbdf9cedSTony Lindgren } 203dbdf9cedSTony Lindgren 2047c38cf02STony Lindgren static void __init osk_init_irq(void) 205dbdf9cedSTony Lindgren { 20687bd63f6STony Lindgren omap1_init_common_hw(); 207dbdf9cedSTony Lindgren omap_init_irq(); 208dbdf9cedSTony Lindgren omap_gpio_init(); 209dbdf9cedSTony Lindgren osk_init_smc91x(); 210dbdf9cedSTony Lindgren osk_init_cf(); 211dbdf9cedSTony Lindgren } 212dbdf9cedSTony Lindgren 213dbdf9cedSTony Lindgren static struct omap_usb_config osk_usb_config __initdata = { 214dbdf9cedSTony Lindgren /* has usb host connector (A) ... for development it can also 215dbdf9cedSTony Lindgren * be used, with a NONSTANDARD gender-bending cable/dongle, as 216dbdf9cedSTony Lindgren * a peripheral. 217dbdf9cedSTony Lindgren */ 218dbdf9cedSTony Lindgren #ifdef CONFIG_USB_GADGET_OMAP 219dbdf9cedSTony Lindgren .register_dev = 1, 220dbdf9cedSTony Lindgren .hmc_mode = 0, 221dbdf9cedSTony Lindgren #else 222dbdf9cedSTony Lindgren .register_host = 1, 223dbdf9cedSTony Lindgren .hmc_mode = 16, 224dbdf9cedSTony Lindgren .rwc = 1, 225dbdf9cedSTony Lindgren #endif 226dbdf9cedSTony Lindgren .pins[0] = 2, 227dbdf9cedSTony Lindgren }; 228dbdf9cedSTony Lindgren 2293179a019STony Lindgren static struct omap_uart_config osk_uart_config __initdata = { 2303179a019STony Lindgren .enabled_uarts = (1 << 0), 2313179a019STony Lindgren }; 2323179a019STony Lindgren 23378762841SDavid Brownell #ifdef CONFIG_OMAP_OSK_MISTRAL 2343179a019STony Lindgren static struct omap_lcd_config osk_lcd_config __initdata = { 2353179a019STony Lindgren .ctrl_name = "internal", 2363179a019STony Lindgren }; 23778762841SDavid Brownell #endif 2383179a019STony Lindgren 239dbdf9cedSTony Lindgren static struct omap_board_config_kernel osk_config[] = { 240dbdf9cedSTony Lindgren { OMAP_TAG_USB, &osk_usb_config }, 2413179a019STony Lindgren { OMAP_TAG_UART, &osk_uart_config }, 24278762841SDavid Brownell #ifdef CONFIG_OMAP_OSK_MISTRAL 2433179a019STony Lindgren { OMAP_TAG_LCD, &osk_lcd_config }, 24478762841SDavid Brownell #endif 245dbdf9cedSTony Lindgren }; 246dbdf9cedSTony Lindgren 2477c38cf02STony Lindgren #ifdef CONFIG_OMAP_OSK_MISTRAL 2487c38cf02STony Lindgren 24978762841SDavid Brownell #include <linux/input.h> 25078762841SDavid Brownell #include <linux/spi/spi.h> 25178762841SDavid Brownell #include <linux/spi/ads7846.h> 25278762841SDavid Brownell 25378762841SDavid Brownell #include <asm/arch/keypad.h> 25478762841SDavid Brownell 25578762841SDavid Brownell static const int osk_keymap[] = { 25678762841SDavid Brownell /* KEY(col, row, code) */ 25778762841SDavid Brownell KEY(0, 0, KEY_F1), /* SW4 */ 25878762841SDavid Brownell KEY(0, 3, KEY_UP), /* (sw2/up) */ 25978762841SDavid Brownell KEY(1, 1, KEY_LEFTCTRL), /* SW5 */ 26078762841SDavid Brownell KEY(1, 2, KEY_LEFT), /* (sw2/left) */ 26178762841SDavid Brownell KEY(2, 0, KEY_SPACE), /* SW3 */ 26278762841SDavid Brownell KEY(2, 1, KEY_ESC), /* SW6 */ 26378762841SDavid Brownell KEY(2, 2, KEY_DOWN), /* (sw2/down) */ 26478762841SDavid Brownell KEY(3, 2, KEY_ENTER), /* (sw2/select) */ 26578762841SDavid Brownell KEY(3, 3, KEY_RIGHT), /* (sw2/right) */ 26678762841SDavid Brownell 0 26778762841SDavid Brownell }; 26878762841SDavid Brownell 26978762841SDavid Brownell static struct omap_kp_platform_data osk_kp_data = { 27078762841SDavid Brownell .rows = 8, 27178762841SDavid Brownell .cols = 8, 27278762841SDavid Brownell .keymap = (int *) osk_keymap, 2734d24607bSKomal Shah .keymapsize = ARRAY_SIZE(osk_keymap), 2744d24607bSKomal Shah .delay = 9, 27578762841SDavid Brownell }; 27678762841SDavid Brownell 27778762841SDavid Brownell static struct resource osk5912_kp_resources[] = { 27878762841SDavid Brownell [0] = { 27978762841SDavid Brownell .start = INT_KEYBOARD, 28078762841SDavid Brownell .end = INT_KEYBOARD, 28178762841SDavid Brownell .flags = IORESOURCE_IRQ, 28278762841SDavid Brownell }, 28378762841SDavid Brownell }; 28478762841SDavid Brownell 28578762841SDavid Brownell static struct platform_device osk5912_kp_device = { 28678762841SDavid Brownell .name = "omap-keypad", 28778762841SDavid Brownell .id = -1, 28878762841SDavid Brownell .dev = { 28978762841SDavid Brownell .platform_data = &osk_kp_data, 29078762841SDavid Brownell }, 29178762841SDavid Brownell .num_resources = ARRAY_SIZE(osk5912_kp_resources), 29278762841SDavid Brownell .resource = osk5912_kp_resources, 29378762841SDavid Brownell }; 29478762841SDavid Brownell 29578762841SDavid Brownell static struct platform_device osk5912_lcd_device = { 29678762841SDavid Brownell .name = "lcd_osk", 29778762841SDavid Brownell .id = -1, 29878762841SDavid Brownell }; 29978762841SDavid Brownell 30078762841SDavid Brownell static struct platform_device *mistral_devices[] __initdata = { 30178762841SDavid Brownell &osk5912_kp_device, 30278762841SDavid Brownell &osk5912_lcd_device, 30378762841SDavid Brownell }; 30478762841SDavid Brownell 305e8cdf7bdSDavid Brownell static int mistral_get_pendown_state(void) 306e8cdf7bdSDavid Brownell { 307e8cdf7bdSDavid Brownell return !omap_get_gpio_datain(4); 308e8cdf7bdSDavid Brownell } 309e8cdf7bdSDavid Brownell 31078762841SDavid Brownell static const struct ads7846_platform_data mistral_ts_info = { 31178762841SDavid Brownell .model = 7846, 31278762841SDavid Brownell .vref_delay_usecs = 100, /* internal, no capacitor */ 31378762841SDavid Brownell .x_plate_ohms = 419, 31478762841SDavid Brownell .y_plate_ohms = 486, 315e8cdf7bdSDavid Brownell .get_pendown_state = mistral_get_pendown_state, 31678762841SDavid Brownell }; 31778762841SDavid Brownell 31878762841SDavid Brownell static struct spi_board_info __initdata mistral_boardinfo[] = { { 31978762841SDavid Brownell /* MicroWire (bus 2) CS0 has an ads7846e */ 32078762841SDavid Brownell .modalias = "ads7846", 32178762841SDavid Brownell .platform_data = &mistral_ts_info, 32278762841SDavid Brownell .irq = OMAP_GPIO_IRQ(4), 32378762841SDavid Brownell .max_speed_hz = 120000 /* max sample rate at 3V */ 32478762841SDavid Brownell * 26 /* command + data + overhead */, 32578762841SDavid Brownell .bus_num = 2, 32678762841SDavid Brownell .chip_select = 0, 32778762841SDavid Brownell } }; 32878762841SDavid Brownell 3297c38cf02STony Lindgren #ifdef CONFIG_PM 3307c38cf02STony Lindgren static irqreturn_t 3310cd61b68SLinus Torvalds osk_mistral_wake_interrupt(int irq, void *ignored) 3327c38cf02STony Lindgren { 3337c38cf02STony Lindgren return IRQ_HANDLED; 3347c38cf02STony Lindgren } 3357c38cf02STony Lindgren #endif 3367c38cf02STony Lindgren 3377c38cf02STony Lindgren static void __init osk_mistral_init(void) 3387c38cf02STony Lindgren { 33978762841SDavid Brownell /* NOTE: we could actually tell if there's a Mistral board 3407c38cf02STony Lindgren * attached, e.g. by trying to read something from the ads7846. 34178762841SDavid Brownell * But this arch_init() code is too early for that, since we 34278762841SDavid Brownell * can't talk to the ads or even the i2c eeprom. 3437c38cf02STony Lindgren */ 3447c38cf02STony Lindgren 345*c72d8950SDavid Brownell /* parallel camera interface */ 346*c72d8950SDavid Brownell omap_cfg_reg(J15_1610_CAM_LCLK); 347*c72d8950SDavid Brownell omap_cfg_reg(J18_1610_CAM_D7); 348*c72d8950SDavid Brownell omap_cfg_reg(J19_1610_CAM_D6); 349*c72d8950SDavid Brownell omap_cfg_reg(J14_1610_CAM_D5); 350*c72d8950SDavid Brownell omap_cfg_reg(K18_1610_CAM_D4); 351*c72d8950SDavid Brownell omap_cfg_reg(K19_1610_CAM_D3); 352*c72d8950SDavid Brownell omap_cfg_reg(K15_1610_CAM_D2); 353*c72d8950SDavid Brownell omap_cfg_reg(K14_1610_CAM_D1); 354*c72d8950SDavid Brownell omap_cfg_reg(L19_1610_CAM_D0); 355*c72d8950SDavid Brownell omap_cfg_reg(L18_1610_CAM_VS); 356*c72d8950SDavid Brownell omap_cfg_reg(L15_1610_CAM_HS); 357*c72d8950SDavid Brownell omap_cfg_reg(M19_1610_CAM_RSTZ); 358*c72d8950SDavid Brownell omap_cfg_reg(Y15_1610_CAM_OUTCLK); 359*c72d8950SDavid Brownell 360*c72d8950SDavid Brownell /* serial camera interface */ 361*c72d8950SDavid Brownell omap_cfg_reg(H19_1610_CAM_EXCLK); 362*c72d8950SDavid Brownell omap_cfg_reg(W13_1610_CCP_CLKM); 363*c72d8950SDavid Brownell omap_cfg_reg(Y12_1610_CCP_CLKP); 364*c72d8950SDavid Brownell /* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */ 365*c72d8950SDavid Brownell // omap_cfg_reg(Y14_1610_CCP_DATAM); 366*c72d8950SDavid Brownell omap_cfg_reg(W14_1610_CCP_DATAP); 367*c72d8950SDavid Brownell 368*c72d8950SDavid Brownell /* CAM_PWDN */ 369*c72d8950SDavid Brownell if (omap_request_gpio(11) == 0) { 370*c72d8950SDavid Brownell omap_cfg_reg(N20_1610_GPIO11); 371*c72d8950SDavid Brownell omap_set_gpio_direction(11, 0 /* out */); 372*c72d8950SDavid Brownell omap_set_gpio_dataout(11, 0 /* off */); 373*c72d8950SDavid Brownell } else 374*c72d8950SDavid Brownell pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); 375*c72d8950SDavid Brownell 376*c72d8950SDavid Brownell 37778762841SDavid Brownell // omap_cfg_reg(P19_1610_GPIO6); // BUSY 37878762841SDavid Brownell omap_cfg_reg(P20_1610_GPIO4); // PENIRQ 37978762841SDavid Brownell set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); 38078762841SDavid Brownell spi_register_board_info(mistral_boardinfo, 38178762841SDavid Brownell ARRAY_SIZE(mistral_boardinfo)); 38278762841SDavid Brownell 3837c38cf02STony Lindgren /* the sideways button (SW1) is for use as a "wakeup" button */ 3847c38cf02STony Lindgren omap_cfg_reg(N15_1610_MPUIO2); 3857c38cf02STony Lindgren if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { 3867c38cf02STony Lindgren int ret = 0; 3877c38cf02STony Lindgren omap_set_gpio_direction(OMAP_MPUIO(2), 1); 3887c38cf02STony Lindgren set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); 3897c38cf02STony Lindgren #ifdef CONFIG_PM 3907c38cf02STony Lindgren /* share the IRQ in case someone wants to use the 3917c38cf02STony Lindgren * button for more than wakeup from system sleep. 3927c38cf02STony Lindgren */ 3937c38cf02STony Lindgren ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), 3947c38cf02STony Lindgren &osk_mistral_wake_interrupt, 39552e405eaSThomas Gleixner IRQF_SHARED, "mistral_wakeup", 3967c38cf02STony Lindgren &osk_mistral_wake_interrupt); 3977c38cf02STony Lindgren if (ret != 0) { 3987c38cf02STony Lindgren omap_free_gpio(OMAP_MPUIO(2)); 3997c38cf02STony Lindgren printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", 4007c38cf02STony Lindgren ret); 4017c38cf02STony Lindgren } else 4027c38cf02STony Lindgren enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2))); 4037c38cf02STony Lindgren #endif 4047c38cf02STony Lindgren } else 4057c38cf02STony Lindgren printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); 40678762841SDavid Brownell 40778762841SDavid Brownell platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); 4087c38cf02STony Lindgren } 4097c38cf02STony Lindgren #else 4107c38cf02STony Lindgren static void __init osk_mistral_init(void) { } 4117c38cf02STony Lindgren #endif 4127c38cf02STony Lindgren 4139b6553cdSTony Lindgren #define EMIFS_CS3_VAL (0x88013141) 4149b6553cdSTony Lindgren 415dbdf9cedSTony Lindgren static void __init osk_init(void) 416dbdf9cedSTony Lindgren { 4179b6553cdSTony Lindgren /* Workaround for wrong CS3 (NOR flash) timing 4189b6553cdSTony Lindgren * There are some U-Boot versions out there which configure 4199b6553cdSTony Lindgren * wrong CS3 memory timings. This mainly leads to CRC 4206cbdc8c5SSimon Arlott * or similar errors if you use NOR flash (e.g. with JFFS2) 4219b6553cdSTony Lindgren */ 4229b6553cdSTony Lindgren if (EMIFS_CCS(3) != EMIFS_CS3_VAL) 4239b6553cdSTony Lindgren EMIFS_CCS(3) = EMIFS_CS3_VAL; 4249b6553cdSTony Lindgren 4257c38cf02STony Lindgren osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 4267c38cf02STony Lindgren osk_flash_resource.end += SZ_32M - 1; 427dbdf9cedSTony Lindgren platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 428dbdf9cedSTony Lindgren omap_board_config = osk_config; 429dbdf9cedSTony Lindgren omap_board_config_size = ARRAY_SIZE(osk_config); 430dbdf9cedSTony Lindgren USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 4317c38cf02STony Lindgren 4323179a019STony Lindgren omap_serial_init(); 4337c38cf02STony Lindgren osk_mistral_init(); 434dbdf9cedSTony Lindgren } 435dbdf9cedSTony Lindgren 436dbdf9cedSTony Lindgren static void __init osk_map_io(void) 437dbdf9cedSTony Lindgren { 43887bd63f6STony Lindgren omap1_map_common_io(); 439dbdf9cedSTony Lindgren } 440dbdf9cedSTony Lindgren 441dbdf9cedSTony Lindgren MACHINE_START(OMAP_OSK, "TI-OSK") 442dbdf9cedSTony Lindgren /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ 443dbdf9cedSTony Lindgren .phys_io = 0xfff00000, 444dbdf9cedSTony Lindgren .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 445dbdf9cedSTony Lindgren .boot_params = 0x10000100, 446dbdf9cedSTony Lindgren .map_io = osk_map_io, 447dbdf9cedSTony Lindgren .init_irq = osk_init_irq, 448dbdf9cedSTony Lindgren .init_machine = osk_init, 449dbdf9cedSTony Lindgren .timer = &omap_timer, 450dbdf9cedSTony Lindgren MACHINE_END 451