diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-09 19:09:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-09 19:10:29 -0500 |
commit | 332ceddb8c4ba2367abcb9a94a69386b2785441b (patch) | |
tree | b3288bcda95b165172b13e7a8ad2f2c1947b9953 /drivers/usb/host | |
parent | a36ae95c4e220afb976dd9d0d813d01e882b7b59 (diff) | |
parent | aaa0ef289afe9186f81e2340114ea413eef0492a (diff) |
Merge branch 'for-usb' of git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux into usb-next
* 'for-usb' of git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux:
usb: PS3 EHCI QH read work-around
usb: Fix PS3 EHCI suspend
usb: PS3 EHCI HC reset work-around
usb: Remove ehci_reset call from ehci_run
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-au1xxx.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 62 | ||||
-rw-r--r-- | drivers/usb/host/ehci-octeon.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-omap.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-ps3.c | 30 | ||||
-rw-r--r-- | drivers/usb/host/ehci-s5p.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-vt8500.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-w90x900.c | 2 |
8 files changed, 93 insertions, 10 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 18bafa99fe57..bf7441afed16 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -23,6 +23,7 @@ static int au1xxx_ehci_setup(struct usb_hcd *hcd) | |||
23 | int ret = ehci_init(hcd); | 23 | int ret = ehci_init(hcd); |
24 | 24 | ||
25 | ehci->need_io_watchdog = 0; | 25 | ehci->need_io_watchdog = 0; |
26 | ehci_reset(ehci); | ||
26 | return ret; | 27 | return ret; |
27 | } | 28 | } |
28 | 29 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 0f15d392aae1..c4c76ab204c1 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -48,6 +48,10 @@ | |||
48 | #include <asm/system.h> | 48 | #include <asm/system.h> |
49 | #include <asm/unaligned.h> | 49 | #include <asm/unaligned.h> |
50 | 50 | ||
51 | #if defined(CONFIG_PPC_PS3) | ||
52 | #include <asm/firmware.h> | ||
53 | #endif | ||
54 | |||
51 | /*-------------------------------------------------------------------------*/ | 55 | /*-------------------------------------------------------------------------*/ |
52 | 56 | ||
53 | /* | 57 | /* |
@@ -230,12 +234,58 @@ static int ehci_halt (struct ehci_hcd *ehci) | |||
230 | STS_HALT, STS_HALT, 16 * 125); | 234 | STS_HALT, STS_HALT, 16 * 125); |
231 | } | 235 | } |
232 | 236 | ||
237 | #if defined(CONFIG_USB_SUSPEND) && defined(CONFIG_PPC_PS3) | ||
238 | |||
239 | /* | ||
240 | * The EHCI controller of the Cell Super Companion Chip used in the | ||
241 | * PS3 will stop the root hub after all root hub ports are suspended. | ||
242 | * When in this condition handshake will return -ETIMEDOUT. The | ||
243 | * STS_HLT bit will not be set, so inspection of the frame index is | ||
244 | * used here to test for the condition. If the condition is found | ||
245 | * return success to allow the USB suspend to complete. | ||
246 | */ | ||
247 | |||
248 | static int handshake_for_broken_root_hub(struct ehci_hcd *ehci, | ||
249 | void __iomem *ptr, u32 mask, u32 done, | ||
250 | int usec) | ||
251 | { | ||
252 | unsigned int old_index; | ||
253 | int error; | ||
254 | |||
255 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) | ||
256 | return -ETIMEDOUT; | ||
257 | |||
258 | old_index = ehci_read_frame_index(ehci); | ||
259 | |||
260 | error = handshake(ehci, ptr, mask, done, usec); | ||
261 | |||
262 | if (error == -ETIMEDOUT && ehci_read_frame_index(ehci) == old_index) | ||
263 | return 0; | ||
264 | |||
265 | return error; | ||
266 | } | ||
267 | |||
268 | #else | ||
269 | |||
270 | static int handshake_for_broken_root_hub(struct ehci_hcd *ehci, | ||
271 | void __iomem *ptr, u32 mask, u32 done, | ||
272 | int usec) | ||
273 | { | ||
274 | return -ETIMEDOUT; | ||
275 | } | ||
276 | |||
277 | #endif | ||
278 | |||
233 | static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, | 279 | static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, |
234 | u32 mask, u32 done, int usec) | 280 | u32 mask, u32 done, int usec) |
235 | { | 281 | { |
236 | int error; | 282 | int error; |
237 | 283 | ||
238 | error = handshake(ehci, ptr, mask, done, usec); | 284 | error = handshake(ehci, ptr, mask, done, usec); |
285 | if (error == -ETIMEDOUT) | ||
286 | error = handshake_for_broken_root_hub(ehci, ptr, mask, done, | ||
287 | usec); | ||
288 | |||
239 | if (error) { | 289 | if (error) { |
240 | ehci_halt(ehci); | 290 | ehci_halt(ehci); |
241 | ehci->rh_state = EHCI_RH_HALTED; | 291 | ehci->rh_state = EHCI_RH_HALTED; |
@@ -620,6 +670,7 @@ static int ehci_init(struct usb_hcd *hcd) | |||
620 | hw = ehci->async->hw; | 670 | hw = ehci->async->hw; |
621 | hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma); | 671 | hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma); |
622 | hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD); | 672 | hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD); |
673 | hw->hw_info1 |= cpu_to_hc32(ehci, (1 << 7)); /* I = 1 */ | ||
623 | hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); | 674 | hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); |
624 | hw->hw_qtd_next = EHCI_LIST_END(ehci); | 675 | hw->hw_qtd_next = EHCI_LIST_END(ehci); |
625 | ehci->async->qh_state = QH_STATE_LINKED; | 676 | ehci->async->qh_state = QH_STATE_LINKED; |
@@ -677,22 +728,13 @@ static int ehci_init(struct usb_hcd *hcd) | |||
677 | static int ehci_run (struct usb_hcd *hcd) | 728 | static int ehci_run (struct usb_hcd *hcd) |
678 | { | 729 | { |
679 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 730 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
680 | int retval; | ||
681 | u32 temp; | 731 | u32 temp; |
682 | u32 hcc_params; | 732 | u32 hcc_params; |
683 | 733 | ||
684 | hcd->uses_new_polling = 1; | 734 | hcd->uses_new_polling = 1; |
685 | 735 | ||
686 | /* EHCI spec section 4.1 */ | 736 | /* EHCI spec section 4.1 */ |
687 | /* | 737 | |
688 | * TDI driver does the ehci_reset in their reset callback. | ||
689 | * Don't reset here, because configuration settings will | ||
690 | * vanish. | ||
691 | */ | ||
692 | if (!ehci_is_TDI(ehci) && (retval = ehci_reset(ehci)) != 0) { | ||
693 | ehci_mem_cleanup(ehci); | ||
694 | return retval; | ||
695 | } | ||
696 | ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); | 738 | ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); |
697 | ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next); | 739 | ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next); |
698 | 740 | ||
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index ba1f51361134..c0104882c72d 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c | |||
@@ -155,6 +155,8 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) | |||
155 | /* cache this readonly data; minimize chip reads */ | 155 | /* cache this readonly data; minimize chip reads */ |
156 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 156 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
157 | 157 | ||
158 | ehci_reset(ehci); | ||
159 | |||
158 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 160 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
159 | if (ret) { | 161 | if (ret) { |
160 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | 162 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index e39b0297bad1..e33baf9052cb 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -228,6 +228,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
228 | /* cache this readonly data; minimize chip reads */ | 228 | /* cache this readonly data; minimize chip reads */ |
229 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); | 229 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); |
230 | 230 | ||
231 | ehci_reset(omap_ehci); | ||
232 | |||
231 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 233 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
232 | if (ret) { | 234 | if (ret) { |
233 | dev_err(dev, "failed to add hcd with err %d\n", ret); | 235 | dev_err(dev, "failed to add hcd with err %d\n", ret); |
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 2dc32da75cfc..a20e496eb479 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -21,6 +21,34 @@ | |||
21 | #include <asm/firmware.h> | 21 | #include <asm/firmware.h> |
22 | #include <asm/ps3.h> | 22 | #include <asm/ps3.h> |
23 | 23 | ||
24 | static void ps3_ehci_setup_insnreg(struct ehci_hcd *ehci) | ||
25 | { | ||
26 | /* PS3 HC internal setup register offsets. */ | ||
27 | |||
28 | enum ps3_ehci_hc_insnreg { | ||
29 | ps3_ehci_hc_insnreg01 = 0x084, | ||
30 | ps3_ehci_hc_insnreg02 = 0x088, | ||
31 | ps3_ehci_hc_insnreg03 = 0x08c, | ||
32 | }; | ||
33 | |||
34 | /* PS3 EHCI HC errata fix 316 - The PS3 EHCI HC will reset its | ||
35 | * internal INSNREGXX setup regs back to the chip default values | ||
36 | * on Host Controller Reset (CMD_RESET) or Light Host Controller | ||
37 | * Reset (CMD_LRESET). The work-around for this is for the HC | ||
38 | * driver to re-initialise these regs when ever the HC is reset. | ||
39 | */ | ||
40 | |||
41 | /* Set burst transfer counts to 256 out, 32 in. */ | ||
42 | |||
43 | writel_be(0x01000020, (void __iomem *)ehci->regs + | ||
44 | ps3_ehci_hc_insnreg01); | ||
45 | |||
46 | /* Enable burst transfer counts. */ | ||
47 | |||
48 | writel_be(0x00000001, (void __iomem *)ehci->regs + | ||
49 | ps3_ehci_hc_insnreg03); | ||
50 | } | ||
51 | |||
24 | static int ps3_ehci_hc_reset(struct usb_hcd *hcd) | 52 | static int ps3_ehci_hc_reset(struct usb_hcd *hcd) |
25 | { | 53 | { |
26 | int result; | 54 | int result; |
@@ -49,6 +77,8 @@ static int ps3_ehci_hc_reset(struct usb_hcd *hcd) | |||
49 | 77 | ||
50 | ehci_reset(ehci); | 78 | ehci_reset(ehci); |
51 | 79 | ||
80 | ps3_ehci_setup_insnreg(ehci); | ||
81 | |||
52 | return result; | 82 | return result; |
53 | } | 83 | } |
54 | 84 | ||
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 8aac02019195..293f7412992e 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c | |||
@@ -134,6 +134,8 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev) | |||
134 | /* cache this readonly data; minimize chip reads */ | 134 | /* cache this readonly data; minimize chip reads */ |
135 | ehci->hcs_params = readl(&ehci->caps->hcs_params); | 135 | ehci->hcs_params = readl(&ehci->caps->hcs_params); |
136 | 136 | ||
137 | ehci_reset(ehci); | ||
138 | |||
137 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); | 139 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
138 | if (err) { | 140 | if (err) { |
139 | dev_err(&pdev->dev, "Failed to add USB HCD\n"); | 141 | dev_err(&pdev->dev, "Failed to add USB HCD\n"); |
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c index 54d1ab8aec49..c1eda73916cd 100644 --- a/drivers/usb/host/ehci-vt8500.c +++ b/drivers/usb/host/ehci-vt8500.c | |||
@@ -132,6 +132,8 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev) | |||
132 | 132 | ||
133 | ehci_port_power(ehci, 1); | 133 | ehci_port_power(ehci, 1); |
134 | 134 | ||
135 | ehci_reset(ehci); | ||
136 | |||
135 | ret = usb_add_hcd(hcd, pdev->resource[1].start, | 137 | ret = usb_add_hcd(hcd, pdev->resource[1].start, |
136 | IRQF_SHARED); | 138 | IRQF_SHARED); |
137 | if (ret == 0) { | 139 | if (ret == 0) { |
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index d661cf7de140..3d2e26cbb34c 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c | |||
@@ -78,6 +78,8 @@ static int __devinit usb_w90x900_probe(const struct hc_driver *driver, | |||
78 | if (irq < 0) | 78 | if (irq < 0) |
79 | goto err4; | 79 | goto err4; |
80 | 80 | ||
81 | ehci_reset(ehci); | ||
82 | |||
81 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); | 83 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
82 | if (retval != 0) | 84 | if (retval != 0) |
83 | goto err4; | 85 | goto err4; |