diff options
author | Cory Maccarrone <darkstar6262@gmail.com> | 2009-12-11 19:16:34 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-12-11 19:16:34 -0500 |
commit | 106997c1a4aa3a34d8e04fa0138ba332f7ceafef (patch) | |
tree | 2eb807445f245aae5d670de5a8b995e4e359fd82 /arch/arm/mach-omap1 | |
parent | f8e9e98454606e43b728269de21db349f57861c7 (diff) |
omap1: Add omap7xx USB support
This change implements USB client side support into the HTC
Herald board configuration. It uses a similar, but updated
algorithm to initialize the USB as is used in the linwizard
project.
Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/board-htcherald.c | 64 | ||||
-rw-r--r-- | arch/arm/mach-omap1/mux.c | 4 |
2 files changed, 67 insertions, 1 deletions
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c index 5f28a5ceacac..e36639f66150 100644 --- a/arch/arm/mach-omap1/board-htcherald.c +++ b/arch/arm/mach-omap1/board-htcherald.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <plat/common.h> | 39 | #include <plat/common.h> |
40 | #include <plat/board.h> | 40 | #include <plat/board.h> |
41 | #include <plat/keypad.h> | 41 | #include <plat/keypad.h> |
42 | #include <plat/usb.h> | ||
42 | 43 | ||
43 | #include <mach/irqs.h> | 44 | #include <mach/irqs.h> |
44 | 45 | ||
@@ -140,6 +141,15 @@ static struct platform_device kp_device = { | |||
140 | .resource = kp_resources, | 141 | .resource = kp_resources, |
141 | }; | 142 | }; |
142 | 143 | ||
144 | /* USB Device */ | ||
145 | static struct omap_usb_config htcherald_usb_config __initdata = { | ||
146 | .otg = 0, | ||
147 | .register_host = 0, | ||
148 | .register_dev = 1, | ||
149 | .hmc_mode = 4, | ||
150 | .pins[0] = 2, | ||
151 | }; | ||
152 | |||
143 | /* LCD Device resources */ | 153 | /* LCD Device resources */ |
144 | static struct platform_device lcd_device = { | 154 | static struct platform_device lcd_device = { |
145 | .name = "lcd_htcherald", | 155 | .name = "lcd_htcherald", |
@@ -214,6 +224,57 @@ static void __init htcherald_disable_watchdog(void) | |||
214 | } | 224 | } |
215 | } | 225 | } |
216 | 226 | ||
227 | #define HTCHERALD_GPIO_USB_EN1 33 | ||
228 | #define HTCHERALD_GPIO_USB_EN2 73 | ||
229 | #define HTCHERALD_GPIO_USB_DM 35 | ||
230 | #define HTCHERALD_GPIO_USB_DP 36 | ||
231 | |||
232 | static void __init htcherald_usb_enable(void) | ||
233 | { | ||
234 | unsigned int tries = 20; | ||
235 | unsigned int value = 0; | ||
236 | |||
237 | /* Request the GPIOs we need to control here */ | ||
238 | if (gpio_request(HTCHERALD_GPIO_USB_EN1, "herald_usb") < 0) | ||
239 | goto err1; | ||
240 | |||
241 | if (gpio_request(HTCHERALD_GPIO_USB_EN2, "herald_usb") < 0) | ||
242 | goto err2; | ||
243 | |||
244 | if (gpio_request(HTCHERALD_GPIO_USB_DM, "herald_usb") < 0) | ||
245 | goto err3; | ||
246 | |||
247 | if (gpio_request(HTCHERALD_GPIO_USB_DP, "herald_usb") < 0) | ||
248 | goto err4; | ||
249 | |||
250 | /* force USB_EN GPIO to 0 */ | ||
251 | do { | ||
252 | /* output low */ | ||
253 | gpio_direction_output(HTCHERALD_GPIO_USB_EN1, 0); | ||
254 | } while ((value = gpio_get_value(HTCHERALD_GPIO_USB_EN1)) == 1 && | ||
255 | --tries); | ||
256 | |||
257 | if (value == 1) | ||
258 | printk(KERN_WARNING "Unable to reset USB, trying to continue\n"); | ||
259 | |||
260 | gpio_direction_output(HTCHERALD_GPIO_USB_EN2, 0); /* output low */ | ||
261 | gpio_direction_input(HTCHERALD_GPIO_USB_DM); /* input */ | ||
262 | gpio_direction_input(HTCHERALD_GPIO_USB_DP); /* input */ | ||
263 | |||
264 | goto done; | ||
265 | |||
266 | err4: | ||
267 | gpio_free(HTCHERALD_GPIO_USB_DM); | ||
268 | err3: | ||
269 | gpio_free(HTCHERALD_GPIO_USB_EN2); | ||
270 | err2: | ||
271 | gpio_free(HTCHERALD_GPIO_USB_EN1); | ||
272 | err1: | ||
273 | printk(KERN_ERR "Unabled to request GPIO for USB\n"); | ||
274 | done: | ||
275 | printk(KERN_INFO "USB setup complete.\n"); | ||
276 | } | ||
277 | |||
217 | static void __init htcherald_init(void) | 278 | static void __init htcherald_init(void) |
218 | { | 279 | { |
219 | printk(KERN_INFO "HTC Herald init.\n"); | 280 | printk(KERN_INFO "HTC Herald init.\n"); |
@@ -225,6 +286,9 @@ static void __init htcherald_init(void) | |||
225 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 286 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
226 | 287 | ||
227 | htcherald_disable_watchdog(); | 288 | htcherald_disable_watchdog(); |
289 | |||
290 | htcherald_usb_enable(); | ||
291 | omap_usb_init(&htcherald_usb_config); | ||
228 | } | 292 | } |
229 | 293 | ||
230 | static void __init htcherald_init_irq(void) | 294 | static void __init htcherald_init_irq(void) |
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c index 785371e982fc..5e183cd7611a 100644 --- a/arch/arm/mach-omap1/mux.c +++ b/arch/arm/mach-omap1/mux.c | |||
@@ -50,7 +50,9 @@ MUX_CFG_7XX("E3_7XX_KBC4", 13, 25, 0, 24, 1, 0) | |||
50 | 50 | ||
51 | MUX_CFG_7XX("AA17_7XX_USB_DM", 2, 21, 0, 20, 0, 0) | 51 | MUX_CFG_7XX("AA17_7XX_USB_DM", 2, 21, 0, 20, 0, 0) |
52 | MUX_CFG_7XX("W16_7XX_USB_PU_EN", 2, 25, 0, 24, 0, 0) | 52 | MUX_CFG_7XX("W16_7XX_USB_PU_EN", 2, 25, 0, 24, 0, 0) |
53 | MUX_CFG_7XX("W17_7XX_USB_VBUSI", 2, 29, 0, 28, 0, 0) | 53 | MUX_CFG_7XX("W17_7XX_USB_VBUSI", 2, 29, 6, 28, 1, 0) |
54 | MUX_CFG_7XX("W18_7XX_USB_DMCK_OUT",3, 3, 1, 2, 0, 0) | ||
55 | MUX_CFG_7XX("W19_7XX_USB_DCRST", 3, 7, 1, 6, 0, 0) | ||
54 | 56 | ||
55 | /* MMC Pins */ | 57 | /* MMC Pins */ |
56 | MUX_CFG_7XX("MMC_7XX_CMD", 2, 9, 0, 8, 1, 0) | 58 | MUX_CFG_7XX("MMC_7XX_CMD", 2, 9, 0, 8, 1, 0) |