diff options
Diffstat (limited to 'drivers/usb/host')
45 files changed, 467 insertions, 295 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 3de291b6ac04..5ad60e46dc2b 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -219,7 +219,7 @@ config USB_EHCI_TEGRA | |||
219 | 219 | ||
220 | config USB_EHCI_HCD_PPC_OF | 220 | config USB_EHCI_HCD_PPC_OF |
221 | bool "EHCI support for PPC USB controller on OF platform bus" | 221 | bool "EHCI support for PPC USB controller on OF platform bus" |
222 | depends on PPC_OF | 222 | depends on PPC |
223 | default y | 223 | default y |
224 | ---help--- | 224 | ---help--- |
225 | Enables support for the USB controller present on the PowerPC | 225 | Enables support for the USB controller present on the PowerPC |
@@ -480,7 +480,7 @@ config USB_OHCI_ATH79 | |||
480 | 480 | ||
481 | config USB_OHCI_HCD_PPC_OF_BE | 481 | config USB_OHCI_HCD_PPC_OF_BE |
482 | bool "OHCI support for OF platform bus (big endian)" | 482 | bool "OHCI support for OF platform bus (big endian)" |
483 | depends on PPC_OF | 483 | depends on PPC |
484 | select USB_OHCI_BIG_ENDIAN_DESC | 484 | select USB_OHCI_BIG_ENDIAN_DESC |
485 | select USB_OHCI_BIG_ENDIAN_MMIO | 485 | select USB_OHCI_BIG_ENDIAN_MMIO |
486 | ---help--- | 486 | ---help--- |
@@ -489,7 +489,7 @@ config USB_OHCI_HCD_PPC_OF_BE | |||
489 | 489 | ||
490 | config USB_OHCI_HCD_PPC_OF_LE | 490 | config USB_OHCI_HCD_PPC_OF_LE |
491 | bool "OHCI support for OF platform bus (little endian)" | 491 | bool "OHCI support for OF platform bus (little endian)" |
492 | depends on PPC_OF | 492 | depends on PPC |
493 | select USB_OHCI_LITTLE_ENDIAN | 493 | select USB_OHCI_LITTLE_ENDIAN |
494 | ---help--- | 494 | ---help--- |
495 | Enables support for little-endian USB controllers present on the | 495 | Enables support for little-endian USB controllers present on the |
@@ -497,7 +497,7 @@ config USB_OHCI_HCD_PPC_OF_LE | |||
497 | 497 | ||
498 | config USB_OHCI_HCD_PPC_OF | 498 | config USB_OHCI_HCD_PPC_OF |
499 | bool | 499 | bool |
500 | depends on PPC_OF | 500 | depends on PPC |
501 | default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE | 501 | default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE |
502 | 502 | ||
503 | config USB_OHCI_HCD_PCI | 503 | config USB_OHCI_HCD_PCI |
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 56a88506febe..663f7908b15c 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c | |||
@@ -27,44 +27,66 @@ | |||
27 | #define DRIVER_DESC "EHCI Atmel driver" | 27 | #define DRIVER_DESC "EHCI Atmel driver" |
28 | 28 | ||
29 | static const char hcd_name[] = "ehci-atmel"; | 29 | static const char hcd_name[] = "ehci-atmel"; |
30 | static struct hc_driver __read_mostly ehci_atmel_hc_driver; | ||
31 | 30 | ||
32 | /* interface and function clocks */ | 31 | /* interface and function clocks */ |
33 | static struct clk *iclk, *fclk, *uclk; | 32 | #define hcd_to_atmel_ehci_priv(h) \ |
34 | static int clocked; | 33 | ((struct atmel_ehci_priv *)hcd_to_ehci(h)->priv) |
34 | |||
35 | struct atmel_ehci_priv { | ||
36 | struct clk *iclk; | ||
37 | struct clk *fclk; | ||
38 | struct clk *uclk; | ||
39 | bool clocked; | ||
40 | }; | ||
41 | |||
42 | static struct hc_driver __read_mostly ehci_atmel_hc_driver; | ||
43 | |||
44 | static const struct ehci_driver_overrides ehci_atmel_drv_overrides __initconst = { | ||
45 | .extra_priv_size = sizeof(struct atmel_ehci_priv), | ||
46 | }; | ||
35 | 47 | ||
36 | /*-------------------------------------------------------------------------*/ | 48 | /*-------------------------------------------------------------------------*/ |
37 | 49 | ||
38 | static void atmel_start_clock(void) | 50 | static void atmel_start_clock(struct atmel_ehci_priv *atmel_ehci) |
39 | { | 51 | { |
52 | if (atmel_ehci->clocked) | ||
53 | return; | ||
40 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | 54 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { |
41 | clk_set_rate(uclk, 48000000); | 55 | clk_set_rate(atmel_ehci->uclk, 48000000); |
42 | clk_prepare_enable(uclk); | 56 | clk_prepare_enable(atmel_ehci->uclk); |
43 | } | 57 | } |
44 | clk_prepare_enable(iclk); | 58 | clk_prepare_enable(atmel_ehci->iclk); |
45 | clk_prepare_enable(fclk); | 59 | clk_prepare_enable(atmel_ehci->fclk); |
46 | clocked = 1; | 60 | atmel_ehci->clocked = true; |
47 | } | 61 | } |
48 | 62 | ||
49 | static void atmel_stop_clock(void) | 63 | static void atmel_stop_clock(struct atmel_ehci_priv *atmel_ehci) |
50 | { | 64 | { |
51 | clk_disable_unprepare(fclk); | 65 | if (!atmel_ehci->clocked) |
52 | clk_disable_unprepare(iclk); | 66 | return; |
67 | clk_disable_unprepare(atmel_ehci->fclk); | ||
68 | clk_disable_unprepare(atmel_ehci->iclk); | ||
53 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | 69 | if (IS_ENABLED(CONFIG_COMMON_CLK)) |
54 | clk_disable_unprepare(uclk); | 70 | clk_disable_unprepare(atmel_ehci->uclk); |
55 | clocked = 0; | 71 | atmel_ehci->clocked = false; |
56 | } | 72 | } |
57 | 73 | ||
58 | static void atmel_start_ehci(struct platform_device *pdev) | 74 | static void atmel_start_ehci(struct platform_device *pdev) |
59 | { | 75 | { |
76 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
77 | struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd); | ||
78 | |||
60 | dev_dbg(&pdev->dev, "start\n"); | 79 | dev_dbg(&pdev->dev, "start\n"); |
61 | atmel_start_clock(); | 80 | atmel_start_clock(atmel_ehci); |
62 | } | 81 | } |
63 | 82 | ||
64 | static void atmel_stop_ehci(struct platform_device *pdev) | 83 | static void atmel_stop_ehci(struct platform_device *pdev) |
65 | { | 84 | { |
85 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
86 | struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd); | ||
87 | |||
66 | dev_dbg(&pdev->dev, "stop\n"); | 88 | dev_dbg(&pdev->dev, "stop\n"); |
67 | atmel_stop_clock(); | 89 | atmel_stop_clock(atmel_ehci); |
68 | } | 90 | } |
69 | 91 | ||
70 | /*-------------------------------------------------------------------------*/ | 92 | /*-------------------------------------------------------------------------*/ |
@@ -75,6 +97,7 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) | |||
75 | const struct hc_driver *driver = &ehci_atmel_hc_driver; | 97 | const struct hc_driver *driver = &ehci_atmel_hc_driver; |
76 | struct resource *res; | 98 | struct resource *res; |
77 | struct ehci_hcd *ehci; | 99 | struct ehci_hcd *ehci; |
100 | struct atmel_ehci_priv *atmel_ehci; | ||
78 | int irq; | 101 | int irq; |
79 | int retval; | 102 | int retval; |
80 | 103 | ||
@@ -105,6 +128,7 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) | |||
105 | retval = -ENOMEM; | 128 | retval = -ENOMEM; |
106 | goto fail_create_hcd; | 129 | goto fail_create_hcd; |
107 | } | 130 | } |
131 | atmel_ehci = hcd_to_atmel_ehci_priv(hcd); | ||
108 | 132 | ||
109 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 133 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
110 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 134 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
@@ -116,23 +140,23 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) | |||
116 | hcd->rsrc_start = res->start; | 140 | hcd->rsrc_start = res->start; |
117 | hcd->rsrc_len = resource_size(res); | 141 | hcd->rsrc_len = resource_size(res); |
118 | 142 | ||
119 | iclk = devm_clk_get(&pdev->dev, "ehci_clk"); | 143 | atmel_ehci->iclk = devm_clk_get(&pdev->dev, "ehci_clk"); |
120 | if (IS_ERR(iclk)) { | 144 | if (IS_ERR(atmel_ehci->iclk)) { |
121 | dev_err(&pdev->dev, "Error getting interface clock\n"); | 145 | dev_err(&pdev->dev, "Error getting interface clock\n"); |
122 | retval = -ENOENT; | 146 | retval = -ENOENT; |
123 | goto fail_request_resource; | 147 | goto fail_request_resource; |
124 | } | 148 | } |
125 | fclk = devm_clk_get(&pdev->dev, "uhpck"); | 149 | atmel_ehci->fclk = devm_clk_get(&pdev->dev, "uhpck"); |
126 | if (IS_ERR(fclk)) { | 150 | if (IS_ERR(atmel_ehci->fclk)) { |
127 | dev_err(&pdev->dev, "Error getting function clock\n"); | 151 | dev_err(&pdev->dev, "Error getting function clock\n"); |
128 | retval = -ENOENT; | 152 | retval = -ENOENT; |
129 | goto fail_request_resource; | 153 | goto fail_request_resource; |
130 | } | 154 | } |
131 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | 155 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { |
132 | uclk = devm_clk_get(&pdev->dev, "usb_clk"); | 156 | atmel_ehci->uclk = devm_clk_get(&pdev->dev, "usb_clk"); |
133 | if (IS_ERR(uclk)) { | 157 | if (IS_ERR(atmel_ehci->uclk)) { |
134 | dev_err(&pdev->dev, "failed to get uclk\n"); | 158 | dev_err(&pdev->dev, "failed to get uclk\n"); |
135 | retval = PTR_ERR(uclk); | 159 | retval = PTR_ERR(atmel_ehci->uclk); |
136 | goto fail_request_resource; | 160 | goto fail_request_resource; |
137 | } | 161 | } |
138 | } | 162 | } |
@@ -169,11 +193,35 @@ static int ehci_atmel_drv_remove(struct platform_device *pdev) | |||
169 | usb_put_hcd(hcd); | 193 | usb_put_hcd(hcd); |
170 | 194 | ||
171 | atmel_stop_ehci(pdev); | 195 | atmel_stop_ehci(pdev); |
172 | fclk = iclk = NULL; | ||
173 | 196 | ||
174 | return 0; | 197 | return 0; |
175 | } | 198 | } |
176 | 199 | ||
200 | #ifdef CONFIG_PM | ||
201 | static int ehci_atmel_drv_suspend(struct device *dev) | ||
202 | { | ||
203 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
204 | struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd); | ||
205 | int ret; | ||
206 | |||
207 | ret = ehci_suspend(hcd, false); | ||
208 | if (ret) | ||
209 | return ret; | ||
210 | |||
211 | atmel_stop_clock(atmel_ehci); | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static int ehci_atmel_drv_resume(struct device *dev) | ||
216 | { | ||
217 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
218 | struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd); | ||
219 | |||
220 | atmel_start_clock(atmel_ehci); | ||
221 | return ehci_resume(hcd, false); | ||
222 | } | ||
223 | #endif | ||
224 | |||
177 | #ifdef CONFIG_OF | 225 | #ifdef CONFIG_OF |
178 | static const struct of_device_id atmel_ehci_dt_ids[] = { | 226 | static const struct of_device_id atmel_ehci_dt_ids[] = { |
179 | { .compatible = "atmel,at91sam9g45-ehci" }, | 227 | { .compatible = "atmel,at91sam9g45-ehci" }, |
@@ -183,12 +231,16 @@ static const struct of_device_id atmel_ehci_dt_ids[] = { | |||
183 | MODULE_DEVICE_TABLE(of, atmel_ehci_dt_ids); | 231 | MODULE_DEVICE_TABLE(of, atmel_ehci_dt_ids); |
184 | #endif | 232 | #endif |
185 | 233 | ||
234 | static SIMPLE_DEV_PM_OPS(ehci_atmel_pm_ops, ehci_atmel_drv_suspend, | ||
235 | ehci_atmel_drv_resume); | ||
236 | |||
186 | static struct platform_driver ehci_atmel_driver = { | 237 | static struct platform_driver ehci_atmel_driver = { |
187 | .probe = ehci_atmel_drv_probe, | 238 | .probe = ehci_atmel_drv_probe, |
188 | .remove = ehci_atmel_drv_remove, | 239 | .remove = ehci_atmel_drv_remove, |
189 | .shutdown = usb_hcd_platform_shutdown, | 240 | .shutdown = usb_hcd_platform_shutdown, |
190 | .driver = { | 241 | .driver = { |
191 | .name = "atmel-ehci", | 242 | .name = "atmel-ehci", |
243 | .pm = &ehci_atmel_pm_ops, | ||
192 | .of_match_table = of_match_ptr(atmel_ehci_dt_ids), | 244 | .of_match_table = of_match_ptr(atmel_ehci_dt_ids), |
193 | }, | 245 | }, |
194 | }; | 246 | }; |
@@ -199,7 +251,7 @@ static int __init ehci_atmel_init(void) | |||
199 | return -ENODEV; | 251 | return -ENODEV; |
200 | 252 | ||
201 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); | 253 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); |
202 | ehci_init_driver(&ehci_atmel_hc_driver, NULL); | 254 | ehci_init_driver(&ehci_atmel_hc_driver, &ehci_atmel_drv_overrides); |
203 | return platform_driver_register(&ehci_atmel_driver); | 255 | return platform_driver_register(&ehci_atmel_driver); |
204 | } | 256 | } |
205 | module_init(ehci_atmel_init); | 257 | module_init(ehci_atmel_init); |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index fb7bd0c7dc15..ab4eee3df97a 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -709,7 +709,6 @@ static struct platform_driver ehci_fsl_driver = { | |||
709 | .shutdown = usb_hcd_platform_shutdown, | 709 | .shutdown = usb_hcd_platform_shutdown, |
710 | .driver = { | 710 | .driver = { |
711 | .name = "fsl-ehci", | 711 | .name = "fsl-ehci", |
712 | .owner = THIS_MODULE, | ||
713 | .pm = EHCI_FSL_PM_OPS, | 712 | .pm = EHCI_FSL_PM_OPS, |
714 | }, | 713 | }, |
715 | }; | 714 | }; |
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c index 495b6fbcbcd9..21650044b09e 100644 --- a/drivers/usb/host/ehci-grlib.c +++ b/drivers/usb/host/ehci-grlib.c | |||
@@ -187,7 +187,6 @@ static struct platform_driver ehci_grlib_driver = { | |||
187 | .shutdown = usb_hcd_platform_shutdown, | 187 | .shutdown = usb_hcd_platform_shutdown, |
188 | .driver = { | 188 | .driver = { |
189 | .name = "grlib-ehci", | 189 | .name = "grlib-ehci", |
190 | .owner = THIS_MODULE, | ||
191 | .of_match_table = ehci_hcd_grlib_of_match, | 190 | .of_match_table = ehci_hcd_grlib_of_match, |
192 | }, | 191 | }, |
193 | }; | 192 | }; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 38bfeedae1d0..85e56d1abd23 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1110,7 +1110,7 @@ int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
1110 | EXPORT_SYMBOL_GPL(ehci_suspend); | 1110 | EXPORT_SYMBOL_GPL(ehci_suspend); |
1111 | 1111 | ||
1112 | /* Returns 0 if power was preserved, 1 if power was lost */ | 1112 | /* Returns 0 if power was preserved, 1 if power was lost */ |
1113 | int ehci_resume(struct usb_hcd *hcd, bool hibernated) | 1113 | int ehci_resume(struct usb_hcd *hcd, bool force_reset) |
1114 | { | 1114 | { |
1115 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 1115 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
1116 | 1116 | ||
@@ -1124,12 +1124,12 @@ int ehci_resume(struct usb_hcd *hcd, bool hibernated) | |||
1124 | return 0; /* Controller is dead */ | 1124 | return 0; /* Controller is dead */ |
1125 | 1125 | ||
1126 | /* | 1126 | /* |
1127 | * If CF is still set and we aren't resuming from hibernation | 1127 | * If CF is still set and reset isn't forced |
1128 | * then we maintained suspend power. | 1128 | * then we maintained suspend power. |
1129 | * Just undo the effect of ehci_suspend(). | 1129 | * Just undo the effect of ehci_suspend(). |
1130 | */ | 1130 | */ |
1131 | if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF && | 1131 | if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF && |
1132 | !hibernated) { | 1132 | !force_reset) { |
1133 | int mask = INTR_MASK; | 1133 | int mask = INTR_MASK; |
1134 | 1134 | ||
1135 | ehci_prepare_ports_for_controller_resume(ehci); | 1135 | ehci_prepare_ports_for_controller_resume(ehci); |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 118edb7bdca2..87cf86f38b36 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -700,15 +700,15 @@ ehci_hub_descriptor ( | |||
700 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); | 700 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); |
701 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); | 701 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); |
702 | 702 | ||
703 | temp = 0x0008; /* per-port overcurrent reporting */ | 703 | temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ |
704 | if (HCS_PPC (ehci->hcs_params)) | 704 | if (HCS_PPC (ehci->hcs_params)) |
705 | temp |= 0x0001; /* per-port power control */ | 705 | temp |= HUB_CHAR_INDV_PORT_LPSM; /* per-port power control */ |
706 | else | 706 | else |
707 | temp |= 0x0002; /* no power switching */ | 707 | temp |= HUB_CHAR_NO_LPSM; /* no power switching */ |
708 | #if 0 | 708 | #if 0 |
709 | // re-enable when we support USB_PORT_FEAT_INDICATOR below. | 709 | // re-enable when we support USB_PORT_FEAT_INDICATOR below. |
710 | if (HCS_INDICATOR (ehci->hcs_params)) | 710 | if (HCS_INDICATOR (ehci->hcs_params)) |
711 | temp |= 0x0080; /* per-port indicators (LEDs) */ | 711 | temp |= HUB_CHAR_PORTIND; /* per-port indicators (LEDs) */ |
712 | #endif | 712 | #endif |
713 | desc->wHubCharacteristics = cpu_to_le16(temp); | 713 | desc->wHubCharacteristics = cpu_to_le16(temp); |
714 | } | 714 | } |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 851006a0d97b..2a5d2fd76040 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -43,6 +43,24 @@ static inline bool is_intel_quark_x1000(struct pci_dev *pdev) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * This is the list of PCI IDs for the devices that have EHCI USB class and | ||
47 | * specific drivers for that. One of the example is a ChipIdea device installed | ||
48 | * on some Intel MID platforms. | ||
49 | */ | ||
50 | static const struct pci_device_id bypass_pci_id_table[] = { | ||
51 | /* ChipIdea on Intel MID platform */ | ||
52 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0811), }, | ||
53 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0829), }, | ||
54 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe006), }, | ||
55 | {} | ||
56 | }; | ||
57 | |||
58 | static inline bool is_bypassed_id(struct pci_dev *pdev) | ||
59 | { | ||
60 | return !!pci_match_id(bypass_pci_id_table, pdev); | ||
61 | } | ||
62 | |||
63 | /* | ||
46 | * 0x84 is the offset of in/out threshold register, | 64 | * 0x84 is the offset of in/out threshold register, |
47 | * and it is the same offset as the register of 'hostpc'. | 65 | * and it is the same offset as the register of 'hostpc'. |
48 | */ | 66 | */ |
@@ -352,6 +370,13 @@ static const struct ehci_driver_overrides pci_overrides __initconst = { | |||
352 | 370 | ||
353 | /*-------------------------------------------------------------------------*/ | 371 | /*-------------------------------------------------------------------------*/ |
354 | 372 | ||
373 | static int ehci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
374 | { | ||
375 | if (is_bypassed_id(pdev)) | ||
376 | return -ENODEV; | ||
377 | return usb_hcd_pci_probe(pdev, id); | ||
378 | } | ||
379 | |||
355 | /* PCI driver selection metadata; PCI hotplugging uses this */ | 380 | /* PCI driver selection metadata; PCI hotplugging uses this */ |
356 | static const struct pci_device_id pci_ids [] = { { | 381 | static const struct pci_device_id pci_ids [] = { { |
357 | /* handle any USB 2.0 EHCI controller */ | 382 | /* handle any USB 2.0 EHCI controller */ |
@@ -370,7 +395,7 @@ static struct pci_driver ehci_pci_driver = { | |||
370 | .name = (char *) hcd_name, | 395 | .name = (char *) hcd_name, |
371 | .id_table = pci_ids, | 396 | .id_table = pci_ids, |
372 | 397 | ||
373 | .probe = usb_hcd_pci_probe, | 398 | .probe = ehci_pci_probe, |
374 | .remove = usb_hcd_pci_remove, | 399 | .remove = usb_hcd_pci_remove, |
375 | .shutdown = usb_hcd_pci_shutdown, | 400 | .shutdown = usb_hcd_pci_shutdown, |
376 | 401 | ||
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 8557803e6154..d8a75a51d6d4 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c | |||
@@ -43,7 +43,8 @@ | |||
43 | struct ehci_platform_priv { | 43 | struct ehci_platform_priv { |
44 | struct clk *clks[EHCI_MAX_CLKS]; | 44 | struct clk *clks[EHCI_MAX_CLKS]; |
45 | struct reset_control *rst; | 45 | struct reset_control *rst; |
46 | struct phy *phy; | 46 | struct phy **phys; |
47 | int num_phys; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | static const char hcd_name[] = "ehci-platform"; | 50 | static const char hcd_name[] = "ehci-platform"; |
@@ -78,7 +79,7 @@ static int ehci_platform_power_on(struct platform_device *dev) | |||
78 | { | 79 | { |
79 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 80 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
80 | struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); | 81 | struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); |
81 | int clk, ret; | 82 | int clk, ret, phy_num; |
82 | 83 | ||
83 | for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { | 84 | for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { |
84 | ret = clk_prepare_enable(priv->clks[clk]); | 85 | ret = clk_prepare_enable(priv->clks[clk]); |
@@ -86,20 +87,28 @@ static int ehci_platform_power_on(struct platform_device *dev) | |||
86 | goto err_disable_clks; | 87 | goto err_disable_clks; |
87 | } | 88 | } |
88 | 89 | ||
89 | if (priv->phy) { | 90 | for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { |
90 | ret = phy_init(priv->phy); | 91 | if (priv->phys[phy_num]) { |
91 | if (ret) | 92 | ret = phy_init(priv->phys[phy_num]); |
92 | goto err_disable_clks; | 93 | if (ret) |
93 | 94 | goto err_exit_phy; | |
94 | ret = phy_power_on(priv->phy); | 95 | ret = phy_power_on(priv->phys[phy_num]); |
95 | if (ret) | 96 | if (ret) { |
96 | goto err_exit_phy; | 97 | phy_exit(priv->phys[phy_num]); |
98 | goto err_exit_phy; | ||
99 | } | ||
100 | } | ||
97 | } | 101 | } |
98 | 102 | ||
99 | return 0; | 103 | return 0; |
100 | 104 | ||
101 | err_exit_phy: | 105 | err_exit_phy: |
102 | phy_exit(priv->phy); | 106 | while (--phy_num >= 0) { |
107 | if (priv->phys[phy_num]) { | ||
108 | phy_power_off(priv->phys[phy_num]); | ||
109 | phy_exit(priv->phys[phy_num]); | ||
110 | } | ||
111 | } | ||
103 | err_disable_clks: | 112 | err_disable_clks: |
104 | while (--clk >= 0) | 113 | while (--clk >= 0) |
105 | clk_disable_unprepare(priv->clks[clk]); | 114 | clk_disable_unprepare(priv->clks[clk]); |
@@ -111,11 +120,13 @@ static void ehci_platform_power_off(struct platform_device *dev) | |||
111 | { | 120 | { |
112 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 121 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
113 | struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); | 122 | struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); |
114 | int clk; | 123 | int clk, phy_num; |
115 | 124 | ||
116 | if (priv->phy) { | 125 | for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { |
117 | phy_power_off(priv->phy); | 126 | if (priv->phys[phy_num]) { |
118 | phy_exit(priv->phy); | 127 | phy_power_off(priv->phys[phy_num]); |
128 | phy_exit(priv->phys[phy_num]); | ||
129 | } | ||
119 | } | 130 | } |
120 | 131 | ||
121 | for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) | 132 | for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) |
@@ -143,7 +154,8 @@ static int ehci_platform_probe(struct platform_device *dev) | |||
143 | struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); | 154 | struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); |
144 | struct ehci_platform_priv *priv; | 155 | struct ehci_platform_priv *priv; |
145 | struct ehci_hcd *ehci; | 156 | struct ehci_hcd *ehci; |
146 | int err, irq, clk = 0; | 157 | const char *phy_name; |
158 | int err, irq, phy_num, clk = 0; | ||
147 | 159 | ||
148 | if (usb_disabled()) | 160 | if (usb_disabled()) |
149 | return -ENODEV; | 161 | return -ENODEV; |
@@ -155,7 +167,8 @@ static int ehci_platform_probe(struct platform_device *dev) | |||
155 | if (!pdata) | 167 | if (!pdata) |
156 | pdata = &ehci_platform_defaults; | 168 | pdata = &ehci_platform_defaults; |
157 | 169 | ||
158 | err = dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); | 170 | err = dma_coerce_mask_and_coherent(&dev->dev, |
171 | pdata->dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); | ||
159 | if (err) | 172 | if (err) |
160 | return err; | 173 | return err; |
161 | 174 | ||
@@ -185,12 +198,42 @@ static int ehci_platform_probe(struct platform_device *dev) | |||
185 | if (of_property_read_bool(dev->dev.of_node, "big-endian")) | 198 | if (of_property_read_bool(dev->dev.of_node, "big-endian")) |
186 | ehci->big_endian_mmio = ehci->big_endian_desc = 1; | 199 | ehci->big_endian_mmio = ehci->big_endian_desc = 1; |
187 | 200 | ||
188 | priv->phy = devm_phy_get(&dev->dev, "usb"); | 201 | if (of_property_read_bool(dev->dev.of_node, |
189 | if (IS_ERR(priv->phy)) { | 202 | "needs-reset-on-resume")) |
190 | err = PTR_ERR(priv->phy); | 203 | pdata->reset_on_resume = 1; |
191 | if (err == -EPROBE_DEFER) | 204 | |
192 | goto err_put_hcd; | 205 | priv->num_phys = of_count_phandle_with_args(dev->dev.of_node, |
193 | priv->phy = NULL; | 206 | "phys", "#phy-cells"); |
207 | priv->num_phys = priv->num_phys > 0 ? priv->num_phys : 1; | ||
208 | |||
209 | priv->phys = devm_kcalloc(&dev->dev, priv->num_phys, | ||
210 | sizeof(struct phy *), GFP_KERNEL); | ||
211 | if (!priv->phys) | ||
212 | return -ENOMEM; | ||
213 | |||
214 | for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { | ||
215 | err = of_property_read_string_index( | ||
216 | dev->dev.of_node, | ||
217 | "phy-names", phy_num, | ||
218 | &phy_name); | ||
219 | |||
220 | if (err < 0) { | ||
221 | if (priv->num_phys > 1) { | ||
222 | dev_err(&dev->dev, "phy-names not provided"); | ||
223 | goto err_put_hcd; | ||
224 | } else | ||
225 | phy_name = "usb"; | ||
226 | } | ||
227 | |||
228 | priv->phys[phy_num] = devm_phy_get(&dev->dev, | ||
229 | phy_name); | ||
230 | if (IS_ERR(priv->phys[phy_num])) { | ||
231 | err = PTR_ERR(priv->phys[phy_num]); | ||
232 | if ((priv->num_phys > 1) || | ||
233 | (err == -EPROBE_DEFER)) | ||
234 | goto err_put_hcd; | ||
235 | priv->phys[phy_num] = NULL; | ||
236 | } | ||
194 | } | 237 | } |
195 | 238 | ||
196 | for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { | 239 | for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { |
@@ -340,7 +383,7 @@ static int ehci_platform_resume(struct device *dev) | |||
340 | return err; | 383 | return err; |
341 | } | 384 | } |
342 | 385 | ||
343 | ehci_resume(hcd, false); | 386 | ehci_resume(hcd, pdata->reset_on_resume); |
344 | return 0; | 387 | return 0; |
345 | } | 388 | } |
346 | #endif /* CONFIG_PM_SLEEP */ | 389 | #endif /* CONFIG_PM_SLEEP */ |
@@ -349,6 +392,7 @@ static const struct of_device_id vt8500_ehci_ids[] = { | |||
349 | { .compatible = "via,vt8500-ehci", }, | 392 | { .compatible = "via,vt8500-ehci", }, |
350 | { .compatible = "wm,prizm-ehci", }, | 393 | { .compatible = "wm,prizm-ehci", }, |
351 | { .compatible = "generic-ehci", }, | 394 | { .compatible = "generic-ehci", }, |
395 | { .compatible = "cavium,octeon-6335-ehci", }, | ||
352 | {} | 396 | {} |
353 | }; | 397 | }; |
354 | MODULE_DEVICE_TABLE(of, vt8500_ehci_ids); | 398 | MODULE_DEVICE_TABLE(of, vt8500_ehci_ids); |
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c index 7d75465d97c7..342816a7f8b1 100644 --- a/drivers/usb/host/ehci-pmcmsp.c +++ b/drivers/usb/host/ehci-pmcmsp.c | |||
@@ -325,6 +325,5 @@ static struct platform_driver ehci_hcd_msp_driver = { | |||
325 | .remove = ehci_hcd_msp_drv_remove, | 325 | .remove = ehci_hcd_msp_drv_remove, |
326 | .driver = { | 326 | .driver = { |
327 | .name = "pmcmsp-ehci", | 327 | .name = "pmcmsp-ehci", |
328 | .owner = THIS_MODULE, | ||
329 | }, | 328 | }, |
330 | }; | 329 | }; |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 547924796d29..1a10c8d542ca 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -234,7 +234,6 @@ static struct platform_driver ehci_hcd_ppc_of_driver = { | |||
234 | .shutdown = usb_hcd_platform_shutdown, | 234 | .shutdown = usb_hcd_platform_shutdown, |
235 | .driver = { | 235 | .driver = { |
236 | .name = "ppc-of-ehci", | 236 | .name = "ppc-of-ehci", |
237 | .owner = THIS_MODULE, | ||
238 | .of_match_table = ehci_hcd_ppc_of_match, | 237 | .of_match_table = ehci_hcd_ppc_of_match, |
239 | }, | 238 | }, |
240 | }; | 239 | }; |
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index 9b6e8d0eac43..3d86cc2ffe68 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c | |||
@@ -178,7 +178,6 @@ static struct platform_driver ehci_hcd_sead3_driver = { | |||
178 | .shutdown = usb_hcd_platform_shutdown, | 178 | .shutdown = usb_hcd_platform_shutdown, |
179 | .driver = { | 179 | .driver = { |
180 | .name = "sead3-ehci", | 180 | .name = "sead3-ehci", |
181 | .owner = THIS_MODULE, | ||
182 | .pm = SEAD3_EHCI_PMOPS, | 181 | .pm = SEAD3_EHCI_PMOPS, |
183 | } | 182 | } |
184 | }; | 183 | }; |
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 0e0ce684aff3..5caf88d679e4 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c | |||
@@ -189,7 +189,6 @@ static struct platform_driver ehci_hcd_sh_driver = { | |||
189 | .shutdown = ehci_hcd_sh_shutdown, | 189 | .shutdown = ehci_hcd_sh_shutdown, |
190 | .driver = { | 190 | .driver = { |
191 | .name = "sh_ehci", | 191 | .name = "sh_ehci", |
192 | .owner = THIS_MODULE, | ||
193 | }, | 192 | }, |
194 | }; | 193 | }; |
195 | 194 | ||
diff --git a/drivers/usb/host/ehci-tilegx.c b/drivers/usb/host/ehci-tilegx.c index 0d247673c3ca..bdb93b6a356f 100644 --- a/drivers/usb/host/ehci-tilegx.c +++ b/drivers/usb/host/ehci-tilegx.c | |||
@@ -210,7 +210,6 @@ static struct platform_driver ehci_hcd_tilegx_driver = { | |||
210 | .shutdown = ehci_hcd_tilegx_drv_shutdown, | 210 | .shutdown = ehci_hcd_tilegx_drv_shutdown, |
211 | .driver = { | 211 | .driver = { |
212 | .name = "tilegx-ehci", | 212 | .name = "tilegx-ehci", |
213 | .owner = THIS_MODULE, | ||
214 | } | 213 | } |
215 | }; | 214 | }; |
216 | 215 | ||
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index a2328361dc80..f54480850bb8 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
@@ -236,7 +236,6 @@ static struct platform_driver ehci_hcd_xilinx_of_driver = { | |||
236 | .shutdown = usb_hcd_platform_shutdown, | 236 | .shutdown = usb_hcd_platform_shutdown, |
237 | .driver = { | 237 | .driver = { |
238 | .name = "xilinx-of-ehci", | 238 | .name = "xilinx-of-ehci", |
239 | .owner = THIS_MODULE, | ||
240 | .of_match_table = ehci_hcd_xilinx_of_match, | 239 | .of_match_table = ehci_hcd_xilinx_of_match, |
241 | }, | 240 | }, |
242 | }; | 241 | }; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 6f0577b0a5ae..52ef0844a180 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -871,7 +871,7 @@ extern int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr, | |||
871 | 871 | ||
872 | #ifdef CONFIG_PM | 872 | #ifdef CONFIG_PM |
873 | extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); | 873 | extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); |
874 | extern int ehci_resume(struct usb_hcd *hcd, bool hibernated); | 874 | extern int ehci_resume(struct usb_hcd *hcd, bool force_reset); |
875 | #endif /* CONFIG_PM */ | 875 | #endif /* CONFIG_PM */ |
876 | 876 | ||
877 | extern int ehci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | 877 | extern int ehci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
diff --git a/drivers/usb/host/fhci-hub.c b/drivers/usb/host/fhci-hub.c index 6af2512f8378..70116a65262c 100644 --- a/drivers/usb/host/fhci-hub.c +++ b/drivers/usb/host/fhci-hub.c | |||
@@ -32,8 +32,8 @@ static u8 root_hub_des[] = { | |||
32 | 0x09, /* blength */ | 32 | 0x09, /* blength */ |
33 | 0x29, /* bDescriptorType;hub-descriptor */ | 33 | 0x29, /* bDescriptorType;hub-descriptor */ |
34 | 0x01, /* bNbrPorts */ | 34 | 0x01, /* bNbrPorts */ |
35 | 0x00, /* wHubCharacteristics */ | 35 | HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_NO_OCPM, /* wHubCharacteristics */ |
36 | 0x00, | 36 | 0x00, /* per-port power, no overcurrent */ |
37 | 0x01, /* bPwrOn2pwrGood;2ms */ | 37 | 0x01, /* bPwrOn2pwrGood;2ms */ |
38 | 0x00, /* bHubContrCurrent;0mA */ | 38 | 0x00, /* bHubContrCurrent;0mA */ |
39 | 0x00, /* DeviceRemoveable */ | 39 | 0x00, /* DeviceRemoveable */ |
@@ -208,7 +208,6 @@ int fhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
208 | { | 208 | { |
209 | struct fhci_hcd *fhci = hcd_to_fhci(hcd); | 209 | struct fhci_hcd *fhci = hcd_to_fhci(hcd); |
210 | int retval = 0; | 210 | int retval = 0; |
211 | int len = 0; | ||
212 | struct usb_hub_status *hub_status; | 211 | struct usb_hub_status *hub_status; |
213 | struct usb_port_status *port_status; | 212 | struct usb_port_status *port_status; |
214 | unsigned long flags; | 213 | unsigned long flags; |
@@ -272,8 +271,6 @@ int fhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
272 | break; | 271 | break; |
273 | case GetHubDescriptor: | 272 | case GetHubDescriptor: |
274 | memcpy(buf, root_hub_des, sizeof(root_hub_des)); | 273 | memcpy(buf, root_hub_des, sizeof(root_hub_des)); |
275 | buf[3] = 0x11; /* per-port power, no ovrcrnt */ | ||
276 | len = (buf[0] < wLength) ? buf[0] : wLength; | ||
277 | break; | 274 | break; |
278 | case GetHubStatus: | 275 | case GetHubStatus: |
279 | hub_status = (struct usb_hub_status *)buf; | 276 | hub_status = (struct usb_hub_status *)buf; |
@@ -281,7 +278,6 @@ int fhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
281 | cpu_to_le16(fhci->vroot_hub->hub.wHubStatus); | 278 | cpu_to_le16(fhci->vroot_hub->hub.wHubStatus); |
282 | hub_status->wHubChange = | 279 | hub_status->wHubChange = |
283 | cpu_to_le16(fhci->vroot_hub->hub.wHubChange); | 280 | cpu_to_le16(fhci->vroot_hub->hub.wHubChange); |
284 | len = 4; | ||
285 | break; | 281 | break; |
286 | case GetPortStatus: | 282 | case GetPortStatus: |
287 | port_status = (struct usb_port_status *)buf; | 283 | port_status = (struct usb_port_status *)buf; |
@@ -289,7 +285,6 @@ int fhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
289 | cpu_to_le16(fhci->vroot_hub->port.wPortStatus); | 285 | cpu_to_le16(fhci->vroot_hub->port.wPortStatus); |
290 | port_status->wPortChange = | 286 | port_status->wPortChange = |
291 | cpu_to_le16(fhci->vroot_hub->port.wPortChange); | 287 | cpu_to_le16(fhci->vroot_hub->port.wPortChange); |
292 | len = 4; | ||
293 | break; | 288 | break; |
294 | case SetHubFeature: | 289 | case SetHubFeature: |
295 | switch (wValue) { | 290 | switch (wValue) { |
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index ecf02b2623e8..475b21fd373b 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c | |||
@@ -1521,8 +1521,8 @@ fotg210_hub_descriptor( | |||
1521 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); | 1521 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); |
1522 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); | 1522 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); |
1523 | 1523 | ||
1524 | temp = 0x0008; /* per-port overcurrent reporting */ | 1524 | temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ |
1525 | temp |= 0x0002; /* no power switching */ | 1525 | temp |= HUB_CHAR_NO_LPSM; /* no power switching */ |
1526 | desc->wHubCharacteristics = cpu_to_le16(temp); | 1526 | desc->wHubCharacteristics = cpu_to_le16(temp); |
1527 | } | 1527 | } |
1528 | 1528 | ||
diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c index 664d2aa1239c..a83eefefffda 100644 --- a/drivers/usb/host/fusbh200-hcd.c +++ b/drivers/usb/host/fusbh200-hcd.c | |||
@@ -1479,8 +1479,8 @@ fusbh200_hub_descriptor ( | |||
1479 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); | 1479 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); |
1480 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); | 1480 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); |
1481 | 1481 | ||
1482 | temp = 0x0008; /* per-port overcurrent reporting */ | 1482 | temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ |
1483 | temp |= 0x0002; /* no power switching */ | 1483 | temp |= HUB_CHAR_NO_LPSM; /* no power switching */ |
1484 | desc->wHubCharacteristics = cpu_to_le16(temp); | 1484 | desc->wHubCharacteristics = cpu_to_le16(temp); |
1485 | } | 1485 | } |
1486 | 1486 | ||
diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c index eb4efba9f1ad..6a2ad550b120 100644 --- a/drivers/usb/host/imx21-hcd.c +++ b/drivers/usb/host/imx21-hcd.c | |||
@@ -1482,9 +1482,8 @@ static int get_hub_descriptor(struct usb_hcd *hcd, | |||
1482 | desc->bDescLength = 9; | 1482 | desc->bDescLength = 9; |
1483 | desc->bPwrOn2PwrGood = 0; | 1483 | desc->bPwrOn2PwrGood = 0; |
1484 | desc->wHubCharacteristics = (__force __u16) cpu_to_le16( | 1484 | desc->wHubCharacteristics = (__force __u16) cpu_to_le16( |
1485 | 0x0002 | /* No power switching */ | 1485 | HUB_CHAR_NO_LPSM | /* No power switching */ |
1486 | 0x0010 | /* No over current protection */ | 1486 | HUB_CHAR_NO_OCPM); /* No over current protection */ |
1487 | 0); | ||
1488 | 1487 | ||
1489 | desc->u.hs.DeviceRemovable[0] = 1 << 1; | 1488 | desc->u.hs.DeviceRemovable[0] = 1 << 1; |
1490 | desc->u.hs.DeviceRemovable[1] = ~0; | 1489 | desc->u.hs.DeviceRemovable[1] = ~0; |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 31c9c4d0fa0b..113d0cc6cc43 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -948,7 +948,10 @@ static void isp116x_hub_descriptor(struct isp116x *isp116x, | |||
948 | desc->bHubContrCurrent = 0; | 948 | desc->bHubContrCurrent = 0; |
949 | desc->bNbrPorts = (u8) (reg & 0x3); | 949 | desc->bNbrPorts = (u8) (reg & 0x3); |
950 | /* Power switching, device type, overcurrent. */ | 950 | /* Power switching, device type, overcurrent. */ |
951 | desc->wHubCharacteristics = cpu_to_le16((u16) ((reg >> 8) & 0x1f)); | 951 | desc->wHubCharacteristics = cpu_to_le16((u16) ((reg >> 8) & |
952 | (HUB_CHAR_LPSM | | ||
953 | HUB_CHAR_COMPOUND | | ||
954 | HUB_CHAR_OCPM))); | ||
952 | desc->bPwrOn2PwrGood = (u8) ((reg >> 24) & 0xff); | 955 | desc->bPwrOn2PwrGood = (u8) ((reg >> 24) & 0xff); |
953 | /* ports removable, and legacy PortPwrCtrlMask */ | 956 | /* ports removable, and legacy PortPwrCtrlMask */ |
954 | desc->u.hs.DeviceRemovable[0] = 0; | 957 | desc->u.hs.DeviceRemovable[0] = 0; |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 75e5876f9d7c..b32ab60cad1e 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -1543,8 +1543,12 @@ static void isp1362_hub_descriptor(struct isp1362_hcd *isp1362_hcd, | |||
1543 | desc->bHubContrCurrent = 0; | 1543 | desc->bHubContrCurrent = 0; |
1544 | desc->bNbrPorts = reg & 0x3; | 1544 | desc->bNbrPorts = reg & 0x3; |
1545 | /* Power switching, device type, overcurrent. */ | 1545 | /* Power switching, device type, overcurrent. */ |
1546 | desc->wHubCharacteristics = cpu_to_le16((reg >> 8) & 0x1f); | 1546 | desc->wHubCharacteristics = cpu_to_le16((reg >> 8) & |
1547 | DBG(0, "%s: hubcharacteristics = %02x\n", __func__, cpu_to_le16((reg >> 8) & 0x1f)); | 1547 | (HUB_CHAR_LPSM | |
1548 | HUB_CHAR_COMPOUND | | ||
1549 | HUB_CHAR_OCPM)); | ||
1550 | DBG(0, "%s: hubcharacteristics = %02x\n", __func__, | ||
1551 | desc->wHubCharacteristics); | ||
1548 | desc->bPwrOn2PwrGood = (reg >> 24) & 0xff; | 1552 | desc->bPwrOn2PwrGood = (reg >> 24) & 0xff; |
1549 | /* ports removable, and legacy PortPwrCtrlMask */ | 1553 | /* ports removable, and legacy PortPwrCtrlMask */ |
1550 | desc->u.hs.DeviceRemovable[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; | 1554 | desc->u.hs.DeviceRemovable[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; |
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c index 6234c75da33f..a98833cbfcf3 100644 --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c | |||
@@ -55,6 +55,7 @@ | |||
55 | * single thread (max3421_spi_thread). | 55 | * single thread (max3421_spi_thread). |
56 | */ | 56 | */ |
57 | 57 | ||
58 | #include <linux/jiffies.h> | ||
58 | #include <linux/module.h> | 59 | #include <linux/module.h> |
59 | #include <linux/spi/spi.h> | 60 | #include <linux/spi/spi.h> |
60 | #include <linux/usb.h> | 61 | #include <linux/usb.h> |
@@ -1291,7 +1292,7 @@ max3421_handle_irqs(struct usb_hcd *hcd) | |||
1291 | char sbuf[16 * 16], *dp, *end; | 1292 | char sbuf[16 * 16], *dp, *end; |
1292 | int i; | 1293 | int i; |
1293 | 1294 | ||
1294 | if (jiffies - last_time > 5*HZ) { | 1295 | if (time_after(jiffies, last_time + 5*HZ)) { |
1295 | dp = sbuf; | 1296 | dp = sbuf; |
1296 | end = sbuf + sizeof(sbuf); | 1297 | end = sbuf + sizeof(sbuf); |
1297 | *dp = '\0'; | 1298 | *dp = '\0'; |
@@ -1660,7 +1661,8 @@ hub_descriptor(struct usb_hub_descriptor *desc) | |||
1660 | */ | 1661 | */ |
1661 | desc->bDescriptorType = 0x29; /* hub descriptor */ | 1662 | desc->bDescriptorType = 0x29; /* hub descriptor */ |
1662 | desc->bDescLength = 9; | 1663 | desc->bDescLength = 9; |
1663 | desc->wHubCharacteristics = cpu_to_le16(0x0001); | 1664 | desc->wHubCharacteristics = cpu_to_le16(HUB_CHAR_INDV_PORT_LPSM | |
1665 | HUB_CHAR_COMMON_OCPM); | ||
1664 | desc->bNbrPorts = 1; | 1666 | desc->bNbrPorts = 1; |
1665 | } | 1667 | } |
1666 | 1668 | ||
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index dc9e4e61f1c8..7cce85a1f7dc 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -33,7 +33,17 @@ | |||
33 | for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++) | 33 | for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++) |
34 | 34 | ||
35 | /* interface, function and usb clocks; sometimes also an AHB clock */ | 35 | /* interface, function and usb clocks; sometimes also an AHB clock */ |
36 | static struct clk *iclk, *fclk, *uclk, *hclk; | 36 | #define hcd_to_ohci_at91_priv(h) \ |
37 | ((struct ohci_at91_priv *)hcd_to_ohci(h)->priv) | ||
38 | |||
39 | struct ohci_at91_priv { | ||
40 | struct clk *iclk; | ||
41 | struct clk *fclk; | ||
42 | struct clk *uclk; | ||
43 | struct clk *hclk; | ||
44 | bool clocked; | ||
45 | bool wakeup; /* Saved wake-up state for resume */ | ||
46 | }; | ||
37 | /* interface and function clocks; sometimes also an AHB clock */ | 47 | /* interface and function clocks; sometimes also an AHB clock */ |
38 | 48 | ||
39 | #define DRIVER_DESC "OHCI Atmel driver" | 49 | #define DRIVER_DESC "OHCI Atmel driver" |
@@ -41,45 +51,53 @@ static struct clk *iclk, *fclk, *uclk, *hclk; | |||
41 | static const char hcd_name[] = "ohci-atmel"; | 51 | static const char hcd_name[] = "ohci-atmel"; |
42 | 52 | ||
43 | static struct hc_driver __read_mostly ohci_at91_hc_driver; | 53 | static struct hc_driver __read_mostly ohci_at91_hc_driver; |
44 | static int clocked; | 54 | |
55 | static const struct ohci_driver_overrides ohci_at91_drv_overrides __initconst = { | ||
56 | .extra_priv_size = sizeof(struct ohci_at91_priv), | ||
57 | }; | ||
45 | 58 | ||
46 | extern int usb_disabled(void); | 59 | extern int usb_disabled(void); |
47 | 60 | ||
48 | /*-------------------------------------------------------------------------*/ | 61 | /*-------------------------------------------------------------------------*/ |
49 | 62 | ||
50 | static void at91_start_clock(void) | 63 | static void at91_start_clock(struct ohci_at91_priv *ohci_at91) |
51 | { | 64 | { |
65 | if (ohci_at91->clocked) | ||
66 | return; | ||
52 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | 67 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { |
53 | clk_set_rate(uclk, 48000000); | 68 | clk_set_rate(ohci_at91->uclk, 48000000); |
54 | clk_prepare_enable(uclk); | 69 | clk_prepare_enable(ohci_at91->uclk); |
55 | } | 70 | } |
56 | clk_prepare_enable(hclk); | 71 | clk_prepare_enable(ohci_at91->hclk); |
57 | clk_prepare_enable(iclk); | 72 | clk_prepare_enable(ohci_at91->iclk); |
58 | clk_prepare_enable(fclk); | 73 | clk_prepare_enable(ohci_at91->fclk); |
59 | clocked = 1; | 74 | ohci_at91->clocked = true; |
60 | } | 75 | } |
61 | 76 | ||
62 | static void at91_stop_clock(void) | 77 | static void at91_stop_clock(struct ohci_at91_priv *ohci_at91) |
63 | { | 78 | { |
64 | clk_disable_unprepare(fclk); | 79 | if (!ohci_at91->clocked) |
65 | clk_disable_unprepare(iclk); | 80 | return; |
66 | clk_disable_unprepare(hclk); | 81 | clk_disable_unprepare(ohci_at91->fclk); |
82 | clk_disable_unprepare(ohci_at91->iclk); | ||
83 | clk_disable_unprepare(ohci_at91->hclk); | ||
67 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | 84 | if (IS_ENABLED(CONFIG_COMMON_CLK)) |
68 | clk_disable_unprepare(uclk); | 85 | clk_disable_unprepare(ohci_at91->uclk); |
69 | clocked = 0; | 86 | ohci_at91->clocked = false; |
70 | } | 87 | } |
71 | 88 | ||
72 | static void at91_start_hc(struct platform_device *pdev) | 89 | static void at91_start_hc(struct platform_device *pdev) |
73 | { | 90 | { |
74 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 91 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
75 | struct ohci_regs __iomem *regs = hcd->regs; | 92 | struct ohci_regs __iomem *regs = hcd->regs; |
93 | struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); | ||
76 | 94 | ||
77 | dev_dbg(&pdev->dev, "start\n"); | 95 | dev_dbg(&pdev->dev, "start\n"); |
78 | 96 | ||
79 | /* | 97 | /* |
80 | * Start the USB clocks. | 98 | * Start the USB clocks. |
81 | */ | 99 | */ |
82 | at91_start_clock(); | 100 | at91_start_clock(ohci_at91); |
83 | 101 | ||
84 | /* | 102 | /* |
85 | * The USB host controller must remain in reset. | 103 | * The USB host controller must remain in reset. |
@@ -91,6 +109,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
91 | { | 109 | { |
92 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 110 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
93 | struct ohci_regs __iomem *regs = hcd->regs; | 111 | struct ohci_regs __iomem *regs = hcd->regs; |
112 | struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); | ||
94 | 113 | ||
95 | dev_dbg(&pdev->dev, "stop\n"); | 114 | dev_dbg(&pdev->dev, "stop\n"); |
96 | 115 | ||
@@ -102,7 +121,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
102 | /* | 121 | /* |
103 | * Stop the USB clocks. | 122 | * Stop the USB clocks. |
104 | */ | 123 | */ |
105 | at91_stop_clock(); | 124 | at91_stop_clock(ohci_at91); |
106 | } | 125 | } |
107 | 126 | ||
108 | 127 | ||
@@ -128,7 +147,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
128 | struct at91_usbh_data *board; | 147 | struct at91_usbh_data *board; |
129 | struct ohci_hcd *ohci; | 148 | struct ohci_hcd *ohci; |
130 | int retval; | 149 | int retval; |
131 | struct usb_hcd *hcd = NULL; | 150 | struct usb_hcd *hcd; |
151 | struct ohci_at91_priv *ohci_at91; | ||
132 | struct device *dev = &pdev->dev; | 152 | struct device *dev = &pdev->dev; |
133 | struct resource *res; | 153 | struct resource *res; |
134 | int irq; | 154 | int irq; |
@@ -142,6 +162,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
142 | hcd = usb_create_hcd(driver, dev, "at91"); | 162 | hcd = usb_create_hcd(driver, dev, "at91"); |
143 | if (!hcd) | 163 | if (!hcd) |
144 | return -ENOMEM; | 164 | return -ENOMEM; |
165 | ohci_at91 = hcd_to_ohci_at91_priv(hcd); | ||
145 | 166 | ||
146 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 167 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
147 | hcd->regs = devm_ioremap_resource(dev, res); | 168 | hcd->regs = devm_ioremap_resource(dev, res); |
@@ -152,29 +173,29 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
152 | hcd->rsrc_start = res->start; | 173 | hcd->rsrc_start = res->start; |
153 | hcd->rsrc_len = resource_size(res); | 174 | hcd->rsrc_len = resource_size(res); |
154 | 175 | ||
155 | iclk = devm_clk_get(dev, "ohci_clk"); | 176 | ohci_at91->iclk = devm_clk_get(dev, "ohci_clk"); |
156 | if (IS_ERR(iclk)) { | 177 | if (IS_ERR(ohci_at91->iclk)) { |
157 | dev_err(dev, "failed to get ohci_clk\n"); | 178 | dev_err(dev, "failed to get ohci_clk\n"); |
158 | retval = PTR_ERR(iclk); | 179 | retval = PTR_ERR(ohci_at91->iclk); |
159 | goto err; | 180 | goto err; |
160 | } | 181 | } |
161 | fclk = devm_clk_get(dev, "uhpck"); | 182 | ohci_at91->fclk = devm_clk_get(dev, "uhpck"); |
162 | if (IS_ERR(fclk)) { | 183 | if (IS_ERR(ohci_at91->fclk)) { |
163 | dev_err(dev, "failed to get uhpck\n"); | 184 | dev_err(dev, "failed to get uhpck\n"); |
164 | retval = PTR_ERR(fclk); | 185 | retval = PTR_ERR(ohci_at91->fclk); |
165 | goto err; | 186 | goto err; |
166 | } | 187 | } |
167 | hclk = devm_clk_get(dev, "hclk"); | 188 | ohci_at91->hclk = devm_clk_get(dev, "hclk"); |
168 | if (IS_ERR(hclk)) { | 189 | if (IS_ERR(ohci_at91->hclk)) { |
169 | dev_err(dev, "failed to get hclk\n"); | 190 | dev_err(dev, "failed to get hclk\n"); |
170 | retval = PTR_ERR(hclk); | 191 | retval = PTR_ERR(ohci_at91->hclk); |
171 | goto err; | 192 | goto err; |
172 | } | 193 | } |
173 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | 194 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { |
174 | uclk = devm_clk_get(dev, "usb_clk"); | 195 | ohci_at91->uclk = devm_clk_get(dev, "usb_clk"); |
175 | if (IS_ERR(uclk)) { | 196 | if (IS_ERR(ohci_at91->uclk)) { |
176 | dev_err(dev, "failed to get uclk\n"); | 197 | dev_err(dev, "failed to get uclk\n"); |
177 | retval = PTR_ERR(uclk); | 198 | retval = PTR_ERR(ohci_at91->uclk); |
178 | goto err; | 199 | goto err; |
179 | } | 200 | } |
180 | } | 201 | } |
@@ -347,11 +368,13 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
347 | */ | 368 | */ |
348 | 369 | ||
349 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); | 370 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); |
350 | desc->wHubCharacteristics |= cpu_to_le16(0x0001); | 371 | desc->wHubCharacteristics |= |
372 | cpu_to_le16(HUB_CHAR_INDV_PORT_LPSM); | ||
351 | 373 | ||
352 | if (pdata->overcurrent_supported) { | 374 | if (pdata->overcurrent_supported) { |
353 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM); | 375 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM); |
354 | desc->wHubCharacteristics |= cpu_to_le16(0x0008|0x0001); | 376 | desc->wHubCharacteristics |= |
377 | cpu_to_le16(HUB_CHAR_INDV_PORT_OCPM); | ||
355 | } | 378 | } |
356 | 379 | ||
357 | dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", | 380 | dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", |
@@ -593,19 +616,27 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | |||
593 | #ifdef CONFIG_PM | 616 | #ifdef CONFIG_PM |
594 | 617 | ||
595 | static int | 618 | static int |
596 | ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) | 619 | ohci_hcd_at91_drv_suspend(struct device *dev) |
597 | { | 620 | { |
598 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 621 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
599 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 622 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
600 | bool do_wakeup = device_may_wakeup(&pdev->dev); | 623 | struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); |
601 | int ret; | 624 | int ret; |
602 | 625 | ||
603 | if (do_wakeup) | 626 | /* |
627 | * Disable wakeup if we are going to sleep with slow clock mode | ||
628 | * enabled. | ||
629 | */ | ||
630 | ohci_at91->wakeup = device_may_wakeup(dev) | ||
631 | && !at91_suspend_entering_slow_clock(); | ||
632 | |||
633 | if (ohci_at91->wakeup) | ||
604 | enable_irq_wake(hcd->irq); | 634 | enable_irq_wake(hcd->irq); |
605 | 635 | ||
606 | ret = ohci_suspend(hcd, do_wakeup); | 636 | ret = ohci_suspend(hcd, ohci_at91->wakeup); |
607 | if (ret) { | 637 | if (ret) { |
608 | disable_irq_wake(hcd->irq); | 638 | if (ohci_at91->wakeup) |
639 | disable_irq_wake(hcd->irq); | ||
609 | return ret; | 640 | return ret; |
610 | } | 641 | } |
611 | /* | 642 | /* |
@@ -615,7 +646,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
615 | * | 646 | * |
616 | * REVISIT: some boards will be able to turn VBUS off... | 647 | * REVISIT: some boards will be able to turn VBUS off... |
617 | */ | 648 | */ |
618 | if (at91_suspend_entering_slow_clock()) { | 649 | if (!ohci_at91->wakeup) { |
619 | ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); | 650 | ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); |
620 | ohci->hc_control &= OHCI_CTRL_RWC; | 651 | ohci->hc_control &= OHCI_CTRL_RWC; |
621 | ohci_writel(ohci, ohci->hc_control, &ohci->regs->control); | 652 | ohci_writel(ohci, ohci->hc_control, &ohci->regs->control); |
@@ -623,38 +654,37 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
623 | 654 | ||
624 | /* flush the writes */ | 655 | /* flush the writes */ |
625 | (void) ohci_readl (ohci, &ohci->regs->control); | 656 | (void) ohci_readl (ohci, &ohci->regs->control); |
626 | at91_stop_clock(); | 657 | at91_stop_clock(ohci_at91); |
627 | } | 658 | } |
628 | 659 | ||
629 | return ret; | 660 | return ret; |
630 | } | 661 | } |
631 | 662 | ||
632 | static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) | 663 | static int ohci_hcd_at91_drv_resume(struct device *dev) |
633 | { | 664 | { |
634 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 665 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
666 | struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); | ||
635 | 667 | ||
636 | if (device_may_wakeup(&pdev->dev)) | 668 | if (ohci_at91->wakeup) |
637 | disable_irq_wake(hcd->irq); | 669 | disable_irq_wake(hcd->irq); |
638 | 670 | ||
639 | if (!clocked) | 671 | at91_start_clock(ohci_at91); |
640 | at91_start_clock(); | ||
641 | 672 | ||
642 | ohci_resume(hcd, false); | 673 | ohci_resume(hcd, false); |
643 | return 0; | 674 | return 0; |
644 | } | 675 | } |
645 | #else | ||
646 | #define ohci_hcd_at91_drv_suspend NULL | ||
647 | #define ohci_hcd_at91_drv_resume NULL | ||
648 | #endif | 676 | #endif |
649 | 677 | ||
678 | static SIMPLE_DEV_PM_OPS(ohci_hcd_at91_pm_ops, ohci_hcd_at91_drv_suspend, | ||
679 | ohci_hcd_at91_drv_resume); | ||
680 | |||
650 | static struct platform_driver ohci_hcd_at91_driver = { | 681 | static struct platform_driver ohci_hcd_at91_driver = { |
651 | .probe = ohci_hcd_at91_drv_probe, | 682 | .probe = ohci_hcd_at91_drv_probe, |
652 | .remove = ohci_hcd_at91_drv_remove, | 683 | .remove = ohci_hcd_at91_drv_remove, |
653 | .shutdown = usb_hcd_platform_shutdown, | 684 | .shutdown = usb_hcd_platform_shutdown, |
654 | .suspend = ohci_hcd_at91_drv_suspend, | ||
655 | .resume = ohci_hcd_at91_drv_resume, | ||
656 | .driver = { | 685 | .driver = { |
657 | .name = "at91_ohci", | 686 | .name = "at91_ohci", |
687 | .pm = &ohci_hcd_at91_pm_ops, | ||
658 | .of_match_table = of_match_ptr(at91_ohci_dt_ids), | 688 | .of_match_table = of_match_ptr(at91_ohci_dt_ids), |
659 | }, | 689 | }, |
660 | }; | 690 | }; |
@@ -665,7 +695,7 @@ static int __init ohci_at91_init(void) | |||
665 | return -ENODEV; | 695 | return -ENODEV; |
666 | 696 | ||
667 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); | 697 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); |
668 | ohci_init_driver(&ohci_at91_hc_driver, NULL); | 698 | ohci_init_driver(&ohci_at91_hc_driver, &ohci_at91_drv_overrides); |
669 | 699 | ||
670 | /* | 700 | /* |
671 | * The Atmel HW has some unusual quirks, which require Atmel-specific | 701 | * The Atmel HW has some unusual quirks, which require Atmel-specific |
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 1c76999b2184..e5c33bc98ea4 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c | |||
@@ -431,7 +431,6 @@ static struct platform_driver ohci_hcd_da8xx_driver = { | |||
431 | .resume = ohci_da8xx_resume, | 431 | .resume = ohci_da8xx_resume, |
432 | #endif | 432 | #endif |
433 | .driver = { | 433 | .driver = { |
434 | .owner = THIS_MODULE, | ||
435 | .name = "ohci", | 434 | .name = "ohci", |
436 | }, | 435 | }, |
437 | }; | 436 | }; |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 0aa17c937115..fe2aedd8a54d 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -544,15 +544,15 @@ ohci_hub_descriptor ( | |||
544 | temp = 1 + (ohci->num_ports / 8); | 544 | temp = 1 + (ohci->num_ports / 8); |
545 | desc->bDescLength = 7 + 2 * temp; | 545 | desc->bDescLength = 7 + 2 * temp; |
546 | 546 | ||
547 | temp = 0; | 547 | temp = HUB_CHAR_COMMON_LPSM | HUB_CHAR_COMMON_OCPM; |
548 | if (rh & RH_A_NPS) /* no power switching? */ | 548 | if (rh & RH_A_NPS) /* no power switching? */ |
549 | temp |= 0x0002; | 549 | temp |= HUB_CHAR_NO_LPSM; |
550 | if (rh & RH_A_PSM) /* per-port power switching? */ | 550 | if (rh & RH_A_PSM) /* per-port power switching? */ |
551 | temp |= 0x0001; | 551 | temp |= HUB_CHAR_INDV_PORT_LPSM; |
552 | if (rh & RH_A_NOCP) /* no overcurrent reporting? */ | 552 | if (rh & RH_A_NOCP) /* no overcurrent reporting? */ |
553 | temp |= 0x0010; | 553 | temp |= HUB_CHAR_NO_OCPM; |
554 | else if (rh & RH_A_OCPM) /* per-port overcurrent reporting? */ | 554 | else if (rh & RH_A_OCPM) /* per-port overcurrent reporting? */ |
555 | temp |= 0x0008; | 555 | temp |= HUB_CHAR_INDV_PORT_OCPM; |
556 | desc->wHubCharacteristics = cpu_to_le16(temp); | 556 | desc->wHubCharacteristics = cpu_to_le16(temp); |
557 | 557 | ||
558 | /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */ | 558 | /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */ |
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index 8ddd8f5470cb..4db78f169256 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c | |||
@@ -239,7 +239,6 @@ static struct platform_driver ohci_hcd_jz4740_driver = { | |||
239 | .remove = jz4740_ohci_remove, | 239 | .remove = jz4740_ohci_remove, |
240 | .driver = { | 240 | .driver = { |
241 | .name = "jz4740-ohci", | 241 | .name = "jz4740-ohci", |
242 | .owner = THIS_MODULE, | ||
243 | }, | 242 | }, |
244 | }; | 243 | }; |
245 | 244 | ||
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index b81d202b15a2..185ceee52d47 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c | |||
@@ -38,7 +38,8 @@ | |||
38 | struct ohci_platform_priv { | 38 | struct ohci_platform_priv { |
39 | struct clk *clks[OHCI_MAX_CLKS]; | 39 | struct clk *clks[OHCI_MAX_CLKS]; |
40 | struct reset_control *rst; | 40 | struct reset_control *rst; |
41 | struct phy *phy; | 41 | struct phy **phys; |
42 | int num_phys; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | static const char hcd_name[] = "ohci-platform"; | 45 | static const char hcd_name[] = "ohci-platform"; |
@@ -47,7 +48,7 @@ static int ohci_platform_power_on(struct platform_device *dev) | |||
47 | { | 48 | { |
48 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 49 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
49 | struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); | 50 | struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); |
50 | int clk, ret; | 51 | int clk, ret, phy_num; |
51 | 52 | ||
52 | for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) { | 53 | for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) { |
53 | ret = clk_prepare_enable(priv->clks[clk]); | 54 | ret = clk_prepare_enable(priv->clks[clk]); |
@@ -55,20 +56,28 @@ static int ohci_platform_power_on(struct platform_device *dev) | |||
55 | goto err_disable_clks; | 56 | goto err_disable_clks; |
56 | } | 57 | } |
57 | 58 | ||
58 | if (priv->phy) { | 59 | for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { |
59 | ret = phy_init(priv->phy); | 60 | if (priv->phys[phy_num]) { |
60 | if (ret) | 61 | ret = phy_init(priv->phys[phy_num]); |
61 | goto err_disable_clks; | 62 | if (ret) |
62 | 63 | goto err_exit_phy; | |
63 | ret = phy_power_on(priv->phy); | 64 | ret = phy_power_on(priv->phys[phy_num]); |
64 | if (ret) | 65 | if (ret) { |
65 | goto err_exit_phy; | 66 | phy_exit(priv->phys[phy_num]); |
67 | goto err_exit_phy; | ||
68 | } | ||
69 | } | ||
66 | } | 70 | } |
67 | 71 | ||
68 | return 0; | 72 | return 0; |
69 | 73 | ||
70 | err_exit_phy: | 74 | err_exit_phy: |
71 | phy_exit(priv->phy); | 75 | while (--phy_num >= 0) { |
76 | if (priv->phys[phy_num]) { | ||
77 | phy_power_off(priv->phys[phy_num]); | ||
78 | phy_exit(priv->phys[phy_num]); | ||
79 | } | ||
80 | } | ||
72 | err_disable_clks: | 81 | err_disable_clks: |
73 | while (--clk >= 0) | 82 | while (--clk >= 0) |
74 | clk_disable_unprepare(priv->clks[clk]); | 83 | clk_disable_unprepare(priv->clks[clk]); |
@@ -80,11 +89,13 @@ static void ohci_platform_power_off(struct platform_device *dev) | |||
80 | { | 89 | { |
81 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 90 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
82 | struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); | 91 | struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); |
83 | int clk; | 92 | int clk, phy_num; |
84 | 93 | ||
85 | if (priv->phy) { | 94 | for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { |
86 | phy_power_off(priv->phy); | 95 | if (priv->phys[phy_num]) { |
87 | phy_exit(priv->phy); | 96 | phy_power_off(priv->phys[phy_num]); |
97 | phy_exit(priv->phys[phy_num]); | ||
98 | } | ||
88 | } | 99 | } |
89 | 100 | ||
90 | for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) | 101 | for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) |
@@ -112,7 +123,8 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
112 | struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); | 123 | struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); |
113 | struct ohci_platform_priv *priv; | 124 | struct ohci_platform_priv *priv; |
114 | struct ohci_hcd *ohci; | 125 | struct ohci_hcd *ohci; |
115 | int err, irq, clk = 0; | 126 | const char *phy_name; |
127 | int err, irq, phy_num, clk = 0; | ||
116 | 128 | ||
117 | if (usb_disabled()) | 129 | if (usb_disabled()) |
118 | return -ENODEV; | 130 | return -ENODEV; |
@@ -160,12 +172,38 @@ static int ohci_platform_probe(struct platform_device *dev) | |||
160 | of_property_read_u32(dev->dev.of_node, "num-ports", | 172 | of_property_read_u32(dev->dev.of_node, "num-ports", |
161 | &ohci->num_ports); | 173 | &ohci->num_ports); |
162 | 174 | ||
163 | priv->phy = devm_phy_get(&dev->dev, "usb"); | 175 | priv->num_phys = of_count_phandle_with_args(dev->dev.of_node, |
164 | if (IS_ERR(priv->phy)) { | 176 | "phys", "#phy-cells"); |
165 | err = PTR_ERR(priv->phy); | 177 | priv->num_phys = priv->num_phys > 0 ? priv->num_phys : 1; |
166 | if (err == -EPROBE_DEFER) | 178 | |
167 | goto err_put_hcd; | 179 | priv->phys = devm_kcalloc(&dev->dev, priv->num_phys, |
168 | priv->phy = NULL; | 180 | sizeof(struct phy *), GFP_KERNEL); |
181 | if (!priv->phys) | ||
182 | return -ENOMEM; | ||
183 | |||
184 | for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { | ||
185 | err = of_property_read_string_index( | ||
186 | dev->dev.of_node, | ||
187 | "phy-names", phy_num, | ||
188 | &phy_name); | ||
189 | |||
190 | if (err < 0) { | ||
191 | if (priv->num_phys > 1) { | ||
192 | dev_err(&dev->dev, "phy-names not provided"); | ||
193 | goto err_put_hcd; | ||
194 | } else | ||
195 | phy_name = "usb"; | ||
196 | } | ||
197 | |||
198 | priv->phys[phy_num] = devm_phy_get(&dev->dev, | ||
199 | phy_name); | ||
200 | if (IS_ERR(priv->phys[phy_num])) { | ||
201 | err = PTR_ERR(priv->phys[phy_num]); | ||
202 | if ((priv->num_phys > 1) || | ||
203 | (err == -EPROBE_DEFER)) | ||
204 | goto err_put_hcd; | ||
205 | priv->phys[phy_num] = NULL; | ||
206 | } | ||
169 | } | 207 | } |
170 | 208 | ||
171 | for (clk = 0; clk < OHCI_MAX_CLKS; clk++) { | 209 | for (clk = 0; clk < OHCI_MAX_CLKS; clk++) { |
@@ -328,6 +366,7 @@ static int ohci_platform_resume(struct device *dev) | |||
328 | 366 | ||
329 | static const struct of_device_id ohci_platform_ids[] = { | 367 | static const struct of_device_id ohci_platform_ids[] = { |
330 | { .compatible = "generic-ohci", }, | 368 | { .compatible = "generic-ohci", }, |
369 | { .compatible = "cavium,octeon-6335-ohci", }, | ||
331 | { } | 370 | { } |
332 | }; | 371 | }; |
333 | MODULE_DEVICE_TABLE(of, ohci_platform_ids); | 372 | MODULE_DEVICE_TABLE(of, ohci_platform_ids); |
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 965e3e9e688a..4f87a5c61b08 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
@@ -229,7 +229,6 @@ static struct platform_driver ohci_hcd_ppc_of_driver = { | |||
229 | .shutdown = usb_hcd_platform_shutdown, | 229 | .shutdown = usb_hcd_platform_shutdown, |
230 | .driver = { | 230 | .driver = { |
231 | .name = "ppc-of-ohci", | 231 | .name = "ppc-of-ohci", |
232 | .owner = THIS_MODULE, | ||
233 | .of_match_table = ohci_hcd_ppc_of_match, | 232 | .of_match_table = ohci_hcd_ppc_of_match, |
234 | }, | 233 | }, |
235 | }; | 234 | }; |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 095113ea1fcb..7a1919ca543a 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -249,14 +249,14 @@ static int ohci_s3c2410_hub_control( | |||
249 | */ | 249 | */ |
250 | 250 | ||
251 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); | 251 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); |
252 | desc->wHubCharacteristics |= cpu_to_le16(0x0001); | 252 | desc->wHubCharacteristics |= cpu_to_le16( |
253 | HUB_CHAR_INDV_PORT_LPSM); | ||
253 | 254 | ||
254 | if (info->enable_oc) { | 255 | if (info->enable_oc) { |
255 | desc->wHubCharacteristics &= ~cpu_to_le16( | 256 | desc->wHubCharacteristics &= ~cpu_to_le16( |
256 | HUB_CHAR_OCPM); | 257 | HUB_CHAR_OCPM); |
257 | desc->wHubCharacteristics |= cpu_to_le16( | 258 | desc->wHubCharacteristics |= cpu_to_le16( |
258 | 0x0008 | | 259 | HUB_CHAR_INDV_PORT_OCPM); |
259 | 0x0001); | ||
260 | } | 260 | } |
261 | 261 | ||
262 | dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", | 262 | dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", |
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 4e81c804c73e..a8b8d8b8d9f3 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
@@ -265,7 +265,6 @@ static struct platform_driver ohci_hcd_sm501_driver = { | |||
265 | .suspend = ohci_sm501_suspend, | 265 | .suspend = ohci_sm501_suspend, |
266 | .resume = ohci_sm501_resume, | 266 | .resume = ohci_sm501_resume, |
267 | .driver = { | 267 | .driver = { |
268 | .owner = THIS_MODULE, | ||
269 | .name = "sm501-usb", | 268 | .name = "sm501-usb", |
270 | }, | 269 | }, |
271 | }; | 270 | }; |
diff --git a/drivers/usb/host/ohci-tilegx.c b/drivers/usb/host/ohci-tilegx.c index bef6dfb0405a..e1b208da460a 100644 --- a/drivers/usb/host/ohci-tilegx.c +++ b/drivers/usb/host/ohci-tilegx.c | |||
@@ -199,7 +199,6 @@ static struct platform_driver ohci_hcd_tilegx_driver = { | |||
199 | .shutdown = ohci_hcd_tilegx_drv_shutdown, | 199 | .shutdown = ohci_hcd_tilegx_drv_shutdown, |
200 | .driver = { | 200 | .driver = { |
201 | .name = "tilegx-ohci", | 201 | .name = "tilegx-ohci", |
202 | .owner = THIS_MODULE, | ||
203 | } | 202 | } |
204 | }; | 203 | }; |
205 | 204 | ||
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index bb409588d39c..e9a6eec39142 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c | |||
@@ -368,6 +368,5 @@ static struct platform_driver ohci_hcd_tmio_driver = { | |||
368 | .resume = ohci_hcd_tmio_drv_resume, | 368 | .resume = ohci_hcd_tmio_drv_resume, |
369 | .driver = { | 369 | .driver = { |
370 | .name = "tmio-ohci", | 370 | .name = "tmio-ohci", |
371 | .owner = THIS_MODULE, | ||
372 | }, | 371 | }, |
373 | }; | 372 | }; |
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index 036924e640f5..ef7efb278b15 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c | |||
@@ -457,11 +457,11 @@ static void ehci_hub_descriptor(struct oxu_hcd *oxu, | |||
457 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); | 457 | memset(&desc->u.hs.DeviceRemovable[0], 0, temp); |
458 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); | 458 | memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); |
459 | 459 | ||
460 | temp = 0x0008; /* per-port overcurrent reporting */ | 460 | temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ |
461 | if (HCS_PPC(oxu->hcs_params)) | 461 | if (HCS_PPC(oxu->hcs_params)) |
462 | temp |= 0x0001; /* per-port power control */ | 462 | temp |= HUB_CHAR_INDV_PORT_LPSM; /* per-port power control */ |
463 | else | 463 | else |
464 | temp |= 0x0002; /* no power switching */ | 464 | temp |= HUB_CHAR_NO_LPSM; /* no power switching */ |
465 | desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp); | 465 | desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp); |
466 | } | 466 | } |
467 | 467 | ||
@@ -2598,9 +2598,7 @@ static int oxu_hcd_init(struct usb_hcd *hcd) | |||
2598 | 2598 | ||
2599 | spin_lock_init(&oxu->lock); | 2599 | spin_lock_init(&oxu->lock); |
2600 | 2600 | ||
2601 | init_timer(&oxu->watchdog); | 2601 | setup_timer(&oxu->watchdog, oxu_watchdog, (unsigned long)oxu); |
2602 | oxu->watchdog.function = oxu_watchdog; | ||
2603 | oxu->watchdog.data = (unsigned long) oxu; | ||
2604 | 2602 | ||
2605 | /* | 2603 | /* |
2606 | * hw default: 1K periodic list heads, one per frame. | 2604 | * hw default: 1K periodic list heads, one per frame. |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index ce636466edb7..f9400564cb72 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -603,9 +603,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
603 | msleep(10); | 603 | msleep(10); |
604 | } | 604 | } |
605 | if (wait_time <= 0) | 605 | if (wait_time <= 0) |
606 | dev_warn(&pdev->dev, "OHCI: BIOS handoff failed" | 606 | dev_warn(&pdev->dev, |
607 | " (BIOS bug?) %08x\n", | 607 | "OHCI: BIOS handoff failed (BIOS bug?) %08x\n", |
608 | readl(base + OHCI_CONTROL)); | 608 | readl(base + OHCI_CONTROL)); |
609 | } | 609 | } |
610 | #endif | 610 | #endif |
611 | 611 | ||
@@ -733,8 +733,9 @@ static void ehci_bios_handoff(struct pci_dev *pdev, | |||
733 | * and hope nothing goes too wrong | 733 | * and hope nothing goes too wrong |
734 | */ | 734 | */ |
735 | if (try_handoff) | 735 | if (try_handoff) |
736 | dev_warn(&pdev->dev, "EHCI: BIOS handoff failed" | 736 | dev_warn(&pdev->dev, |
737 | " (BIOS bug?) %08x\n", cap); | 737 | "EHCI: BIOS handoff failed (BIOS bug?) %08x\n", |
738 | cap); | ||
738 | pci_write_config_byte(pdev, offset + 2, 0); | 739 | pci_write_config_byte(pdev, offset + 2, 0); |
739 | } | 740 | } |
740 | 741 | ||
@@ -781,8 +782,9 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev) | |||
781 | case 0: /* Illegal reserved cap, set cap=0 so we exit */ | 782 | case 0: /* Illegal reserved cap, set cap=0 so we exit */ |
782 | cap = 0; /* then fallthrough... */ | 783 | cap = 0; /* then fallthrough... */ |
783 | default: | 784 | default: |
784 | dev_warn(&pdev->dev, "EHCI: unrecognized capability " | 785 | dev_warn(&pdev->dev, |
785 | "%02x\n", cap & 0xff); | 786 | "EHCI: unrecognized capability %02x\n", |
787 | cap & 0xff); | ||
786 | } | 788 | } |
787 | offset = (cap >> 8) & 0xff; | 789 | offset = (cap >> 8) & 0xff; |
788 | } | 790 | } |
@@ -893,8 +895,7 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) | |||
893 | */ | 895 | */ |
894 | if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) { | 896 | if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) { |
895 | dev_warn(&xhci_pdev->dev, | 897 | dev_warn(&xhci_pdev->dev, |
896 | "CONFIG_USB_XHCI_HCD is turned off, " | 898 | "CONFIG_USB_XHCI_HCD is turned off, defaulting to EHCI.\n"); |
897 | "defaulting to EHCI.\n"); | ||
898 | dev_warn(&xhci_pdev->dev, | 899 | dev_warn(&xhci_pdev->dev, |
899 | "USB 3.0 devices will work at USB 2.0 speeds.\n"); | 900 | "USB 3.0 devices will work at USB 2.0 speeds.\n"); |
900 | usb_disable_xhci_ports(xhci_pdev); | 901 | usb_disable_xhci_ports(xhci_pdev); |
@@ -919,8 +920,9 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) | |||
919 | 920 | ||
920 | pci_read_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, | 921 | pci_read_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, |
921 | &ports_available); | 922 | &ports_available); |
922 | dev_dbg(&xhci_pdev->dev, "USB 3.0 ports that are now enabled " | 923 | dev_dbg(&xhci_pdev->dev, |
923 | "under xHCI: 0x%x\n", ports_available); | 924 | "USB 3.0 ports that are now enabled under xHCI: 0x%x\n", |
925 | ports_available); | ||
924 | 926 | ||
925 | /* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register | 927 | /* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register |
926 | * Indicate the USB 2.0 ports to be controlled by the xHCI host. | 928 | * Indicate the USB 2.0 ports to be controlled by the xHCI host. |
@@ -941,8 +943,9 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) | |||
941 | 943 | ||
942 | pci_read_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, | 944 | pci_read_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, |
943 | &ports_available); | 945 | &ports_available); |
944 | dev_dbg(&xhci_pdev->dev, "USB 2.0 ports that are now switched over " | 946 | dev_dbg(&xhci_pdev->dev, |
945 | "to xHCI: 0x%x\n", ports_available); | 947 | "USB 2.0 ports that are now switched over to xHCI: 0x%x\n", |
948 | ports_available); | ||
946 | } | 949 | } |
947 | EXPORT_SYMBOL_GPL(usb_enable_intel_xhci_ports); | 950 | EXPORT_SYMBOL_GPL(usb_enable_intel_xhci_ports); |
948 | 951 | ||
@@ -1010,8 +1013,9 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) | |||
1010 | 1013 | ||
1011 | /* Assume a buggy BIOS and take HC ownership anyway */ | 1014 | /* Assume a buggy BIOS and take HC ownership anyway */ |
1012 | if (timeout) { | 1015 | if (timeout) { |
1013 | dev_warn(&pdev->dev, "xHCI BIOS handoff failed" | 1016 | dev_warn(&pdev->dev, |
1014 | " (BIOS bug ?) %08x\n", val); | 1017 | "xHCI BIOS handoff failed (BIOS bug ?) %08x\n", |
1018 | val); | ||
1015 | writel(val & ~XHCI_HC_BIOS_OWNED, base + ext_cap_offset); | 1019 | writel(val & ~XHCI_HC_BIOS_OWNED, base + ext_cap_offset); |
1016 | } | 1020 | } |
1017 | } | 1021 | } |
@@ -1039,8 +1043,8 @@ hc_init: | |||
1039 | if (timeout) { | 1043 | if (timeout) { |
1040 | val = readl(op_reg_base + XHCI_STS_OFFSET); | 1044 | val = readl(op_reg_base + XHCI_STS_OFFSET); |
1041 | dev_warn(&pdev->dev, | 1045 | dev_warn(&pdev->dev, |
1042 | "xHCI HW not ready after 5 sec (HC bug?) " | 1046 | "xHCI HW not ready after 5 sec (HC bug?) status = 0x%x\n", |
1043 | "status = 0x%x\n", val); | 1047 | val); |
1044 | } | 1048 | } |
1045 | 1049 | ||
1046 | /* Send the halt and disable interrupts command */ | 1050 | /* Send the halt and disable interrupts command */ |
@@ -1054,8 +1058,8 @@ hc_init: | |||
1054 | if (timeout) { | 1058 | if (timeout) { |
1055 | val = readl(op_reg_base + XHCI_STS_OFFSET); | 1059 | val = readl(op_reg_base + XHCI_STS_OFFSET); |
1056 | dev_warn(&pdev->dev, | 1060 | dev_warn(&pdev->dev, |
1057 | "xHCI HW did not halt within %d usec " | 1061 | "xHCI HW did not halt within %d usec status = 0x%x\n", |
1058 | "status = 0x%x\n", XHCI_MAX_HALT_USEC, val); | 1062 | XHCI_MAX_HALT_USEC, val); |
1059 | } | 1063 | } |
1060 | 1064 | ||
1061 | iounmap(base); | 1065 | iounmap(base); |
@@ -1075,8 +1079,8 @@ static void quirk_usb_early_handoff(struct pci_dev *pdev) | |||
1075 | return; | 1079 | return; |
1076 | 1080 | ||
1077 | if (pci_enable_device(pdev) < 0) { | 1081 | if (pci_enable_device(pdev) < 0) { |
1078 | dev_warn(&pdev->dev, "Can't enable PCI device, " | 1082 | dev_warn(&pdev->dev, |
1079 | "BIOS handoff failed.\n"); | 1083 | "Can't enable PCI device, BIOS handoff failed.\n"); |
1080 | return; | 1084 | return; |
1081 | } | 1085 | } |
1082 | if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI) | 1086 | if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI) |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index c4bcfaedeec9..bdc82fea0a1f 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -2141,7 +2141,8 @@ static void r8a66597_hub_descriptor(struct r8a66597 *r8a66597, | |||
2141 | desc->bNbrPorts = r8a66597->max_root_hub; | 2141 | desc->bNbrPorts = r8a66597->max_root_hub; |
2142 | desc->bDescLength = 9; | 2142 | desc->bDescLength = 9; |
2143 | desc->bPwrOn2PwrGood = 0; | 2143 | desc->bPwrOn2PwrGood = 0; |
2144 | desc->wHubCharacteristics = cpu_to_le16(0x0011); | 2144 | desc->wHubCharacteristics = |
2145 | cpu_to_le16(HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_NO_OCPM); | ||
2145 | desc->u.hs.DeviceRemovable[0] = | 2146 | desc->u.hs.DeviceRemovable[0] = |
2146 | ((1 << r8a66597->max_root_hub) - 1) << 1; | 2147 | ((1 << r8a66597->max_root_hub) - 1) << 1; |
2147 | desc->u.hs.DeviceRemovable[1] = ~0; | 2148 | desc->u.hs.DeviceRemovable[1] = ~0; |
@@ -2483,9 +2484,8 @@ static int r8a66597_probe(struct platform_device *pdev) | |||
2483 | r8a66597->max_root_hub = 2; | 2484 | r8a66597->max_root_hub = 2; |
2484 | 2485 | ||
2485 | spin_lock_init(&r8a66597->lock); | 2486 | spin_lock_init(&r8a66597->lock); |
2486 | init_timer(&r8a66597->rh_timer); | 2487 | setup_timer(&r8a66597->rh_timer, r8a66597_timer, |
2487 | r8a66597->rh_timer.function = r8a66597_timer; | 2488 | (unsigned long)r8a66597); |
2488 | r8a66597->rh_timer.data = (unsigned long)r8a66597; | ||
2489 | r8a66597->reg = reg; | 2489 | r8a66597->reg = reg; |
2490 | 2490 | ||
2491 | /* make sure no interrupts are pending */ | 2491 | /* make sure no interrupts are pending */ |
@@ -2496,9 +2496,8 @@ static int r8a66597_probe(struct platform_device *pdev) | |||
2496 | 2496 | ||
2497 | for (i = 0; i < R8A66597_MAX_NUM_PIPE; i++) { | 2497 | for (i = 0; i < R8A66597_MAX_NUM_PIPE; i++) { |
2498 | INIT_LIST_HEAD(&r8a66597->pipe_queue[i]); | 2498 | INIT_LIST_HEAD(&r8a66597->pipe_queue[i]); |
2499 | init_timer(&r8a66597->td_timer[i]); | 2499 | setup_timer(&r8a66597->td_timer[i], r8a66597_td_timer, |
2500 | r8a66597->td_timer[i].function = r8a66597_td_timer; | 2500 | (unsigned long)r8a66597); |
2501 | r8a66597->td_timer[i].data = (unsigned long)r8a66597; | ||
2502 | setup_timer(&r8a66597->interval_timer[i], | 2501 | setup_timer(&r8a66597->interval_timer[i], |
2503 | r8a66597_interval_timer, | 2502 | r8a66597_interval_timer, |
2504 | (unsigned long)r8a66597); | 2503 | (unsigned long)r8a66597); |
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 25fb1da8d3d7..4f4ba1ea9e9b 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -1103,12 +1103,12 @@ sl811h_hub_descriptor ( | |||
1103 | desc->bPwrOn2PwrGood = sl811->board->potpg; | 1103 | desc->bPwrOn2PwrGood = sl811->board->potpg; |
1104 | if (!desc->bPwrOn2PwrGood) | 1104 | if (!desc->bPwrOn2PwrGood) |
1105 | desc->bPwrOn2PwrGood = 10; | 1105 | desc->bPwrOn2PwrGood = 10; |
1106 | temp = 0x0001; | 1106 | temp = HUB_CHAR_INDV_PORT_LPSM; |
1107 | } else | 1107 | } else |
1108 | temp = 0x0002; | 1108 | temp = HUB_CHAR_NO_LPSM; |
1109 | 1109 | ||
1110 | /* no overcurrent errors detection/handling */ | 1110 | /* no overcurrent errors detection/handling */ |
1111 | temp |= 0x0010; | 1111 | temp |= HUB_CHAR_NO_OCPM; |
1112 | 1112 | ||
1113 | desc->wHubCharacteristics = cpu_to_le16(temp); | 1113 | desc->wHubCharacteristics = cpu_to_le16(temp); |
1114 | 1114 | ||
@@ -1691,9 +1691,7 @@ sl811h_probe(struct platform_device *dev) | |||
1691 | spin_lock_init(&sl811->lock); | 1691 | spin_lock_init(&sl811->lock); |
1692 | INIT_LIST_HEAD(&sl811->async); | 1692 | INIT_LIST_HEAD(&sl811->async); |
1693 | sl811->board = dev_get_platdata(&dev->dev); | 1693 | sl811->board = dev_get_platdata(&dev->dev); |
1694 | init_timer(&sl811->timer); | 1694 | setup_timer(&sl811->timer, sl811h_timer, (unsigned long)sl811); |
1695 | sl811->timer.function = sl811h_timer; | ||
1696 | sl811->timer.data = (unsigned long) sl811; | ||
1697 | sl811->addr_reg = addr_reg; | 1695 | sl811->addr_reg = addr_reg; |
1698 | sl811->data_reg = data_reg; | 1696 | sl811->data_reg = data_reg; |
1699 | 1697 | ||
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 2894e54e5b9c..ad97e8a1ad1c 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -2590,15 +2590,15 @@ static int u132_roothub_descriptor(struct u132 *u132, | |||
2590 | desc->bNbrPorts = u132->num_ports; | 2590 | desc->bNbrPorts = u132->num_ports; |
2591 | temp = 1 + (u132->num_ports / 8); | 2591 | temp = 1 + (u132->num_ports / 8); |
2592 | desc->bDescLength = 7 + 2 * temp; | 2592 | desc->bDescLength = 7 + 2 * temp; |
2593 | temp = 0; | 2593 | temp = HUB_CHAR_COMMON_LPSM | HUB_CHAR_COMMON_OCPM; |
2594 | if (rh_a & RH_A_NPS) | 2594 | if (rh_a & RH_A_NPS) |
2595 | temp |= 0x0002; | 2595 | temp |= HUB_CHAR_NO_LPSM; |
2596 | if (rh_a & RH_A_PSM) | 2596 | if (rh_a & RH_A_PSM) |
2597 | temp |= 0x0001; | 2597 | temp |= HUB_CHAR_INDV_PORT_LPSM; |
2598 | if (rh_a & RH_A_NOCP) | 2598 | if (rh_a & RH_A_NOCP) |
2599 | temp |= 0x0010; | 2599 | temp |= HUB_CHAR_NO_OCPM; |
2600 | else if (rh_a & RH_A_OCPM) | 2600 | else if (rh_a & RH_A_OCPM) |
2601 | temp |= 0x0008; | 2601 | temp |= HUB_CHAR_INDV_PORT_OCPM; |
2602 | desc->wHubCharacteristics = cpu_to_le16(temp); | 2602 | desc->wHubCharacteristics = cpu_to_le16(temp); |
2603 | retval = u132_read_pcimem(u132, roothub.b, &rh_b); | 2603 | retval = u132_read_pcimem(u132, roothub.b, &rh_b); |
2604 | if (retval) | 2604 | if (retval) |
diff --git a/drivers/usb/host/uhci-grlib.c b/drivers/usb/host/uhci-grlib.c index 05f57ffdf9ab..0342991c9507 100644 --- a/drivers/usb/host/uhci-grlib.c +++ b/drivers/usb/host/uhci-grlib.c | |||
@@ -188,7 +188,6 @@ static struct platform_driver uhci_grlib_driver = { | |||
188 | .shutdown = uhci_hcd_grlib_shutdown, | 188 | .shutdown = uhci_hcd_grlib_shutdown, |
189 | .driver = { | 189 | .driver = { |
190 | .name = "grlib-uhci", | 190 | .name = "grlib-uhci", |
191 | .owner = THIS_MODULE, | ||
192 | .of_match_table = uhci_hcd_grlib_of_match, | 191 | .of_match_table = uhci_hcd_grlib_of_match, |
193 | }, | 192 | }, |
194 | }; | 193 | }; |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 93e17b12fb33..19ba5eafb31e 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -17,8 +17,9 @@ static const __u8 root_hub_hub_des[] = | |||
17 | 0x09, /* __u8 bLength; */ | 17 | 0x09, /* __u8 bLength; */ |
18 | 0x29, /* __u8 bDescriptorType; Hub-descriptor */ | 18 | 0x29, /* __u8 bDescriptorType; Hub-descriptor */ |
19 | 0x02, /* __u8 bNbrPorts; */ | 19 | 0x02, /* __u8 bNbrPorts; */ |
20 | 0x0a, /* __u16 wHubCharacteristics; */ | 20 | HUB_CHAR_NO_LPSM | /* __u16 wHubCharacteristics; */ |
21 | 0x00, /* (per-port OC, no power switching) */ | 21 | HUB_CHAR_INDV_PORT_OCPM, /* (per-port OC, no power switching) */ |
22 | 0x00, | ||
22 | 0x01, /* __u8 bPwrOn2pwrGood; 2ms */ | 23 | 0x01, /* __u8 bPwrOn2pwrGood; 2ms */ |
23 | 0x00, /* __u8 bHubContrCurrent; 0 mA */ | 24 | 0x00, /* __u8 bHubContrCurrent; 0 mA */ |
24 | 0x00, /* __u8 DeviceRemovable; *** 7 Ports max */ | 25 | 0x00, /* __u8 DeviceRemovable; *** 7 Ports max */ |
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index cf8f46003f62..3a3e3eeba291 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c | |||
@@ -147,7 +147,6 @@ static struct platform_driver uhci_platform_driver = { | |||
147 | .shutdown = uhci_hcd_platform_shutdown, | 147 | .shutdown = uhci_hcd_platform_shutdown, |
148 | .driver = { | 148 | .driver = { |
149 | .name = "platform-uhci", | 149 | .name = "platform-uhci", |
150 | .owner = THIS_MODULE, | ||
151 | .of_match_table = platform_uhci_ids, | 150 | .of_match_table = platform_uhci_ids, |
152 | }, | 151 | }, |
153 | }; | 152 | }; |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index bb89175ca6e5..745717ec9c89 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -552,7 +552,7 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
552 | 552 | ||
553 | if (ctx->type == XHCI_CTX_TYPE_INPUT) { | 553 | if (ctx->type == XHCI_CTX_TYPE_INPUT) { |
554 | struct xhci_input_control_ctx *ctrl_ctx = | 554 | struct xhci_input_control_ctx *ctrl_ctx = |
555 | xhci_get_input_control_ctx(xhci, ctx); | 555 | xhci_get_input_control_ctx(ctx); |
556 | if (!ctrl_ctx) { | 556 | if (!ctrl_ctx) { |
557 | xhci_warn(xhci, "Could not get input context, bad type.\n"); | 557 | xhci_warn(xhci, "Could not get input context, bad type.\n"); |
558 | return; | 558 | return; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 5cb3d7a10017..f8336408ef07 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -535,7 +535,7 @@ static void xhci_free_container_ctx(struct xhci_hcd *xhci, | |||
535 | kfree(ctx); | 535 | kfree(ctx); |
536 | } | 536 | } |
537 | 537 | ||
538 | struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, | 538 | struct xhci_input_control_ctx *xhci_get_input_control_ctx( |
539 | struct xhci_container_ctx *ctx) | 539 | struct xhci_container_ctx *ctx) |
540 | { | 540 | { |
541 | if (ctx->type != XHCI_CTX_TYPE_INPUT) | 541 | if (ctx->type != XHCI_CTX_TYPE_INPUT) |
@@ -784,8 +784,7 @@ void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci, | |||
784 | * Reinstalls the "normal" endpoint ring (at its previous dequeue mark, | 784 | * Reinstalls the "normal" endpoint ring (at its previous dequeue mark, |
785 | * not at the beginning of the ring). | 785 | * not at the beginning of the ring). |
786 | */ | 786 | */ |
787 | void xhci_setup_no_streams_ep_input_ctx(struct xhci_hcd *xhci, | 787 | void xhci_setup_no_streams_ep_input_ctx(struct xhci_ep_ctx *ep_ctx, |
788 | struct xhci_ep_ctx *ep_ctx, | ||
789 | struct xhci_virt_ep *ep) | 788 | struct xhci_virt_ep *ep) |
790 | { | 789 | { |
791 | dma_addr_t addr; | 790 | dma_addr_t addr; |
@@ -833,9 +832,8 @@ void xhci_free_stream_info(struct xhci_hcd *xhci, | |||
833 | static void xhci_init_endpoint_timer(struct xhci_hcd *xhci, | 832 | static void xhci_init_endpoint_timer(struct xhci_hcd *xhci, |
834 | struct xhci_virt_ep *ep) | 833 | struct xhci_virt_ep *ep) |
835 | { | 834 | { |
836 | init_timer(&ep->stop_cmd_timer); | 835 | setup_timer(&ep->stop_cmd_timer, xhci_stop_endpoint_command_watchdog, |
837 | ep->stop_cmd_timer.data = (unsigned long) ep; | 836 | (unsigned long)ep); |
838 | ep->stop_cmd_timer.function = xhci_stop_endpoint_command_watchdog; | ||
839 | ep->xhci = xhci; | 837 | ep->xhci = xhci; |
840 | } | 838 | } |
841 | 839 | ||
@@ -1342,8 +1340,7 @@ static u32 xhci_get_endpoint_mult(struct usb_device *udev, | |||
1342 | return ep->ss_ep_comp.bmAttributes; | 1340 | return ep->ss_ep_comp.bmAttributes; |
1343 | } | 1341 | } |
1344 | 1342 | ||
1345 | static u32 xhci_get_endpoint_type(struct usb_device *udev, | 1343 | static u32 xhci_get_endpoint_type(struct usb_host_endpoint *ep) |
1346 | struct usb_host_endpoint *ep) | ||
1347 | { | 1344 | { |
1348 | int in; | 1345 | int in; |
1349 | u32 type; | 1346 | u32 type; |
@@ -1376,8 +1373,7 @@ static u32 xhci_get_endpoint_type(struct usb_device *udev, | |||
1376 | * Basically, this is the maxpacket size, multiplied by the burst size | 1373 | * Basically, this is the maxpacket size, multiplied by the burst size |
1377 | * and mult size. | 1374 | * and mult size. |
1378 | */ | 1375 | */ |
1379 | static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | 1376 | static u32 xhci_get_max_esit_payload(struct usb_device *udev, |
1380 | struct usb_device *udev, | ||
1381 | struct usb_host_endpoint *ep) | 1377 | struct usb_host_endpoint *ep) |
1382 | { | 1378 | { |
1383 | int max_burst; | 1379 | int max_burst; |
@@ -1418,7 +1414,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1418 | ep_index = xhci_get_endpoint_index(&ep->desc); | 1414 | ep_index = xhci_get_endpoint_index(&ep->desc); |
1419 | ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); | 1415 | ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); |
1420 | 1416 | ||
1421 | endpoint_type = xhci_get_endpoint_type(udev, ep); | 1417 | endpoint_type = xhci_get_endpoint_type(ep); |
1422 | if (!endpoint_type) | 1418 | if (!endpoint_type) |
1423 | return -EINVAL; | 1419 | return -EINVAL; |
1424 | ep_ctx->ep_info2 = cpu_to_le32(endpoint_type); | 1420 | ep_ctx->ep_info2 = cpu_to_le32(endpoint_type); |
@@ -1484,7 +1480,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1484 | } | 1480 | } |
1485 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) | | 1481 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) | |
1486 | MAX_BURST(max_burst)); | 1482 | MAX_BURST(max_burst)); |
1487 | max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep); | 1483 | max_esit_payload = xhci_get_max_esit_payload(udev, ep); |
1488 | ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload)); | 1484 | ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload)); |
1489 | 1485 | ||
1490 | /* | 1486 | /* |
@@ -1773,7 +1769,7 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, | |||
1773 | return command; | 1769 | return command; |
1774 | } | 1770 | } |
1775 | 1771 | ||
1776 | void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv) | 1772 | void xhci_urb_free_priv(struct urb_priv *urb_priv) |
1777 | { | 1773 | { |
1778 | if (urb_priv) { | 1774 | if (urb_priv) { |
1779 | kfree(urb_priv->td[0]); | 1775 | kfree(urb_priv->td[0]); |
@@ -1926,7 +1922,7 @@ static int xhci_test_trb_in_td(struct xhci_hcd *xhci, | |||
1926 | } | 1922 | } |
1927 | 1923 | ||
1928 | /* TRB math checks for xhci_trb_in_td(), using the command and event rings. */ | 1924 | /* TRB math checks for xhci_trb_in_td(), using the command and event rings. */ |
1929 | static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci, gfp_t mem_flags) | 1925 | static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci) |
1930 | { | 1926 | { |
1931 | struct { | 1927 | struct { |
1932 | dma_addr_t input_dma; | 1928 | dma_addr_t input_dma; |
@@ -2452,7 +2448,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2452 | flags); | 2448 | flags); |
2453 | if (!xhci->event_ring) | 2449 | if (!xhci->event_ring) |
2454 | goto fail; | 2450 | goto fail; |
2455 | if (xhci_check_trb_in_td_math(xhci, flags) < 0) | 2451 | if (xhci_check_trb_in_td_math(xhci) < 0) |
2456 | goto fail; | 2452 | goto fail; |
2457 | 2453 | ||
2458 | xhci->erst.entries = dma_alloc_coherent(dev, | 2454 | xhci->erst.entries = dma_alloc_coherent(dev, |
@@ -2509,9 +2505,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2509 | xhci_print_ir_set(xhci, 0); | 2505 | xhci_print_ir_set(xhci, 0); |
2510 | 2506 | ||
2511 | /* init command timeout timer */ | 2507 | /* init command timeout timer */ |
2512 | init_timer(&xhci->cmd_timer); | 2508 | setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout, |
2513 | xhci->cmd_timer.data = (unsigned long) xhci; | 2509 | (unsigned long)xhci); |
2514 | xhci->cmd_timer.function = xhci_handle_command_timeout; | ||
2515 | 2510 | ||
2516 | /* | 2511 | /* |
2517 | * XXX: Might need to set the Interrupter Moderation Register to | 2512 | * XXX: Might need to set the Interrupter Moderation Register to |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index e692e769c50c..88da8d629820 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -299,7 +299,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | |||
299 | * seconds), then it should assume that the there are | 299 | * seconds), then it should assume that the there are |
300 | * larger problems with the xHC and assert HCRST. | 300 | * larger problems with the xHC and assert HCRST. |
301 | */ | 301 | */ |
302 | ret = xhci_handshake(xhci, &xhci->op_regs->cmd_ring, | 302 | ret = xhci_handshake(&xhci->op_regs->cmd_ring, |
303 | CMD_RING_RUNNING, 0, 5 * 1000 * 1000); | 303 | CMD_RING_RUNNING, 0, 5 * 1000 * 1000); |
304 | if (ret < 0) { | 304 | if (ret < 0) { |
305 | xhci_err(xhci, "Stopped the command ring failed, " | 305 | xhci_err(xhci, "Stopped the command ring failed, " |
@@ -609,7 +609,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, | |||
609 | 609 | ||
610 | spin_unlock(&xhci->lock); | 610 | spin_unlock(&xhci->lock); |
611 | usb_hcd_giveback_urb(hcd, urb, status); | 611 | usb_hcd_giveback_urb(hcd, urb, status); |
612 | xhci_urb_free_priv(xhci, urb_priv); | 612 | xhci_urb_free_priv(urb_priv); |
613 | spin_lock(&xhci->lock); | 613 | spin_lock(&xhci->lock); |
614 | } | 614 | } |
615 | } | 615 | } |
@@ -1110,7 +1110,7 @@ static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, | |||
1110 | * is not waiting on the configure endpoint command. | 1110 | * is not waiting on the configure endpoint command. |
1111 | */ | 1111 | */ |
1112 | virt_dev = xhci->devs[slot_id]; | 1112 | virt_dev = xhci->devs[slot_id]; |
1113 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | 1113 | ctrl_ctx = xhci_get_input_control_ctx(virt_dev->in_ctx); |
1114 | if (!ctrl_ctx) { | 1114 | if (!ctrl_ctx) { |
1115 | xhci_warn(xhci, "Could not get input context, bad type.\n"); | 1115 | xhci_warn(xhci, "Could not get input context, bad type.\n"); |
1116 | return; | 1116 | return; |
@@ -2354,8 +2354,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2354 | status = 0; | 2354 | status = 0; |
2355 | break; | 2355 | break; |
2356 | } | 2356 | } |
2357 | xhci_warn(xhci, "ERROR Unknown event condition, HC probably " | 2357 | xhci_warn(xhci, "ERROR Unknown event condition %u, HC probably busted\n", |
2358 | "busted\n"); | 2358 | trb_comp_code); |
2359 | goto cleanup; | 2359 | goto cleanup; |
2360 | } | 2360 | } |
2361 | 2361 | ||
@@ -2497,7 +2497,7 @@ cleanup: | |||
2497 | urb = td->urb; | 2497 | urb = td->urb; |
2498 | urb_priv = urb->hcpriv; | 2498 | urb_priv = urb->hcpriv; |
2499 | 2499 | ||
2500 | xhci_urb_free_priv(xhci, urb_priv); | 2500 | xhci_urb_free_priv(urb_priv); |
2501 | 2501 | ||
2502 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | 2502 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); |
2503 | if ((urb->actual_length != urb->transfer_buffer_length && | 2503 | if ((urb->actual_length != urb->transfer_buffer_length && |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index c50d8d202618..ec8ac1674854 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -60,8 +60,7 @@ MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); | |||
60 | * handshake done). There are two failure modes: "usec" have passed (major | 60 | * handshake done). There are two failure modes: "usec" have passed (major |
61 | * hardware flakeout), or the register reads as all-ones (hardware removed). | 61 | * hardware flakeout), or the register reads as all-ones (hardware removed). |
62 | */ | 62 | */ |
63 | int xhci_handshake(struct xhci_hcd *xhci, void __iomem *ptr, | 63 | int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) |
64 | u32 mask, u32 done, int usec) | ||
65 | { | 64 | { |
66 | u32 result; | 65 | u32 result; |
67 | 66 | ||
@@ -111,7 +110,7 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
111 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC"); | 110 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC"); |
112 | xhci_quiesce(xhci); | 111 | xhci_quiesce(xhci); |
113 | 112 | ||
114 | ret = xhci_handshake(xhci, &xhci->op_regs->status, | 113 | ret = xhci_handshake(&xhci->op_regs->status, |
115 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); | 114 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); |
116 | if (!ret) { | 115 | if (!ret) { |
117 | xhci->xhc_state |= XHCI_STATE_HALTED; | 116 | xhci->xhc_state |= XHCI_STATE_HALTED; |
@@ -140,7 +139,7 @@ static int xhci_start(struct xhci_hcd *xhci) | |||
140 | * Wait for the HCHalted Status bit to be 0 to indicate the host is | 139 | * Wait for the HCHalted Status bit to be 0 to indicate the host is |
141 | * running. | 140 | * running. |
142 | */ | 141 | */ |
143 | ret = xhci_handshake(xhci, &xhci->op_regs->status, | 142 | ret = xhci_handshake(&xhci->op_regs->status, |
144 | STS_HALT, 0, XHCI_MAX_HALT_USEC); | 143 | STS_HALT, 0, XHCI_MAX_HALT_USEC); |
145 | if (ret == -ETIMEDOUT) | 144 | if (ret == -ETIMEDOUT) |
146 | xhci_err(xhci, "Host took too long to start, " | 145 | xhci_err(xhci, "Host took too long to start, " |
@@ -175,7 +174,7 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
175 | command |= CMD_RESET; | 174 | command |= CMD_RESET; |
176 | writel(command, &xhci->op_regs->command); | 175 | writel(command, &xhci->op_regs->command); |
177 | 176 | ||
178 | ret = xhci_handshake(xhci, &xhci->op_regs->command, | 177 | ret = xhci_handshake(&xhci->op_regs->command, |
179 | CMD_RESET, 0, 10 * 1000 * 1000); | 178 | CMD_RESET, 0, 10 * 1000 * 1000); |
180 | if (ret) | 179 | if (ret) |
181 | return ret; | 180 | return ret; |
@@ -186,7 +185,7 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
186 | * xHCI cannot write to any doorbells or operational registers other | 185 | * xHCI cannot write to any doorbells or operational registers other |
187 | * than status until the "Controller Not Ready" flag is cleared. | 186 | * than status until the "Controller Not Ready" flag is cleared. |
188 | */ | 187 | */ |
189 | ret = xhci_handshake(xhci, &xhci->op_regs->status, | 188 | ret = xhci_handshake(&xhci->op_regs->status, |
190 | STS_CNR, 0, 10 * 1000 * 1000); | 189 | STS_CNR, 0, 10 * 1000 * 1000); |
191 | 190 | ||
192 | for (i = 0; i < 2; ++i) { | 191 | for (i = 0; i < 2; ++i) { |
@@ -473,10 +472,8 @@ static void compliance_mode_recovery(unsigned long arg) | |||
473 | static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci) | 472 | static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci) |
474 | { | 473 | { |
475 | xhci->port_status_u0 = 0; | 474 | xhci->port_status_u0 = 0; |
476 | init_timer(&xhci->comp_mode_recovery_timer); | 475 | setup_timer(&xhci->comp_mode_recovery_timer, |
477 | 476 | compliance_mode_recovery, (unsigned long)xhci); | |
478 | xhci->comp_mode_recovery_timer.data = (unsigned long) xhci; | ||
479 | xhci->comp_mode_recovery_timer.function = compliance_mode_recovery; | ||
480 | xhci->comp_mode_recovery_timer.expires = jiffies + | 477 | xhci->comp_mode_recovery_timer.expires = jiffies + |
481 | msecs_to_jiffies(COMP_MODE_RCVRY_MSECS); | 478 | msecs_to_jiffies(COMP_MODE_RCVRY_MSECS); |
482 | 479 | ||
@@ -929,7 +926,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) | |||
929 | /* Some chips from Fresco Logic need an extraordinary delay */ | 926 | /* Some chips from Fresco Logic need an extraordinary delay */ |
930 | delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1; | 927 | delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1; |
931 | 928 | ||
932 | if (xhci_handshake(xhci, &xhci->op_regs->status, | 929 | if (xhci_handshake(&xhci->op_regs->status, |
933 | STS_HALT, STS_HALT, delay)) { | 930 | STS_HALT, STS_HALT, delay)) { |
934 | xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n"); | 931 | xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n"); |
935 | spin_unlock_irq(&xhci->lock); | 932 | spin_unlock_irq(&xhci->lock); |
@@ -944,7 +941,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) | |||
944 | command = readl(&xhci->op_regs->command); | 941 | command = readl(&xhci->op_regs->command); |
945 | command |= CMD_CSS; | 942 | command |= CMD_CSS; |
946 | writel(command, &xhci->op_regs->command); | 943 | writel(command, &xhci->op_regs->command); |
947 | if (xhci_handshake(xhci, &xhci->op_regs->status, | 944 | if (xhci_handshake(&xhci->op_regs->status, |
948 | STS_SAVE, 0, 10 * 1000)) { | 945 | STS_SAVE, 0, 10 * 1000)) { |
949 | xhci_warn(xhci, "WARN: xHC save state timeout\n"); | 946 | xhci_warn(xhci, "WARN: xHC save state timeout\n"); |
950 | spin_unlock_irq(&xhci->lock); | 947 | spin_unlock_irq(&xhci->lock); |
@@ -1011,7 +1008,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1011 | command = readl(&xhci->op_regs->command); | 1008 | command = readl(&xhci->op_regs->command); |
1012 | command |= CMD_CRS; | 1009 | command |= CMD_CRS; |
1013 | writel(command, &xhci->op_regs->command); | 1010 | writel(command, &xhci->op_regs->command); |
1014 | if (xhci_handshake(xhci, &xhci->op_regs->status, | 1011 | if (xhci_handshake(&xhci->op_regs->status, |
1015 | STS_RESTORE, 0, 10 * 1000)) { | 1012 | STS_RESTORE, 0, 10 * 1000)) { |
1016 | xhci_warn(xhci, "WARN: xHC restore state timeout\n"); | 1013 | xhci_warn(xhci, "WARN: xHC restore state timeout\n"); |
1017 | spin_unlock_irq(&xhci->lock); | 1014 | spin_unlock_irq(&xhci->lock); |
@@ -1082,7 +1079,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1082 | command = readl(&xhci->op_regs->command); | 1079 | command = readl(&xhci->op_regs->command); |
1083 | command |= CMD_RUN; | 1080 | command |= CMD_RUN; |
1084 | writel(command, &xhci->op_regs->command); | 1081 | writel(command, &xhci->op_regs->command); |
1085 | xhci_handshake(xhci, &xhci->op_regs->status, STS_HALT, | 1082 | xhci_handshake(&xhci->op_regs->status, STS_HALT, |
1086 | 0, 250 * 1000); | 1083 | 0, 250 * 1000); |
1087 | 1084 | ||
1088 | /* step 5: walk topology and initialize portsc, | 1085 | /* step 5: walk topology and initialize portsc, |
@@ -1276,7 +1273,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, | |||
1276 | return -ENOMEM; | 1273 | return -ENOMEM; |
1277 | 1274 | ||
1278 | command->in_ctx = xhci->devs[slot_id]->in_ctx; | 1275 | command->in_ctx = xhci->devs[slot_id]->in_ctx; |
1279 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 1276 | ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); |
1280 | if (!ctrl_ctx) { | 1277 | if (!ctrl_ctx) { |
1281 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 1278 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
1282 | __func__); | 1279 | __func__); |
@@ -1374,7 +1371,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
1374 | ret = xhci_check_maxpacket(xhci, slot_id, | 1371 | ret = xhci_check_maxpacket(xhci, slot_id, |
1375 | ep_index, urb); | 1372 | ep_index, urb); |
1376 | if (ret < 0) { | 1373 | if (ret < 0) { |
1377 | xhci_urb_free_priv(xhci, urb_priv); | 1374 | xhci_urb_free_priv(urb_priv); |
1378 | urb->hcpriv = NULL; | 1375 | urb->hcpriv = NULL; |
1379 | return ret; | 1376 | return ret; |
1380 | } | 1377 | } |
@@ -1440,7 +1437,7 @@ dying: | |||
1440 | urb->ep->desc.bEndpointAddress, urb); | 1437 | urb->ep->desc.bEndpointAddress, urb); |
1441 | ret = -ESHUTDOWN; | 1438 | ret = -ESHUTDOWN; |
1442 | free_priv: | 1439 | free_priv: |
1443 | xhci_urb_free_priv(xhci, urb_priv); | 1440 | xhci_urb_free_priv(urb_priv); |
1444 | urb->hcpriv = NULL; | 1441 | urb->hcpriv = NULL; |
1445 | spin_unlock_irqrestore(&xhci->lock, flags); | 1442 | spin_unlock_irqrestore(&xhci->lock, flags); |
1446 | return ret; | 1443 | return ret; |
@@ -1553,7 +1550,7 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1553 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 1550 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
1554 | spin_unlock_irqrestore(&xhci->lock, flags); | 1551 | spin_unlock_irqrestore(&xhci->lock, flags); |
1555 | usb_hcd_giveback_urb(hcd, urb, -ESHUTDOWN); | 1552 | usb_hcd_giveback_urb(hcd, urb, -ESHUTDOWN); |
1556 | xhci_urb_free_priv(xhci, urb_priv); | 1553 | xhci_urb_free_priv(urb_priv); |
1557 | return ret; | 1554 | return ret; |
1558 | } | 1555 | } |
1559 | if ((xhci->xhc_state & XHCI_STATE_DYING) || | 1556 | if ((xhci->xhc_state & XHCI_STATE_DYING) || |
@@ -1660,7 +1657,7 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1660 | 1657 | ||
1661 | in_ctx = xhci->devs[udev->slot_id]->in_ctx; | 1658 | in_ctx = xhci->devs[udev->slot_id]->in_ctx; |
1662 | out_ctx = xhci->devs[udev->slot_id]->out_ctx; | 1659 | out_ctx = xhci->devs[udev->slot_id]->out_ctx; |
1663 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 1660 | ctrl_ctx = xhci_get_input_control_ctx(in_ctx); |
1664 | if (!ctrl_ctx) { | 1661 | if (!ctrl_ctx) { |
1665 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 1662 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
1666 | __func__); | 1663 | __func__); |
@@ -1676,8 +1673,10 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1676 | cpu_to_le32(EP_STATE_DISABLED)) || | 1673 | cpu_to_le32(EP_STATE_DISABLED)) || |
1677 | le32_to_cpu(ctrl_ctx->drop_flags) & | 1674 | le32_to_cpu(ctrl_ctx->drop_flags) & |
1678 | xhci_get_endpoint_flag(&ep->desc)) { | 1675 | xhci_get_endpoint_flag(&ep->desc)) { |
1679 | xhci_warn(xhci, "xHCI %s called with disabled ep %p\n", | 1676 | /* Do not warn when called after a usb_device_reset */ |
1680 | __func__, ep); | 1677 | if (xhci->devs[udev->slot_id]->eps[ep_index].ring != NULL) |
1678 | xhci_warn(xhci, "xHCI %s called with disabled ep %p\n", | ||
1679 | __func__, ep); | ||
1681 | return 0; | 1680 | return 0; |
1682 | } | 1681 | } |
1683 | 1682 | ||
@@ -1714,7 +1713,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1714 | struct usb_host_endpoint *ep) | 1713 | struct usb_host_endpoint *ep) |
1715 | { | 1714 | { |
1716 | struct xhci_hcd *xhci; | 1715 | struct xhci_hcd *xhci; |
1717 | struct xhci_container_ctx *in_ctx, *out_ctx; | 1716 | struct xhci_container_ctx *in_ctx; |
1718 | unsigned int ep_index; | 1717 | unsigned int ep_index; |
1719 | struct xhci_input_control_ctx *ctrl_ctx; | 1718 | struct xhci_input_control_ctx *ctrl_ctx; |
1720 | u32 added_ctxs; | 1719 | u32 added_ctxs; |
@@ -1745,8 +1744,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1745 | 1744 | ||
1746 | virt_dev = xhci->devs[udev->slot_id]; | 1745 | virt_dev = xhci->devs[udev->slot_id]; |
1747 | in_ctx = virt_dev->in_ctx; | 1746 | in_ctx = virt_dev->in_ctx; |
1748 | out_ctx = virt_dev->out_ctx; | 1747 | ctrl_ctx = xhci_get_input_control_ctx(in_ctx); |
1749 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | ||
1750 | if (!ctrl_ctx) { | 1748 | if (!ctrl_ctx) { |
1751 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 1749 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
1752 | __func__); | 1750 | __func__); |
@@ -1758,8 +1756,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1758 | * to add it again without dropping it, reject the addition. | 1756 | * to add it again without dropping it, reject the addition. |
1759 | */ | 1757 | */ |
1760 | if (virt_dev->eps[ep_index].ring && | 1758 | if (virt_dev->eps[ep_index].ring && |
1761 | !(le32_to_cpu(ctrl_ctx->drop_flags) & | 1759 | !(le32_to_cpu(ctrl_ctx->drop_flags) & added_ctxs)) { |
1762 | xhci_get_endpoint_flag(&ep->desc))) { | ||
1763 | xhci_warn(xhci, "Trying to add endpoint 0x%x " | 1760 | xhci_warn(xhci, "Trying to add endpoint 0x%x " |
1764 | "without dropping it.\n", | 1761 | "without dropping it.\n", |
1765 | (unsigned int) ep->desc.bEndpointAddress); | 1762 | (unsigned int) ep->desc.bEndpointAddress); |
@@ -1769,8 +1766,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1769 | /* If the HCD has already noted the endpoint is enabled, | 1766 | /* If the HCD has already noted the endpoint is enabled, |
1770 | * ignore this request. | 1767 | * ignore this request. |
1771 | */ | 1768 | */ |
1772 | if (le32_to_cpu(ctrl_ctx->add_flags) & | 1769 | if (le32_to_cpu(ctrl_ctx->add_flags) & added_ctxs) { |
1773 | xhci_get_endpoint_flag(&ep->desc)) { | ||
1774 | xhci_warn(xhci, "xHCI %s called with enabled ep %p\n", | 1770 | xhci_warn(xhci, "xHCI %s called with enabled ep %p\n", |
1775 | __func__, ep); | 1771 | __func__, ep); |
1776 | return 0; | 1772 | return 0; |
@@ -1816,7 +1812,7 @@ static void xhci_zero_in_ctx(struct xhci_hcd *xhci, struct xhci_virt_device *vir | |||
1816 | struct xhci_slot_ctx *slot_ctx; | 1812 | struct xhci_slot_ctx *slot_ctx; |
1817 | int i; | 1813 | int i; |
1818 | 1814 | ||
1819 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | 1815 | ctrl_ctx = xhci_get_input_control_ctx(virt_dev->in_ctx); |
1820 | if (!ctrl_ctx) { | 1816 | if (!ctrl_ctx) { |
1821 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 1817 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
1822 | __func__); | 1818 | __func__); |
@@ -2542,7 +2538,7 @@ static int xhci_reserve_bandwidth(struct xhci_hcd *xhci, | |||
2542 | if (virt_dev->tt_info) | 2538 | if (virt_dev->tt_info) |
2543 | old_active_eps = virt_dev->tt_info->active_eps; | 2539 | old_active_eps = virt_dev->tt_info->active_eps; |
2544 | 2540 | ||
2545 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 2541 | ctrl_ctx = xhci_get_input_control_ctx(in_ctx); |
2546 | if (!ctrl_ctx) { | 2542 | if (!ctrl_ctx) { |
2547 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 2543 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
2548 | __func__); | 2544 | __func__); |
@@ -2639,7 +2635,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | |||
2639 | spin_lock_irqsave(&xhci->lock, flags); | 2635 | spin_lock_irqsave(&xhci->lock, flags); |
2640 | virt_dev = xhci->devs[udev->slot_id]; | 2636 | virt_dev = xhci->devs[udev->slot_id]; |
2641 | 2637 | ||
2642 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 2638 | ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); |
2643 | if (!ctrl_ctx) { | 2639 | if (!ctrl_ctx) { |
2644 | spin_unlock_irqrestore(&xhci->lock, flags); | 2640 | spin_unlock_irqrestore(&xhci->lock, flags); |
2645 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 2641 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
@@ -2758,7 +2754,7 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | |||
2758 | command->in_ctx = virt_dev->in_ctx; | 2754 | command->in_ctx = virt_dev->in_ctx; |
2759 | 2755 | ||
2760 | /* See section 4.6.6 - A0 = 1; A1 = D0 = D1 = 0 */ | 2756 | /* See section 4.6.6 - A0 = 1; A1 = D0 = D1 = 0 */ |
2761 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 2757 | ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); |
2762 | if (!ctrl_ctx) { | 2758 | if (!ctrl_ctx) { |
2763 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 2759 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
2764 | __func__); | 2760 | __func__); |
@@ -2883,7 +2879,7 @@ static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, | |||
2883 | dma_addr_t addr; | 2879 | dma_addr_t addr; |
2884 | 2880 | ||
2885 | in_ctx = xhci->devs[slot_id]->in_ctx; | 2881 | in_ctx = xhci->devs[slot_id]->in_ctx; |
2886 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 2882 | ctrl_ctx = xhci_get_input_control_ctx(in_ctx); |
2887 | if (!ctrl_ctx) { | 2883 | if (!ctrl_ctx) { |
2888 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 2884 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
2889 | __func__); | 2885 | __func__); |
@@ -3173,7 +3169,7 @@ int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev, | |||
3173 | xhci_dbg(xhci, "Could not allocate xHCI command structure.\n"); | 3169 | xhci_dbg(xhci, "Could not allocate xHCI command structure.\n"); |
3174 | return -ENOMEM; | 3170 | return -ENOMEM; |
3175 | } | 3171 | } |
3176 | ctrl_ctx = xhci_get_input_control_ctx(xhci, config_cmd->in_ctx); | 3172 | ctrl_ctx = xhci_get_input_control_ctx(config_cmd->in_ctx); |
3177 | if (!ctrl_ctx) { | 3173 | if (!ctrl_ctx) { |
3178 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 3174 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
3179 | __func__); | 3175 | __func__); |
@@ -3328,7 +3324,7 @@ int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, | |||
3328 | */ | 3324 | */ |
3329 | ep_index = xhci_get_endpoint_index(&eps[0]->desc); | 3325 | ep_index = xhci_get_endpoint_index(&eps[0]->desc); |
3330 | command = vdev->eps[ep_index].stream_info->free_streams_command; | 3326 | command = vdev->eps[ep_index].stream_info->free_streams_command; |
3331 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 3327 | ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); |
3332 | if (!ctrl_ctx) { | 3328 | if (!ctrl_ctx) { |
3333 | spin_unlock_irqrestore(&xhci->lock, flags); | 3329 | spin_unlock_irqrestore(&xhci->lock, flags); |
3334 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 3330 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
@@ -3346,7 +3342,7 @@ int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, | |||
3346 | 3342 | ||
3347 | xhci_endpoint_copy(xhci, command->in_ctx, | 3343 | xhci_endpoint_copy(xhci, command->in_ctx, |
3348 | vdev->out_ctx, ep_index); | 3344 | vdev->out_ctx, ep_index); |
3349 | xhci_setup_no_streams_ep_input_ctx(xhci, ep_ctx, | 3345 | xhci_setup_no_streams_ep_input_ctx(ep_ctx, |
3350 | &vdev->eps[ep_index]); | 3346 | &vdev->eps[ep_index]); |
3351 | } | 3347 | } |
3352 | xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, | 3348 | xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, |
@@ -3820,7 +3816,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3820 | command->completion = &xhci->addr_dev; | 3816 | command->completion = &xhci->addr_dev; |
3821 | 3817 | ||
3822 | slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx); | 3818 | slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx); |
3823 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | 3819 | ctrl_ctx = xhci_get_input_control_ctx(virt_dev->in_ctx); |
3824 | if (!ctrl_ctx) { | 3820 | if (!ctrl_ctx) { |
3825 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 3821 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
3826 | __func__); | 3822 | __func__); |
@@ -4003,7 +3999,7 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, | |||
4003 | 3999 | ||
4004 | /* Attempt to issue an Evaluate Context command to change the MEL. */ | 4000 | /* Attempt to issue an Evaluate Context command to change the MEL. */ |
4005 | command = xhci->lpm_command; | 4001 | command = xhci->lpm_command; |
4006 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 4002 | ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); |
4007 | if (!ctrl_ctx) { | 4003 | if (!ctrl_ctx) { |
4008 | spin_unlock_irqrestore(&xhci->lock, flags); | 4004 | spin_unlock_irqrestore(&xhci->lock, flags); |
4009 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 4005 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
@@ -4741,7 +4737,7 @@ int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, | |||
4741 | xhci_dbg(xhci, "Could not allocate xHCI command structure.\n"); | 4737 | xhci_dbg(xhci, "Could not allocate xHCI command structure.\n"); |
4742 | return -ENOMEM; | 4738 | return -ENOMEM; |
4743 | } | 4739 | } |
4744 | ctrl_ctx = xhci_get_input_control_ctx(xhci, config_cmd->in_ctx); | 4740 | ctrl_ctx = xhci_get_input_control_ctx(config_cmd->in_ctx); |
4745 | if (!ctrl_ctx) { | 4741 | if (!ctrl_ctx) { |
4746 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 4742 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
4747 | __func__); | 4743 | __func__); |
@@ -4910,6 +4906,10 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4910 | if (retval) | 4906 | if (retval) |
4911 | goto error; | 4907 | goto error; |
4912 | xhci_dbg(xhci, "Called HCD init\n"); | 4908 | xhci_dbg(xhci, "Called HCD init\n"); |
4909 | |||
4910 | xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%08x\n", | ||
4911 | xhci->hcc_params, xhci->hci_version, xhci->quirks); | ||
4912 | |||
4913 | return 0; | 4913 | return 0; |
4914 | error: | 4914 | error: |
4915 | kfree(xhci); | 4915 | kfree(xhci); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index cc7c5bb7cbcf..974514762a14 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1605,6 +1605,8 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) | |||
1605 | dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args) | 1605 | dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args) |
1606 | #define xhci_warn_ratelimited(xhci, fmt, args...) \ | 1606 | #define xhci_warn_ratelimited(xhci, fmt, args...) \ |
1607 | dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args) | 1607 | dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args) |
1608 | #define xhci_info(xhci, fmt, args...) \ | ||
1609 | dev_info(xhci_to_hcd(xhci)->self.controller , fmt , ## args) | ||
1608 | 1610 | ||
1609 | /* | 1611 | /* |
1610 | * Registers should always be accessed with double word or quad word accesses. | 1612 | * Registers should always be accessed with double word or quad word accesses. |
@@ -1712,8 +1714,7 @@ void xhci_free_stream_info(struct xhci_hcd *xhci, | |||
1712 | void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci, | 1714 | void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci, |
1713 | struct xhci_ep_ctx *ep_ctx, | 1715 | struct xhci_ep_ctx *ep_ctx, |
1714 | struct xhci_stream_info *stream_info); | 1716 | struct xhci_stream_info *stream_info); |
1715 | void xhci_setup_no_streams_ep_input_ctx(struct xhci_hcd *xhci, | 1717 | void xhci_setup_no_streams_ep_input_ctx(struct xhci_ep_ctx *ep_ctx, |
1716 | struct xhci_ep_ctx *ep_ctx, | ||
1717 | struct xhci_virt_ep *ep); | 1718 | struct xhci_virt_ep *ep); |
1718 | void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, | 1719 | void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, |
1719 | struct xhci_virt_device *virt_dev, bool drop_control_ep); | 1720 | struct xhci_virt_device *virt_dev, bool drop_control_ep); |
@@ -1727,14 +1728,13 @@ struct xhci_ring *xhci_stream_id_to_ring( | |||
1727 | struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, | 1728 | struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, |
1728 | bool allocate_in_ctx, bool allocate_completion, | 1729 | bool allocate_in_ctx, bool allocate_completion, |
1729 | gfp_t mem_flags); | 1730 | gfp_t mem_flags); |
1730 | void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv); | 1731 | void xhci_urb_free_priv(struct urb_priv *urb_priv); |
1731 | void xhci_free_command(struct xhci_hcd *xhci, | 1732 | void xhci_free_command(struct xhci_hcd *xhci, |
1732 | struct xhci_command *command); | 1733 | struct xhci_command *command); |
1733 | 1734 | ||
1734 | /* xHCI host controller glue */ | 1735 | /* xHCI host controller glue */ |
1735 | typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); | 1736 | typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); |
1736 | int xhci_handshake(struct xhci_hcd *xhci, void __iomem *ptr, | 1737 | int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec); |
1737 | u32 mask, u32 done, int usec); | ||
1738 | void xhci_quiesce(struct xhci_hcd *xhci); | 1738 | void xhci_quiesce(struct xhci_hcd *xhci); |
1739 | int xhci_halt(struct xhci_hcd *xhci); | 1739 | int xhci_halt(struct xhci_hcd *xhci); |
1740 | int xhci_reset(struct xhci_hcd *xhci); | 1740 | int xhci_reset(struct xhci_hcd *xhci); |
@@ -1864,7 +1864,7 @@ int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
1864 | void xhci_ring_device(struct xhci_hcd *xhci, int slot_id); | 1864 | void xhci_ring_device(struct xhci_hcd *xhci, int slot_id); |
1865 | 1865 | ||
1866 | /* xHCI contexts */ | 1866 | /* xHCI contexts */ |
1867 | struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); | 1867 | struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_container_ctx *ctx); |
1868 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); | 1868 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); |
1869 | struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index); | 1869 | struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index); |
1870 | 1870 | ||