diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-omap4panda.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-omap4panda.c | 109 |
1 files changed, 98 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index db69bcadf4c7..702f2a63f2c1 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
| 23 | #include <linux/leds.h> | ||
| 23 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
| 24 | #include <linux/usb/otg.h> | 25 | #include <linux/usb/otg.h> |
| 25 | #include <linux/i2c/twl.h> | 26 | #include <linux/i2c/twl.h> |
| @@ -33,12 +34,45 @@ | |||
| 33 | 34 | ||
| 34 | #include <plat/board.h> | 35 | #include <plat/board.h> |
| 35 | #include <plat/common.h> | 36 | #include <plat/common.h> |
| 36 | #include <plat/control.h> | ||
| 37 | #include <plat/timer-gp.h> | ||
| 38 | #include <plat/usb.h> | 37 | #include <plat/usb.h> |
| 39 | #include <plat/mmc.h> | 38 | #include <plat/mmc.h> |
| 39 | #include "timer-gp.h" | ||
| 40 | |||
| 40 | #include "hsmmc.h" | 41 | #include "hsmmc.h" |
| 42 | #include "control.h" | ||
| 43 | |||
| 44 | #define GPIO_HUB_POWER 1 | ||
| 45 | #define GPIO_HUB_NRESET 62 | ||
| 46 | |||
| 47 | static struct gpio_led gpio_leds[] = { | ||
| 48 | { | ||
| 49 | .name = "pandaboard::status1", | ||
| 50 | .default_trigger = "heartbeat", | ||
| 51 | .gpio = 7, | ||
| 52 | }, | ||
| 53 | { | ||
| 54 | .name = "pandaboard::status2", | ||
| 55 | .default_trigger = "mmc0", | ||
| 56 | .gpio = 8, | ||
| 57 | }, | ||
| 58 | }; | ||
| 41 | 59 | ||
| 60 | static struct gpio_led_platform_data gpio_led_info = { | ||
| 61 | .leds = gpio_leds, | ||
| 62 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
| 63 | }; | ||
| 64 | |||
| 65 | static struct platform_device leds_gpio = { | ||
| 66 | .name = "leds-gpio", | ||
| 67 | .id = -1, | ||
| 68 | .dev = { | ||
| 69 | .platform_data = &gpio_led_info, | ||
| 70 | }, | ||
| 71 | }; | ||
| 72 | |||
| 73 | static struct platform_device *panda_devices[] __initdata = { | ||
| 74 | &leds_gpio, | ||
| 75 | }; | ||
| 42 | 76 | ||
| 43 | static void __init omap4_panda_init_irq(void) | 77 | static void __init omap4_panda_init_irq(void) |
| 44 | { | 78 | { |
| @@ -47,6 +81,56 @@ static void __init omap4_panda_init_irq(void) | |||
| 47 | omap_gpio_init(); | 81 | omap_gpio_init(); |
| 48 | } | 82 | } |
| 49 | 83 | ||
| 84 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | ||
| 85 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | ||
| 86 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
| 87 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
| 88 | .phy_reset = false, | ||
| 89 | .reset_gpio_port[0] = -EINVAL, | ||
| 90 | .reset_gpio_port[1] = -EINVAL, | ||
| 91 | .reset_gpio_port[2] = -EINVAL | ||
| 92 | }; | ||
| 93 | |||
| 94 | static void __init omap4_ehci_init(void) | ||
| 95 | { | ||
| 96 | int ret; | ||
| 97 | |||
| 98 | |||
| 99 | /* disable the power to the usb hub prior to init */ | ||
| 100 | ret = gpio_request(GPIO_HUB_POWER, "hub_power"); | ||
| 101 | if (ret) { | ||
| 102 | pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER); | ||
| 103 | goto error1; | ||
| 104 | } | ||
| 105 | gpio_export(GPIO_HUB_POWER, 0); | ||
| 106 | gpio_direction_output(GPIO_HUB_POWER, 0); | ||
| 107 | gpio_set_value(GPIO_HUB_POWER, 0); | ||
| 108 | |||
| 109 | /* reset phy+hub */ | ||
| 110 | ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset"); | ||
| 111 | if (ret) { | ||
| 112 | pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET); | ||
| 113 | goto error2; | ||
| 114 | } | ||
| 115 | gpio_export(GPIO_HUB_NRESET, 0); | ||
| 116 | gpio_direction_output(GPIO_HUB_NRESET, 0); | ||
| 117 | gpio_set_value(GPIO_HUB_NRESET, 0); | ||
| 118 | gpio_set_value(GPIO_HUB_NRESET, 1); | ||
| 119 | |||
| 120 | usb_ehci_init(&ehci_pdata); | ||
| 121 | |||
| 122 | /* enable power to hub */ | ||
| 123 | gpio_set_value(GPIO_HUB_POWER, 1); | ||
| 124 | return; | ||
| 125 | |||
| 126 | error2: | ||
| 127 | gpio_free(GPIO_HUB_POWER); | ||
| 128 | error1: | ||
| 129 | pr_err("Unable to initialize EHCI power/reset\n"); | ||
| 130 | return; | ||
| 131 | |||
| 132 | } | ||
| 133 | |||
| 50 | static struct omap_musb_board_data musb_board_data = { | 134 | static struct omap_musb_board_data musb_board_data = { |
| 51 | .interface_type = MUSB_INTERFACE_UTMI, | 135 | .interface_type = MUSB_INTERFACE_UTMI, |
| 52 | .mode = MUSB_PERIPHERAL, | 136 | .mode = MUSB_PERIPHERAL, |
| @@ -56,7 +140,7 @@ static struct omap_musb_board_data musb_board_data = { | |||
| 56 | static struct omap2_hsmmc_info mmc[] = { | 140 | static struct omap2_hsmmc_info mmc[] = { |
| 57 | { | 141 | { |
| 58 | .mmc = 1, | 142 | .mmc = 1, |
| 59 | .wires = 8, | 143 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
| 60 | .gpio_wp = -EINVAL, | 144 | .gpio_wp = -EINVAL, |
| 61 | }, | 145 | }, |
| 62 | {} /* Terminator */ | 146 | {} /* Terminator */ |
| @@ -67,10 +151,6 @@ static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = { | |||
| 67 | .supply = "vmmc", | 151 | .supply = "vmmc", |
| 68 | .dev_name = "mmci-omap-hs.0", | 152 | .dev_name = "mmci-omap-hs.0", |
| 69 | }, | 153 | }, |
| 70 | { | ||
| 71 | .supply = "vmmc", | ||
| 72 | .dev_name = "mmci-omap-hs.1", | ||
| 73 | }, | ||
| 74 | }; | 154 | }; |
| 75 | 155 | ||
| 76 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) | 156 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) |
| @@ -89,7 +169,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) | |||
| 89 | 169 | ||
| 90 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) | 170 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) |
| 91 | { | 171 | { |
| 92 | struct omap_mmc_platform_data *pdata = dev->platform_data; | 172 | struct omap_mmc_platform_data *pdata; |
| 173 | |||
| 174 | /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ | ||
| 175 | if (!dev) { | ||
| 176 | pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n"); | ||
| 177 | return; | ||
| 178 | } | ||
| 179 | pdata = dev->platform_data; | ||
| 93 | 180 | ||
| 94 | pdata->init = omap4_twl6030_hsmmc_late_init; | 181 | pdata->init = omap4_twl6030_hsmmc_late_init; |
| 95 | } | 182 | } |
| @@ -156,7 +243,7 @@ static struct regulator_init_data omap4_panda_vmmc = { | |||
| 156 | | REGULATOR_CHANGE_MODE | 243 | | REGULATOR_CHANGE_MODE |
| 157 | | REGULATOR_CHANGE_STATUS, | 244 | | REGULATOR_CHANGE_STATUS, |
| 158 | }, | 245 | }, |
| 159 | .num_consumer_supplies = 2, | 246 | .num_consumer_supplies = 1, |
| 160 | .consumer_supplies = omap4_panda_vmmc_supply, | 247 | .consumer_supplies = omap4_panda_vmmc_supply, |
| 161 | }; | 248 | }; |
| 162 | 249 | ||
| @@ -274,13 +361,13 @@ static int __init omap4_panda_i2c_init(void) | |||
| 274 | } | 361 | } |
| 275 | static void __init omap4_panda_init(void) | 362 | static void __init omap4_panda_init(void) |
| 276 | { | 363 | { |
| 277 | int status; | ||
| 278 | |||
| 279 | omap4_panda_i2c_init(); | 364 | omap4_panda_i2c_init(); |
| 365 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); | ||
| 280 | omap_serial_init(); | 366 | omap_serial_init(); |
| 281 | omap4_twl6030_hsmmc_init(mmc); | 367 | omap4_twl6030_hsmmc_init(mmc); |
| 282 | /* OMAP4 Panda uses internal transceiver so register nop transceiver */ | 368 | /* OMAP4 Panda uses internal transceiver so register nop transceiver */ |
| 283 | usb_nop_xceiv_register(); | 369 | usb_nop_xceiv_register(); |
| 370 | omap4_ehci_init(); | ||
| 284 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ | 371 | /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ |
| 285 | if (!cpu_is_omap44xx()) | 372 | if (!cpu_is_omap44xx()) |
| 286 | usb_musb_init(&musb_board_data); | 373 | usb_musb_init(&musb_board_data); |
