diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2007-12-27 14:19:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:35:01 -0500 |
commit | 4bde4a4c4ff53e67cde4b0fe630d6fc28106bff8 (patch) | |
tree | 2974db90544830883700844cc3ef65c1d2108d81 /drivers/usb | |
parent | 979e524a9c563376af096d2d8629b9969fc06659 (diff) |
USB: ohci-at91 uses generic GPIO calls
Update the ohci-at91 bus glue to start understanding about the per-port
power switch GPIOs it's given (on the sam9263-ek and potentially other
boards). For the moment this just claims them and forces them active
(assuming active-low power enables) whenever the HCD is loaded.
The assumption is still that board setup configures the GPIOs. Using
gpio_request() tracks actual usage and guards against conflict.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index d849c809acbd..126fcbdd6408 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -17,6 +17,8 @@ | |||
17 | 17 | ||
18 | #include <asm/mach-types.h> | 18 | #include <asm/mach-types.h> |
19 | #include <asm/hardware.h> | 19 | #include <asm/hardware.h> |
20 | #include <asm/gpio.h> | ||
21 | |||
20 | #include <asm/arch/board.h> | 22 | #include <asm/arch/board.h> |
21 | #include <asm/arch/cpu.h> | 23 | #include <asm/arch/cpu.h> |
22 | 24 | ||
@@ -271,12 +273,41 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
271 | 273 | ||
272 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | 274 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
273 | { | 275 | { |
276 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | ||
277 | int i; | ||
278 | |||
279 | if (pdata) { | ||
280 | /* REVISIT make the driver support per-port power switching, | ||
281 | * and also overcurrent detection. Here we assume the ports | ||
282 | * are always powered while this driver is active, and use | ||
283 | * active-low power switches. | ||
284 | */ | ||
285 | for (i = 0; i < pdata->ports; i++) { | ||
286 | if (pdata->vbus_pin[i] <= 0) | ||
287 | continue; | ||
288 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); | ||
289 | gpio_direction_output(pdata->vbus_pin[i], 0); | ||
290 | } | ||
291 | } | ||
292 | |||
274 | device_init_wakeup(&pdev->dev, 1); | 293 | device_init_wakeup(&pdev->dev, 1); |
275 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | 294 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); |
276 | } | 295 | } |
277 | 296 | ||
278 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | 297 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
279 | { | 298 | { |
299 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | ||
300 | int i; | ||
301 | |||
302 | if (pdata) { | ||
303 | for (i = 0; i < pdata->ports; i++) { | ||
304 | if (pdata->vbus_pin[i] <= 0) | ||
305 | continue; | ||
306 | gpio_direction_output(pdata->vbus_pin[i], 1); | ||
307 | gpio_free(pdata->vbus_pin[i]); | ||
308 | } | ||
309 | } | ||
310 | |||
280 | device_init_wakeup(&pdev->dev, 0); | 311 | device_init_wakeup(&pdev->dev, 0); |
281 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); | 312 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); |
282 | } | 313 | } |