aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-07-09 15:55:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-09 16:35:05 -0400
commit1a49e2ac9651df7349867a5cf44e2c83de1046af (patch)
treeb4ba01d645073947dcf8bbe1972b7af740031b5b
parent1530280084c3905be6fce802cbfa83fb3bbb8839 (diff)
EHCI: centralize controller initialization
This patch (as1564c) converts the EHCI platform drivers to use the central ehci_setup() routine for generic controller initialization rather than each having its own idiosyncratic approach. The major point of difficulty lies in ehci-pci's many vendor- and device-specific workarounds. Some of them have to be applied before calling ehci_setup() and some after, which necessitates a fair amount of code motion. The other platform drivers require much smaller changes. One point not addressed by the patch is whether ports should be powered on or off following initialization. The different drivers appear to handle this pretty much at random. In fact it shouldn't matter, because the hub driver turns on power to all ports when it binds to the root hub. Straightening that out will be left for another day. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/ehci-atmel.c19
-rw-r--r--drivers/usb/host/ehci-au1xxx.c14
-rw-r--r--drivers/usb/host/ehci-cns3xxx.c6
-rw-r--r--drivers/usb/host/ehci-fsl.c18
-rw-r--r--drivers/usb/host/ehci-grlib.c15
-rw-r--r--drivers/usb/host/ehci-hcd.c5
-rw-r--r--drivers/usb/host/ehci-ixp4xx.c6
-rw-r--r--drivers/usb/host/ehci-mv.c23
-rw-r--r--drivers/usb/host/ehci-mxc.c17
-rw-r--r--drivers/usb/host/ehci-octeon.c8
-rw-r--r--drivers/usb/host/ehci-omap.c104
-rw-r--r--drivers/usb/host/ehci-orion.c17
-rw-r--r--drivers/usb/host/ehci-pci.c160
-rw-r--r--drivers/usb/host/ehci-pmcmsp.c17
-rw-r--r--drivers/usb/host/ehci-ppc-of.c25
-rw-r--r--drivers/usb/host/ehci-ps3.c18
-rw-r--r--drivers/usb/host/ehci-s5p.c12
-rw-r--r--drivers/usb/host/ehci-sh.c16
-rw-r--r--drivers/usb/host/ehci-spear.c10
-rw-r--r--drivers/usb/host/ehci-tegra.c18
-rw-r--r--drivers/usb/host/ehci-vt8500.c14
-rw-r--r--drivers/usb/host/ehci-w90x900.c9
-rw-r--r--drivers/usb/host/ehci-xilinx-of.c31
-rw-r--r--drivers/usb/host/ehci-xls.c21
24 files changed, 164 insertions, 439 deletions
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index cf14c95a6700..a47e2cffaaf8 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -53,30 +53,15 @@ static void atmel_stop_ehci(struct platform_device *pdev)
53static int ehci_atmel_setup(struct usb_hcd *hcd) 53static int ehci_atmel_setup(struct usb_hcd *hcd)
54{ 54{
55 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 55 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
56 int retval = 0; 56 int retval;
57 57
58 /* registers start at offset 0x0 */ 58 /* registers start at offset 0x0 */
59 ehci->caps = hcd->regs; 59 ehci->caps = hcd->regs;
60 ehci->regs = hcd->regs +
61 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
62 dbg_hcs_params(ehci, "reset");
63 dbg_hcc_params(ehci, "reset");
64
65 /* cache this readonly data; minimize chip reads */
66 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
67
68 retval = ehci_halt(ehci);
69 if (retval)
70 return retval;
71 60
72 /* data structure init */ 61 retval = ehci_setup(hcd);
73 retval = ehci_init(hcd);
74 if (retval) 62 if (retval)
75 return retval; 63 return retval;
76 64
77 ehci->sbrn = 0x20;
78
79 ehci_reset(ehci);
80 ehci_port_power(ehci, 0); 65 ehci_port_power(ehci, 0);
81 66
82 return retval; 67 return retval;
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 182d39565906..cba10d625a5d 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -20,10 +20,12 @@ extern int usb_disabled(void);
20static int au1xxx_ehci_setup(struct usb_hcd *hcd) 20static int au1xxx_ehci_setup(struct usb_hcd *hcd)
21{ 21{
22 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 22 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
23 int ret = ehci_init(hcd); 23 int ret;
24
25 ehci->caps = hcd->regs;
26 ret = ehci_setup(hcd);
24 27
25 ehci->need_io_watchdog = 0; 28 ehci->need_io_watchdog = 0;
26 ehci_reset(ehci);
27 return ret; 29 return ret;
28} 30}
29 31
@@ -78,7 +80,6 @@ static const struct hc_driver ehci_au1xxx_hc_driver = {
78static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) 80static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
79{ 81{
80 struct usb_hcd *hcd; 82 struct usb_hcd *hcd;
81 struct ehci_hcd *ehci;
82 struct resource *res; 83 struct resource *res;
83 int ret; 84 int ret;
84 85
@@ -116,13 +117,6 @@ static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
116 goto err3; 117 goto err3;
117 } 118 }
118 119
119 ehci = hcd_to_ehci(hcd);
120 ehci->caps = hcd->regs;
121 ehci->regs = hcd->regs +
122 HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
123 /* cache this readonly data; minimize chip reads */
124 ehci->hcs_params = readl(&ehci->caps->hcs_params);
125
126 ret = usb_add_hcd(hcd, pdev->resource[1].start, 120 ret = usb_add_hcd(hcd, pdev->resource[1].start,
127 IRQF_SHARED); 121 IRQF_SHARED);
128 if (ret == 0) { 122 if (ret == 0) {
diff --git a/drivers/usb/host/ehci-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c
index 6536abdea6e6..caaa3e5be334 100644
--- a/drivers/usb/host/ehci-cns3xxx.c
+++ b/drivers/usb/host/ehci-cns3xxx.c
@@ -33,14 +33,10 @@ static int cns3xxx_ehci_init(struct usb_hcd *hcd)
33 } 33 }
34 34
35 ehci->caps = hcd->regs; 35 ehci->caps = hcd->regs;
36 ehci->regs = hcd->regs
37 + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
38 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
39 36
40 hcd->has_tt = 0; 37 hcd->has_tt = 0;
41 ehci_reset(ehci);
42 38
43 retval = ehci_init(hcd); 39 retval = ehci_setup(hcd);
44 if (retval) 40 if (retval)
45 return retval; 41 return retval;
46 42
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 74914de8b9bf..ab52db684b63 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -348,29 +348,13 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
348 348
349 /* EHCI registers start at offset 0x100 */ 349 /* EHCI registers start at offset 0x100 */
350 ehci->caps = hcd->regs + 0x100; 350 ehci->caps = hcd->regs + 0x100;
351 ehci->regs = hcd->regs + 0x100 +
352 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
353 dbg_hcs_params(ehci, "reset");
354 dbg_hcc_params(ehci, "reset");
355
356 /* cache this readonly data; minimize chip reads */
357 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
358 351
359 hcd->has_tt = 1; 352 hcd->has_tt = 1;
360 353
361 retval = ehci_halt(ehci); 354 retval = ehci_setup(hcd);
362 if (retval)
363 return retval;
364
365 /* data structure init */
366 retval = ehci_init(hcd);
367 if (retval) 355 if (retval)
368 return retval; 356 return retval;
369 357
370 ehci->sbrn = 0x20;
371
372 ehci_reset(ehci);
373
374 if (of_device_is_compatible(dev->parent->of_node, 358 if (of_device_is_compatible(dev->parent->of_node,
375 "fsl,mpc5121-usb2-dr")) { 359 "fsl,mpc5121-usb2-dr")) {
376 /* 360 /*
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c
index fdfd8c5b639b..22ca45c079a4 100644
--- a/drivers/usb/host/ehci-grlib.c
+++ b/drivers/usb/host/ehci-grlib.c
@@ -40,18 +40,13 @@ static int ehci_grlib_setup(struct usb_hcd *hcd)
40 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 40 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
41 int retval; 41 int retval;
42 42
43 retval = ehci_halt(ehci); 43 retval = ehci_setup(hcd);
44 if (retval) 44 if (retval)
45 return retval; 45 return retval;
46 46
47 retval = ehci_init(hcd);
48 if (retval)
49 return retval;
50
51 ehci->sbrn = 0x20;
52 ehci_port_power(ehci, 1); 47 ehci_port_power(ehci, 1);
53 48
54 return ehci_reset(ehci); 49 return retval;
55} 50}
56 51
57 52
@@ -164,12 +159,6 @@ static int __devinit ehci_hcd_grlib_probe(struct platform_device *op)
164 ehci->big_endian_capbase = 1; 159 ehci->big_endian_capbase = 1;
165 } 160 }
166 161
167 ehci->regs = hcd->regs +
168 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
169
170 /* cache this readonly data; minimize chip reads */
171 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
172
173 rv = usb_add_hcd(hcd, irq, 0); 162 rv = usb_add_hcd(hcd, irq, 0);
174 if (rv) 163 if (rv)
175 goto err_ehci; 164 goto err_ehci;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index e6823a0cf642..f9a783bfa1fe 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -808,7 +808,7 @@ static int ehci_run (struct usb_hcd *hcd)
808 return 0; 808 return 0;
809} 809}
810 810
811static int __maybe_unused ehci_setup (struct usb_hcd *hcd) 811static int ehci_setup(struct usb_hcd *hcd)
812{ 812{
813 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 813 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
814 int retval; 814 int retval;
@@ -832,6 +832,9 @@ static int __maybe_unused ehci_setup (struct usb_hcd *hcd)
832 if (retval) 832 if (retval)
833 return retval; 833 return retval;
834 834
835 if (ehci_is_TDI(ehci))
836 tdi_reset(ehci);
837
835 ehci_reset(ehci); 838 ehci_reset(ehci);
836 839
837 return 0; 840 return 0;
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
index c4460f3d009f..488d401942e9 100644
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -22,14 +22,10 @@ static int ixp4xx_ehci_init(struct usb_hcd *hcd)
22 ehci->big_endian_mmio = 1; 22 ehci->big_endian_mmio = 1;
23 23
24 ehci->caps = hcd->regs + 0x100; 24 ehci->caps = hcd->regs + 0x100;
25 ehci->regs = hcd->regs + 0x100
26 + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
27 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
28 25
29 hcd->has_tt = 1; 26 hcd->has_tt = 1;
30 ehci_reset(ehci);
31 27
32 retval = ehci_init(hcd); 28 retval = ehci_setup(hcd);
33 if (retval) 29 if (retval)
34 return retval; 30 return retval;
35 31
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 0e8c168ca24c..f6df1ccc9617 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -77,7 +77,6 @@ static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv)
77 77
78static int mv_ehci_reset(struct usb_hcd *hcd) 78static int mv_ehci_reset(struct usb_hcd *hcd)
79{ 79{
80 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
81 struct device *dev = hcd->self.controller; 80 struct device *dev = hcd->self.controller;
82 struct ehci_hcd_mv *ehci_mv = dev_get_drvdata(dev); 81 struct ehci_hcd_mv *ehci_mv = dev_get_drvdata(dev);
83 int retval; 82 int retval;
@@ -87,25 +86,13 @@ static int mv_ehci_reset(struct usb_hcd *hcd)
87 return -ENODEV; 86 return -ENODEV;
88 } 87 }
89 88
90 /*
91 * data structure init
92 */
93 retval = ehci_init(hcd);
94 if (retval) {
95 dev_err(dev, "ehci_init failed %d\n", retval);
96 return retval;
97 }
98
99 hcd->has_tt = 1; 89 hcd->has_tt = 1;
100 ehci->sbrn = 0x20;
101 90
102 retval = ehci_reset(ehci); 91 retval = ehci_setup(hcd);
103 if (retval) { 92 if (retval)
104 dev_err(dev, "ehci_reset failed %d\n", retval); 93 dev_err(dev, "ehci_setup failed %d\n", retval);
105 return retval;
106 }
107 94
108 return 0; 95 return retval;
109} 96}
110 97
111static const struct hc_driver mv_ehci_hc_driver = { 98static const struct hc_driver mv_ehci_hc_driver = {
@@ -248,8 +235,6 @@ static int mv_ehci_probe(struct platform_device *pdev)
248 235
249 ehci = hcd_to_ehci(hcd); 236 ehci = hcd_to_ehci(hcd);
250 ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs; 237 ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs;
251 ehci->regs = (struct ehci_regs *) ehci_mv->op_regs;
252 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
253 238
254 ehci_mv->mode = pdata->mode; 239 ehci_mv->mode = pdata->mode;
255 if (ehci_mv->mode == MV_USB_MODE_OTG) { 240 if (ehci_mv->mode == MV_USB_MODE_OTG) {
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index c778ffe4e4e5..34201372c85f 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -42,27 +42,12 @@ static int ehci_mxc_setup(struct usb_hcd *hcd)
42 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 42 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
43 int retval; 43 int retval;
44 44
45 dbg_hcs_params(ehci, "reset");
46 dbg_hcc_params(ehci, "reset");
47
48 /* cache this readonly data; minimize chip reads */
49 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
50
51 hcd->has_tt = 1; 45 hcd->has_tt = 1;
52 46
53 retval = ehci_halt(ehci); 47 retval = ehci_setup(hcd);
54 if (retval) 48 if (retval)
55 return retval; 49 return retval;
56 50
57 /* data structure init */
58 retval = ehci_init(hcd);
59 if (retval)
60 return retval;
61
62 ehci->sbrn = 0x20;
63
64 ehci_reset(ehci);
65
66 ehci_port_power(ehci, 0); 51 ehci_port_power(ehci, 0);
67 return 0; 52 return 0;
68} 53}
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c
index c0104882c72d..ba26957abf46 100644
--- a/drivers/usb/host/ehci-octeon.c
+++ b/drivers/usb/host/ehci-octeon.c
@@ -56,7 +56,7 @@ static const struct hc_driver ehci_octeon_hc_driver = {
56 /* 56 /*
57 * basic lifecycle operations 57 * basic lifecycle operations
58 */ 58 */
59 .reset = ehci_init, 59 .reset = ehci_setup,
60 .start = ehci_run, 60 .start = ehci_run,
61 .stop = ehci_stop, 61 .stop = ehci_stop,
62 .shutdown = ehci_shutdown, 62 .shutdown = ehci_shutdown,
@@ -150,12 +150,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
150#endif 150#endif
151 151
152 ehci->caps = hcd->regs; 152 ehci->caps = hcd->regs;
153 ehci->regs = hcd->regs +
154 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
155 /* cache this readonly data; minimize chip reads */
156 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
157
158 ehci_reset(ehci);
159 153
160 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 154 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
161 if (ret) { 155 if (ret) {
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 6e15fc87cf60..6133d93808dc 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -145,6 +145,56 @@ static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port)
145 } 145 }
146} 146}
147 147
148static int omap_ehci_init(struct usb_hcd *hcd)
149{
150 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
151 int rc;
152 struct ehci_hcd_omap_platform_data *pdata;
153
154 pdata = hcd->self.controller->platform_data;
155 if (pdata->phy_reset) {
156 if (gpio_is_valid(pdata->reset_gpio_port[0]))
157 gpio_request_one(pdata->reset_gpio_port[0],
158 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
159
160 if (gpio_is_valid(pdata->reset_gpio_port[1]))
161 gpio_request_one(pdata->reset_gpio_port[1],
162 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
163
164 /* Hold the PHY in RESET for enough time till DIR is high */
165 udelay(10);
166 }
167
168 /* Soft reset the PHY using PHY reset command over ULPI */
169 if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
170 omap_ehci_soft_phy_reset(pdev, 0);
171 if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
172 omap_ehci_soft_phy_reset(pdev, 1);
173
174 /* we know this is the memory we want, no need to ioremap again */
175 ehci->caps = hcd->regs;
176
177 rc = ehci_setup(hcd);
178
179 if (pdata->phy_reset) {
180 /* Hold the PHY in RESET for enough time till
181 * PHY is settled and ready
182 */
183 udelay(10);
184
185 if (gpio_is_valid(pdata->reset_gpio_port[0]))
186 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 1);
187
188 if (gpio_is_valid(pdata->reset_gpio_port[1]))
189 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
190 }
191
192 /* root ports should always stay powered */
193 ehci_port_power(ehci, 1);
194
195 return rc;
196}
197
148static int omap_ehci_hub_control( 198static int omap_ehci_hub_control(
149 struct usb_hcd *hcd, 199 struct usb_hcd *hcd,
150 u16 typeReq, 200 u16 typeReq,
@@ -219,7 +269,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
219 struct resource *res; 269 struct resource *res;
220 struct usb_hcd *hcd; 270 struct usb_hcd *hcd;
221 void __iomem *regs; 271 void __iomem *regs;
222 struct ehci_hcd *omap_ehci;
223 int ret = -ENODEV; 272 int ret = -ENODEV;
224 int irq; 273 int irq;
225 int i; 274 int i;
@@ -281,19 +330,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
281 } 330 }
282 } 331 }
283 332
284 if (pdata->phy_reset) {
285 if (gpio_is_valid(pdata->reset_gpio_port[0]))
286 gpio_request_one(pdata->reset_gpio_port[0],
287 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
288
289 if (gpio_is_valid(pdata->reset_gpio_port[1]))
290 gpio_request_one(pdata->reset_gpio_port[1],
291 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
292
293 /* Hold the PHY in RESET for enough time till DIR is high */
294 udelay(10);
295 }
296
297 pm_runtime_enable(dev); 333 pm_runtime_enable(dev);
298 pm_runtime_get_sync(dev); 334 pm_runtime_get_sync(dev);
299 335
@@ -309,50 +345,12 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
309 ehci_write(regs, EHCI_INSNREG04, 345 ehci_write(regs, EHCI_INSNREG04,
310 EHCI_INSNREG04_DISABLE_UNSUSPEND); 346 EHCI_INSNREG04_DISABLE_UNSUSPEND);
311 347
312 /* Soft reset the PHY using PHY reset command over ULPI */
313 if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
314 omap_ehci_soft_phy_reset(pdev, 0);
315 if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
316 omap_ehci_soft_phy_reset(pdev, 1);
317
318 omap_ehci = hcd_to_ehci(hcd);
319 omap_ehci->sbrn = 0x20;
320
321 /* we know this is the memory we want, no need to ioremap again */
322 omap_ehci->caps = hcd->regs;
323 omap_ehci->regs = hcd->regs
324 + HC_LENGTH(ehci, readl(&omap_ehci->caps->hc_capbase));
325
326 dbg_hcs_params(omap_ehci, "reset");
327 dbg_hcc_params(omap_ehci, "reset");
328
329 /* cache this readonly data; minimize chip reads */
330 omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params);
331
332 ehci_reset(omap_ehci);
333
334 if (pdata->phy_reset) {
335 /* Hold the PHY in RESET for enough time till
336 * PHY is settled and ready
337 */
338 udelay(10);
339
340 if (gpio_is_valid(pdata->reset_gpio_port[0]))
341 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 1);
342
343 if (gpio_is_valid(pdata->reset_gpio_port[1]))
344 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
345 }
346
347 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 348 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
348 if (ret) { 349 if (ret) {
349 dev_err(dev, "failed to add hcd with err %d\n", ret); 350 dev_err(dev, "failed to add hcd with err %d\n", ret);
350 goto err_pm_runtime; 351 goto err_pm_runtime;
351 } 352 }
352 353
353 /* root ports should always stay powered */
354 ehci_port_power(omap_ehci, 1);
355
356 /* get clocks */ 354 /* get clocks */
357 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk"); 355 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
358 if (IS_ERR(utmi_p1_fck)) { 356 if (IS_ERR(utmi_p1_fck)) {
@@ -512,7 +510,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
512 /* 510 /*
513 * basic lifecycle operations 511 * basic lifecycle operations
514 */ 512 */
515 .reset = ehci_init, 513 .reset = omap_ehci_init,
516 .start = ehci_run, 514 .start = ehci_run,
517 .stop = ehci_stop, 515 .stop = ehci_stop,
518 .shutdown = ehci_shutdown, 516 .shutdown = ehci_shutdown,
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 82de1073aa52..3e411230953b 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -106,21 +106,10 @@ static int ehci_orion_setup(struct usb_hcd *hcd)
106 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 106 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
107 int retval; 107 int retval;
108 108
109 hcd->has_tt = 1; 109 retval = ehci_setup(ehci);
110
111 retval = ehci_halt(ehci);
112 if (retval)
113 return retval;
114
115 /*
116 * data structure init
117 */
118 retval = ehci_init(hcd);
119 if (retval) 110 if (retval)
120 return retval; 111 return retval;
121 112
122 ehci_reset(ehci);
123
124 ehci_port_power(ehci, 0); 113 ehci_port_power(ehci, 0);
125 114
126 return retval; 115 return retval;
@@ -261,11 +250,7 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
261 250
262 ehci = hcd_to_ehci(hcd); 251 ehci = hcd_to_ehci(hcd);
263 ehci->caps = hcd->regs + 0x100; 252 ehci->caps = hcd->regs + 0x100;
264 ehci->regs = hcd->regs + 0x100 +
265 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
266 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
267 hcd->has_tt = 1; 253 hcd->has_tt = 1;
268 ehci->sbrn = 0x20;
269 254
270 /* 255 /*
271 * (Re-)program MBUS remapping windows if we are asked to. 256 * (Re-)program MBUS remapping windows if we are asked to.
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 6e767bce0605..21e5f963f331 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -54,6 +54,17 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
54 u32 temp; 54 u32 temp;
55 int retval; 55 int retval;
56 56
57 ehci->caps = hcd->regs;
58
59 /*
60 * ehci_init() causes memory for DMA transfers to be
61 * allocated. Thus, any vendor-specific workarounds based on
62 * limiting the type of memory used for DMA transfers must
63 * happen before ehci_setup() is called.
64 *
65 * Most other workarounds can be done either before or after
66 * init and reset; they are located here too.
67 */
57 switch (pdev->vendor) { 68 switch (pdev->vendor) {
58 case PCI_VENDOR_ID_TOSHIBA_2: 69 case PCI_VENDOR_ID_TOSHIBA_2:
59 /* celleb's companion chip */ 70 /* celleb's companion chip */
@@ -66,20 +77,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
66#endif 77#endif
67 } 78 }
68 break; 79 break;
69 }
70
71 ehci->caps = hcd->regs;
72 ehci->regs = hcd->regs +
73 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
74
75 dbg_hcs_params(ehci, "reset");
76 dbg_hcc_params(ehci, "reset");
77
78 /* ehci_init() causes memory for DMA transfers to be
79 * allocated. Thus, any vendor-specific workarounds based on
80 * limiting the type of memory used for DMA transfers must
81 * happen before ehci_init() is called. */
82 switch (pdev->vendor) {
83 case PCI_VENDOR_ID_NVIDIA: 80 case PCI_VENDOR_ID_NVIDIA:
84 /* NVidia reports that certain chips don't handle 81 /* NVidia reports that certain chips don't handle
85 * QH, ITD, or SITD addresses above 2GB. (But TD, 82 * QH, ITD, or SITD addresses above 2GB. (But TD,
@@ -95,61 +92,28 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
95 ehci_warn(ehci, "can't enable NVidia " 92 ehci_warn(ehci, "can't enable NVidia "
96 "workaround for >2GB RAM\n"); 93 "workaround for >2GB RAM\n");
97 break; 94 break;
98 }
99 break;
100 }
101 95
102 /* cache this readonly data; minimize chip reads */ 96 /* Some NForce2 chips have problems with selective suspend;
103 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); 97 * fixed in newer silicon.
104
105 retval = ehci_halt(ehci);
106 if (retval)
107 return retval;
108
109 if ((pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x7808) ||
110 (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x4396)) {
111 /* EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may
112 * read/write memory space which does not belong to it when
113 * there is NULL pointer with T-bit set to 1 in the frame list
114 * table. To avoid the issue, the frame list link pointer
115 * should always contain a valid pointer to a inactive qh.
116 */ 98 */
117 ehci->use_dummy_qh = 1; 99 case 0x0068:
118 ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI " 100 if (pdev->revision < 0xa4)
119 "dummy qh workaround\n"); 101 ehci->no_selective_suspend = 1;
120 } 102 break;
121 103 }
122 /* data structure init */
123 retval = ehci_init(hcd);
124 if (retval)
125 return retval;
126
127 switch (pdev->vendor) {
128 case PCI_VENDOR_ID_NEC:
129 ehci->need_io_watchdog = 0;
130 break; 104 break;
131 case PCI_VENDOR_ID_INTEL: 105 case PCI_VENDOR_ID_INTEL:
132 ehci->need_io_watchdog = 0;
133 ehci->fs_i_thresh = 1; 106 ehci->fs_i_thresh = 1;
134 if (pdev->device == 0x27cc) { 107 if (pdev->device == 0x27cc) {
135 ehci->broken_periodic = 1; 108 ehci->broken_periodic = 1;
136 ehci_info(ehci, "using broken periodic workaround\n"); 109 ehci_info(ehci, "using broken periodic workaround\n");
137 } 110 }
138 if (pdev->device == 0x0806 || pdev->device == 0x0811 111 if (pdev->device == PCI_DEVICE_ID_INTEL_CE4100_USB)
139 || pdev->device == 0x0829) {
140 ehci_info(ehci, "disable lpm for langwell/penwell\n");
141 ehci->has_lpm = 0;
142 }
143 if (pdev->device == PCI_DEVICE_ID_INTEL_CE4100_USB) {
144 hcd->has_tt = 1; 112 hcd->has_tt = 1;
145 tdi_reset(ehci);
146 }
147 break; 113 break;
148 case PCI_VENDOR_ID_TDI: 114 case PCI_VENDOR_ID_TDI:
149 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 115 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI)
150 hcd->has_tt = 1; 116 hcd->has_tt = 1;
151 tdi_reset(ehci);
152 }
153 break; 117 break;
154 case PCI_VENDOR_ID_AMD: 118 case PCI_VENDOR_ID_AMD:
155 /* AMD PLL quirk */ 119 /* AMD PLL quirk */
@@ -161,28 +125,17 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
161 retval = -EIO; 125 retval = -EIO;
162 goto done; 126 goto done;
163 } 127 }
164 break;
165 case PCI_VENDOR_ID_NVIDIA:
166 switch (pdev->device) {
167 /* Some NForce2 chips have problems with selective suspend;
168 * fixed in newer silicon.
169 */
170 case 0x0068:
171 if (pdev->revision < 0xa4)
172 ehci->no_selective_suspend = 1;
173 break;
174 128
175 /* MCP89 chips on the MacBookAir3,1 give EPROTO when 129 /*
176 * fetching device descriptors unless LPM is disabled. 130 * EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may
177 * There are also intermittent problems enumerating 131 * read/write memory space which does not belong to it when
178 * devices with PPCD enabled. 132 * there is NULL pointer with T-bit set to 1 in the frame list
133 * table. To avoid the issue, the frame list link pointer
134 * should always contain a valid pointer to a inactive qh.
179 */ 135 */
180 case 0x0d9d: 136 if (pdev->device == 0x7808) {
181 ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89"); 137 ehci->use_dummy_qh = 1;
182 ehci->has_lpm = 0; 138 ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI dummy qh workaround\n");
183 ehci->has_ppcd = 0;
184 ehci->command &= ~CMD_PPCEE;
185 break;
186 } 139 }
187 break; 140 break;
188 case PCI_VENDOR_ID_VIA: 141 case PCI_VENDOR_ID_VIA:
@@ -203,6 +156,18 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
203 /* AMD PLL quirk */ 156 /* AMD PLL quirk */
204 if (usb_amd_find_chipset_info()) 157 if (usb_amd_find_chipset_info())
205 ehci->amd_pll_fix = 1; 158 ehci->amd_pll_fix = 1;
159
160 /*
161 * EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may
162 * read/write memory space which does not belong to it when
163 * there is NULL pointer with T-bit set to 1 in the frame list
164 * table. To avoid the issue, the frame list link pointer
165 * should always contain a valid pointer to a inactive qh.
166 */
167 if (pdev->device == 0x4396) {
168 ehci->use_dummy_qh = 1;
169 ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI dummy qh workaround\n");
170 }
206 /* SB600 and old version of SB700 have a bug in EHCI controller, 171 /* SB600 and old version of SB700 have a bug in EHCI controller,
207 * which causes usb devices lose response in some cases. 172 * which causes usb devices lose response in some cases.
208 */ 173 */
@@ -231,6 +196,40 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
231 break; 196 break;
232 } 197 }
233 198
199 retval = ehci_setup(hcd);
200 if (retval)
201 return retval;
202
203 /* These workarounds need to be applied after ehci_setup() */
204 switch (pdev->vendor) {
205 case PCI_VENDOR_ID_NEC:
206 ehci->need_io_watchdog = 0;
207 break;
208 case PCI_VENDOR_ID_INTEL:
209 ehci->need_io_watchdog = 0;
210 if (pdev->device == 0x0806 || pdev->device == 0x0811
211 || pdev->device == 0x0829) {
212 ehci_info(ehci, "disable lpm for langwell/penwell\n");
213 ehci->has_lpm = 0;
214 }
215 break;
216 case PCI_VENDOR_ID_NVIDIA:
217 switch (pdev->device) {
218 /* MCP89 chips on the MacBookAir3,1 give EPROTO when
219 * fetching device descriptors unless LPM is disabled.
220 * There are also intermittent problems enumerating
221 * devices with PPCD enabled.
222 */
223 case 0x0d9d:
224 ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89");
225 ehci->has_lpm = 0;
226 ehci->has_ppcd = 0;
227 ehci->command &= ~CMD_PPCEE;
228 break;
229 }
230 break;
231 }
232
234 /* optional debug port, normally in the first BAR */ 233 /* optional debug port, normally in the first BAR */
235 temp = pci_find_capability(pdev, 0x0a); 234 temp = pci_find_capability(pdev, 0x0a);
236 if (temp) { 235 if (temp) {
@@ -238,7 +237,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
238 temp >>= 16; 237 temp >>= 16;
239 if ((temp & (3 << 13)) == (1 << 13)) { 238 if ((temp & (3 << 13)) == (1 << 13)) {
240 temp &= 0x1fff; 239 temp &= 0x1fff;
241 ehci->debug = ehci_to_hcd(ehci)->regs + temp; 240 ehci->debug = hcd->regs + temp;
242 temp = ehci_readl(ehci, &ehci->debug->control); 241 temp = ehci_readl(ehci, &ehci->debug->control);
243 ehci_info(ehci, "debug port %d%s\n", 242 ehci_info(ehci, "debug port %d%s\n",
244 HCS_DEBUG_PORT(ehci->hcs_params), 243 HCS_DEBUG_PORT(ehci->hcs_params),
@@ -250,8 +249,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
250 } 249 }
251 } 250 }
252 251
253 ehci_reset(ehci);
254
255 /* at least the Genesys GL880S needs fixup here */ 252 /* at least the Genesys GL880S needs fixup here */
256 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); 253 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
257 temp &= 0x0f; 254 temp &= 0x0f;
@@ -275,10 +272,11 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
275 } 272 }
276 273
277 /* Serial Bus Release Number is at PCI 0x60 offset */ 274 /* Serial Bus Release Number is at PCI 0x60 offset */
278 pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
279 if (pdev->vendor == PCI_VENDOR_ID_STMICRO 275 if (pdev->vendor == PCI_VENDOR_ID_STMICRO
280 && pdev->device == PCI_DEVICE_ID_STMICRO_USB_HOST) 276 && pdev->device == PCI_DEVICE_ID_STMICRO_USB_HOST)
281 ehci->sbrn = 0x20; /* ConneXT has no sbrn register */ 277 ; /* ConneXT has no sbrn register */
278 else
279 pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
282 280
283 /* Keep this around for a while just in case some EHCI 281 /* Keep this around for a while just in case some EHCI
284 * implementation uses legacy PCI PM support. This test 282 * implementation uses legacy PCI PM support. This test
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c
index e8d54de44acc..087aee2a904f 100644
--- a/drivers/usb/host/ehci-pmcmsp.c
+++ b/drivers/usb/host/ehci-pmcmsp.c
@@ -78,27 +78,14 @@ static int ehci_msp_setup(struct usb_hcd *hcd)
78{ 78{
79 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 79 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
80 int retval; 80 int retval;
81
81 ehci->big_endian_mmio = 1; 82 ehci->big_endian_mmio = 1;
82 ehci->big_endian_desc = 1; 83 ehci->big_endian_desc = 1;
83 84
84 ehci->caps = hcd->regs; 85 ehci->caps = hcd->regs;
85 ehci->regs = hcd->regs +
86 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
87 dbg_hcs_params(ehci, "reset");
88 dbg_hcc_params(ehci, "reset");
89
90 /* cache this readonly data; minimize chip reads */
91 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
92 hcd->has_tt = 1; 86 hcd->has_tt = 1;
93 87
94 retval = ehci_halt(ehci); 88 retval = ehci_setup(hcd);
95 if (retval)
96 return retval;
97
98 ehci_reset(ehci);
99
100 /* data structure init */
101 retval = ehci_init(hcd);
102 if (retval) 89 if (retval)
103 return retval; 90 return retval;
104 91
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 41d11fe14252..bbbe89dfd886 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -17,24 +17,6 @@
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19 19
20/* called during probe() after chip reset completes */
21static int ehci_ppc_of_setup(struct usb_hcd *hcd)
22{
23 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
24 int retval;
25
26 retval = ehci_halt(ehci);
27 if (retval)
28 return retval;
29
30 retval = ehci_init(hcd);
31 if (retval)
32 return retval;
33
34 ehci->sbrn = 0x20;
35 return ehci_reset(ehci);
36}
37
38 20
39static const struct hc_driver ehci_ppc_of_hc_driver = { 21static const struct hc_driver ehci_ppc_of_hc_driver = {
40 .description = hcd_name, 22 .description = hcd_name,
@@ -50,7 +32,7 @@ static const struct hc_driver ehci_ppc_of_hc_driver = {
50 /* 32 /*
51 * basic lifecycle operations 33 * basic lifecycle operations
52 */ 34 */
53 .reset = ehci_ppc_of_setup, 35 .reset = ehci_setup,
54 .start = ehci_run, 36 .start = ehci_run,
55 .stop = ehci_stop, 37 .stop = ehci_stop,
56 .shutdown = ehci_shutdown, 38 .shutdown = ehci_shutdown,
@@ -178,11 +160,6 @@ static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
178 ehci->big_endian_desc = 1; 160 ehci->big_endian_desc = 1;
179 161
180 ehci->caps = hcd->regs; 162 ehci->caps = hcd->regs;
181 ehci->regs = hcd->regs +
182 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
183
184 /* cache this readonly data; minimize chip reads */
185 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
186 163
187 if (of_device_is_compatible(dn, "ibm,usb-ehci-440epx")) { 164 if (of_device_is_compatible(dn, "ibm,usb-ehci-440epx")) {
188 rv = ppc44x_enable_bmt(dn); 165 rv = ppc44x_enable_bmt(dn);
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index a20e496eb479..45a356e9f138 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -55,28 +55,12 @@ static int ps3_ehci_hc_reset(struct usb_hcd *hcd)
55 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 55 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
56 56
57 ehci->big_endian_mmio = 1; 57 ehci->big_endian_mmio = 1;
58
59 ehci->caps = hcd->regs; 58 ehci->caps = hcd->regs;
60 ehci->regs = hcd->regs + HC_LENGTH(ehci, ehci_readl(ehci,
61 &ehci->caps->hc_capbase));
62
63 dbg_hcs_params(ehci, "reset");
64 dbg_hcc_params(ehci, "reset");
65
66 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
67
68 result = ehci_halt(ehci);
69 59
60 result = ehci_setup(hcd);
70 if (result) 61 if (result)
71 return result; 62 return result;
72 63
73 result = ehci_init(hcd);
74
75 if (result)
76 return result;
77
78 ehci_reset(ehci);
79
80 ps3_ehci_setup_insnreg(ehci); 64 ps3_ehci_setup_insnreg(ehci);
81 65
82 return result; 66 return result;
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index c7e0936d4a7c..13c179fb2ee2 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -40,7 +40,7 @@ static const struct hc_driver s5p_ehci_hc_driver = {
40 .irq = ehci_irq, 40 .irq = ehci_irq,
41 .flags = HCD_MEMORY | HCD_USB2, 41 .flags = HCD_MEMORY | HCD_USB2,
42 42
43 .reset = ehci_init, 43 .reset = ehci_setup,
44 .start = ehci_run, 44 .start = ehci_run,
45 .stop = ehci_stop, 45 .stop = ehci_stop,
46 .shutdown = ehci_shutdown, 46 .shutdown = ehci_shutdown,
@@ -134,20 +134,10 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
134 134
135 ehci = hcd_to_ehci(hcd); 135 ehci = hcd_to_ehci(hcd);
136 ehci->caps = hcd->regs; 136 ehci->caps = hcd->regs;
137 ehci->regs = hcd->regs +
138 HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
139 137
140 /* DMA burst Enable */ 138 /* DMA burst Enable */
141 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); 139 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs));
142 140
143 dbg_hcs_params(ehci, "reset");
144 dbg_hcc_params(ehci, "reset");
145
146 /* cache this readonly data; minimize chip reads */
147 ehci->hcs_params = readl(&ehci->caps->hcs_params);
148
149 ehci_reset(ehci);
150
151 err = usb_add_hcd(hcd, irq, IRQF_SHARED); 141 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
152 if (err) { 142 if (err) {
153 dev_err(&pdev->dev, "Failed to add USB HCD\n"); 143 dev_err(&pdev->dev, "Failed to add USB HCD\n");
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
index e7cb3925abf8..b3f1e3650da0 100644
--- a/drivers/usb/host/ehci-sh.c
+++ b/drivers/usb/host/ehci-sh.c
@@ -24,25 +24,11 @@ static int ehci_sh_reset(struct usb_hcd *hcd)
24 int ret; 24 int ret;
25 25
26 ehci->caps = hcd->regs; 26 ehci->caps = hcd->regs;
27 ehci->regs = hcd->regs + HC_LENGTH(ehci, ehci_readl(ehci,
28 &ehci->caps->hc_capbase));
29 27
30 dbg_hcs_params(ehci, "reset"); 28 ret = ehci_setup(hcd);
31 dbg_hcc_params(ehci, "reset");
32
33 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
34
35 ret = ehci_halt(ehci);
36 if (unlikely(ret))
37 return ret;
38
39 ret = ehci_init(hcd);
40 if (unlikely(ret)) 29 if (unlikely(ret))
41 return ret; 30 return ret;
42 31
43 ehci->sbrn = 0x20;
44
45 ehci_reset(ehci);
46 ehci_port_power(ehci, 0); 32 ehci_port_power(ehci, 0);
47 33
48 return ret; 34 return ret;
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 7ed533e6cca8..c718a065e154 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -41,19 +41,11 @@ static int ehci_spear_setup(struct usb_hcd *hcd)
41 41
42 /* registers start at offset 0x0 */ 42 /* registers start at offset 0x0 */
43 ehci->caps = hcd->regs; 43 ehci->caps = hcd->regs;
44 ehci->regs = hcd->regs + HC_LENGTH(ehci, ehci_readl(ehci,
45 &ehci->caps->hc_capbase));
46 /* cache this readonly data; minimize chip reads */
47 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
48 retval = ehci_halt(ehci);
49 if (retval)
50 return retval;
51 44
52 retval = ehci_init(hcd); 45 retval = ehci_setup(hcd);
53 if (retval) 46 if (retval)
54 return retval; 47 return retval;
55 48
56 ehci_reset(ehci);
57 ehci_port_power(ehci, 0); 49 ehci_port_power(ehci, 0);
58 50
59 return retval; 51 return retval;
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 477ecfa05154..f7f3ce3275b8 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -281,30 +281,14 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
281 281
282 /* EHCI registers start at offset 0x100 */ 282 /* EHCI registers start at offset 0x100 */
283 ehci->caps = hcd->regs + 0x100; 283 ehci->caps = hcd->regs + 0x100;
284 ehci->regs = hcd->regs + 0x100 +
285 HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
286
287 dbg_hcs_params(ehci, "reset");
288 dbg_hcc_params(ehci, "reset");
289
290 /* cache this readonly data; minimize chip reads */
291 ehci->hcs_params = readl(&ehci->caps->hcs_params);
292 284
293 /* switch to host mode */ 285 /* switch to host mode */
294 hcd->has_tt = 1; 286 hcd->has_tt = 1;
295 ehci_reset(ehci);
296 287
297 retval = ehci_halt(ehci); 288 retval = ehci_setup(ehci);
298 if (retval) 289 if (retval)
299 return retval; 290 return retval;
300 291
301 /* data structure init */
302 retval = ehci_init(hcd);
303 if (retval)
304 return retval;
305
306 ehci->sbrn = 0x20;
307
308 ehci_port_power(ehci, 1); 292 ehci_port_power(ehci, 1);
309 return retval; 293 return retval;
310} 294}
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c
index c1eda73916cd..4d147c4e33f5 100644
--- a/drivers/usb/host/ehci-vt8500.c
+++ b/drivers/usb/host/ehci-vt8500.c
@@ -48,7 +48,7 @@ static const struct hc_driver vt8500_ehci_hc_driver = {
48 /* 48 /*
49 * basic lifecycle operations 49 * basic lifecycle operations
50 */ 50 */
51 .reset = ehci_init, 51 .reset = ehci_setup,
52 .start = ehci_run, 52 .start = ehci_run,
53 .stop = ehci_stop, 53 .stop = ehci_stop,
54 .shutdown = ehci_shutdown, 54 .shutdown = ehci_shutdown,
@@ -121,18 +121,6 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev)
121 121
122 ehci = hcd_to_ehci(hcd); 122 ehci = hcd_to_ehci(hcd);
123 ehci->caps = hcd->regs; 123 ehci->caps = hcd->regs;
124 ehci->regs = hcd->regs +
125 HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
126
127 dbg_hcs_params(ehci, "reset");
128 dbg_hcc_params(ehci, "reset");
129
130 /* cache this readonly data; minimize chip reads */
131 ehci->hcs_params = readl(&ehci->caps->hcs_params);
132
133 ehci_port_power(ehci, 1);
134
135 ehci_reset(ehci);
136 124
137 ret = usb_add_hcd(hcd, pdev->resource[1].start, 125 ret = usb_add_hcd(hcd, pdev->resource[1].start,
138 IRQF_SHARED); 126 IRQF_SHARED);
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c
index 3d2e26cbb34c..ec598082c14b 100644
--- a/drivers/usb/host/ehci-w90x900.c
+++ b/drivers/usb/host/ehci-w90x900.c
@@ -71,21 +71,14 @@ static int __devinit usb_w90x900_probe(const struct hc_driver *driver,
71 val |= ENPHY; 71 val |= ENPHY;
72 __raw_writel(val, ehci->regs+PHY1_CTR); 72 __raw_writel(val, ehci->regs+PHY1_CTR);
73 73
74 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
75 ehci->sbrn = 0x20;
76
77 irq = platform_get_irq(pdev, 0); 74 irq = platform_get_irq(pdev, 0);
78 if (irq < 0) 75 if (irq < 0)
79 goto err4; 76 goto err4;
80 77
81 ehci_reset(ehci);
82
83 retval = usb_add_hcd(hcd, irq, IRQF_SHARED); 78 retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
84 if (retval != 0) 79 if (retval != 0)
85 goto err4; 80 goto err4;
86 81
87 ehci_writel(ehci, 1, &ehci->regs->configured_flag);
88
89 return retval; 82 return retval;
90err4: 83err4:
91 iounmap(hcd->regs); 84 iounmap(hcd->regs);
@@ -120,7 +113,7 @@ static const struct hc_driver ehci_w90x900_hc_driver = {
120 /* 113 /*
121 * basic lifecycle operations 114 * basic lifecycle operations
122 */ 115 */
123 .reset = ehci_init, 116 .reset = ehci_setup,
124 .start = ehci_run, 117 .start = ehci_run,
125 118
126 .stop = ehci_stop, 119 .stop = ehci_stop,
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c
index e9713d589e30..39f24fa37ebe 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -32,30 +32,6 @@
32#include <linux/of_address.h> 32#include <linux/of_address.h>
33 33
34/** 34/**
35 * ehci_xilinx_of_setup - Initialize the device for ehci_reset()
36 * @hcd: Pointer to the usb_hcd device to which the host controller bound
37 *
38 * called during probe() after chip reset completes.
39 */
40static int ehci_xilinx_of_setup(struct usb_hcd *hcd)
41{
42 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
43 int retval;
44
45 retval = ehci_halt(ehci);
46 if (retval)
47 return retval;
48
49 retval = ehci_init(hcd);
50 if (retval)
51 return retval;
52
53 ehci->sbrn = 0x20;
54
55 return ehci_reset(ehci);
56}
57
58/**
59 * ehci_xilinx_port_handed_over - hand the port out if failed to enable it 35 * ehci_xilinx_port_handed_over - hand the port out if failed to enable it
60 * @hcd: Pointer to the usb_hcd device to which the host controller bound 36 * @hcd: Pointer to the usb_hcd device to which the host controller bound
61 * @portnum:Port number to which the device is attached. 37 * @portnum:Port number to which the device is attached.
@@ -107,7 +83,7 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = {
107 /* 83 /*
108 * basic lifecycle operations 84 * basic lifecycle operations
109 */ 85 */
110 .reset = ehci_xilinx_of_setup, 86 .reset = ehci_setup,
111 .start = ehci_run, 87 .start = ehci_run,
112 .stop = ehci_stop, 88 .stop = ehci_stop,
113 .shutdown = ehci_shutdown, 89 .shutdown = ehci_shutdown,
@@ -219,11 +195,6 @@ static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
219 /* Debug registers are at the first 0x100 region 195 /* Debug registers are at the first 0x100 region
220 */ 196 */
221 ehci->caps = hcd->regs + 0x100; 197 ehci->caps = hcd->regs + 0x100;
222 ehci->regs = hcd->regs + 0x100 +
223 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
224
225 /* cache this readonly data; minimize chip reads */
226 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
227 198
228 rv = usb_add_hcd(hcd, irq, 0); 199 rv = usb_add_hcd(hcd, irq, 0);
229 if (rv == 0) 200 if (rv == 0)
diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c
index 72f08196f8cd..99c353a85ae4 100644
--- a/drivers/usb/host/ehci-xls.c
+++ b/drivers/usb/host/ehci-xls.c
@@ -14,30 +14,11 @@
14 14
15static int ehci_xls_setup(struct usb_hcd *hcd) 15static int ehci_xls_setup(struct usb_hcd *hcd)
16{ 16{
17 int retval;
18 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 17 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
19 18
20 ehci->caps = hcd->regs; 19 ehci->caps = hcd->regs;
21 ehci->regs = hcd->regs +
22 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
23 dbg_hcs_params(ehci, "reset");
24 dbg_hcc_params(ehci, "reset");
25 20
26 /* cache this readonly data; minimize chip reads */ 21 return ehci_setup(ehci);
27 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
28
29 retval = ehci_halt(ehci);
30 if (retval)
31 return retval;
32
33 /* data structure init */
34 retval = ehci_init(hcd);
35 if (retval)
36 return retval;
37
38 ehci_reset(ehci);
39
40 return retval;
41} 22}
42 23
43int ehci_xls_probe_internal(const struct hc_driver *driver, 24int ehci_xls_probe_internal(const struct hc_driver *driver,