aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-sa1111.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-26 08:25:47 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-09 10:34:50 -0500
commitae99ddbc976572194e8a68cb9ca1e27805ce30c7 (patch)
tree1c9beadf736c4038625a77cefd6f030cfba130ce /drivers/usb/host/ohci-sa1111.c
parent6bd72f0562142ddae26a052cfc4e578ad6953d06 (diff)
ARM: sa1111: add platform enable/disable functions
Add platform hooks to be called when individual sa1111 devices are enabled and disabled. This will allow us to move some platform specifics out of the individual drivers. Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/usb/host/ohci-sa1111.c')
-rw-r--r--drivers/usb/host/ohci-sa1111.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 7d2aa62ea613..f61f4f90529e 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -27,9 +27,10 @@ extern int usb_disabled(void);
27 27
28/*-------------------------------------------------------------------------*/ 28/*-------------------------------------------------------------------------*/
29 29
30static void sa1111_start_hc(struct sa1111_dev *dev) 30static int sa1111_start_hc(struct sa1111_dev *dev)
31{ 31{
32 unsigned int usb_rst = 0; 32 unsigned int usb_rst = 0;
33 int ret;
33 34
34 printk(KERN_DEBUG "%s: starting SA-1111 OHCI USB Controller\n", 35 printk(KERN_DEBUG "%s: starting SA-1111 OHCI USB Controller\n",
35 __FILE__); 36 __FILE__);
@@ -57,9 +58,13 @@ static void sa1111_start_hc(struct sa1111_dev *dev)
57 * Now, carefully enable the USB clock, and take 58 * Now, carefully enable the USB clock, and take
58 * the USB host controller out of reset. 59 * the USB host controller out of reset.
59 */ 60 */
60 sa1111_enable_device(dev); 61 ret = sa1111_enable_device(dev);
61 udelay(11); 62 if (ret == 0) {
62 sa1111_writel(usb_rst, dev->mapbase + SA1111_USB_RESET); 63 udelay(11);
64 sa1111_writel(usb_rst, dev->mapbase + SA1111_USB_RESET);
65 }
66
67 return ret;
63} 68}
64 69
65static void sa1111_stop_hc(struct sa1111_dev *dev) 70static void sa1111_stop_hc(struct sa1111_dev *dev)
@@ -140,7 +145,10 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
140 } 145 }
141 hcd->regs = dev->mapbase; 146 hcd->regs = dev->mapbase;
142 147
143 sa1111_start_hc(dev); 148 ret = sa1111_start_hc(dev);
149 if (ret)
150 goto err2;
151
144 ohci_hcd_init(hcd_to_ohci(hcd)); 152 ohci_hcd_init(hcd_to_ohci(hcd));
145 153
146 retval = usb_add_hcd(hcd, dev->irq[1], 0); 154 retval = usb_add_hcd(hcd, dev->irq[1], 0);
@@ -148,6 +156,7 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
148 return retval; 156 return retval;
149 157
150 sa1111_stop_hc(dev); 158 sa1111_stop_hc(dev);
159 err2:
151 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 160 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
152 err1: 161 err1:
153 usb_put_hcd(hcd); 162 usb_put_hcd(hcd);