static void __init osk_init(void) { /* Workaround for wrong CS3 (NOR flash) timing * There are some U-Boot versions out there which configure * wrong CS3 memory timings. This mainly leads to CRC * or similar errors if you use NOR flash (e.g. with JFFS2) */ if (EMIFS_CCS(3) != EMIFS_CS3_VAL) EMIFS_CCS(3) = EMIFS_CS3_VAL; osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); osk_flash_resource.end += SZ_32M - 1; platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); omap_board_config = osk_config; omap_board_config_size = ARRAY_SIZE(osk_config); USB_TRANSCEIVER_CTRL_REG |= (3 << 1); /* irq for tps65010 chip */ /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0) gpio_direction_input(OMAP_MPUIO(1)); omap_serial_init(); omap_register_i2c_bus(1, 400, osk_i2c_board_info, ARRAY_SIZE(osk_i2c_board_info)); osk_mistral_init(); }
static int __init omap_leds_init(void) { if (!cpu_class_is_omap1()) return -ENODEV; if (machine_is_omap_innovator()) leds_event = innovator_leds_event; else if (machine_is_omap_h2() || machine_is_omap_h3() || machine_is_omap_perseus2()) leds_event = h2p2_dbg_leds_event; else if (machine_is_omap_osk()) leds_event = osk_leds_event; else return -1; if (machine_is_omap_h2() || machine_is_omap_h3() #ifdef CONFIG_OMAP_OSK_MISTRAL || machine_is_omap_osk() #endif ) { /* LED1/LED2 pins can be used as GPIO (as done here), or by * the LPG (works even in deep sleep!), to drive a bicolor * LED on the H2 sample board, and another on the H2/P2 * "surfer" expansion board. * * The same pins drive a LED on the OSK Mistral board, but * that's a different kind of LED (just one color at a time). */ omap_cfg_reg(P18_1610_GPIO3); if (gpio_request(3, "LED red") == 0) gpio_direction_output(3, 1); else printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); omap_cfg_reg(MPUIO4); if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) gpio_direction_output(OMAP_MPUIO(4), 1); else printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); } leds_event(led_start); return 0; }
static void __init osk_init(void) { u32 l; osk_init_smc91x(); osk_init_cf(); /* Workaround for wrong CS3 (NOR flash) timing * There are some U-Boot versions out there which configure * wrong CS3 memory timings. This mainly leads to CRC * or similar errors if you use NOR flash (e.g. with JFFS2) */ l = omap_readl(EMIFS_CCS(3)); if (l != EMIFS_CS3_VAL) omap_writel(EMIFS_CS3_VAL, EMIFS_CCS(3)); osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); osk_flash_resource.end += SZ_32M - 1; osk5912_smc91x_resources[1].start = gpio_to_irq(0); osk5912_smc91x_resources[1].end = gpio_to_irq(0); osk5912_cf_resources[0].start = gpio_to_irq(62); osk5912_cf_resources[0].end = gpio_to_irq(62); platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); l = omap_readl(USB_TRANSCEIVER_CTRL); l |= (3 << 1); omap_writel(l, USB_TRANSCEIVER_CTRL); omap1_usb_init(&osk_usb_config); /* irq for tps65010 chip */ /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0) gpio_direction_input(OMAP_MPUIO(1)); omap_serial_init(); osk_i2c_board_info[0].irq = gpio_to_irq(OMAP_MPUIO(1)); omap_register_i2c_bus(1, 400, osk_i2c_board_info, ARRAY_SIZE(osk_i2c_board_info)); osk_mistral_init(); #ifdef CONFIG_OMAP_OSK_MISTRAL omapfb_set_lcd_config(&osk_lcd_config); #endif }
static void __init osk_mistral_init(void) { /* FIXME here's where to feed in framebuffer, touchpad, and * keyboard setup ... not in the drivers for those devices! * * NOTE: we could actually tell if there's a Mistral board * attached, e.g. by trying to read something from the ads7846. * But this is too early for that... */ /* the sideways button (SW1) is for use as a "wakeup" button */ omap_cfg_reg(N15_1610_MPUIO2); if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { int ret = 0; omap_set_gpio_direction(OMAP_MPUIO(2), 1); set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); #ifdef CONFIG_PM /* share the IRQ in case someone wants to use the * button for more than wakeup from system sleep. */ ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), &osk_mistral_wake_interrupt, SA_SHIRQ, "mistral_wakeup", &osk_mistral_wake_interrupt); if (ret != 0) { omap_free_gpio(OMAP_MPUIO(2)); printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", ret); } else enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2))); #endif } else printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); }
gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH); /* Only the second MMC controller is used */ nokia770_mmc_data[1] = &nokia770_mmc2_data; omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC); } #else static inline void nokia770_mmc_init(void) { } #endif #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE) static struct i2c_cbus_platform_data nokia770_cbus_data = { .clk_gpio = OMAP_MPUIO(9), .dat_gpio = OMAP_MPUIO(10), .sel_gpio = OMAP_MPUIO(11), }; static struct platform_device nokia770_cbus_device = { .name = "i2c-cbus-gpio", .id = 2, .dev = { .platform_data = &nokia770_cbus_data, }, }; static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = { { I2C_BOARD_INFO("retu-mfd", 0x01),
static void __init osk_mistral_init(void) { /* NOTE: we could actually tell if there's a Mistral board * attached, e.g. by trying to read something from the ads7846. * But this arch_init() code is too early for that, since we * can't talk to the ads or even the i2c eeprom. */ /* parallel camera interface */ omap_cfg_reg(J15_1610_CAM_LCLK); omap_cfg_reg(J18_1610_CAM_D7); omap_cfg_reg(J19_1610_CAM_D6); omap_cfg_reg(J14_1610_CAM_D5); omap_cfg_reg(K18_1610_CAM_D4); omap_cfg_reg(K19_1610_CAM_D3); omap_cfg_reg(K15_1610_CAM_D2); omap_cfg_reg(K14_1610_CAM_D1); omap_cfg_reg(L19_1610_CAM_D0); omap_cfg_reg(L18_1610_CAM_VS); omap_cfg_reg(L15_1610_CAM_HS); omap_cfg_reg(M19_1610_CAM_RSTZ); omap_cfg_reg(Y15_1610_CAM_OUTCLK); /* serial camera interface */ omap_cfg_reg(H19_1610_CAM_EXCLK); omap_cfg_reg(W13_1610_CCP_CLKM); omap_cfg_reg(Y12_1610_CCP_CLKP); /* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */ /* omap_cfg_reg(Y14_1610_CCP_DATAM); */ omap_cfg_reg(W14_1610_CCP_DATAP); /* CAM_PWDN */ if (omap_request_gpio(11) == 0) { omap_cfg_reg(N20_1610_GPIO11); omap_set_gpio_direction(11, 0 /* out */); omap_set_gpio_dataout(11, 0 /* off */); } else pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */ omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); spi_register_board_info(mistral_boardinfo, ARRAY_SIZE(mistral_boardinfo)); /* the sideways button (SW1) is for use as a "wakeup" button */ omap_cfg_reg(N15_1610_MPUIO2); if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { int ret = 0; omap_set_gpio_direction(OMAP_MPUIO(2), 1); set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); #ifdef CONFIG_PM /* share the IRQ in case someone wants to use the * button for more than wakeup from system sleep. */ ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), &osk_mistral_wake_interrupt, IRQF_SHARED, "mistral_wakeup", &osk_mistral_wake_interrupt); if (ret != 0) { omap_free_gpio(OMAP_MPUIO(2)); printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", ret); } else enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2))); #endif } else printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); /* LCD: backlight, and power; power controls other devices on the * board, like the touchscreen, EEPROM, and wakeup (!) switch. */ omap_cfg_reg(PWL); if (omap_request_gpio(2) == 0) { omap_set_gpio_direction(2, 0 /* out */); omap_set_gpio_dataout(2, 1 /* on */); } platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); }
.platform_data = &alsa_config, }, }; static struct platform_device *osk5912_devices[] __initdata = { &osk5912_flash_device, &osk5912_smc91x_device, &osk5912_cf_device, &osk5912_mcbsp1_device, }; static struct i2c_board_info __initdata osk_i2c_board_info[] = { { I2C_BOARD_INFO("tps65010", 0x48), .type = "tps65010", .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), }, /* TODO when driver support is ready: * - aic23 audio chip at 0x1a * - on Mistral, 24c04 eeprom at 0x50 * - optionally on Mistral, ov9640 camera sensor at 0x30 */ }; static void __init osk_init_smc91x(void) { if ((omap_request_gpio(0)) < 0) { printk("Error requesting gpio 0 for smc91x irq\n"); return; }
static void __init osk_mistral_init(void) { /* NOTE: we could actually tell if there's a Mistral board * attached, e.g. by trying to read something from the ads7846. * But this arch_init() code is too early for that, since we * can't talk to the ads or even the i2c eeprom. */ /* parallel camera interface */ omap_cfg_reg(J15_1610_CAM_LCLK); omap_cfg_reg(J18_1610_CAM_D7); omap_cfg_reg(J19_1610_CAM_D6); omap_cfg_reg(J14_1610_CAM_D5); omap_cfg_reg(K18_1610_CAM_D4); omap_cfg_reg(K19_1610_CAM_D3); omap_cfg_reg(K15_1610_CAM_D2); omap_cfg_reg(K14_1610_CAM_D1); omap_cfg_reg(L19_1610_CAM_D0); omap_cfg_reg(L18_1610_CAM_VS); omap_cfg_reg(L15_1610_CAM_HS); omap_cfg_reg(M19_1610_CAM_RSTZ); omap_cfg_reg(Y15_1610_CAM_OUTCLK); /* serial camera interface */ omap_cfg_reg(H19_1610_CAM_EXCLK); omap_cfg_reg(W13_1610_CCP_CLKM); omap_cfg_reg(Y12_1610_CCP_CLKP); /* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */ /* omap_cfg_reg(Y14_1610_CCP_DATAM); */ omap_cfg_reg(W14_1610_CCP_DATAP); /* CAM_PWDN */ if (gpio_request(11, "cam_pwdn") == 0) { omap_cfg_reg(N20_1610_GPIO11); gpio_direction_output(11, 0); } else pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */ gpio_request(6, "ts_busy"); gpio_direction_input(6); omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ gpio_request(4, "ts_int"); gpio_direction_input(4); irq_set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING); mistral_boardinfo[0].irq = gpio_to_irq(4); spi_register_board_info(mistral_boardinfo, ARRAY_SIZE(mistral_boardinfo)); /* the sideways button (SW1) is for use as a "wakeup" button * * NOTE: The Mistral board has the wakeup button (SW1) wired * to the LCD 3.3V rail, which is powered down during suspend. * To allow this button to wake up the omap, work around this * HW bug by rewiring SW1 to use the main 3.3V rail. */ omap_cfg_reg(N15_1610_MPUIO2); if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) { int ret = 0; int irq = gpio_to_irq(OMAP_MPUIO(2)); gpio_direction_input(OMAP_MPUIO(2)); irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); #ifdef CONFIG_PM /* share the IRQ in case someone wants to use the * button for more than wakeup from system sleep. */ ret = request_irq(irq, &osk_mistral_wake_interrupt, IRQF_SHARED, "mistral_wakeup", &osk_mistral_wake_interrupt); if (ret != 0) { gpio_free(OMAP_MPUIO(2)); printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", ret); } else enable_irq_wake(irq); #endif } else printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); /* LCD: backlight, and power; power controls other devices on the * board, like the touchscreen, EEPROM, and wakeup (!) switch. */ omap_cfg_reg(PWL); if (gpio_request(2, "lcd_pwr") == 0) gpio_direction_output(2, 1); i2c_register_board_info(1, mistral_i2c_board_info, ARRAY_SIZE(mistral_i2c_board_info)); platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); }
int __init cbus_bus_init(void) { struct cbus_host *chost; int ret; chost = kmalloc(sizeof (*chost), GFP_KERNEL); if (chost == NULL) return -ENOMEM; memset(chost, 0, sizeof (*chost)); spin_lock_init(&chost->lock); /* REVISIT: Pass these from board-*.c files in platform_data */ if (machine_is_nokia770()) { chost->clk_gpio = OMAP_MPUIO(11); chost->dat_gpio = OMAP_MPUIO(10); chost->sel_gpio = OMAP_MPUIO(9); } else if (machine_is_nokia_n800() || machine_is_nokia_n810() || machine_is_nokia_n810_wimax()) { chost->clk_gpio = 66; chost->dat_gpio = 65; chost->sel_gpio = 64; } else { printk(KERN_ERR "cbus: Unsupported board\n"); ret = -ENODEV; goto exit1; } #ifdef CONFIG_ARCH_OMAP1 if (!OMAP_GPIO_IS_MPUIO(chost->clk_gpio) || !OMAP_GPIO_IS_MPUIO(chost->dat_gpio) || !OMAP_GPIO_IS_MPUIO(chost->sel_gpio)) { printk(KERN_ERR "cbus: Only MPUIO pins supported\n"); ret = -ENODEV; goto exit1; } #endif if ((ret = gpio_request(chost->clk_gpio, "CBUS clk")) < 0) goto exit1; if ((ret = gpio_request(chost->dat_gpio, "CBUS data")) < 0) goto exit2; if ((ret = gpio_request(chost->sel_gpio, "CBUS sel")) < 0) goto exit3; gpio_direction_output(chost->clk_gpio, 0); gpio_direction_input(chost->dat_gpio); gpio_direction_output(chost->sel_gpio, 1); gpio_set_value(chost->clk_gpio, 1); gpio_set_value(chost->clk_gpio, 0); cbus_host = chost; return 0; exit3: gpio_free(chost->dat_gpio); exit2: gpio_free(chost->clk_gpio); exit1: kfree(chost); return ret; }
#ifdef CONFIG_USB_GADGET_OMAP .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */ #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */ .hmc_mode = 20, /* 1:dev|otg(off) 1:host 2:disabled */ #endif .pins[1] = 3, }; static struct omap_mmc_config h3_mmc_config __initdata = { .mmc[0] = { .enabled = 1, .power_pin = -1, /* tps65010 GPIO4 */ .switch_pin = OMAP_MPUIO(1), }, }; static struct omap_uart_config h3_uart_config __initdata = { .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), }; static struct omap_lcd_config h3_lcd_config __initdata = { .panel_name = "h3", .ctrl_name = "internal", }; static struct omap_board_config_kernel h3_config[] = { { OMAP_TAG_USB, &h3_usb_config }, { OMAP_TAG_MMC, &h3_mmc_config },
.platform_data = &h2_kp_data, }, .num_resources = ARRAY_SIZE(h2_kp_resources), .resource = h2_kp_resources, }; static struct gpio_led h2_gpio_led_pins[] = { { .name = "h2:red", .default_trigger = "heartbeat", .gpio = 3, }, { .name = "h2:green", .default_trigger = "cpu0", .gpio = OMAP_MPUIO(4), }, }; static struct gpio_led_platform_data h2_gpio_led_data = { .leds = h2_gpio_led_pins, .num_leds = ARRAY_SIZE(h2_gpio_led_pins), }; static struct platform_device h2_gpio_leds = { .name = "leds-gpio", .id = -1, .dev = { .platform_data = &h2_gpio_led_data, }, };
static struct omap_lcd_config h2_lcd_config __initdata = { .ctrl_name = "internal", }; static struct omap_board_config_kernel h2_config[] __initdata = { { OMAP_TAG_USB, &h2_usb_config }, { OMAP_TAG_MMC, &h2_mmc_config }, { OMAP_TAG_UART, &h2_uart_config }, { OMAP_TAG_LCD, &h2_lcd_config }, }; static struct omap_gpio_switch h2_gpio_switches[] __initdata = { { .name = "mmc_slot", .gpio = OMAP_MPUIO(1), .type = OMAP_GPIO_SWITCH_TYPE_COVER, .debounce_rising = 100, .debounce_falling = 0, .notify = h2_mmc_slot_cover_handler, .notify_data = NULL, }, }; #define H2_NAND_RB_GPIO_PIN 62 static int h2_nand_dev_ready(struct omap_nand_platform_data *data) { return omap_get_gpio_datain(H2_NAND_RB_GPIO_PIN); }
#define GPIO_ETH_NRESET 79 /* USBB3 to SMSC LAN9730 */ #define GPIO_HUB_NRESET 80 /* USBB2 to SMSC 3530 HUB */ #define GPIO_POWER_BUTTON 83 #define GPIO_EXT_INT_PIN 99 #define GPIO_TWL6040_PWRON 141 #define GPIO_SDCARD_DETECT 152 #define HDMI_GPIO_HPD 193 #define HDMI_GPIO_CT_CP_HPD 256 #define HDMI_GPIO_LS_OE 257 #define GPIO_MSECURE 234 /* MSECURE GPIO */ static struct gpio_led panda5_gpio_leds[] = { { .name = "blue", .default_trigger = "timer", .gpio = OMAP_MPUIO(19), }, { .name = "red", .default_trigger = "timer", .gpio = OMAP_MPUIO(17), }, { .name = "green", .default_trigger = "timer", .gpio = OMAP_MPUIO(18), }, { .name = "panda5::status1", .default_trigger = "heartbeat", .gpio = OMAP_MPUIO(2),
.otg = 2, #ifdef CONFIG_USB_GADGET_OMAP .hmc_mode = 19, /* 0:host(off) 1:dev|otg 2:disabled */ #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */ .hmc_mode = 20, /* 1:dev|otg(off) 1:host 2:disabled */ #endif .pins[1] = 3, }; static struct omap_mmc_config h3_mmc_config __initdata_or_module = { .mmc_blocks = 1, .mmc1_power_pin = -1, /* tps65010 GPIO4 */ .mmc1_switch_pin = OMAP_MPUIO(1), }; static struct omap_board_config_kernel h3_config[] = { { OMAP_TAG_USB, &h3_usb_config }, { OMAP_TAG_MMC, &h3_mmc_config }, }; static void __init h3_init(void) { h3_flash_resource.end = h3_flash_resource.start = omap_cs3_phys(); h3_flash_resource.end += OMAP_CS3_SIZE - 1; (void) platform_add_devices(devices, ARRAY_SIZE(devices)); omap_board_config = h3_config; omap_board_config_size = ARRAY_SIZE(h3_config); }
#ifdef CONFIG_USB_GADGET_OMAP .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback) #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) /* needs OTG cable, or NONSTANDARD (B-to-MiniB) */ .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled #endif .pins[1] = 3, }; static struct omap_mmc_config h2_mmc_config __initdata = { .mmc [0] = { .enabled = 1, .wire4 = 1, .wp_pin = OMAP_MPUIO(3), .power_pin = -1, /* tps65010 gpio3 */ .switch_pin = OMAP_MPUIO(1), }, }; static struct omap_uart_config h2_uart_config __initdata = { .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), }; static struct omap_lcd_config h2_lcd_config __initdata = { .ctrl_name = "internal", }; static struct omap_board_config_kernel h2_config[] = { { OMAP_TAG_USB, &h2_usb_config },
.hmc_mode = 20, /* 1:dev|otg(off) 1:host 2:disabled */ #endif .pins[1] = 3, }; static struct omap_lcd_config innovator1610_lcd_config __initdata = { .ctrl_name = "internal", }; #endif static struct omap_mmc_config innovator_mmc_config __initdata = { .mmc [0] = { .enabled = 1, .wire4 = 1, .wp_pin = OMAP_MPUIO(3), .power_pin = -1, /* FPGA F3 UIO42 */ .switch_pin = -1, /* FPGA F4 UIO43 */ }, }; static struct omap_uart_config innovator_uart_config __initdata = { .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), }; static struct omap_board_config_kernel innovator_config[] = { { OMAP_TAG_USB, NULL }, { OMAP_TAG_LCD, NULL }, { OMAP_TAG_MMC, &innovator_mmc_config }, { OMAP_TAG_UART, &innovator_uart_config }, };