diff options
Diffstat (limited to 'drivers/usb/host')
46 files changed, 778 insertions, 545 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 33b467a8352d..228797e54f9c 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -129,7 +129,7 @@ config USB_ISP1760_PCI | |||
129 | 129 | ||
130 | config USB_ISP1760_OF | 130 | config USB_ISP1760_OF |
131 | bool "Support for the OF platform bus" | 131 | bool "Support for the OF platform bus" |
132 | depends on USB_ISP1760_HCD && OF | 132 | depends on USB_ISP1760_HCD && PPC_OF |
133 | ---help--- | 133 | ---help--- |
134 | Enables support for the device present on the PowerPC | 134 | Enables support for the device present on the PowerPC |
135 | OpenFirmware platform bus. | 135 | OpenFirmware platform bus. |
@@ -300,8 +300,8 @@ config USB_R8A66597_HCD | |||
300 | module will be called r8a66597-hcd. | 300 | module will be called r8a66597-hcd. |
301 | 301 | ||
302 | config SUPERH_ON_CHIP_R8A66597 | 302 | config SUPERH_ON_CHIP_R8A66597 |
303 | boolean "Enable SuperH on-chip USB like the R8A66597" | 303 | boolean "Enable SuperH on-chip R8A66597 USB" |
304 | depends on USB_R8A66597_HCD && CPU_SUBTYPE_SH7366 | 304 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723) |
305 | help | 305 | help |
306 | Renesas SuperH processor has USB like the R8A66597. | 306 | This driver enables support for the on-chip R8A66597 in the |
307 | This driver supported processor is SH7366. | 307 | SH7366 and SH7723 processors. |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 8b5f991e949c..bf69f4739107 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -19,262 +19,304 @@ | |||
19 | #define USB_MCFG_RDCOMB (1<<30) | 19 | #define USB_MCFG_RDCOMB (1<<30) |
20 | #define USB_MCFG_SSDEN (1<<23) | 20 | #define USB_MCFG_SSDEN (1<<23) |
21 | #define USB_MCFG_PHYPLLEN (1<<19) | 21 | #define USB_MCFG_PHYPLLEN (1<<19) |
22 | #define USB_MCFG_UCECLKEN (1<<18) | ||
22 | #define USB_MCFG_EHCCLKEN (1<<17) | 23 | #define USB_MCFG_EHCCLKEN (1<<17) |
24 | #ifdef CONFIG_DMA_COHERENT | ||
23 | #define USB_MCFG_UCAM (1<<7) | 25 | #define USB_MCFG_UCAM (1<<7) |
26 | #else | ||
27 | #define USB_MCFG_UCAM (0) | ||
28 | #endif | ||
24 | #define USB_MCFG_EBMEN (1<<3) | 29 | #define USB_MCFG_EBMEN (1<<3) |
25 | #define USB_MCFG_EMEMEN (1<<2) | 30 | #define USB_MCFG_EMEMEN (1<<2) |
26 | 31 | ||
27 | #define USBH_ENABLE_CE (USB_MCFG_PHYPLLEN | USB_MCFG_EHCCLKEN) | 32 | #define USBH_ENABLE_CE (USB_MCFG_PHYPLLEN | USB_MCFG_EHCCLKEN) |
33 | #define USBH_ENABLE_INIT (USB_MCFG_PFEN | USB_MCFG_RDCOMB | \ | ||
34 | USBH_ENABLE_CE | USB_MCFG_SSDEN | \ | ||
35 | USB_MCFG_UCAM | USB_MCFG_EBMEN | \ | ||
36 | USB_MCFG_EMEMEN) | ||
28 | 37 | ||
29 | #ifdef CONFIG_DMA_COHERENT | ||
30 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE \ | ||
31 | | USB_MCFG_PFEN | USB_MCFG_RDCOMB \ | ||
32 | | USB_MCFG_SSDEN | USB_MCFG_UCAM \ | ||
33 | | USB_MCFG_EBMEN | USB_MCFG_EMEMEN) | ||
34 | #else | ||
35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE \ | ||
36 | | USB_MCFG_PFEN | USB_MCFG_RDCOMB \ | ||
37 | | USB_MCFG_SSDEN \ | ||
38 | | USB_MCFG_EBMEN | USB_MCFG_EMEMEN) | ||
39 | #endif | ||
40 | #define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) | 38 | #define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) |
41 | 39 | ||
42 | extern int usb_disabled(void); | 40 | extern int usb_disabled(void); |
43 | 41 | ||
44 | /*-------------------------------------------------------------------------*/ | 42 | static void au1xxx_start_ehc(void) |
45 | |||
46 | static void au1xxx_start_ehc(struct platform_device *dev) | ||
47 | { | 43 | { |
48 | pr_debug(__FILE__ ": starting Au1xxx EHCI USB Controller\n"); | 44 | /* enable clock to EHCI block and HS PHY PLL*/ |
49 | 45 | au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_CE, USB_HOST_CONFIG); | |
50 | /* write HW defaults again in case Yamon cleared them */ | 46 | au_sync(); |
51 | if (au_readl(USB_HOST_CONFIG) == 0) { | ||
52 | au_writel(0x00d02000, USB_HOST_CONFIG); | ||
53 | au_readl(USB_HOST_CONFIG); | ||
54 | udelay(1000); | ||
55 | } | ||
56 | /* enable host controller */ | ||
57 | au_writel(USBH_ENABLE_CE | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); | ||
58 | au_readl(USB_HOST_CONFIG); | ||
59 | udelay(1000); | ||
60 | au_writel(USBH_ENABLE_INIT | au_readl(USB_HOST_CONFIG), | ||
61 | USB_HOST_CONFIG); | ||
62 | au_readl(USB_HOST_CONFIG); | ||
63 | udelay(1000); | 47 | udelay(1000); |
64 | 48 | ||
65 | pr_debug(__FILE__ ": Clock to USB host has been enabled\n"); | 49 | /* enable EHCI mmio */ |
50 | au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_INIT, USB_HOST_CONFIG); | ||
51 | au_sync(); | ||
52 | udelay(1000); | ||
66 | } | 53 | } |
67 | 54 | ||
68 | static void au1xxx_stop_ehc(struct platform_device *dev) | 55 | static void au1xxx_stop_ehc(void) |
69 | { | 56 | { |
70 | pr_debug(__FILE__ ": stopping Au1xxx EHCI USB Controller\n"); | 57 | unsigned long c; |
71 | 58 | ||
72 | /* Disable mem */ | 59 | /* Disable mem */ |
73 | au_writel(~USBH_DISABLE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); | 60 | au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_DISABLE, USB_HOST_CONFIG); |
61 | au_sync(); | ||
74 | udelay(1000); | 62 | udelay(1000); |
75 | /* Disable clock */ | 63 | |
76 | au_writel(~USB_MCFG_EHCCLKEN & au_readl(USB_HOST_CONFIG), | 64 | /* Disable EHC clock. If the HS PHY is unused disable it too. */ |
77 | USB_HOST_CONFIG); | 65 | c = au_readl(USB_HOST_CONFIG) & ~USB_MCFG_EHCCLKEN; |
78 | au_readl(USB_HOST_CONFIG); | 66 | if (!(c & USB_MCFG_UCECLKEN)) /* UDC disabled? */ |
67 | c &= ~USB_MCFG_PHYPLLEN; /* yes: disable HS PHY PLL */ | ||
68 | au_writel(c, USB_HOST_CONFIG); | ||
69 | au_sync(); | ||
79 | } | 70 | } |
80 | 71 | ||
81 | /*-------------------------------------------------------------------------*/ | 72 | static const struct hc_driver ehci_au1xxx_hc_driver = { |
73 | .description = hcd_name, | ||
74 | .product_desc = "Au1xxx EHCI", | ||
75 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
76 | |||
77 | /* | ||
78 | * generic hardware linkage | ||
79 | */ | ||
80 | .irq = ehci_irq, | ||
81 | .flags = HCD_MEMORY | HCD_USB2, | ||
82 | |||
83 | /* | ||
84 | * basic lifecycle operations | ||
85 | * | ||
86 | * FIXME -- ehci_init() doesn't do enough here. | ||
87 | * See ehci-ppc-soc for a complete implementation. | ||
88 | */ | ||
89 | .reset = ehci_init, | ||
90 | .start = ehci_run, | ||
91 | .stop = ehci_stop, | ||
92 | .shutdown = ehci_shutdown, | ||
82 | 93 | ||
83 | /* configure so an HC device and id are always provided */ | 94 | /* |
84 | /* always called with process context; sleeping is OK */ | 95 | * managing i/o requests and associated device resources |
96 | */ | ||
97 | .urb_enqueue = ehci_urb_enqueue, | ||
98 | .urb_dequeue = ehci_urb_dequeue, | ||
99 | .endpoint_disable = ehci_endpoint_disable, | ||
85 | 100 | ||
86 | /** | 101 | /* |
87 | * usb_ehci_au1xxx_probe - initialize Au1xxx-based HCDs | 102 | * scheduling support |
88 | * Context: !in_interrupt() | 103 | */ |
89 | * | 104 | .get_frame_number = ehci_get_frame, |
90 | * Allocates basic resources for this USB host controller, and | 105 | |
91 | * then invokes the start() method for the HCD associated with it | 106 | /* |
92 | * through the hotplug entry's driver_data. | 107 | * root hub support |
93 | * | 108 | */ |
94 | */ | 109 | .hub_status_data = ehci_hub_status_data, |
95 | int usb_ehci_au1xxx_probe(const struct hc_driver *driver, | 110 | .hub_control = ehci_hub_control, |
96 | struct usb_hcd **hcd_out, struct platform_device *dev) | 111 | .bus_suspend = ehci_bus_suspend, |
112 | .bus_resume = ehci_bus_resume, | ||
113 | .relinquish_port = ehci_relinquish_port, | ||
114 | .port_handed_over = ehci_port_handed_over, | ||
115 | }; | ||
116 | |||
117 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) | ||
97 | { | 118 | { |
98 | int retval; | ||
99 | struct usb_hcd *hcd; | 119 | struct usb_hcd *hcd; |
100 | struct ehci_hcd *ehci; | 120 | struct ehci_hcd *ehci; |
121 | int ret; | ||
101 | 122 | ||
102 | #if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) | 123 | if (usb_disabled()) |
124 | return -ENODEV; | ||
103 | 125 | ||
126 | #if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) | ||
104 | /* Au1200 AB USB does not support coherent memory */ | 127 | /* Au1200 AB USB does not support coherent memory */ |
105 | if (!(read_c0_prid() & 0xff)) { | 128 | if (!(read_c0_prid() & 0xff)) { |
106 | pr_info("%s: this is chip revision AB!\n", dev->name); | 129 | printk(KERN_INFO "%s: this is chip revision AB!\n", pdev->name); |
107 | pr_info("%s: update your board or re-configure the kernel\n", | 130 | printk(KERN_INFO "%s: update your board or re-configure" |
108 | dev->name); | 131 | " the kernel\n", pdev->name); |
109 | return -ENODEV; | 132 | return -ENODEV; |
110 | } | 133 | } |
111 | #endif | 134 | #endif |
112 | 135 | ||
113 | au1xxx_start_ehc(dev); | 136 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { |
114 | |||
115 | if (dev->resource[1].flags != IORESOURCE_IRQ) { | ||
116 | pr_debug("resource[1] is not IORESOURCE_IRQ"); | 137 | pr_debug("resource[1] is not IORESOURCE_IRQ"); |
117 | retval = -ENOMEM; | 138 | return -ENOMEM; |
118 | } | 139 | } |
119 | hcd = usb_create_hcd(driver, &dev->dev, "Au1xxx"); | 140 | hcd = usb_create_hcd(&ehci_au1xxx_hc_driver, &pdev->dev, "Au1xxx"); |
120 | if (!hcd) | 141 | if (!hcd) |
121 | return -ENOMEM; | 142 | return -ENOMEM; |
122 | hcd->rsrc_start = dev->resource[0].start; | 143 | |
123 | hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; | 144 | hcd->rsrc_start = pdev->resource[0].start; |
145 | hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; | ||
124 | 146 | ||
125 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 147 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
126 | pr_debug("request_mem_region failed"); | 148 | pr_debug("request_mem_region failed"); |
127 | retval = -EBUSY; | 149 | ret = -EBUSY; |
128 | goto err1; | 150 | goto err1; |
129 | } | 151 | } |
130 | 152 | ||
131 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | 153 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); |
132 | if (!hcd->regs) { | 154 | if (!hcd->regs) { |
133 | pr_debug("ioremap failed"); | 155 | pr_debug("ioremap failed"); |
134 | retval = -ENOMEM; | 156 | ret = -ENOMEM; |
135 | goto err2; | 157 | goto err2; |
136 | } | 158 | } |
137 | 159 | ||
160 | au1xxx_start_ehc(); | ||
161 | |||
138 | ehci = hcd_to_ehci(hcd); | 162 | ehci = hcd_to_ehci(hcd); |
139 | ehci->caps = hcd->regs; | 163 | ehci->caps = hcd->regs; |
140 | ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); | 164 | ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); |
141 | /* cache this readonly data; minimize chip reads */ | 165 | /* cache this readonly data; minimize chip reads */ |
142 | ehci->hcs_params = readl(&ehci->caps->hcs_params); | 166 | ehci->hcs_params = readl(&ehci->caps->hcs_params); |
143 | 167 | ||
144 | /* ehci_hcd_init(hcd_to_ehci(hcd)); */ | 168 | ret = usb_add_hcd(hcd, pdev->resource[1].start, |
145 | 169 | IRQF_DISABLED | IRQF_SHARED); | |
146 | retval = | 170 | if (ret == 0) { |
147 | usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED); | 171 | platform_set_drvdata(pdev, hcd); |
148 | if (retval == 0) | 172 | return ret; |
149 | return retval; | 173 | } |
150 | 174 | ||
151 | au1xxx_stop_ehc(dev); | 175 | au1xxx_stop_ehc(); |
152 | iounmap(hcd->regs); | 176 | iounmap(hcd->regs); |
153 | err2: | 177 | err2: |
154 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 178 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
155 | err1: | 179 | err1: |
156 | usb_put_hcd(hcd); | 180 | usb_put_hcd(hcd); |
157 | return retval; | 181 | return ret; |
158 | } | 182 | } |
159 | 183 | ||
160 | /* may be called without controller electrically present */ | 184 | static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) |
161 | /* may be called with controller, bus, and devices active */ | ||
162 | |||
163 | /** | ||
164 | * usb_ehci_hcd_au1xxx_remove - shutdown processing for Au1xxx-based HCDs | ||
165 | * @dev: USB Host Controller being removed | ||
166 | * Context: !in_interrupt() | ||
167 | * | ||
168 | * Reverses the effect of usb_ehci_hcd_au1xxx_probe(), first invoking | ||
169 | * the HCD's stop() method. It is always called from a thread | ||
170 | * context, normally "rmmod", "apmd", or something similar. | ||
171 | * | ||
172 | */ | ||
173 | void usb_ehci_au1xxx_remove(struct usb_hcd *hcd, struct platform_device *dev) | ||
174 | { | 185 | { |
186 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
187 | |||
175 | usb_remove_hcd(hcd); | 188 | usb_remove_hcd(hcd); |
176 | iounmap(hcd->regs); | 189 | iounmap(hcd->regs); |
177 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 190 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
178 | usb_put_hcd(hcd); | 191 | usb_put_hcd(hcd); |
179 | au1xxx_stop_ehc(dev); | 192 | au1xxx_stop_ehc(); |
193 | platform_set_drvdata(pdev, NULL); | ||
194 | |||
195 | return 0; | ||
180 | } | 196 | } |
181 | 197 | ||
182 | /*-------------------------------------------------------------------------*/ | 198 | #ifdef CONFIG_PM |
199 | static int ehci_hcd_au1xxx_drv_suspend(struct platform_device *pdev, | ||
200 | pm_message_t message) | ||
201 | { | ||
202 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
203 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
204 | unsigned long flags; | ||
205 | int rc; | ||
183 | 206 | ||
184 | static const struct hc_driver ehci_au1xxx_hc_driver = { | 207 | return 0; |
185 | .description = hcd_name, | 208 | rc = 0; |
186 | .product_desc = "Au1xxx EHCI", | ||
187 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
188 | 209 | ||
189 | /* | 210 | if (time_before(jiffies, ehci->next_statechange)) |
190 | * generic hardware linkage | 211 | msleep(10); |
191 | */ | ||
192 | .irq = ehci_irq, | ||
193 | .flags = HCD_MEMORY | HCD_USB2, | ||
194 | 212 | ||
195 | /* | 213 | /* Root hub was already suspended. Disable irq emission and |
196 | * basic lifecycle operations | 214 | * mark HW unaccessible, bail out if RH has been resumed. Use |
215 | * the spinlock to properly synchronize with possible pending | ||
216 | * RH suspend or resume activity. | ||
197 | * | 217 | * |
198 | * FIXME -- ehci_init() doesn't do enough here. | 218 | * This is still racy as hcd->state is manipulated outside of |
199 | * See ehci-ppc-soc for a complete implementation. | 219 | * any locks =P But that will be a different fix. |
200 | */ | ||
201 | .reset = ehci_init, | ||
202 | .start = ehci_run, | ||
203 | .stop = ehci_stop, | ||
204 | .shutdown = ehci_shutdown, | ||
205 | |||
206 | /* | ||
207 | * managing i/o requests and associated device resources | ||
208 | */ | 220 | */ |
209 | .urb_enqueue = ehci_urb_enqueue, | 221 | spin_lock_irqsave(&ehci->lock, flags); |
210 | .urb_dequeue = ehci_urb_dequeue, | 222 | if (hcd->state != HC_STATE_SUSPENDED) { |
211 | .endpoint_disable = ehci_endpoint_disable, | 223 | rc = -EINVAL; |
224 | goto bail; | ||
225 | } | ||
226 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | ||
227 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); | ||
212 | 228 | ||
213 | /* | 229 | /* make sure snapshot being resumed re-enumerates everything */ |
214 | * scheduling support | 230 | if (message.event == PM_EVENT_PRETHAW) { |
215 | */ | 231 | ehci_halt(ehci); |
216 | .get_frame_number = ehci_get_frame, | 232 | ehci_reset(ehci); |
233 | } | ||
217 | 234 | ||
218 | /* | 235 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
219 | * root hub support | ||
220 | */ | ||
221 | .hub_status_data = ehci_hub_status_data, | ||
222 | .hub_control = ehci_hub_control, | ||
223 | .bus_suspend = ehci_bus_suspend, | ||
224 | .bus_resume = ehci_bus_resume, | ||
225 | .relinquish_port = ehci_relinquish_port, | ||
226 | }; | ||
227 | 236 | ||
228 | /*-------------------------------------------------------------------------*/ | 237 | au1xxx_stop_ehc(); |
229 | 238 | ||
230 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) | 239 | bail: |
231 | { | 240 | spin_unlock_irqrestore(&ehci->lock, flags); |
232 | struct usb_hcd *hcd = NULL; | ||
233 | int ret; | ||
234 | 241 | ||
235 | pr_debug("In ehci_hcd_au1xxx_drv_probe\n"); | 242 | // could save FLADJ in case of Vaux power loss |
243 | // ... we'd only use it to handle clock skew | ||
236 | 244 | ||
237 | if (usb_disabled()) | 245 | return rc; |
238 | return -ENODEV; | ||
239 | |||
240 | /* FIXME we only want one one probe() not two */ | ||
241 | ret = usb_ehci_au1xxx_probe(&ehci_au1xxx_hc_driver, &hcd, pdev); | ||
242 | return ret; | ||
243 | } | 246 | } |
244 | 247 | ||
245 | static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) | 248 | |
249 | static int ehci_hcd_au1xxx_drv_resume(struct platform_device *pdev) | ||
246 | { | 250 | { |
247 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 251 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
252 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
248 | 253 | ||
249 | /* FIXME we only want one one remove() not two */ | 254 | au1xxx_start_ehc(); |
250 | usb_ehci_au1xxx_remove(hcd, pdev); | ||
251 | return 0; | ||
252 | } | ||
253 | 255 | ||
254 | /*TBD*/ | 256 | // maybe restore FLADJ |
255 | /*static int ehci_hcd_au1xxx_drv_suspend(struct device *dev) | ||
256 | { | ||
257 | struct platform_device *pdev = to_platform_device(dev); | ||
258 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
259 | 257 | ||
260 | return 0; | 258 | if (time_before(jiffies, ehci->next_statechange)) |
261 | } | 259 | msleep(100); |
262 | static int ehci_hcd_au1xxx_drv_resume(struct device *dev) | 260 | |
263 | { | 261 | /* Mark hardware accessible again as we are out of D3 state by now */ |
264 | struct platform_device *pdev = to_platform_device(dev); | 262 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
265 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 263 | |
264 | /* If CF is still set, we maintained PCI Vaux power. | ||
265 | * Just undo the effect of ehci_pci_suspend(). | ||
266 | */ | ||
267 | if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF) { | ||
268 | int mask = INTR_MASK; | ||
269 | |||
270 | if (!hcd->self.root_hub->do_remote_wakeup) | ||
271 | mask &= ~STS_PCD; | ||
272 | ehci_writel(ehci, mask, &ehci->regs->intr_enable); | ||
273 | ehci_readl(ehci, &ehci->regs->intr_enable); | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | ehci_dbg(ehci, "lost power, restarting\n"); | ||
278 | usb_root_hub_lost_power(hcd->self.root_hub); | ||
279 | |||
280 | /* Else reset, to cope with power loss or flush-to-storage | ||
281 | * style "resume" having let BIOS kick in during reboot. | ||
282 | */ | ||
283 | (void) ehci_halt(ehci); | ||
284 | (void) ehci_reset(ehci); | ||
285 | |||
286 | /* emptying the schedule aborts any urbs */ | ||
287 | spin_lock_irq(&ehci->lock); | ||
288 | if (ehci->reclaim) | ||
289 | end_unlink_async(ehci); | ||
290 | ehci_work(ehci); | ||
291 | spin_unlock_irq(&ehci->lock); | ||
292 | |||
293 | ehci_writel(ehci, ehci->command, &ehci->regs->command); | ||
294 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); | ||
295 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ | ||
296 | |||
297 | /* here we "know" root ports should always stay powered */ | ||
298 | ehci_port_power(ehci, 1); | ||
299 | |||
300 | hcd->state = HC_STATE_SUSPENDED; | ||
266 | 301 | ||
267 | return 0; | 302 | return 0; |
268 | } | 303 | } |
269 | */ | 304 | |
270 | MODULE_ALIAS("platform:au1xxx-ehci"); | 305 | #else |
306 | #define ehci_hcd_au1xxx_drv_suspend NULL | ||
307 | #define ehci_hcd_au1xxx_drv_resume NULL | ||
308 | #endif | ||
309 | |||
271 | static struct platform_driver ehci_hcd_au1xxx_driver = { | 310 | static struct platform_driver ehci_hcd_au1xxx_driver = { |
272 | .probe = ehci_hcd_au1xxx_drv_probe, | 311 | .probe = ehci_hcd_au1xxx_drv_probe, |
273 | .remove = ehci_hcd_au1xxx_drv_remove, | 312 | .remove = ehci_hcd_au1xxx_drv_remove, |
274 | .shutdown = usb_hcd_platform_shutdown, | 313 | .shutdown = usb_hcd_platform_shutdown, |
275 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ | 314 | .suspend = ehci_hcd_au1xxx_drv_suspend, |
276 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ | 315 | .resume = ehci_hcd_au1xxx_drv_resume, |
277 | .driver = { | 316 | .driver = { |
278 | .name = "au1xxx-ehci", | 317 | .name = "au1xxx-ehci", |
318 | .owner = THIS_MODULE, | ||
279 | } | 319 | } |
280 | }; | 320 | }; |
321 | |||
322 | MODULE_ALIAS("platform:au1xxx-ehci"); | ||
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 0f82fdcaef09..b0f8ed5a7fb9 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -676,7 +676,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) | |||
676 | "%s\n" | 676 | "%s\n" |
677 | "SUSPENDED (no register access)\n", | 677 | "SUSPENDED (no register access)\n", |
678 | hcd->self.controller->bus->name, | 678 | hcd->self.controller->bus->name, |
679 | hcd->self.controller->bus_id, | 679 | dev_name(hcd->self.controller), |
680 | hcd->product_desc); | 680 | hcd->product_desc); |
681 | goto done; | 681 | goto done; |
682 | } | 682 | } |
@@ -688,7 +688,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) | |||
688 | "%s\n" | 688 | "%s\n" |
689 | "EHCI %x.%02x, hcd state %d\n", | 689 | "EHCI %x.%02x, hcd state %d\n", |
690 | hcd->self.controller->bus->name, | 690 | hcd->self.controller->bus->name, |
691 | hcd->self.controller->bus_id, | 691 | dev_name(hcd->self.controller), |
692 | hcd->product_desc, | 692 | hcd->product_desc, |
693 | i >> 8, i & 0x0ff, hcd->state); | 693 | i >> 8, i & 0x0ff, hcd->state); |
694 | size -= temp; | 694 | size -= temp; |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 6d9bed6c1f48..01c3da34f678 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -56,7 +56,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
56 | pdata = (struct fsl_usb2_platform_data *)pdev->dev.platform_data; | 56 | pdata = (struct fsl_usb2_platform_data *)pdev->dev.platform_data; |
57 | if (!pdata) { | 57 | if (!pdata) { |
58 | dev_err(&pdev->dev, | 58 | dev_err(&pdev->dev, |
59 | "No platform data for %s.\n", pdev->dev.bus_id); | 59 | "No platform data for %s.\n", dev_name(&pdev->dev)); |
60 | return -ENODEV; | 60 | return -ENODEV; |
61 | } | 61 | } |
62 | 62 | ||
@@ -69,7 +69,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
69 | (pdata->operating_mode == FSL_USB2_DR_OTG))) { | 69 | (pdata->operating_mode == FSL_USB2_DR_OTG))) { |
70 | dev_err(&pdev->dev, | 70 | dev_err(&pdev->dev, |
71 | "Non Host Mode configured for %s. Wrong driver linked.\n", | 71 | "Non Host Mode configured for %s. Wrong driver linked.\n", |
72 | pdev->dev.bus_id); | 72 | dev_name(&pdev->dev)); |
73 | return -ENODEV; | 73 | return -ENODEV; |
74 | } | 74 | } |
75 | 75 | ||
@@ -77,12 +77,12 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
77 | if (!res) { | 77 | if (!res) { |
78 | dev_err(&pdev->dev, | 78 | dev_err(&pdev->dev, |
79 | "Found HC with no IRQ. Check %s setup!\n", | 79 | "Found HC with no IRQ. Check %s setup!\n", |
80 | pdev->dev.bus_id); | 80 | dev_name(&pdev->dev)); |
81 | return -ENODEV; | 81 | return -ENODEV; |
82 | } | 82 | } |
83 | irq = res->start; | 83 | irq = res->start; |
84 | 84 | ||
85 | hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); | 85 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
86 | if (!hcd) { | 86 | if (!hcd) { |
87 | retval = -ENOMEM; | 87 | retval = -ENOMEM; |
88 | goto err1; | 88 | goto err1; |
@@ -92,7 +92,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
92 | if (!res) { | 92 | if (!res) { |
93 | dev_err(&pdev->dev, | 93 | dev_err(&pdev->dev, |
94 | "Found HC with no register addr. Check %s setup!\n", | 94 | "Found HC with no register addr. Check %s setup!\n", |
95 | pdev->dev.bus_id); | 95 | dev_name(&pdev->dev)); |
96 | retval = -ENODEV; | 96 | retval = -ENODEV; |
97 | goto err2; | 97 | goto err2; |
98 | } | 98 | } |
@@ -132,7 +132,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
132 | err2: | 132 | err2: |
133 | usb_put_hcd(hcd); | 133 | usb_put_hcd(hcd); |
134 | err1: | 134 | err1: |
135 | dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, retval); | 135 | dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval); |
136 | return retval; | 136 | return retval; |
137 | } | 137 | } |
138 | 138 | ||
@@ -230,8 +230,13 @@ static void mpc83xx_usb_setup(struct usb_hcd *hcd) | |||
230 | 230 | ||
231 | /* put controller in host mode. */ | 231 | /* put controller in host mode. */ |
232 | ehci_writel(ehci, 0x00000003, non_ehci + FSL_SOC_USB_USBMODE); | 232 | ehci_writel(ehci, 0x00000003, non_ehci + FSL_SOC_USB_USBMODE); |
233 | #ifdef CONFIG_PPC_85xx | ||
234 | out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x00000008); | ||
235 | out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000080); | ||
236 | #else | ||
233 | out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x0000000c); | 237 | out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x0000000c); |
234 | out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000040); | 238 | out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000040); |
239 | #endif | ||
235 | out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001); | 240 | out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001); |
236 | } | 241 | } |
237 | 242 | ||
@@ -269,7 +274,7 @@ static int ehci_fsl_setup(struct usb_hcd *hcd) | |||
269 | if (retval) | 274 | if (retval) |
270 | return retval; | 275 | return retval; |
271 | 276 | ||
272 | ehci->is_tdi_rh_tt = 1; | 277 | hcd->has_tt = 1; |
273 | 278 | ||
274 | ehci->sbrn = 0x20; | 279 | ehci->sbrn = 0x20; |
275 | 280 | ||
@@ -295,10 +300,6 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
295 | */ | 300 | */ |
296 | .reset = ehci_fsl_setup, | 301 | .reset = ehci_fsl_setup, |
297 | .start = ehci_run, | 302 | .start = ehci_run, |
298 | #ifdef CONFIG_PM | ||
299 | .suspend = ehci_bus_suspend, | ||
300 | .resume = ehci_bus_resume, | ||
301 | #endif | ||
302 | .stop = ehci_stop, | 303 | .stop = ehci_stop, |
303 | .shutdown = ehci_shutdown, | 304 | .shutdown = ehci_shutdown, |
304 | 305 | ||
@@ -322,6 +323,7 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
322 | .bus_suspend = ehci_bus_suspend, | 323 | .bus_suspend = ehci_bus_suspend, |
323 | .bus_resume = ehci_bus_resume, | 324 | .bus_resume = ehci_bus_resume, |
324 | .relinquish_port = ehci_relinquish_port, | 325 | .relinquish_port = ehci_relinquish_port, |
326 | .port_handed_over = ehci_port_handed_over, | ||
325 | }; | 327 | }; |
326 | 328 | ||
327 | static int ehci_fsl_drv_probe(struct platform_device *pdev) | 329 | static int ehci_fsl_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 369a8a5ea7bb..d9d53f289caf 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -84,7 +84,7 @@ static const char hcd_name [] = "ehci_hcd"; | |||
84 | #define EHCI_IAA_MSECS 10 /* arbitrary */ | 84 | #define EHCI_IAA_MSECS 10 /* arbitrary */ |
85 | #define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */ | 85 | #define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */ |
86 | #define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */ | 86 | #define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */ |
87 | #define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */ | 87 | #define EHCI_SHRINK_FRAMES 5 /* async qh unlink delay */ |
88 | 88 | ||
89 | /* Initial IRQ latency: faster than hw default */ | 89 | /* Initial IRQ latency: faster than hw default */ |
90 | static int log2_irq_thresh = 0; // 0 to 6 | 90 | static int log2_irq_thresh = 0; // 0 to 6 |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 382587c4457c..740835bb8575 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -609,7 +609,7 @@ static int ehci_hub_control ( | |||
609 | } | 609 | } |
610 | break; | 610 | break; |
611 | case USB_PORT_FEAT_C_SUSPEND: | 611 | case USB_PORT_FEAT_C_SUSPEND: |
612 | /* we auto-clear this feature */ | 612 | clear_bit(wIndex, &ehci->port_c_suspend); |
613 | break; | 613 | break; |
614 | case USB_PORT_FEAT_POWER: | 614 | case USB_PORT_FEAT_POWER: |
615 | if (HCS_PPC (ehci->hcs_params)) | 615 | if (HCS_PPC (ehci->hcs_params)) |
@@ -688,7 +688,7 @@ static int ehci_hub_control ( | |||
688 | /* resume completed? */ | 688 | /* resume completed? */ |
689 | else if (time_after_eq(jiffies, | 689 | else if (time_after_eq(jiffies, |
690 | ehci->reset_done[wIndex])) { | 690 | ehci->reset_done[wIndex])) { |
691 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | 691 | set_bit(wIndex, &ehci->port_c_suspend); |
692 | ehci->reset_done[wIndex] = 0; | 692 | ehci->reset_done[wIndex] = 0; |
693 | 693 | ||
694 | /* stop resume signaling */ | 694 | /* stop resume signaling */ |
@@ -765,6 +765,8 @@ static int ehci_hub_control ( | |||
765 | status |= 1 << USB_PORT_FEAT_RESET; | 765 | status |= 1 << USB_PORT_FEAT_RESET; |
766 | if (temp & PORT_POWER) | 766 | if (temp & PORT_POWER) |
767 | status |= 1 << USB_PORT_FEAT_POWER; | 767 | status |= 1 << USB_PORT_FEAT_POWER; |
768 | if (test_bit(wIndex, &ehci->port_c_suspend)) | ||
769 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | ||
768 | 770 | ||
769 | #ifndef VERBOSE_DEBUG | 771 | #ifndef VERBOSE_DEBUG |
770 | if (status & ~0xffff) /* only if wPortChange is interesting */ | 772 | if (status & ~0xffff) /* only if wPortChange is interesting */ |
@@ -875,3 +877,13 @@ static void ehci_relinquish_port(struct usb_hcd *hcd, int portnum) | |||
875 | set_owner(ehci, --portnum, PORT_OWNER); | 877 | set_owner(ehci, --portnum, PORT_OWNER); |
876 | } | 878 | } |
877 | 879 | ||
880 | static int ehci_port_handed_over(struct usb_hcd *hcd, int portnum) | ||
881 | { | ||
882 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
883 | u32 __iomem *reg; | ||
884 | |||
885 | if (ehci_is_TDI(ehci)) | ||
886 | return 0; | ||
887 | reg = &ehci->regs->port_status[portnum - 1]; | ||
888 | return ehci_readl(ehci, reg) & PORT_OWNER; | ||
889 | } | ||
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index 601c8795a854..f9575c409124 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c | |||
@@ -26,7 +26,7 @@ static int ixp4xx_ehci_init(struct usb_hcd *hcd) | |||
26 | + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 26 | + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
27 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 27 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
28 | 28 | ||
29 | ehci->is_tdi_rh_tt = 1; | 29 | hcd->has_tt = 1; |
30 | ehci_reset(ehci); | 30 | ehci_reset(ehci); |
31 | 31 | ||
32 | retval = ehci_init(hcd); | 32 | retval = ehci_init(hcd); |
@@ -58,6 +58,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = { | |||
58 | .bus_suspend = ehci_bus_suspend, | 58 | .bus_suspend = ehci_bus_suspend, |
59 | .bus_resume = ehci_bus_resume, | 59 | .bus_resume = ehci_bus_resume, |
60 | #endif | 60 | #endif |
61 | .relinquish_port = ehci_relinquish_port, | ||
62 | .port_handed_over = ehci_port_handed_over, | ||
61 | }; | 63 | }; |
62 | 64 | ||
63 | static int ixp4xx_ehci_probe(struct platform_device *pdev) | 65 | static int ixp4xx_ehci_probe(struct platform_device *pdev) |
@@ -75,12 +77,12 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev) | |||
75 | if (!res) { | 77 | if (!res) { |
76 | dev_err(&pdev->dev, | 78 | dev_err(&pdev->dev, |
77 | "Found HC with no IRQ. Check %s setup!\n", | 79 | "Found HC with no IRQ. Check %s setup!\n", |
78 | pdev->dev.bus_id); | 80 | dev_name(&pdev->dev)); |
79 | return -ENODEV; | 81 | return -ENODEV; |
80 | } | 82 | } |
81 | irq = res->start; | 83 | irq = res->start; |
82 | 84 | ||
83 | hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); | 85 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
84 | if (!hcd) { | 86 | if (!hcd) { |
85 | retval = -ENOMEM; | 87 | retval = -ENOMEM; |
86 | goto fail_create_hcd; | 88 | goto fail_create_hcd; |
@@ -90,7 +92,7 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev) | |||
90 | if (!res) { | 92 | if (!res) { |
91 | dev_err(&pdev->dev, | 93 | dev_err(&pdev->dev, |
92 | "Found HC with no register addr. Check %s setup!\n", | 94 | "Found HC with no register addr. Check %s setup!\n", |
93 | pdev->dev.bus_id); | 95 | dev_name(&pdev->dev)); |
94 | retval = -ENODEV; | 96 | retval = -ENODEV; |
95 | goto fail_request_resource; | 97 | goto fail_request_resource; |
96 | } | 98 | } |
@@ -124,7 +126,7 @@ fail_ioremap: | |||
124 | fail_request_resource: | 126 | fail_request_resource: |
125 | usb_put_hcd(hcd); | 127 | usb_put_hcd(hcd); |
126 | fail_create_hcd: | 128 | fail_create_hcd: |
127 | dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, retval); | 129 | dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval); |
128 | return retval; | 130 | return retval; |
129 | } | 131 | } |
130 | 132 | ||
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index d187d0313742..5fbdc14e63b3 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -115,6 +115,8 @@ static int ehci_orion_setup(struct usb_hcd *hcd) | |||
115 | if (retval) | 115 | if (retval) |
116 | return retval; | 116 | return retval; |
117 | 117 | ||
118 | hcd->has_tt = 1; | ||
119 | |||
118 | ehci_reset(ehci); | 120 | ehci_reset(ehci); |
119 | ehci_port_power(ehci, 0); | 121 | ehci_port_power(ehci, 0); |
120 | 122 | ||
@@ -137,10 +139,6 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
137 | */ | 139 | */ |
138 | .reset = ehci_orion_setup, | 140 | .reset = ehci_orion_setup, |
139 | .start = ehci_run, | 141 | .start = ehci_run, |
140 | #ifdef CONFIG_PM | ||
141 | .suspend = ehci_bus_suspend, | ||
142 | .resume = ehci_bus_resume, | ||
143 | #endif | ||
144 | .stop = ehci_stop, | 142 | .stop = ehci_stop, |
145 | .shutdown = ehci_shutdown, | 143 | .shutdown = ehci_shutdown, |
146 | 144 | ||
@@ -163,6 +161,8 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
163 | .hub_control = ehci_hub_control, | 161 | .hub_control = ehci_hub_control, |
164 | .bus_suspend = ehci_bus_suspend, | 162 | .bus_suspend = ehci_bus_suspend, |
165 | .bus_resume = ehci_bus_resume, | 163 | .bus_resume = ehci_bus_resume, |
164 | .relinquish_port = ehci_relinquish_port, | ||
165 | .port_handed_over = ehci_port_handed_over, | ||
166 | }; | 166 | }; |
167 | 167 | ||
168 | static void __init | 168 | static void __init |
@@ -204,7 +204,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
204 | if (irq <= 0) { | 204 | if (irq <= 0) { |
205 | dev_err(&pdev->dev, | 205 | dev_err(&pdev->dev, |
206 | "Found HC with no IRQ. Check %s setup!\n", | 206 | "Found HC with no IRQ. Check %s setup!\n", |
207 | pdev->dev.bus_id); | 207 | dev_name(&pdev->dev)); |
208 | err = -ENODEV; | 208 | err = -ENODEV; |
209 | goto err1; | 209 | goto err1; |
210 | } | 210 | } |
@@ -213,7 +213,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
213 | if (!res) { | 213 | if (!res) { |
214 | dev_err(&pdev->dev, | 214 | dev_err(&pdev->dev, |
215 | "Found HC with no register addr. Check %s setup!\n", | 215 | "Found HC with no register addr. Check %s setup!\n", |
216 | pdev->dev.bus_id); | 216 | dev_name(&pdev->dev)); |
217 | err = -ENODEV; | 217 | err = -ENODEV; |
218 | goto err1; | 218 | goto err1; |
219 | } | 219 | } |
@@ -233,7 +233,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | hcd = usb_create_hcd(&ehci_orion_hc_driver, | 235 | hcd = usb_create_hcd(&ehci_orion_hc_driver, |
236 | &pdev->dev, pdev->dev.bus_id); | 236 | &pdev->dev, dev_name(&pdev->dev)); |
237 | if (!hcd) { | 237 | if (!hcd) { |
238 | err = -ENOMEM; | 238 | err = -ENOMEM; |
239 | goto err3; | 239 | goto err3; |
@@ -248,7 +248,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
248 | ehci->regs = hcd->regs + 0x100 + | 248 | ehci->regs = hcd->regs + 0x100 + |
249 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 249 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
250 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 250 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
251 | ehci->is_tdi_rh_tt = 1; | 251 | hcd->has_tt = 1; |
252 | ehci->sbrn = 0x20; | 252 | ehci->sbrn = 0x20; |
253 | 253 | ||
254 | /* | 254 | /* |
@@ -276,7 +276,7 @@ err2: | |||
276 | release_mem_region(res->start, res->end - res->start + 1); | 276 | release_mem_region(res->start, res->end - res->start + 1); |
277 | err1: | 277 | err1: |
278 | dev_err(&pdev->dev, "init %s fail, %d\n", | 278 | dev_err(&pdev->dev, "init %s fail, %d\n", |
279 | pdev->dev.bus_id, err); | 279 | dev_name(&pdev->dev), err); |
280 | 280 | ||
281 | return err; | 281 | return err; |
282 | } | 282 | } |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 5bb7f6bb13f3..c46a58f9181d 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -129,7 +129,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
129 | switch (pdev->vendor) { | 129 | switch (pdev->vendor) { |
130 | case PCI_VENDOR_ID_TDI: | 130 | case PCI_VENDOR_ID_TDI: |
131 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 131 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
132 | ehci->is_tdi_rh_tt = 1; | ||
133 | hcd->has_tt = 1; | 132 | hcd->has_tt = 1; |
134 | tdi_reset(ehci); | 133 | tdi_reset(ehci); |
135 | } | 134 | } |
@@ -379,7 +378,8 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
379 | .hub_control = ehci_hub_control, | 378 | .hub_control = ehci_hub_control, |
380 | .bus_suspend = ehci_bus_suspend, | 379 | .bus_suspend = ehci_bus_suspend, |
381 | .bus_resume = ehci_bus_resume, | 380 | .bus_resume = ehci_bus_resume, |
382 | .relinquish_port = ehci_relinquish_port, | 381 | .relinquish_port = ehci_relinquish_port, |
382 | .port_handed_over = ehci_port_handed_over, | ||
383 | }; | 383 | }; |
384 | 384 | ||
385 | /*-------------------------------------------------------------------------*/ | 385 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index ee305b1f99ff..b018deed2e8f 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -76,6 +76,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = { | |||
76 | .bus_suspend = ehci_bus_suspend, | 76 | .bus_suspend = ehci_bus_suspend, |
77 | .bus_resume = ehci_bus_resume, | 77 | .bus_resume = ehci_bus_resume, |
78 | #endif | 78 | #endif |
79 | .relinquish_port = ehci_relinquish_port, | ||
80 | .port_handed_over = ehci_port_handed_over, | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | 83 | ||
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c index 6c76036783a1..529590eb4037 100644 --- a/drivers/usb/host/ehci-ppc-soc.c +++ b/drivers/usb/host/ehci-ppc-soc.c | |||
@@ -163,6 +163,7 @@ static const struct hc_driver ehci_ppc_soc_hc_driver = { | |||
163 | .bus_suspend = ehci_bus_suspend, | 163 | .bus_suspend = ehci_bus_suspend, |
164 | .bus_resume = ehci_bus_resume, | 164 | .bus_resume = ehci_bus_resume, |
165 | .relinquish_port = ehci_relinquish_port, | 165 | .relinquish_port = ehci_relinquish_port, |
166 | .port_handed_over = ehci_port_handed_over, | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) | 169 | static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 69782221bcf3..0eba894bcb01 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -73,6 +73,7 @@ static const struct hc_driver ps3_ehci_hc_driver = { | |||
73 | .bus_resume = ehci_bus_resume, | 73 | .bus_resume = ehci_bus_resume, |
74 | #endif | 74 | #endif |
75 | .relinquish_port = ehci_relinquish_port, | 75 | .relinquish_port = ehci_relinquish_port, |
76 | .port_handed_over = ehci_port_handed_over, | ||
76 | }; | 77 | }; |
77 | 78 | ||
78 | static int ps3_ehci_probe(struct ps3_system_bus_device *dev) | 79 | static int ps3_ehci_probe(struct ps3_system_bus_device *dev) |
@@ -127,7 +128,7 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev) | |||
127 | 128 | ||
128 | dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ | 129 | dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ |
129 | 130 | ||
130 | hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev->core.bus_id); | 131 | hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev_name(&dev->core)); |
131 | 132 | ||
132 | if (!hcd) { | 133 | if (!hcd) { |
133 | dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, | 134 | dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index b85b54160cda..2622b6596d7c 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -1116,8 +1116,7 @@ static void scan_async (struct ehci_hcd *ehci) | |||
1116 | struct ehci_qh *qh; | 1116 | struct ehci_qh *qh; |
1117 | enum ehci_timer_action action = TIMER_IO_WATCHDOG; | 1117 | enum ehci_timer_action action = TIMER_IO_WATCHDOG; |
1118 | 1118 | ||
1119 | if (!++(ehci->stamp)) | 1119 | ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); |
1120 | ehci->stamp++; | ||
1121 | timer_action_done (ehci, TIMER_ASYNC_SHRINK); | 1120 | timer_action_done (ehci, TIMER_ASYNC_SHRINK); |
1122 | rescan: | 1121 | rescan: |
1123 | qh = ehci->async->qh_next.qh; | 1122 | qh = ehci->async->qh_next.qh; |
@@ -1142,18 +1141,20 @@ rescan: | |||
1142 | } | 1141 | } |
1143 | } | 1142 | } |
1144 | 1143 | ||
1145 | /* unlink idle entries, reducing HC PCI usage as well | 1144 | /* unlink idle entries, reducing DMA usage as well |
1146 | * as HCD schedule-scanning costs. delay for any qh | 1145 | * as HCD schedule-scanning costs. delay for any qh |
1147 | * we just scanned, there's a not-unusual case that it | 1146 | * we just scanned, there's a not-unusual case that it |
1148 | * doesn't stay idle for long. | 1147 | * doesn't stay idle for long. |
1149 | * (plus, avoids some kind of re-activation race.) | 1148 | * (plus, avoids some kind of re-activation race.) |
1150 | */ | 1149 | */ |
1151 | if (list_empty (&qh->qtd_list)) { | 1150 | if (list_empty(&qh->qtd_list) |
1152 | if (qh->stamp == ehci->stamp) | 1151 | && qh->qh_state == QH_STATE_LINKED) { |
1152 | if (!ehci->reclaim | ||
1153 | && ((ehci->stamp - qh->stamp) & 0x1fff) | ||
1154 | >= (EHCI_SHRINK_FRAMES * 8)) | ||
1155 | start_unlink_async(ehci, qh); | ||
1156 | else | ||
1153 | action = TIMER_ASYNC_SHRINK; | 1157 | action = TIMER_ASYNC_SHRINK; |
1154 | else if (!ehci->reclaim | ||
1155 | && qh->qh_state == QH_STATE_LINKED) | ||
1156 | start_unlink_async (ehci, qh); | ||
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | qh = qh->qh_next.qh; | 1160 | qh = qh->qh_next.qh; |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index be575e46eac3..b7853c8bac0f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1349,18 +1349,27 @@ iso_stream_schedule ( | |||
1349 | /* when's the last uframe this urb could start? */ | 1349 | /* when's the last uframe this urb could start? */ |
1350 | max = now + mod; | 1350 | max = now + mod; |
1351 | 1351 | ||
1352 | /* typical case: reuse current schedule. stream is still active, | 1352 | /* Typical case: reuse current schedule, stream is still active. |
1353 | * and no gaps from host falling behind (irq delays etc) | 1353 | * Hopefully there are no gaps from the host falling behind |
1354 | * (irq delays etc), but if there are we'll take the next | ||
1355 | * slot in the schedule, implicitly assuming URB_ISO_ASAP. | ||
1354 | */ | 1356 | */ |
1355 | if (likely (!list_empty (&stream->td_list))) { | 1357 | if (likely (!list_empty (&stream->td_list))) { |
1356 | start = stream->next_uframe; | 1358 | start = stream->next_uframe; |
1357 | if (start < now) | 1359 | if (start < now) |
1358 | start += mod; | 1360 | start += mod; |
1359 | if (likely ((start + sched->span) < max)) | 1361 | |
1360 | goto ready; | 1362 | /* Fell behind (by up to twice the slop amount)? */ |
1361 | /* else fell behind; someday, try to reschedule */ | 1363 | if (start >= max - 2 * 8 * SCHEDULE_SLOP) |
1362 | status = -EL2NSYNC; | 1364 | start += stream->interval * DIV_ROUND_UP( |
1363 | goto fail; | 1365 | max - start, stream->interval) - mod; |
1366 | |||
1367 | /* Tried to schedule too far into the future? */ | ||
1368 | if (unlikely((start + sched->span) >= max)) { | ||
1369 | status = -EFBIG; | ||
1370 | goto fail; | ||
1371 | } | ||
1372 | goto ready; | ||
1364 | } | 1373 | } |
1365 | 1374 | ||
1366 | /* need to schedule; when's the next (u)frame we could start? | 1375 | /* need to schedule; when's the next (u)frame we could start? |
@@ -1613,6 +1622,9 @@ itd_complete ( | |||
1613 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { | 1622 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { |
1614 | desc->status = 0; | 1623 | desc->status = 0; |
1615 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1624 | desc->actual_length = EHCI_ITD_LENGTH (t); |
1625 | } else { | ||
1626 | /* URB was too late */ | ||
1627 | desc->status = -EXDEV; | ||
1616 | } | 1628 | } |
1617 | } | 1629 | } |
1618 | 1630 | ||
@@ -2095,7 +2107,7 @@ done: | |||
2095 | static void | 2107 | static void |
2096 | scan_periodic (struct ehci_hcd *ehci) | 2108 | scan_periodic (struct ehci_hcd *ehci) |
2097 | { | 2109 | { |
2098 | unsigned frame, clock, now_uframe, mod; | 2110 | unsigned now_uframe, frame, clock, clock_frame, mod; |
2099 | unsigned modified; | 2111 | unsigned modified; |
2100 | 2112 | ||
2101 | mod = ehci->periodic_size << 3; | 2113 | mod = ehci->periodic_size << 3; |
@@ -2111,6 +2123,7 @@ scan_periodic (struct ehci_hcd *ehci) | |||
2111 | else | 2123 | else |
2112 | clock = now_uframe + mod - 1; | 2124 | clock = now_uframe + mod - 1; |
2113 | clock %= mod; | 2125 | clock %= mod; |
2126 | clock_frame = clock >> 3; | ||
2114 | 2127 | ||
2115 | for (;;) { | 2128 | for (;;) { |
2116 | union ehci_shadow q, *q_p; | 2129 | union ehci_shadow q, *q_p; |
@@ -2157,22 +2170,26 @@ restart: | |||
2157 | case Q_TYPE_ITD: | 2170 | case Q_TYPE_ITD: |
2158 | /* If this ITD is still active, leave it for | 2171 | /* If this ITD is still active, leave it for |
2159 | * later processing ... check the next entry. | 2172 | * later processing ... check the next entry. |
2173 | * No need to check for activity unless the | ||
2174 | * frame is current. | ||
2160 | */ | 2175 | */ |
2161 | rmb (); | 2176 | if (frame == clock_frame && live) { |
2162 | for (uf = 0; uf < 8 && live; uf++) { | 2177 | rmb(); |
2163 | if (0 == (q.itd->hw_transaction [uf] | 2178 | for (uf = 0; uf < 8; uf++) { |
2164 | & ITD_ACTIVE(ehci))) | 2179 | if (q.itd->hw_transaction[uf] & |
2165 | continue; | 2180 | ITD_ACTIVE(ehci)) |
2166 | incomplete = true; | 2181 | break; |
2167 | q_p = &q.itd->itd_next; | 2182 | } |
2168 | hw_p = &q.itd->hw_next; | 2183 | if (uf < 8) { |
2169 | type = Q_NEXT_TYPE(ehci, | 2184 | incomplete = true; |
2185 | q_p = &q.itd->itd_next; | ||
2186 | hw_p = &q.itd->hw_next; | ||
2187 | type = Q_NEXT_TYPE(ehci, | ||
2170 | q.itd->hw_next); | 2188 | q.itd->hw_next); |
2171 | q = *q_p; | 2189 | q = *q_p; |
2172 | break; | 2190 | break; |
2191 | } | ||
2173 | } | 2192 | } |
2174 | if (uf < 8 && live) | ||
2175 | break; | ||
2176 | 2193 | ||
2177 | /* Take finished ITDs out of the schedule | 2194 | /* Take finished ITDs out of the schedule |
2178 | * and process them: recycle, maybe report | 2195 | * and process them: recycle, maybe report |
@@ -2189,9 +2206,12 @@ restart: | |||
2189 | case Q_TYPE_SITD: | 2206 | case Q_TYPE_SITD: |
2190 | /* If this SITD is still active, leave it for | 2207 | /* If this SITD is still active, leave it for |
2191 | * later processing ... check the next entry. | 2208 | * later processing ... check the next entry. |
2209 | * No need to check for activity unless the | ||
2210 | * frame is current. | ||
2192 | */ | 2211 | */ |
2193 | if ((q.sitd->hw_results & SITD_ACTIVE(ehci)) | 2212 | if (frame == clock_frame && live && |
2194 | && live) { | 2213 | (q.sitd->hw_results & |
2214 | SITD_ACTIVE(ehci))) { | ||
2195 | incomplete = true; | 2215 | incomplete = true; |
2196 | q_p = &q.sitd->sitd_next; | 2216 | q_p = &q.sitd->sitd_next; |
2197 | hw_p = &q.sitd->hw_next; | 2217 | hw_p = &q.sitd->hw_next; |
@@ -2260,6 +2280,7 @@ restart: | |||
2260 | 2280 | ||
2261 | /* rescan the rest of this frame, then ... */ | 2281 | /* rescan the rest of this frame, then ... */ |
2262 | clock = now; | 2282 | clock = now; |
2283 | clock_frame = clock >> 3; | ||
2263 | } else { | 2284 | } else { |
2264 | now_uframe++; | 2285 | now_uframe++; |
2265 | now_uframe %= mod; | 2286 | now_uframe %= mod; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bf92d209a1a9..5799298364fb 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -97,6 +97,8 @@ struct ehci_hcd { /* one per controller */ | |||
97 | dedicated to the companion controller */ | 97 | dedicated to the companion controller */ |
98 | unsigned long owned_ports; /* which ports are | 98 | unsigned long owned_ports; /* which ports are |
99 | owned by the companion during a bus suspend */ | 99 | owned by the companion during a bus suspend */ |
100 | unsigned long port_c_suspend; /* which ports have | ||
101 | the change-suspend feature turned on */ | ||
100 | 102 | ||
101 | /* per-HC memory pools (could be per-bus, but ...) */ | 103 | /* per-HC memory pools (could be per-bus, but ...) */ |
102 | struct dma_pool *qh_pool; /* qh per active urb */ | 104 | struct dma_pool *qh_pool; /* qh per active urb */ |
@@ -112,7 +114,6 @@ struct ehci_hcd { /* one per controller */ | |||
112 | u32 command; | 114 | u32 command; |
113 | 115 | ||
114 | /* SILICON QUIRKS */ | 116 | /* SILICON QUIRKS */ |
115 | unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */ | ||
116 | unsigned no_selective_suspend:1; | 117 | unsigned no_selective_suspend:1; |
117 | unsigned has_fsl_port_bug:1; /* FreeScale */ | 118 | unsigned has_fsl_port_bug:1; /* FreeScale */ |
118 | unsigned big_endian_mmio:1; | 119 | unsigned big_endian_mmio:1; |
@@ -176,6 +177,15 @@ timer_action_done (struct ehci_hcd *ehci, enum ehci_timer_action action) | |||
176 | static inline void | 177 | static inline void |
177 | timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) | 178 | timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) |
178 | { | 179 | { |
180 | /* Don't override timeouts which shrink or (later) disable | ||
181 | * the async ring; just the I/O watchdog. Note that if a | ||
182 | * SHRINK were pending, OFF would never be requested. | ||
183 | */ | ||
184 | if (timer_pending(&ehci->watchdog) | ||
185 | && ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF)) | ||
186 | & ehci->actions)) | ||
187 | return; | ||
188 | |||
179 | if (!test_and_set_bit (action, &ehci->actions)) { | 189 | if (!test_and_set_bit (action, &ehci->actions)) { |
180 | unsigned long t; | 190 | unsigned long t; |
181 | 191 | ||
@@ -188,18 +198,13 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) | |||
188 | break; | 198 | break; |
189 | // case TIMER_ASYNC_SHRINK: | 199 | // case TIMER_ASYNC_SHRINK: |
190 | default: | 200 | default: |
191 | t = EHCI_SHRINK_JIFFIES; | 201 | /* add a jiffie since we synch against the |
202 | * 8 KHz uframe counter. | ||
203 | */ | ||
204 | t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1; | ||
192 | break; | 205 | break; |
193 | } | 206 | } |
194 | t += jiffies; | 207 | mod_timer(&ehci->watchdog, t + jiffies); |
195 | // all timings except IAA watchdog can be overridden. | ||
196 | // async queue SHRINK often precedes IAA. while it's ready | ||
197 | // to go OFF neither can matter, and afterwards the IO | ||
198 | // watchdog stops unless there's still periodic traffic. | ||
199 | if (time_before_eq(t, ehci->watchdog.expires) | ||
200 | && timer_pending (&ehci->watchdog)) | ||
201 | return; | ||
202 | mod_timer (&ehci->watchdog, t); | ||
203 | } | 208 | } |
204 | } | 209 | } |
205 | 210 | ||
@@ -678,7 +683,7 @@ struct ehci_fstn { | |||
678 | * needed (mostly in root hub code). | 683 | * needed (mostly in root hub code). |
679 | */ | 684 | */ |
680 | 685 | ||
681 | #define ehci_is_TDI(e) ((e)->is_tdi_rh_tt) | 686 | #define ehci_is_TDI(e) (ehci_to_hcd(e)->has_tt) |
682 | 687 | ||
683 | /* Returns the speed of a device attached to a port on the root hub. */ | 688 | /* Returns the speed of a device attached to a port on the root hub. */ |
684 | static inline unsigned int | 689 | static inline unsigned int |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 20b9a0d07420..ce1ca0ba0515 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -94,6 +94,10 @@ static void write_ptddata_to_fifo(struct isp116x *isp116x, void *buf, int len) | |||
94 | u16 w; | 94 | u16 w; |
95 | int quot = len % 4; | 95 | int quot = len % 4; |
96 | 96 | ||
97 | /* buffer is already in 'usb data order', which is LE. */ | ||
98 | /* When reading buffer as u16, we have to take care byte order */ | ||
99 | /* doesn't get mixed up */ | ||
100 | |||
97 | if ((unsigned long)dp2 & 1) { | 101 | if ((unsigned long)dp2 & 1) { |
98 | /* not aligned */ | 102 | /* not aligned */ |
99 | for (; len > 1; len -= 2) { | 103 | for (; len > 1; len -= 2) { |
@@ -105,8 +109,11 @@ static void write_ptddata_to_fifo(struct isp116x *isp116x, void *buf, int len) | |||
105 | isp116x_write_data16(isp116x, (u16) * dp); | 109 | isp116x_write_data16(isp116x, (u16) * dp); |
106 | } else { | 110 | } else { |
107 | /* aligned */ | 111 | /* aligned */ |
108 | for (; len > 1; len -= 2) | 112 | for (; len > 1; len -= 2) { |
109 | isp116x_raw_write_data16(isp116x, *dp2++); | 113 | /* Keep byte order ! */ |
114 | isp116x_raw_write_data16(isp116x, cpu_to_le16(*dp2++)); | ||
115 | } | ||
116 | |||
110 | if (len) | 117 | if (len) |
111 | isp116x_write_data16(isp116x, 0xff & *((u8 *) dp2)); | 118 | isp116x_write_data16(isp116x, 0xff & *((u8 *) dp2)); |
112 | } | 119 | } |
@@ -124,6 +131,10 @@ static void read_ptddata_from_fifo(struct isp116x *isp116x, void *buf, int len) | |||
124 | u16 w; | 131 | u16 w; |
125 | int quot = len % 4; | 132 | int quot = len % 4; |
126 | 133 | ||
134 | /* buffer is already in 'usb data order', which is LE. */ | ||
135 | /* When reading buffer as u16, we have to take care byte order */ | ||
136 | /* doesn't get mixed up */ | ||
137 | |||
127 | if ((unsigned long)dp2 & 1) { | 138 | if ((unsigned long)dp2 & 1) { |
128 | /* not aligned */ | 139 | /* not aligned */ |
129 | for (; len > 1; len -= 2) { | 140 | for (; len > 1; len -= 2) { |
@@ -131,12 +142,16 @@ static void read_ptddata_from_fifo(struct isp116x *isp116x, void *buf, int len) | |||
131 | *dp++ = w & 0xff; | 142 | *dp++ = w & 0xff; |
132 | *dp++ = (w >> 8) & 0xff; | 143 | *dp++ = (w >> 8) & 0xff; |
133 | } | 144 | } |
145 | |||
134 | if (len) | 146 | if (len) |
135 | *dp = 0xff & isp116x_read_data16(isp116x); | 147 | *dp = 0xff & isp116x_read_data16(isp116x); |
136 | } else { | 148 | } else { |
137 | /* aligned */ | 149 | /* aligned */ |
138 | for (; len > 1; len -= 2) | 150 | for (; len > 1; len -= 2) { |
139 | *dp2++ = isp116x_raw_read_data16(isp116x); | 151 | /* Keep byte order! */ |
152 | *dp2++ = le16_to_cpu(isp116x_raw_read_data16(isp116x)); | ||
153 | } | ||
154 | |||
140 | if (len) | 155 | if (len) |
141 | *(u8 *) dp2 = 0xff & isp116x_read_data16(isp116x); | 156 | *(u8 *) dp2 = 0xff & isp116x_read_data16(isp116x); |
142 | } | 157 | } |
@@ -867,7 +882,7 @@ static void isp116x_endpoint_disable(struct usb_hcd *hcd, | |||
867 | for (i = 0; i < 100 && !list_empty(&hep->urb_list); i++) | 882 | for (i = 0; i < 100 && !list_empty(&hep->urb_list); i++) |
868 | msleep(3); | 883 | msleep(3); |
869 | if (!list_empty(&hep->urb_list)) | 884 | if (!list_empty(&hep->urb_list)) |
870 | WARN("ep %p not empty?\n", ep); | 885 | WARNING("ep %p not empty?\n", ep); |
871 | 886 | ||
872 | kfree(ep); | 887 | kfree(ep); |
873 | hep->hcpriv = NULL; | 888 | hep->hcpriv = NULL; |
@@ -1592,7 +1607,7 @@ static int __devinit isp116x_probe(struct platform_device *pdev) | |||
1592 | } | 1607 | } |
1593 | 1608 | ||
1594 | /* allocate and initialize hcd */ | 1609 | /* allocate and initialize hcd */ |
1595 | hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id); | 1610 | hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, dev_name(&pdev->dev)); |
1596 | if (!hcd) { | 1611 | if (!hcd) { |
1597 | ret = -ENOMEM; | 1612 | ret = -ENOMEM; |
1598 | goto err5; | 1613 | goto err5; |
diff --git a/drivers/usb/host/isp116x.h b/drivers/usb/host/isp116x.h index 595b90a99848..aa211bafcff9 100644 --- a/drivers/usb/host/isp116x.h +++ b/drivers/usb/host/isp116x.h | |||
@@ -338,7 +338,7 @@ struct isp116x_ep { | |||
338 | #endif | 338 | #endif |
339 | 339 | ||
340 | #define ERR(stuff...) printk(KERN_ERR "116x: " stuff) | 340 | #define ERR(stuff...) printk(KERN_ERR "116x: " stuff) |
341 | #define WARN(stuff...) printk(KERN_WARNING "116x: " stuff) | 341 | #define WARNING(stuff...) printk(KERN_WARNING "116x: " stuff) |
342 | #define INFO(stuff...) printk(KERN_INFO "116x: " stuff) | 342 | #define INFO(stuff...) printk(KERN_INFO "116x: " stuff) |
343 | 343 | ||
344 | /* ------------------------------------------------- */ | 344 | /* ------------------------------------------------- */ |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 4ba96c1e060c..c858f2adb929 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -38,6 +38,7 @@ struct isp1760_hcd { | |||
38 | unsigned i_thresh; | 38 | unsigned i_thresh; |
39 | unsigned long reset_done; | 39 | unsigned long reset_done; |
40 | unsigned long next_statechange; | 40 | unsigned long next_statechange; |
41 | unsigned int devflags; | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) | 44 | static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) |
@@ -378,9 +379,31 @@ static int isp1760_hc_setup(struct usb_hcd *hcd) | |||
378 | { | 379 | { |
379 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 380 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
380 | int result; | 381 | int result; |
381 | u32 scratch; | 382 | u32 scratch, hwmode; |
383 | |||
384 | /* Setup HW Mode Control: This assumes a level active-low interrupt */ | ||
385 | hwmode = HW_DATA_BUS_32BIT; | ||
386 | |||
387 | if (priv->devflags & ISP1760_FLAG_BUS_WIDTH_16) | ||
388 | hwmode &= ~HW_DATA_BUS_32BIT; | ||
389 | if (priv->devflags & ISP1760_FLAG_ANALOG_OC) | ||
390 | hwmode |= HW_ANA_DIGI_OC; | ||
391 | if (priv->devflags & ISP1760_FLAG_DACK_POL_HIGH) | ||
392 | hwmode |= HW_DACK_POL_HIGH; | ||
393 | if (priv->devflags & ISP1760_FLAG_DREQ_POL_HIGH) | ||
394 | hwmode |= HW_DREQ_POL_HIGH; | ||
395 | |||
396 | /* | ||
397 | * We have to set this first in case we're in 16-bit mode. | ||
398 | * Write it twice to ensure correct upper bits if switching | ||
399 | * to 16-bit mode. | ||
400 | */ | ||
401 | isp1760_writel(hwmode, hcd->regs + HC_HW_MODE_CTRL); | ||
402 | isp1760_writel(hwmode, hcd->regs + HC_HW_MODE_CTRL); | ||
382 | 403 | ||
383 | isp1760_writel(0xdeadbabe, hcd->regs + HC_SCRATCH_REG); | 404 | isp1760_writel(0xdeadbabe, hcd->regs + HC_SCRATCH_REG); |
405 | /* Change bus pattern */ | ||
406 | scratch = isp1760_readl(hcd->regs + HC_CHIP_ID_REG); | ||
384 | scratch = isp1760_readl(hcd->regs + HC_SCRATCH_REG); | 407 | scratch = isp1760_readl(hcd->regs + HC_SCRATCH_REG); |
385 | if (scratch != 0xdeadbabe) { | 408 | if (scratch != 0xdeadbabe) { |
386 | printk(KERN_ERR "ISP1760: Scratch test failed.\n"); | 409 | printk(KERN_ERR "ISP1760: Scratch test failed.\n"); |
@@ -403,17 +426,29 @@ static int isp1760_hc_setup(struct usb_hcd *hcd) | |||
403 | 426 | ||
404 | /* Step 11 passed */ | 427 | /* Step 11 passed */ |
405 | 428 | ||
406 | isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_REG); | 429 | isp1760_info(priv, "bus width: %d, oc: %s\n", |
407 | isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_ENABLE); | 430 | (priv->devflags & ISP1760_FLAG_BUS_WIDTH_16) ? |
431 | 16 : 32, (priv->devflags & ISP1760_FLAG_ANALOG_OC) ? | ||
432 | "analog" : "digital"); | ||
408 | 433 | ||
409 | /* ATL reset */ | 434 | /* ATL reset */ |
410 | scratch = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); | 435 | isp1760_writel(hwmode | ALL_ATX_RESET, hcd->regs + HC_HW_MODE_CTRL); |
411 | isp1760_writel(scratch | ALL_ATX_RESET, hcd->regs + HC_HW_MODE_CTRL); | ||
412 | mdelay(10); | 436 | mdelay(10); |
413 | isp1760_writel(scratch, hcd->regs + HC_HW_MODE_CTRL); | 437 | isp1760_writel(hwmode, hcd->regs + HC_HW_MODE_CTRL); |
414 | 438 | ||
415 | isp1760_writel(PORT1_POWER | PORT1_INIT2, hcd->regs + HC_PORT1_CTRL); | 439 | isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_REG); |
416 | mdelay(10); | 440 | isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_ENABLE); |
441 | |||
442 | /* | ||
443 | * PORT 1 Control register of the ISP1760 is the OTG control | ||
444 | * register on ISP1761. | ||
445 | */ | ||
446 | if (!(priv->devflags & ISP1760_FLAG_ISP1761) && | ||
447 | !(priv->devflags & ISP1760_FLAG_PORT1_DIS)) { | ||
448 | isp1760_writel(PORT1_POWER | PORT1_INIT2, | ||
449 | hcd->regs + HC_PORT1_CTRL); | ||
450 | mdelay(10); | ||
451 | } | ||
417 | 452 | ||
418 | priv->hcs_params = isp1760_readl(hcd->regs + HC_HCSPARAMS); | 453 | priv->hcs_params = isp1760_readl(hcd->regs + HC_HCSPARAMS); |
419 | 454 | ||
@@ -453,8 +488,7 @@ static int isp1760_run(struct usb_hcd *hcd) | |||
453 | hcd->state = HC_STATE_RUNNING; | 488 | hcd->state = HC_STATE_RUNNING; |
454 | isp1760_enable_interrupts(hcd); | 489 | isp1760_enable_interrupts(hcd); |
455 | temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); | 490 | temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); |
456 | temp |= FINAL_HW_CONFIG; | 491 | isp1760_writel(temp | HW_GLOBAL_INTR_EN, hcd->regs + HC_HW_MODE_CTRL); |
457 | isp1760_writel(temp, hcd->regs + HC_HW_MODE_CTRL); | ||
458 | 492 | ||
459 | command = isp1760_readl(hcd->regs + HC_USBCMD); | 493 | command = isp1760_readl(hcd->regs + HC_USBCMD); |
460 | command &= ~(CMD_LRESET|CMD_RESET); | 494 | command &= ~(CMD_LRESET|CMD_RESET); |
@@ -782,8 +816,8 @@ static void enqueue_one_int_qtd(u32 int_regs, u32 payload, | |||
782 | qtd->status |= slot << 16; | 816 | qtd->status |= slot << 16; |
783 | } | 817 | } |
784 | 818 | ||
785 | void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | 819 | static void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, |
786 | struct isp1760_qtd *qtd) | 820 | struct isp1760_qtd *qtd) |
787 | { | 821 | { |
788 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 822 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
789 | u32 skip_map, or_map; | 823 | u32 skip_map, or_map; |
@@ -816,8 +850,8 @@ void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
816 | isp1760_writel(buffstatus, hcd->regs + HC_BUFFER_STATUS_REG); | 850 | isp1760_writel(buffstatus, hcd->regs + HC_BUFFER_STATUS_REG); |
817 | } | 851 | } |
818 | 852 | ||
819 | void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | 853 | static void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, |
820 | struct isp1760_qtd *qtd) | 854 | struct isp1760_qtd *qtd) |
821 | { | 855 | { |
822 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 856 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
823 | u32 skip_map, or_map; | 857 | u32 skip_map, or_map; |
@@ -988,7 +1022,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
988 | * This did not trigger for a long time now. | 1022 | * This did not trigger for a long time now. |
989 | */ | 1023 | */ |
990 | printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " | 1024 | printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " |
991 | "%d of %d done: %08x cur: %08x\n", qtd, | 1025 | "%d of %zu done: %08x cur: %08x\n", qtd, |
992 | urb, qh, PTD_XFERRED_LENGTH(dw3), | 1026 | urb, qh, PTD_XFERRED_LENGTH(dw3), |
993 | qtd->length, done_map, | 1027 | qtd->length, done_map, |
994 | (1 << queue_entry)); | 1028 | (1 << queue_entry)); |
@@ -1088,7 +1122,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
1088 | } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) { | 1122 | } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) { |
1089 | /* short BULK received */ | 1123 | /* short BULK received */ |
1090 | 1124 | ||
1091 | printk(KERN_ERR "short bulk, %d instead %d\n", length, | 1125 | printk(KERN_ERR "short bulk, %d instead %zu\n", length, |
1092 | qtd->length); | 1126 | qtd->length); |
1093 | if (urb->transfer_flags & URB_SHORT_NOT_OK) { | 1127 | if (urb->transfer_flags & URB_SHORT_NOT_OK) { |
1094 | urb->status = -EREMOTEIO; | 1128 | urb->status = -EREMOTEIO; |
@@ -1592,7 +1626,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1592 | struct inter_packet_info *ints; | 1626 | struct inter_packet_info *ints; |
1593 | u32 i; | 1627 | u32 i; |
1594 | u32 reg_base, or_reg, skip_reg; | 1628 | u32 reg_base, or_reg, skip_reg; |
1595 | int flags; | 1629 | unsigned long flags; |
1596 | struct ptd ptd; | 1630 | struct ptd ptd; |
1597 | 1631 | ||
1598 | switch (usb_pipetype(urb->pipe)) { | 1632 | switch (usb_pipetype(urb->pipe)) { |
@@ -2061,7 +2095,7 @@ static void isp1760_endpoint_disable(struct usb_hcd *usb_hcd, | |||
2061 | struct isp1760_hcd *priv = hcd_to_priv(usb_hcd); | 2095 | struct isp1760_hcd *priv = hcd_to_priv(usb_hcd); |
2062 | struct isp1760_qh *qh; | 2096 | struct isp1760_qh *qh; |
2063 | struct isp1760_qtd *qtd; | 2097 | struct isp1760_qtd *qtd; |
2064 | u32 flags; | 2098 | unsigned long flags; |
2065 | 2099 | ||
2066 | spin_lock_irqsave(&priv->lock, flags); | 2100 | spin_lock_irqsave(&priv->lock, flags); |
2067 | qh = ep->hcpriv; | 2101 | qh = ep->hcpriv; |
@@ -2112,6 +2146,7 @@ static int isp1760_get_frame(struct usb_hcd *hcd) | |||
2112 | static void isp1760_stop(struct usb_hcd *hcd) | 2146 | static void isp1760_stop(struct usb_hcd *hcd) |
2113 | { | 2147 | { |
2114 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 2148 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
2149 | u32 temp; | ||
2115 | 2150 | ||
2116 | isp1760_hub_control(hcd, ClearPortFeature, USB_PORT_FEAT_POWER, 1, | 2151 | isp1760_hub_control(hcd, ClearPortFeature, USB_PORT_FEAT_POWER, 1, |
2117 | NULL, 0); | 2152 | NULL, 0); |
@@ -2120,7 +2155,8 @@ static void isp1760_stop(struct usb_hcd *hcd) | |||
2120 | spin_lock_irq(&priv->lock); | 2155 | spin_lock_irq(&priv->lock); |
2121 | ehci_reset(priv); | 2156 | ehci_reset(priv); |
2122 | /* Disable IRQ */ | 2157 | /* Disable IRQ */ |
2123 | isp1760_writel(HW_DATA_BUS_32BIT, hcd->regs + HC_HW_MODE_CTRL); | 2158 | temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); |
2159 | isp1760_writel(temp &= ~HW_GLOBAL_INTR_EN, hcd->regs + HC_HW_MODE_CTRL); | ||
2124 | spin_unlock_irq(&priv->lock); | 2160 | spin_unlock_irq(&priv->lock); |
2125 | 2161 | ||
2126 | isp1760_writel(0, hcd->regs + HC_CONFIGFLAG); | 2162 | isp1760_writel(0, hcd->regs + HC_CONFIGFLAG); |
@@ -2128,10 +2164,11 @@ static void isp1760_stop(struct usb_hcd *hcd) | |||
2128 | 2164 | ||
2129 | static void isp1760_shutdown(struct usb_hcd *hcd) | 2165 | static void isp1760_shutdown(struct usb_hcd *hcd) |
2130 | { | 2166 | { |
2131 | u32 command; | 2167 | u32 command, temp; |
2132 | 2168 | ||
2133 | isp1760_stop(hcd); | 2169 | isp1760_stop(hcd); |
2134 | isp1760_writel(HW_DATA_BUS_32BIT, hcd->regs + HC_HW_MODE_CTRL); | 2170 | temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); |
2171 | isp1760_writel(temp &= ~HW_GLOBAL_INTR_EN, hcd->regs + HC_HW_MODE_CTRL); | ||
2135 | 2172 | ||
2136 | command = isp1760_readl(hcd->regs + HC_USBCMD); | 2173 | command = isp1760_readl(hcd->regs + HC_USBCMD); |
2137 | command &= ~CMD_RUN; | 2174 | command &= ~CMD_RUN; |
@@ -2183,7 +2220,8 @@ void deinit_kmem_cache(void) | |||
2183 | } | 2220 | } |
2184 | 2221 | ||
2185 | struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, | 2222 | struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, |
2186 | u64 irqflags, struct device *dev, const char *busname) | 2223 | u64 irqflags, struct device *dev, const char *busname, |
2224 | unsigned int devflags) | ||
2187 | { | 2225 | { |
2188 | struct usb_hcd *hcd; | 2226 | struct usb_hcd *hcd; |
2189 | struct isp1760_hcd *priv; | 2227 | struct isp1760_hcd *priv; |
@@ -2195,11 +2233,12 @@ struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, | |||
2195 | /* prevent usb-core allocating DMA pages */ | 2233 | /* prevent usb-core allocating DMA pages */ |
2196 | dev->dma_mask = NULL; | 2234 | dev->dma_mask = NULL; |
2197 | 2235 | ||
2198 | hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev->bus_id); | 2236 | hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev)); |
2199 | if (!hcd) | 2237 | if (!hcd) |
2200 | return ERR_PTR(-ENOMEM); | 2238 | return ERR_PTR(-ENOMEM); |
2201 | 2239 | ||
2202 | priv = hcd_to_priv(hcd); | 2240 | priv = hcd_to_priv(hcd); |
2241 | priv->devflags = devflags; | ||
2203 | init_memory(priv); | 2242 | init_memory(priv); |
2204 | hcd->regs = ioremap(res_start, res_len); | 2243 | hcd->regs = ioremap(res_start, res_len); |
2205 | if (!hcd->regs) { | 2244 | if (!hcd->regs) { |
@@ -2207,14 +2246,14 @@ struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, | |||
2207 | goto err_put; | 2246 | goto err_put; |
2208 | } | 2247 | } |
2209 | 2248 | ||
2210 | ret = usb_add_hcd(hcd, irq, irqflags); | ||
2211 | if (ret) | ||
2212 | goto err_unmap; | ||
2213 | |||
2214 | hcd->irq = irq; | 2249 | hcd->irq = irq; |
2215 | hcd->rsrc_start = res_start; | 2250 | hcd->rsrc_start = res_start; |
2216 | hcd->rsrc_len = res_len; | 2251 | hcd->rsrc_len = res_len; |
2217 | 2252 | ||
2253 | ret = usb_add_hcd(hcd, irq, irqflags); | ||
2254 | if (ret) | ||
2255 | goto err_unmap; | ||
2256 | |||
2218 | return hcd; | 2257 | return hcd; |
2219 | 2258 | ||
2220 | err_unmap: | 2259 | err_unmap: |
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h index 3d86d0f6b147..6473dd86993c 100644 --- a/drivers/usb/host/isp1760-hcd.h +++ b/drivers/usb/host/isp1760-hcd.h | |||
@@ -3,7 +3,8 @@ | |||
3 | 3 | ||
4 | /* exports for if */ | 4 | /* exports for if */ |
5 | struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, | 5 | struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, |
6 | u64 irqflags, struct device *dev, const char *busname); | 6 | u64 irqflags, struct device *dev, const char *busname, |
7 | unsigned int devflags); | ||
7 | int init_kmem_once(void); | 8 | int init_kmem_once(void); |
8 | void deinit_kmem_cache(void); | 9 | void deinit_kmem_cache(void); |
9 | 10 | ||
@@ -31,6 +32,7 @@ void deinit_kmem_cache(void); | |||
31 | /* Configuration Register */ | 32 | /* Configuration Register */ |
32 | #define HC_HW_MODE_CTRL 0x300 | 33 | #define HC_HW_MODE_CTRL 0x300 |
33 | #define ALL_ATX_RESET (1 << 31) | 34 | #define ALL_ATX_RESET (1 << 31) |
35 | #define HW_ANA_DIGI_OC (1 << 15) | ||
34 | #define HW_DATA_BUS_32BIT (1 << 8) | 36 | #define HW_DATA_BUS_32BIT (1 << 8) |
35 | #define HW_DACK_POL_HIGH (1 << 6) | 37 | #define HW_DACK_POL_HIGH (1 << 6) |
36 | #define HW_DREQ_POL_HIGH (1 << 5) | 38 | #define HW_DREQ_POL_HIGH (1 << 5) |
@@ -56,13 +58,14 @@ void deinit_kmem_cache(void); | |||
56 | #define PORT1_POWER (3 << 3) | 58 | #define PORT1_POWER (3 << 3) |
57 | #define PORT1_INIT1 (1 << 7) | 59 | #define PORT1_INIT1 (1 << 7) |
58 | #define PORT1_INIT2 (1 << 23) | 60 | #define PORT1_INIT2 (1 << 23) |
61 | #define HW_OTG_CTRL_SET 0x374 | ||
62 | #define HW_OTG_CTRL_CLR 0x376 | ||
59 | 63 | ||
60 | /* Interrupt Register */ | 64 | /* Interrupt Register */ |
61 | #define HC_INTERRUPT_REG 0x310 | 65 | #define HC_INTERRUPT_REG 0x310 |
62 | 66 | ||
63 | #define HC_INTERRUPT_ENABLE 0x314 | 67 | #define HC_INTERRUPT_ENABLE 0x314 |
64 | #define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT | HC_EOT_INT) | 68 | #define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT | HC_EOT_INT) |
65 | #define FINAL_HW_CONFIG (HW_GLOBAL_INTR_EN | HW_DATA_BUS_32BIT) | ||
66 | 69 | ||
67 | #define HC_ISO_INT (1 << 9) | 70 | #define HC_ISO_INT (1 << 9) |
68 | #define HC_ATL_INT (1 << 8) | 71 | #define HC_ATL_INT (1 << 8) |
@@ -122,6 +125,19 @@ typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
122 | #define isp1760_err(priv, fmt, args...) \ | 125 | #define isp1760_err(priv, fmt, args...) \ |
123 | dev_err(priv_to_hcd(priv)->self.controller, fmt, ##args) | 126 | dev_err(priv_to_hcd(priv)->self.controller, fmt, ##args) |
124 | 127 | ||
128 | /* | ||
129 | * Device flags that can vary from board to board. All of these | ||
130 | * indicate the most "atypical" case, so that a devflags of 0 is | ||
131 | * a sane default configuration. | ||
132 | */ | ||
133 | #define ISP1760_FLAG_PORT1_DIS 0x00000001 /* Port 1 disabled */ | ||
134 | #define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */ | ||
135 | #define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */ | ||
136 | #define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */ | ||
137 | #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */ | ||
138 | #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */ | ||
139 | #define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */ | ||
140 | |||
125 | /* chip memory management */ | 141 | /* chip memory management */ |
126 | struct memory_chunk { | 142 | struct memory_chunk { |
127 | unsigned int start; | 143 | unsigned int start; |
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 73fb2a38f1e4..051ef7b6bdc6 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -35,13 +35,15 @@ static int of_isp1760_probe(struct of_device *dev, | |||
35 | int virq; | 35 | int virq; |
36 | u64 res_len; | 36 | u64 res_len; |
37 | int ret; | 37 | int ret; |
38 | const unsigned int *prop; | ||
39 | unsigned int devflags = 0; | ||
38 | 40 | ||
39 | ret = of_address_to_resource(dp, 0, &memory); | 41 | ret = of_address_to_resource(dp, 0, &memory); |
40 | if (ret) | 42 | if (ret) |
41 | return -ENXIO; | 43 | return -ENXIO; |
42 | 44 | ||
43 | res = request_mem_region(memory.start, memory.end - memory.start + 1, | 45 | res = request_mem_region(memory.start, memory.end - memory.start + 1, |
44 | dev->dev.bus_id); | 46 | dev_name(&dev->dev)); |
45 | if (!res) | 47 | if (!res) |
46 | return -EBUSY; | 48 | return -EBUSY; |
47 | 49 | ||
@@ -55,8 +57,32 @@ static int of_isp1760_probe(struct of_device *dev, | |||
55 | virq = irq_create_of_mapping(oirq.controller, oirq.specifier, | 57 | virq = irq_create_of_mapping(oirq.controller, oirq.specifier, |
56 | oirq.size); | 58 | oirq.size); |
57 | 59 | ||
60 | if (of_device_is_compatible(dp, "nxp,usb-isp1761")) | ||
61 | devflags |= ISP1760_FLAG_ISP1761; | ||
62 | |||
63 | if (of_get_property(dp, "port1-disable", NULL) != NULL) | ||
64 | devflags |= ISP1760_FLAG_PORT1_DIS; | ||
65 | |||
66 | /* Some systems wire up only 16 of the 32 data lines */ | ||
67 | prop = of_get_property(dp, "bus-width", NULL); | ||
68 | if (prop && *prop == 16) | ||
69 | devflags |= ISP1760_FLAG_BUS_WIDTH_16; | ||
70 | |||
71 | if (of_get_property(dp, "port1-otg", NULL) != NULL) | ||
72 | devflags |= ISP1760_FLAG_OTG_EN; | ||
73 | |||
74 | if (of_get_property(dp, "analog-oc", NULL) != NULL) | ||
75 | devflags |= ISP1760_FLAG_ANALOG_OC; | ||
76 | |||
77 | if (of_get_property(dp, "dack-polarity", NULL) != NULL) | ||
78 | devflags |= ISP1760_FLAG_DACK_POL_HIGH; | ||
79 | |||
80 | if (of_get_property(dp, "dreq-polarity", NULL) != NULL) | ||
81 | devflags |= ISP1760_FLAG_DREQ_POL_HIGH; | ||
82 | |||
58 | hcd = isp1760_register(memory.start, res_len, virq, | 83 | hcd = isp1760_register(memory.start, res_len, virq, |
59 | IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev->dev.bus_id); | 84 | IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev), |
85 | devflags); | ||
60 | if (IS_ERR(hcd)) { | 86 | if (IS_ERR(hcd)) { |
61 | ret = PTR_ERR(hcd); | 87 | ret = PTR_ERR(hcd); |
62 | goto release_reg; | 88 | goto release_reg; |
@@ -87,6 +113,9 @@ static struct of_device_id of_isp1760_match[] = { | |||
87 | { | 113 | { |
88 | .compatible = "nxp,usb-isp1760", | 114 | .compatible = "nxp,usb-isp1760", |
89 | }, | 115 | }, |
116 | { | ||
117 | .compatible = "nxp,usb-isp1761", | ||
118 | }, | ||
90 | { }, | 119 | { }, |
91 | }; | 120 | }; |
92 | MODULE_DEVICE_TABLE(of, of_isp1760_match); | 121 | MODULE_DEVICE_TABLE(of, of_isp1760_match); |
@@ -104,8 +133,8 @@ static u32 nxp_pci_io_base; | |||
104 | static u32 iolength; | 133 | static u32 iolength; |
105 | static u32 pci_mem_phy0; | 134 | static u32 pci_mem_phy0; |
106 | static u32 length; | 135 | static u32 length; |
107 | static u8 *chip_addr; | 136 | static u8 __iomem *chip_addr; |
108 | static u8 *iobase; | 137 | static u8 __iomem *iobase; |
109 | 138 | ||
110 | static int __devinit isp1761_pci_probe(struct pci_dev *dev, | 139 | static int __devinit isp1761_pci_probe(struct pci_dev *dev, |
111 | const struct pci_device_id *id) | 140 | const struct pci_device_id *id) |
@@ -116,6 +145,7 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev, | |||
116 | int length; | 145 | int length; |
117 | int status = 1; | 146 | int status = 1; |
118 | struct usb_hcd *hcd; | 147 | struct usb_hcd *hcd; |
148 | unsigned int devflags = 0; | ||
119 | 149 | ||
120 | if (usb_disabled()) | 150 | if (usb_disabled()) |
121 | return -ENODEV; | 151 | return -ENODEV; |
@@ -200,7 +230,8 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev, | |||
200 | 230 | ||
201 | dev->dev.dma_mask = NULL; | 231 | dev->dev.dma_mask = NULL; |
202 | hcd = isp1760_register(pci_mem_phy0, length, dev->irq, | 232 | hcd = isp1760_register(pci_mem_phy0, length, dev->irq, |
203 | IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev->dev.bus_id); | 233 | IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev), |
234 | devflags); | ||
204 | pci_set_drvdata(dev, hcd); | 235 | pci_set_drvdata(dev, hcd); |
205 | if (!hcd) | 236 | if (!hcd) |
206 | return 0; | 237 | return 0; |
@@ -256,7 +287,7 @@ static struct pci_driver isp1761_pci_driver = { | |||
256 | 287 | ||
257 | static int __init isp1760_init(void) | 288 | static int __init isp1760_init(void) |
258 | { | 289 | { |
259 | int ret; | 290 | int ret = -ENODEV; |
260 | 291 | ||
261 | init_kmem_once(); | 292 | init_kmem_once(); |
262 | 293 | ||
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index c96db1153dcf..a5d8e550d897 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -91,7 +91,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
91 | 91 | ||
92 | /*-------------------------------------------------------------------------*/ | 92 | /*-------------------------------------------------------------------------*/ |
93 | 93 | ||
94 | static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | 94 | static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); |
95 | 95 | ||
96 | /* configure so an HC device and id are always provided */ | 96 | /* configure so an HC device and id are always provided */ |
97 | /* always called with process context; sleeping is OK */ | 97 | /* always called with process context; sleeping is OK */ |
@@ -184,13 +184,14 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
184 | * context, "rmmod" or something similar. | 184 | * context, "rmmod" or something similar. |
185 | * | 185 | * |
186 | */ | 186 | */ |
187 | static int usb_hcd_at91_remove(struct usb_hcd *hcd, | 187 | static void usb_hcd_at91_remove(struct usb_hcd *hcd, |
188 | struct platform_device *pdev) | 188 | struct platform_device *pdev) |
189 | { | 189 | { |
190 | usb_remove_hcd(hcd); | 190 | usb_remove_hcd(hcd); |
191 | at91_stop_hc(pdev); | 191 | at91_stop_hc(pdev); |
192 | iounmap(hcd->regs); | 192 | iounmap(hcd->regs); |
193 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 193 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
194 | usb_put_hcd(hcd); | ||
194 | 195 | ||
195 | if (cpu_is_at91sam9261()) | 196 | if (cpu_is_at91sam9261()) |
196 | clk_put(hclk); | 197 | clk_put(hclk); |
@@ -199,7 +200,6 @@ static int usb_hcd_at91_remove(struct usb_hcd *hcd, | |||
199 | fclk = iclk = hclk = NULL; | 200 | fclk = iclk = hclk = NULL; |
200 | 201 | ||
201 | dev_set_drvdata(&pdev->dev, NULL); | 202 | dev_set_drvdata(&pdev->dev, NULL); |
202 | return 0; | ||
203 | } | 203 | } |
204 | 204 | ||
205 | /*-------------------------------------------------------------------------*/ | 205 | /*-------------------------------------------------------------------------*/ |
@@ -261,6 +261,7 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
261 | */ | 261 | */ |
262 | .hub_status_data = ohci_hub_status_data, | 262 | .hub_status_data = ohci_hub_status_data, |
263 | .hub_control = ohci_hub_control, | 263 | .hub_control = ohci_hub_control, |
264 | .hub_irq_enable = ohci_rhsc_enable, | ||
264 | #ifdef CONFIG_PM | 265 | #ifdef CONFIG_PM |
265 | .bus_suspend = ohci_bus_suspend, | 266 | .bus_suspend = ohci_bus_suspend, |
266 | .bus_resume = ohci_bus_resume, | 267 | .bus_resume = ohci_bus_resume, |
@@ -308,7 +309,8 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | |||
308 | } | 309 | } |
309 | 310 | ||
310 | device_init_wakeup(&pdev->dev, 0); | 311 | device_init_wakeup(&pdev->dev, 0); |
311 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); | 312 | usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); |
313 | return 0; | ||
312 | } | 314 | } |
313 | 315 | ||
314 | #ifdef CONFIG_PM | 316 | #ifdef CONFIG_PM |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 1b9abdba920b..c0948008fe3d 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Bus Glue for AMD Alchemy Au1xxx | 8 | * Bus Glue for AMD Alchemy Au1xxx |
9 | * | 9 | * |
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | 10 | * Written by Christopher Hoover <ch@hpl.hp.com> |
11 | * Based on fragments of previous driver by Rusell King et al. | 11 | * Based on fragments of previous driver by Russell King et al. |
12 | * | 12 | * |
13 | * Modified for LH7A404 from ohci-sa1111.c | 13 | * Modified for LH7A404 from ohci-sa1111.c |
14 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> | 14 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> |
@@ -34,7 +34,8 @@ | |||
34 | #ifdef __LITTLE_ENDIAN | 34 | #ifdef __LITTLE_ENDIAN |
35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) | 35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) |
36 | #elif __BIG_ENDIAN | 36 | #elif __BIG_ENDIAN |
37 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | USBH_ENABLE_BE) | 37 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ |
38 | USBH_ENABLE_BE) | ||
38 | #else | 39 | #else |
39 | #error not byte order defined | 40 | #error not byte order defined |
40 | #endif | 41 | #endif |
@@ -46,213 +47,87 @@ | |||
46 | #define USB_MCFG_RDCOMB (1<<30) | 47 | #define USB_MCFG_RDCOMB (1<<30) |
47 | #define USB_MCFG_SSDEN (1<<23) | 48 | #define USB_MCFG_SSDEN (1<<23) |
48 | #define USB_MCFG_OHCCLKEN (1<<16) | 49 | #define USB_MCFG_OHCCLKEN (1<<16) |
50 | #ifdef CONFIG_DMA_COHERENT | ||
49 | #define USB_MCFG_UCAM (1<<7) | 51 | #define USB_MCFG_UCAM (1<<7) |
52 | #else | ||
53 | #define USB_MCFG_UCAM (0) | ||
54 | #endif | ||
50 | #define USB_MCFG_OBMEN (1<<1) | 55 | #define USB_MCFG_OBMEN (1<<1) |
51 | #define USB_MCFG_OMEMEN (1<<0) | 56 | #define USB_MCFG_OMEMEN (1<<0) |
52 | 57 | ||
53 | #define USBH_ENABLE_CE USB_MCFG_OHCCLKEN | 58 | #define USBH_ENABLE_CE USB_MCFG_OHCCLKEN |
54 | #ifdef CONFIG_DMA_COHERENT | 59 | |
55 | #define USBH_ENABLE_INIT (USB_MCFG_OHCCLKEN \ | 60 | #define USBH_ENABLE_INIT (USB_MCFG_PFEN | USB_MCFG_RDCOMB | \ |
56 | | USB_MCFG_PFEN | USB_MCFG_RDCOMB \ | 61 | USBH_ENABLE_CE | USB_MCFG_SSDEN | \ |
57 | | USB_MCFG_SSDEN | USB_MCFG_UCAM \ | 62 | USB_MCFG_UCAM | \ |
58 | | USB_MCFG_OBMEN | USB_MCFG_OMEMEN) | 63 | USB_MCFG_OBMEN | USB_MCFG_OMEMEN) |
59 | #else | 64 | |
60 | #define USBH_ENABLE_INIT (USB_MCFG_OHCCLKEN \ | ||
61 | | USB_MCFG_PFEN | USB_MCFG_RDCOMB \ | ||
62 | | USB_MCFG_SSDEN \ | ||
63 | | USB_MCFG_OBMEN | USB_MCFG_OMEMEN) | ||
64 | #endif | ||
65 | #define USBH_DISABLE (USB_MCFG_OBMEN | USB_MCFG_OMEMEN) | 65 | #define USBH_DISABLE (USB_MCFG_OBMEN | USB_MCFG_OMEMEN) |
66 | 66 | ||
67 | #endif /* Au1200 */ | 67 | #endif /* Au1200 */ |
68 | 68 | ||
69 | extern int usb_disabled(void); | 69 | extern int usb_disabled(void); |
70 | 70 | ||
71 | /*-------------------------------------------------------------------------*/ | 71 | static void au1xxx_start_ohc(void) |
72 | |||
73 | static void au1xxx_start_ohc(struct platform_device *dev) | ||
74 | { | 72 | { |
75 | printk(KERN_DEBUG __FILE__ | ||
76 | ": starting Au1xxx OHCI USB Controller\n"); | ||
77 | |||
78 | /* enable host controller */ | 73 | /* enable host controller */ |
79 | |||
80 | #ifndef CONFIG_SOC_AU1200 | 74 | #ifndef CONFIG_SOC_AU1200 |
81 | |||
82 | au_writel(USBH_ENABLE_CE, USB_HOST_CONFIG); | 75 | au_writel(USBH_ENABLE_CE, USB_HOST_CONFIG); |
76 | au_sync(); | ||
83 | udelay(1000); | 77 | udelay(1000); |
84 | au_writel(USBH_ENABLE_INIT, USB_HOST_CONFIG); | ||
85 | udelay(1000); | ||
86 | |||
87 | #else /* Au1200 */ | ||
88 | 78 | ||
89 | /* write HW defaults again in case Yamon cleared them */ | 79 | au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_INIT, USB_HOST_CONFIG); |
90 | if (au_readl(USB_HOST_CONFIG) == 0) { | 80 | au_sync(); |
91 | au_writel(0x00d02000, USB_HOST_CONFIG); | ||
92 | au_readl(USB_HOST_CONFIG); | ||
93 | udelay(1000); | ||
94 | } | ||
95 | au_writel(USBH_ENABLE_CE | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); | ||
96 | au_readl(USB_HOST_CONFIG); | ||
97 | udelay(1000); | 81 | udelay(1000); |
98 | au_writel(USBH_ENABLE_INIT | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); | ||
99 | au_readl(USB_HOST_CONFIG); | ||
100 | udelay(1000); | ||
101 | |||
102 | #endif /* Au1200 */ | ||
103 | 82 | ||
104 | #ifndef CONFIG_SOC_AU1200 | ||
105 | /* wait for reset complete (read register twice; see au1500 errata) */ | 83 | /* wait for reset complete (read register twice; see au1500 errata) */ |
106 | while (au_readl(USB_HOST_CONFIG), | 84 | while (au_readl(USB_HOST_CONFIG), |
107 | !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) | 85 | !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) |
108 | #endif | ||
109 | udelay(1000); | 86 | udelay(1000); |
110 | 87 | ||
111 | printk(KERN_DEBUG __FILE__ | ||
112 | ": Clock to USB host has been enabled \n"); | ||
113 | } | ||
114 | |||
115 | static void au1xxx_stop_ohc(struct platform_device *dev) | ||
116 | { | ||
117 | printk(KERN_DEBUG __FILE__ | ||
118 | ": stopping Au1xxx OHCI USB Controller\n"); | ||
119 | |||
120 | #ifndef CONFIG_SOC_AU1200 | ||
121 | |||
122 | /* Disable clock */ | ||
123 | au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG); | ||
124 | |||
125 | #else /* Au1200 */ | 88 | #else /* Au1200 */ |
126 | 89 | au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_CE, USB_HOST_CONFIG); | |
127 | /* Disable mem */ | 90 | au_sync(); |
128 | au_writel(~USBH_DISABLE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); | ||
129 | udelay(1000); | 91 | udelay(1000); |
130 | /* Disable clock */ | 92 | |
131 | au_writel(~USBH_ENABLE_CE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); | 93 | au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_INIT, USB_HOST_CONFIG); |
132 | au_readl(USB_HOST_CONFIG); | 94 | au_sync(); |
95 | udelay(2000); | ||
133 | #endif /* Au1200 */ | 96 | #endif /* Au1200 */ |
134 | } | 97 | } |
135 | 98 | ||
136 | 99 | static void au1xxx_stop_ohc(void) | |
137 | /*-------------------------------------------------------------------------*/ | ||
138 | |||
139 | /* configure so an HC device and id are always provided */ | ||
140 | /* always called with process context; sleeping is OK */ | ||
141 | |||
142 | |||
143 | /** | ||
144 | * usb_ohci_au1xxx_probe - initialize Au1xxx-based HCDs | ||
145 | * Context: !in_interrupt() | ||
146 | * | ||
147 | * Allocates basic resources for this USB host controller, and | ||
148 | * then invokes the start() method for the HCD associated with it | ||
149 | * through the hotplug entry's driver_data. | ||
150 | * | ||
151 | */ | ||
152 | static int usb_ohci_au1xxx_probe(const struct hc_driver *driver, | ||
153 | struct platform_device *dev) | ||
154 | { | 100 | { |
155 | int retval; | 101 | #ifdef CONFIG_SOC_AU1200 |
156 | struct usb_hcd *hcd; | 102 | /* Disable mem */ |
157 | 103 | au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_DISABLE, USB_HOST_CONFIG); | |
158 | #if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) | 104 | au_sync(); |
159 | /* Au1200 AB USB does not support coherent memory */ | 105 | udelay(1000); |
160 | if (!(read_c0_prid() & 0xff)) { | ||
161 | pr_info("%s: this is chip revision AB !!\n", | ||
162 | dev->name); | ||
163 | pr_info("%s: update your board or re-configure the kernel\n", | ||
164 | dev->name); | ||
165 | return -ENODEV; | ||
166 | } | ||
167 | #endif | 106 | #endif |
168 | 107 | /* Disable clock */ | |
169 | if (dev->resource[1].flags != IORESOURCE_IRQ) { | 108 | au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG); |
170 | pr_debug("resource[1] is not IORESOURCE_IRQ\n"); | 109 | au_sync(); |
171 | return -ENOMEM; | ||
172 | } | ||
173 | |||
174 | hcd = usb_create_hcd(driver, &dev->dev, "au1xxx"); | ||
175 | if (!hcd) | ||
176 | return -ENOMEM; | ||
177 | hcd->rsrc_start = dev->resource[0].start; | ||
178 | hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; | ||
179 | |||
180 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
181 | pr_debug("request_mem_region failed\n"); | ||
182 | retval = -EBUSY; | ||
183 | goto err1; | ||
184 | } | ||
185 | |||
186 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
187 | if (!hcd->regs) { | ||
188 | pr_debug("ioremap failed\n"); | ||
189 | retval = -ENOMEM; | ||
190 | goto err2; | ||
191 | } | ||
192 | |||
193 | au1xxx_start_ohc(dev); | ||
194 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
195 | |||
196 | retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED); | ||
197 | if (retval == 0) | ||
198 | return retval; | ||
199 | |||
200 | au1xxx_stop_ohc(dev); | ||
201 | iounmap(hcd->regs); | ||
202 | err2: | ||
203 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
204 | err1: | ||
205 | usb_put_hcd(hcd); | ||
206 | return retval; | ||
207 | } | ||
208 | |||
209 | |||
210 | /* may be called without controller electrically present */ | ||
211 | /* may be called with controller, bus, and devices active */ | ||
212 | |||
213 | /** | ||
214 | * usb_hcd_au1xxx_remove - shutdown processing for Au1xxx-based HCDs | ||
215 | * @dev: USB Host Controller being removed | ||
216 | * Context: !in_interrupt() | ||
217 | * | ||
218 | * Reverses the effect of usb_hcd_au1xxx_probe(), first invoking | ||
219 | * the HCD's stop() method. It is always called from a thread | ||
220 | * context, normally "rmmod", "apmd", or something similar. | ||
221 | * | ||
222 | */ | ||
223 | static void usb_ohci_au1xxx_remove(struct usb_hcd *hcd, struct platform_device *dev) | ||
224 | { | ||
225 | usb_remove_hcd(hcd); | ||
226 | au1xxx_stop_ohc(dev); | ||
227 | iounmap(hcd->regs); | ||
228 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
229 | usb_put_hcd(hcd); | ||
230 | } | 110 | } |
231 | 111 | ||
232 | /*-------------------------------------------------------------------------*/ | 112 | static int __devinit ohci_au1xxx_start(struct usb_hcd *hcd) |
233 | |||
234 | static int __devinit | ||
235 | ohci_au1xxx_start (struct usb_hcd *hcd) | ||
236 | { | 113 | { |
237 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 114 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
238 | int ret; | 115 | int ret; |
239 | 116 | ||
240 | ohci_dbg (ohci, "ohci_au1xxx_start, ohci:%p", ohci); | 117 | ohci_dbg(ohci, "ohci_au1xxx_start, ohci:%p", ohci); |
241 | 118 | ||
242 | if ((ret = ohci_init (ohci)) < 0) | 119 | if ((ret = ohci_init(ohci)) < 0) |
243 | return ret; | 120 | return ret; |
244 | 121 | ||
245 | if ((ret = ohci_run (ohci)) < 0) { | 122 | if ((ret = ohci_run(ohci)) < 0) { |
246 | err ("can't start %s", hcd->self.bus_name); | 123 | err ("can't start %s", hcd->self.bus_name); |
247 | ohci_stop (hcd); | 124 | ohci_stop(hcd); |
248 | return ret; | 125 | return ret; |
249 | } | 126 | } |
250 | 127 | ||
251 | return 0; | 128 | return 0; |
252 | } | 129 | } |
253 | 130 | ||
254 | /*-------------------------------------------------------------------------*/ | ||
255 | |||
256 | static const struct hc_driver ohci_au1xxx_hc_driver = { | 131 | static const struct hc_driver ohci_au1xxx_hc_driver = { |
257 | .description = hcd_name, | 132 | .description = hcd_name, |
258 | .product_desc = "Au1xxx OHCI", | 133 | .product_desc = "Au1xxx OHCI", |
@@ -288,6 +163,7 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
288 | */ | 163 | */ |
289 | .hub_status_data = ohci_hub_status_data, | 164 | .hub_status_data = ohci_hub_status_data, |
290 | .hub_control = ohci_hub_control, | 165 | .hub_control = ohci_hub_control, |
166 | .hub_irq_enable = ohci_rhsc_enable, | ||
291 | #ifdef CONFIG_PM | 167 | #ifdef CONFIG_PM |
292 | .bus_suspend = ohci_bus_suspend, | 168 | .bus_suspend = ohci_bus_suspend, |
293 | .bus_resume = ohci_bus_resume, | 169 | .bus_resume = ohci_bus_resume, |
@@ -295,18 +171,66 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
295 | .start_port_reset = ohci_start_port_reset, | 171 | .start_port_reset = ohci_start_port_reset, |
296 | }; | 172 | }; |
297 | 173 | ||
298 | /*-------------------------------------------------------------------------*/ | ||
299 | |||
300 | static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) | 174 | static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) |
301 | { | 175 | { |
302 | int ret; | 176 | int ret; |
303 | 177 | struct usb_hcd *hcd; | |
304 | pr_debug ("In ohci_hcd_au1xxx_drv_probe"); | ||
305 | 178 | ||
306 | if (usb_disabled()) | 179 | if (usb_disabled()) |
307 | return -ENODEV; | 180 | return -ENODEV; |
308 | 181 | ||
309 | ret = usb_ohci_au1xxx_probe(&ohci_au1xxx_hc_driver, pdev); | 182 | #if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) |
183 | /* Au1200 AB USB does not support coherent memory */ | ||
184 | if (!(read_c0_prid() & 0xff)) { | ||
185 | printk(KERN_INFO "%s: this is chip revision AB !!\n", | ||
186 | pdev->name); | ||
187 | printk(KERN_INFO "%s: update your board or re-configure " | ||
188 | "the kernel\n", pdev->name); | ||
189 | return -ENODEV; | ||
190 | } | ||
191 | #endif | ||
192 | |||
193 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | ||
194 | pr_debug("resource[1] is not IORESOURCE_IRQ\n"); | ||
195 | return -ENOMEM; | ||
196 | } | ||
197 | |||
198 | hcd = usb_create_hcd(&ohci_au1xxx_hc_driver, &pdev->dev, "au1xxx"); | ||
199 | if (!hcd) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | hcd->rsrc_start = pdev->resource[0].start; | ||
203 | hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; | ||
204 | |||
205 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
206 | pr_debug("request_mem_region failed\n"); | ||
207 | ret = -EBUSY; | ||
208 | goto err1; | ||
209 | } | ||
210 | |||
211 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
212 | if (!hcd->regs) { | ||
213 | pr_debug("ioremap failed\n"); | ||
214 | ret = -ENOMEM; | ||
215 | goto err2; | ||
216 | } | ||
217 | |||
218 | au1xxx_start_ohc(); | ||
219 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
220 | |||
221 | ret = usb_add_hcd(hcd, pdev->resource[1].start, | ||
222 | IRQF_DISABLED | IRQF_SHARED); | ||
223 | if (ret == 0) { | ||
224 | platform_set_drvdata(pdev, hcd); | ||
225 | return ret; | ||
226 | } | ||
227 | |||
228 | au1xxx_stop_ohc(); | ||
229 | iounmap(hcd->regs); | ||
230 | err2: | ||
231 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
232 | err1: | ||
233 | usb_put_hcd(hcd); | ||
310 | return ret; | 234 | return ret; |
311 | } | 235 | } |
312 | 236 | ||
@@ -314,30 +238,78 @@ static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev) | |||
314 | { | 238 | { |
315 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 239 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
316 | 240 | ||
317 | usb_ohci_au1xxx_remove(hcd, pdev); | 241 | usb_remove_hcd(hcd); |
242 | au1xxx_stop_ohc(); | ||
243 | iounmap(hcd->regs); | ||
244 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
245 | usb_put_hcd(hcd); | ||
246 | platform_set_drvdata(pdev, NULL); | ||
247 | |||
318 | return 0; | 248 | return 0; |
319 | } | 249 | } |
320 | /*TBD*/ | 250 | |
321 | /*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev) | 251 | #ifdef CONFIG_PM |
252 | static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *pdev, | ||
253 | pm_message_t message) | ||
322 | { | 254 | { |
323 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 255 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
256 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
257 | unsigned long flags; | ||
258 | int rc; | ||
259 | |||
260 | rc = 0; | ||
261 | |||
262 | /* Root hub was already suspended. Disable irq emission and | ||
263 | * mark HW unaccessible, bail out if RH has been resumed. Use | ||
264 | * the spinlock to properly synchronize with possible pending | ||
265 | * RH suspend or resume activity. | ||
266 | * | ||
267 | * This is still racy as hcd->state is manipulated outside of | ||
268 | * any locks =P But that will be a different fix. | ||
269 | */ | ||
270 | spin_lock_irqsave(&ohci->lock, flags); | ||
271 | if (hcd->state != HC_STATE_SUSPENDED) { | ||
272 | rc = -EINVAL; | ||
273 | goto bail; | ||
274 | } | ||
275 | ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | ||
276 | (void)ohci_readl(ohci, &ohci->regs->intrdisable); | ||
324 | 277 | ||
325 | return 0; | 278 | /* make sure snapshot being resumed re-enumerates everything */ |
279 | if (message.event == PM_EVENT_PRETHAW) | ||
280 | ohci_usb_reset(ohci); | ||
281 | |||
282 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
283 | |||
284 | au1xxx_stop_ohc(); | ||
285 | bail: | ||
286 | spin_unlock_irqrestore(&ohci->lock, flags); | ||
287 | |||
288 | return rc; | ||
326 | } | 289 | } |
327 | static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) | 290 | |
291 | static int ohci_hcd_au1xxx_drv_resume(struct platform_device *pdev) | ||
328 | { | 292 | { |
329 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 293 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
294 | |||
295 | au1xxx_start_ohc(); | ||
296 | |||
297 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
298 | ohci_finish_controller_resume(hcd); | ||
330 | 299 | ||
331 | return 0; | 300 | return 0; |
332 | } | 301 | } |
333 | */ | 302 | #else |
303 | #define ohci_hcd_au1xxx_drv_suspend NULL | ||
304 | #define ohci_hcd_au1xxx_drv_resume NULL | ||
305 | #endif | ||
334 | 306 | ||
335 | static struct platform_driver ohci_hcd_au1xxx_driver = { | 307 | static struct platform_driver ohci_hcd_au1xxx_driver = { |
336 | .probe = ohci_hcd_au1xxx_drv_probe, | 308 | .probe = ohci_hcd_au1xxx_drv_probe, |
337 | .remove = ohci_hcd_au1xxx_drv_remove, | 309 | .remove = ohci_hcd_au1xxx_drv_remove, |
338 | .shutdown = usb_hcd_platform_shutdown, | 310 | .shutdown = usb_hcd_platform_shutdown, |
339 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ | 311 | .suspend = ohci_hcd_au1xxx_drv_suspend, |
340 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ | 312 | .resume = ohci_hcd_au1xxx_drv_resume, |
341 | .driver = { | 313 | .driver = { |
342 | .name = "au1xxx-ohci", | 314 | .name = "au1xxx-ohci", |
343 | .owner = THIS_MODULE, | 315 | .owner = THIS_MODULE, |
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index e06bfaebec54..7cef1d2f7ccc 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -651,7 +651,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) | |||
651 | "%s\n" | 651 | "%s\n" |
652 | "%s version " DRIVER_VERSION "\n", | 652 | "%s version " DRIVER_VERSION "\n", |
653 | hcd->self.controller->bus->name, | 653 | hcd->self.controller->bus->name, |
654 | hcd->self.controller->bus_id, | 654 | dev_name(hcd->self.controller), |
655 | hcd->product_desc, | 655 | hcd->product_desc, |
656 | hcd_name); | 656 | hcd_name); |
657 | 657 | ||
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 06aadfb0ec29..5adaf36e47d0 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -135,6 +135,7 @@ static struct hc_driver ohci_ep93xx_hc_driver = { | |||
135 | .get_frame_number = ohci_get_frame, | 135 | .get_frame_number = ohci_get_frame, |
136 | .hub_status_data = ohci_hub_status_data, | 136 | .hub_status_data = ohci_hub_status_data, |
137 | .hub_control = ohci_hub_control, | 137 | .hub_control = ohci_hub_control, |
138 | .hub_irq_enable = ohci_rhsc_enable, | ||
138 | #ifdef CONFIG_PM | 139 | #ifdef CONFIG_PM |
139 | .bus_suspend = ohci_bus_suspend, | 140 | .bus_suspend = ohci_bus_suspend, |
140 | .bus_resume = ohci_bus_resume, | 141 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 33f1c1c32edf..26bc47941d01 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -974,7 +974,7 @@ MODULE_LICENSE ("GPL"); | |||
974 | #define PCI_DRIVER ohci_pci_driver | 974 | #define PCI_DRIVER ohci_pci_driver |
975 | #endif | 975 | #endif |
976 | 976 | ||
977 | #ifdef CONFIG_SA1111 | 977 | #if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_SA1111) |
978 | #include "ohci-sa1111.c" | 978 | #include "ohci-sa1111.c" |
979 | #define SA1111_DRIVER ohci_hcd_sa1111_driver | 979 | #define SA1111_DRIVER ohci_hcd_sa1111_driver |
980 | #endif | 980 | #endif |
@@ -1054,7 +1054,7 @@ MODULE_LICENSE ("GPL"); | |||
1054 | 1054 | ||
1055 | #ifdef CONFIG_MFD_SM501 | 1055 | #ifdef CONFIG_MFD_SM501 |
1056 | #include "ohci-sm501.c" | 1056 | #include "ohci-sm501.c" |
1057 | #define PLATFORM_DRIVER ohci_hcd_sm501_driver | 1057 | #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver |
1058 | #endif | 1058 | #endif |
1059 | 1059 | ||
1060 | #if !defined(PCI_DRIVER) && \ | 1060 | #if !defined(PCI_DRIVER) && \ |
@@ -1062,6 +1062,7 @@ MODULE_LICENSE ("GPL"); | |||
1062 | !defined(OF_PLATFORM_DRIVER) && \ | 1062 | !defined(OF_PLATFORM_DRIVER) && \ |
1063 | !defined(SA1111_DRIVER) && \ | 1063 | !defined(SA1111_DRIVER) && \ |
1064 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ | 1064 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ |
1065 | !defined(SM501_OHCI_DRIVER) && \ | ||
1065 | !defined(SSB_OHCI_DRIVER) | 1066 | !defined(SSB_OHCI_DRIVER) |
1066 | #error "missing bus glue for ohci-hcd" | 1067 | #error "missing bus glue for ohci-hcd" |
1067 | #endif | 1068 | #endif |
@@ -1121,9 +1122,18 @@ static int __init ohci_hcd_mod_init(void) | |||
1121 | goto error_ssb; | 1122 | goto error_ssb; |
1122 | #endif | 1123 | #endif |
1123 | 1124 | ||
1125 | #ifdef SM501_OHCI_DRIVER | ||
1126 | retval = platform_driver_register(&SM501_OHCI_DRIVER); | ||
1127 | if (retval < 0) | ||
1128 | goto error_sm501; | ||
1129 | #endif | ||
1130 | |||
1124 | return retval; | 1131 | return retval; |
1125 | 1132 | ||
1126 | /* Error path */ | 1133 | /* Error path */ |
1134 | #ifdef SM501_OHCI_DRIVER | ||
1135 | error_sm501: | ||
1136 | #endif | ||
1127 | #ifdef SSB_OHCI_DRIVER | 1137 | #ifdef SSB_OHCI_DRIVER |
1128 | error_ssb: | 1138 | error_ssb: |
1129 | #endif | 1139 | #endif |
@@ -1159,6 +1169,9 @@ module_init(ohci_hcd_mod_init); | |||
1159 | 1169 | ||
1160 | static void __exit ohci_hcd_mod_exit(void) | 1170 | static void __exit ohci_hcd_mod_exit(void) |
1161 | { | 1171 | { |
1172 | #ifdef SM501_OHCI_DRIVER | ||
1173 | platform_driver_unregister(&SM501_OHCI_DRIVER); | ||
1174 | #endif | ||
1162 | #ifdef SSB_OHCI_DRIVER | 1175 | #ifdef SSB_OHCI_DRIVER |
1163 | ssb_driver_unregister(&SSB_OHCI_DRIVER); | 1176 | ssb_driver_unregister(&SSB_OHCI_DRIVER); |
1164 | #endif | 1177 | #endif |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 79a78029f896..b56739221d11 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -36,6 +36,18 @@ | |||
36 | 36 | ||
37 | /*-------------------------------------------------------------------------*/ | 37 | /*-------------------------------------------------------------------------*/ |
38 | 38 | ||
39 | /* hcd->hub_irq_enable() */ | ||
40 | static void ohci_rhsc_enable (struct usb_hcd *hcd) | ||
41 | { | ||
42 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
43 | |||
44 | spin_lock_irq(&ohci->lock); | ||
45 | if (!ohci->autostop) | ||
46 | del_timer(&hcd->rh_timer); /* Prevent next poll */ | ||
47 | ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); | ||
48 | spin_unlock_irq(&ohci->lock); | ||
49 | } | ||
50 | |||
39 | #define OHCI_SCHED_ENABLES \ | 51 | #define OHCI_SCHED_ENABLES \ |
40 | (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) | 52 | (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) |
41 | 53 | ||
@@ -362,28 +374,18 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
362 | int any_connected) | 374 | int any_connected) |
363 | { | 375 | { |
364 | int poll_rh = 1; | 376 | int poll_rh = 1; |
365 | int rhsc; | ||
366 | 377 | ||
367 | rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC; | ||
368 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { | 378 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { |
369 | 379 | ||
370 | case OHCI_USB_OPER: | 380 | case OHCI_USB_OPER: |
371 | /* If no status changes are pending, enable status-change | 381 | /* keep on polling until we know a device is connected |
372 | * interrupts. | 382 | * and RHSC is enabled */ |
373 | */ | ||
374 | if (!rhsc && !changed) { | ||
375 | rhsc = OHCI_INTR_RHSC; | ||
376 | ohci_writel(ohci, rhsc, &ohci->regs->intrenable); | ||
377 | } | ||
378 | |||
379 | /* Keep on polling until we know a device is connected | ||
380 | * and RHSC is enabled, or until we autostop. | ||
381 | */ | ||
382 | if (!ohci->autostop) { | 383 | if (!ohci->autostop) { |
383 | if (any_connected || | 384 | if (any_connected || |
384 | !device_may_wakeup(&ohci_to_hcd(ohci) | 385 | !device_may_wakeup(&ohci_to_hcd(ohci) |
385 | ->self.root_hub->dev)) { | 386 | ->self.root_hub->dev)) { |
386 | if (rhsc) | 387 | if (ohci_readl(ohci, &ohci->regs->intrenable) & |
388 | OHCI_INTR_RHSC) | ||
387 | poll_rh = 0; | 389 | poll_rh = 0; |
388 | } else { | 390 | } else { |
389 | ohci->autostop = 1; | 391 | ohci->autostop = 1; |
@@ -396,13 +398,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
396 | ohci->autostop = 0; | 398 | ohci->autostop = 0; |
397 | ohci->next_statechange = jiffies + | 399 | ohci->next_statechange = jiffies + |
398 | STATECHANGE_DELAY; | 400 | STATECHANGE_DELAY; |
399 | } else if (rhsc && time_after_eq(jiffies, | 401 | } else if (time_after_eq(jiffies, |
400 | ohci->next_statechange) | 402 | ohci->next_statechange) |
401 | && !ohci->ed_rm_list | 403 | && !ohci->ed_rm_list |
402 | && !(ohci->hc_control & | 404 | && !(ohci->hc_control & |
403 | OHCI_SCHED_ENABLES)) { | 405 | OHCI_SCHED_ENABLES)) { |
404 | ohci_rh_suspend(ohci, 1); | 406 | ohci_rh_suspend(ohci, 1); |
405 | poll_rh = 0; | ||
406 | } | 407 | } |
407 | } | 408 | } |
408 | break; | 409 | break; |
@@ -416,12 +417,6 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
416 | else | 417 | else |
417 | usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); | 418 | usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); |
418 | } else { | 419 | } else { |
419 | if (!rhsc && (ohci->autostop || | ||
420 | ohci_to_hcd(ohci)->self.root_hub-> | ||
421 | do_remote_wakeup)) | ||
422 | ohci_writel(ohci, OHCI_INTR_RHSC, | ||
423 | &ohci->regs->intrenable); | ||
424 | |||
425 | /* everything is idle, no need for polling */ | 420 | /* everything is idle, no need for polling */ |
426 | poll_rh = 0; | 421 | poll_rh = 0; |
427 | } | 422 | } |
@@ -443,16 +438,12 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci) | |||
443 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | 438 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, |
444 | int any_connected) | 439 | int any_connected) |
445 | { | 440 | { |
446 | /* If RHSC is enabled, don't poll */ | 441 | int poll_rh = 1; |
447 | if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) | ||
448 | return 0; | ||
449 | 442 | ||
450 | /* If no status changes are pending, enable status-change interrupts */ | 443 | /* keep on polling until RHSC is enabled */ |
451 | if (!changed) { | 444 | if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) |
452 | ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); | 445 | poll_rh = 0; |
453 | return 0; | 446 | return poll_rh; |
454 | } | ||
455 | return 1; | ||
456 | } | 447 | } |
457 | 448 | ||
458 | #endif /* CONFIG_PM */ | 449 | #endif /* CONFIG_PM */ |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 96d14fa1d833..1ef5d482c145 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Bus Glue for Sharp LH7A404 | 8 | * Bus Glue for Sharp LH7A404 |
9 | * | 9 | * |
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | 10 | * Written by Christopher Hoover <ch@hpl.hp.com> |
11 | * Based on fragments of previous driver by Rusell King et al. | 11 | * Based on fragments of previous driver by Russell King et al. |
12 | * | 12 | * |
13 | * Modified for LH7A404 from ohci-sa1111.c | 13 | * Modified for LH7A404 from ohci-sa1111.c |
14 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> | 14 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> |
@@ -193,6 +193,7 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
193 | */ | 193 | */ |
194 | .hub_status_data = ohci_hub_status_data, | 194 | .hub_status_data = ohci_hub_status_data, |
195 | .hub_control = ohci_hub_control, | 195 | .hub_control = ohci_hub_control, |
196 | .hub_irq_enable = ohci_rhsc_enable, | ||
196 | #ifdef CONFIG_PM | 197 | #ifdef CONFIG_PM |
197 | .bus_suspend = ohci_bus_suspend, | 198 | .bus_suspend = ohci_bus_suspend, |
198 | .bus_resume = ohci_bus_resume, | 199 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 6859fb5f1d6f..6e5e5f81ac90 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -169,13 +169,16 @@ static void start_hnp(struct ohci_hcd *ohci) | |||
169 | { | 169 | { |
170 | const unsigned port = ohci_to_hcd(ohci)->self.otg_port - 1; | 170 | const unsigned port = ohci_to_hcd(ohci)->self.otg_port - 1; |
171 | unsigned long flags; | 171 | unsigned long flags; |
172 | u32 l; | ||
172 | 173 | ||
173 | otg_start_hnp(ohci->transceiver); | 174 | otg_start_hnp(ohci->transceiver); |
174 | 175 | ||
175 | local_irq_save(flags); | 176 | local_irq_save(flags); |
176 | ohci->transceiver->state = OTG_STATE_A_SUSPEND; | 177 | ohci->transceiver->state = OTG_STATE_A_SUSPEND; |
177 | writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); | 178 | writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); |
178 | OTG_CTRL_REG &= ~OTG_A_BUSREQ; | 179 | l = omap_readl(OTG_CTRL); |
180 | l &= ~OTG_A_BUSREQ; | ||
181 | omap_writel(l, OTG_CTRL); | ||
179 | local_irq_restore(flags); | 182 | local_irq_restore(flags); |
180 | } | 183 | } |
181 | 184 | ||
@@ -326,7 +329,7 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver, | |||
326 | } | 329 | } |
327 | 330 | ||
328 | 331 | ||
329 | hcd = usb_create_hcd (driver, &pdev->dev, pdev->dev.bus_id); | 332 | hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev)); |
330 | if (!hcd) { | 333 | if (!hcd) { |
331 | retval = -ENOMEM; | 334 | retval = -ENOMEM; |
332 | goto err0; | 335 | goto err0; |
@@ -466,6 +469,7 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
466 | */ | 469 | */ |
467 | .hub_status_data = ohci_hub_status_data, | 470 | .hub_status_data = ohci_hub_status_data, |
468 | .hub_control = ohci_hub_control, | 471 | .hub_control = ohci_hub_control, |
472 | .hub_irq_enable = ohci_rhsc_enable, | ||
469 | #ifdef CONFIG_PM | 473 | #ifdef CONFIG_PM |
470 | .bus_suspend = ohci_bus_suspend, | 474 | .bus_suspend = ohci_bus_suspend, |
471 | .bus_resume = ohci_bus_resume, | 475 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 3bf175d95a23..4696cc912e16 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -327,6 +327,7 @@ static const struct hc_driver ohci_pci_hc_driver = { | |||
327 | */ | 327 | */ |
328 | .hub_status_data = ohci_hub_status_data, | 328 | .hub_status_data = ohci_hub_status_data, |
329 | .hub_control = ohci_hub_control, | 329 | .hub_control = ohci_hub_control, |
330 | .hub_irq_enable = ohci_rhsc_enable, | ||
330 | #ifdef CONFIG_PM | 331 | #ifdef CONFIG_PM |
331 | .bus_suspend = ohci_bus_suspend, | 332 | .bus_suspend = ohci_bus_suspend, |
332 | .bus_resume = ohci_bus_resume, | 333 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c index 664f07ee8732..6ad8f2fc57b9 100644 --- a/drivers/usb/host/ohci-pnx4008.c +++ b/drivers/usb/host/ohci-pnx4008.c | |||
@@ -109,8 +109,6 @@ static struct clk *usb_clk; | |||
109 | 109 | ||
110 | static int isp1301_probe(struct i2c_adapter *adap); | 110 | static int isp1301_probe(struct i2c_adapter *adap); |
111 | static int isp1301_detach(struct i2c_client *client); | 111 | static int isp1301_detach(struct i2c_client *client); |
112 | static int isp1301_command(struct i2c_client *client, unsigned int cmd, | ||
113 | void *arg); | ||
114 | 112 | ||
115 | static const unsigned short normal_i2c[] = | 113 | static const unsigned short normal_i2c[] = |
116 | { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END }; | 114 | { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END }; |
@@ -123,30 +121,37 @@ static struct i2c_client_address_data addr_data = { | |||
123 | }; | 121 | }; |
124 | 122 | ||
125 | struct i2c_driver isp1301_driver = { | 123 | struct i2c_driver isp1301_driver = { |
126 | .class = I2C_CLASS_HWMON, | 124 | .driver = { |
125 | .name = "isp1301_pnx", | ||
126 | }, | ||
127 | .attach_adapter = isp1301_probe, | 127 | .attach_adapter = isp1301_probe, |
128 | .detach_client = isp1301_detach, | 128 | .detach_client = isp1301_detach, |
129 | .command = isp1301_command | ||
130 | }; | 129 | }; |
131 | 130 | ||
132 | static int isp1301_attach(struct i2c_adapter *adap, int addr, int kind) | 131 | static int isp1301_attach(struct i2c_adapter *adap, int addr, int kind) |
133 | { | 132 | { |
134 | struct i2c_client *c; | 133 | struct i2c_client *c; |
134 | int err; | ||
135 | 135 | ||
136 | c = kzalloc(sizeof(*c), GFP_KERNEL); | 136 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
137 | |||
138 | if (!c) | 137 | if (!c) |
139 | return -ENOMEM; | 138 | return -ENOMEM; |
140 | 139 | ||
141 | strcpy(c->name, "isp1301"); | 140 | strlcpy(c->name, "isp1301_pnx", I2C_NAME_SIZE); |
142 | c->flags = 0; | 141 | c->flags = 0; |
143 | c->addr = addr; | 142 | c->addr = addr; |
144 | c->adapter = adap; | 143 | c->adapter = adap; |
145 | c->driver = &isp1301_driver; | 144 | c->driver = &isp1301_driver; |
146 | 145 | ||
146 | err = i2c_attach_client(c); | ||
147 | if (err) { | ||
148 | kfree(c); | ||
149 | return err; | ||
150 | } | ||
151 | |||
147 | isp1301_i2c_client = c; | 152 | isp1301_i2c_client = c; |
148 | 153 | ||
149 | return i2c_attach_client(c); | 154 | return 0; |
150 | } | 155 | } |
151 | 156 | ||
152 | static int isp1301_probe(struct i2c_adapter *adap) | 157 | static int isp1301_probe(struct i2c_adapter *adap) |
@@ -161,13 +166,6 @@ static int isp1301_detach(struct i2c_client *client) | |||
161 | return 0; | 166 | return 0; |
162 | } | 167 | } |
163 | 168 | ||
164 | /* No commands defined */ | ||
165 | static int isp1301_command(struct i2c_client *client, unsigned int cmd, | ||
166 | void *arg) | ||
167 | { | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static void i2c_write(u8 buf, u8 subaddr) | 169 | static void i2c_write(u8 buf, u8 subaddr) |
172 | { | 170 | { |
173 | char tmpbuf[2]; | 171 | char tmpbuf[2]; |
@@ -280,6 +278,7 @@ static const struct hc_driver ohci_pnx4008_hc_driver = { | |||
280 | */ | 278 | */ |
281 | .hub_status_data = ohci_hub_status_data, | 279 | .hub_status_data = ohci_hub_status_data, |
282 | .hub_control = ohci_hub_control, | 280 | .hub_control = ohci_hub_control, |
281 | .hub_irq_enable = ohci_rhsc_enable, | ||
283 | #ifdef CONFIG_PM | 282 | #ifdef CONFIG_PM |
284 | .bus_suspend = ohci_bus_suspend, | 283 | .bus_suspend = ohci_bus_suspend, |
285 | .bus_resume = ohci_bus_resume, | 284 | .bus_resume = ohci_bus_resume, |
@@ -388,7 +387,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev) | |||
388 | while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) != | 387 | while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) != |
389 | USB_CLOCK_MASK) ; | 388 | USB_CLOCK_MASK) ; |
390 | 389 | ||
391 | hcd = usb_create_hcd (driver, &pdev->dev, pdev->dev.bus_id); | 390 | hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev)); |
392 | if (!hcd) { | 391 | if (!hcd) { |
393 | err("Failed to allocate HC buffer"); | 392 | err("Failed to allocate HC buffer"); |
394 | ret = -ENOMEM; | 393 | ret = -ENOMEM; |
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c index 28467e288a93..605d59cba28e 100644 --- a/drivers/usb/host/ohci-pnx8550.c +++ b/drivers/usb/host/ohci-pnx8550.c | |||
@@ -201,6 +201,7 @@ static const struct hc_driver ohci_pnx8550_hc_driver = { | |||
201 | */ | 201 | */ |
202 | .hub_status_data = ohci_hub_status_data, | 202 | .hub_status_data = ohci_hub_status_data, |
203 | .hub_control = ohci_hub_control, | 203 | .hub_control = ohci_hub_control, |
204 | .hub_irq_enable = ohci_rhsc_enable, | ||
204 | #ifdef CONFIG_PM | 205 | #ifdef CONFIG_PM |
205 | .bus_suspend = ohci_bus_suspend, | 206 | .bus_suspend = ohci_bus_suspend, |
206 | .bus_resume = ohci_bus_resume, | 207 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 50e55db13636..91e6e101a4cc 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
@@ -14,8 +14,8 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/signal.h> | 16 | #include <linux/signal.h> |
17 | #include <linux/of_platform.h> | ||
17 | 18 | ||
18 | #include <asm/of_platform.h> | ||
19 | #include <asm/prom.h> | 19 | #include <asm/prom.h> |
20 | 20 | ||
21 | 21 | ||
@@ -72,6 +72,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = { | |||
72 | */ | 72 | */ |
73 | .hub_status_data = ohci_hub_status_data, | 73 | .hub_status_data = ohci_hub_status_data, |
74 | .hub_control = ohci_hub_control, | 74 | .hub_control = ohci_hub_control, |
75 | .hub_irq_enable = ohci_rhsc_enable, | ||
75 | #ifdef CONFIG_PM | 76 | #ifdef CONFIG_PM |
76 | .bus_suspend = ohci_bus_suspend, | 77 | .bus_suspend = ohci_bus_suspend, |
77 | .bus_resume = ohci_bus_resume, | 78 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index cd3398b675b2..523c30125577 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -172,6 +172,7 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { | |||
172 | */ | 172 | */ |
173 | .hub_status_data = ohci_hub_status_data, | 173 | .hub_status_data = ohci_hub_status_data, |
174 | .hub_control = ohci_hub_control, | 174 | .hub_control = ohci_hub_control, |
175 | .hub_irq_enable = ohci_rhsc_enable, | ||
175 | #ifdef CONFIG_PM | 176 | #ifdef CONFIG_PM |
176 | .bus_suspend = ohci_bus_suspend, | 177 | .bus_suspend = ohci_bus_suspend, |
177 | .bus_resume = ohci_bus_resume, | 178 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index bfdeb0d22d05..55c95647f008 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c | |||
@@ -68,6 +68,7 @@ static const struct hc_driver ps3_ohci_hc_driver = { | |||
68 | .get_frame_number = ohci_get_frame, | 68 | .get_frame_number = ohci_get_frame, |
69 | .hub_status_data = ohci_hub_status_data, | 69 | .hub_status_data = ohci_hub_status_data, |
70 | .hub_control = ohci_hub_control, | 70 | .hub_control = ohci_hub_control, |
71 | .hub_irq_enable = ohci_rhsc_enable, | ||
71 | .start_port_reset = ohci_start_port_reset, | 72 | .start_port_reset = ohci_start_port_reset, |
72 | #if defined(CONFIG_PM) | 73 | #if defined(CONFIG_PM) |
73 | .bus_suspend = ohci_bus_suspend, | 74 | .bus_suspend = ohci_bus_suspend, |
@@ -128,7 +129,7 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev) | |||
128 | 129 | ||
129 | dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ | 130 | dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ |
130 | 131 | ||
131 | hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev->core.bus_id); | 132 | hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev_name(&dev->core)); |
132 | 133 | ||
133 | if (!hcd) { | 134 | if (!hcd) { |
134 | dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, | 135 | dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 70b0d4b459e7..127b15799024 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
28 | #include <asm/hardware.h> | 28 | #include <asm/hardware.h> |
29 | #include <asm/arch/pxa-regs.h> | 29 | #include <asm/arch/pxa-regs.h> |
30 | #include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */ | ||
30 | #include <asm/arch/ohci.h> | 31 | #include <asm/arch/ohci.h> |
31 | 32 | ||
32 | #define PXA_UHC_MAX_PORTNUM 3 | 33 | #define PXA_UHC_MAX_PORTNUM 3 |
@@ -104,7 +105,7 @@ static int pxa27x_start_hc(struct device *dev) | |||
104 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); | 105 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); |
105 | 106 | ||
106 | /* Clear any OTG Pin Hold */ | 107 | /* Clear any OTG Pin Hold */ |
107 | if (PSSR & PSSR_OTGPH) | 108 | if (cpu_is_pxa27x() && (PSSR & PSSR_OTGPH)) |
108 | PSSR |= PSSR_OTGPH; | 109 | PSSR |= PSSR_OTGPH; |
109 | 110 | ||
110 | return 0; | 111 | return 0; |
@@ -298,6 +299,7 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
298 | */ | 299 | */ |
299 | .hub_status_data = ohci_hub_status_data, | 300 | .hub_status_data = ohci_hub_status_data, |
300 | .hub_control = ohci_hub_control, | 301 | .hub_control = ohci_hub_control, |
302 | .hub_irq_enable = ohci_rhsc_enable, | ||
301 | #ifdef CONFIG_PM | 303 | #ifdef CONFIG_PM |
302 | .bus_suspend = ohci_bus_suspend, | 304 | .bus_suspend = ohci_bus_suspend, |
303 | .bus_resume = ohci_bus_resume, | 305 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index 9c9f3b59186f..6a9b4c557953 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
@@ -159,9 +159,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | |||
159 | { | 159 | { |
160 | int branch; | 160 | int branch; |
161 | 161 | ||
162 | if (ohci_to_hcd(ohci)->state == HC_STATE_QUIESCING) | ||
163 | return -EAGAIN; | ||
164 | |||
165 | ed->state = ED_OPER; | 162 | ed->state = ED_OPER; |
166 | ed->ed_prev = NULL; | 163 | ed->ed_prev = NULL; |
167 | ed->ed_next = NULL; | 164 | ed->ed_next = NULL; |
@@ -952,6 +949,7 @@ rescan_this: | |||
952 | struct urb *urb; | 949 | struct urb *urb; |
953 | urb_priv_t *urb_priv; | 950 | urb_priv_t *urb_priv; |
954 | __hc32 savebits; | 951 | __hc32 savebits; |
952 | u32 tdINFO; | ||
955 | 953 | ||
956 | td = list_entry (entry, struct td, td_list); | 954 | td = list_entry (entry, struct td, td_list); |
957 | urb = td->urb; | 955 | urb = td->urb; |
@@ -966,6 +964,17 @@ rescan_this: | |||
966 | savebits = *prev & ~cpu_to_hc32 (ohci, TD_MASK); | 964 | savebits = *prev & ~cpu_to_hc32 (ohci, TD_MASK); |
967 | *prev = td->hwNextTD | savebits; | 965 | *prev = td->hwNextTD | savebits; |
968 | 966 | ||
967 | /* If this was unlinked, the TD may not have been | ||
968 | * retired ... so manually save the data toggle. | ||
969 | * The controller ignores the value we save for | ||
970 | * control and ISO endpoints. | ||
971 | */ | ||
972 | tdINFO = hc32_to_cpup(ohci, &td->hwINFO); | ||
973 | if ((tdINFO & TD_T) == TD_T_DATA0) | ||
974 | ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_C); | ||
975 | else if ((tdINFO & TD_T) == TD_T_DATA1) | ||
976 | ed->hwHeadP |= cpu_to_hc32(ohci, ED_C); | ||
977 | |||
969 | /* HC may have partly processed this TD */ | 978 | /* HC may have partly processed this TD */ |
970 | td_done (ohci, urb, td); | 979 | td_done (ohci, urb, td); |
971 | urb_priv->td_cnt++; | 980 | urb_priv->td_cnt++; |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index a73d2ff322e2..3c7a740cfe0c 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * USB Bus Glue for Samsung S3C2410 | 8 | * USB Bus Glue for Samsung S3C2410 |
9 | * | 9 | * |
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | 10 | * Written by Christopher Hoover <ch@hpl.hp.com> |
11 | * Based on fragments of previous driver by Rusell King et al. | 11 | * Based on fragments of previous driver by Russell King et al. |
12 | * | 12 | * |
13 | * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c | 13 | * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c |
14 | * by Ben Dooks, <ben@simtec.co.uk> | 14 | * by Ben Dooks, <ben@simtec.co.uk> |
@@ -466,6 +466,7 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
466 | */ | 466 | */ |
467 | .hub_status_data = ohci_s3c2410_hub_status_data, | 467 | .hub_status_data = ohci_s3c2410_hub_status_data, |
468 | .hub_control = ohci_s3c2410_hub_control, | 468 | .hub_control = ohci_s3c2410_hub_control, |
469 | .hub_irq_enable = ohci_rhsc_enable, | ||
469 | #ifdef CONFIG_PM | 470 | #ifdef CONFIG_PM |
470 | .bus_suspend = ohci_bus_suspend, | 471 | .bus_suspend = ohci_bus_suspend, |
471 | .bus_resume = ohci_bus_resume, | 472 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 99438c65981b..2e9dceb9bb99 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * SA1111 Bus Glue | 8 | * SA1111 Bus Glue |
9 | * | 9 | * |
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | 10 | * Written by Christopher Hoover <ch@hpl.hp.com> |
11 | * Based on fragments of previous driver by Rusell King et al. | 11 | * Based on fragments of previous driver by Russell King et al. |
12 | * | 12 | * |
13 | * This file is licenced under the GPL. | 13 | * This file is licenced under the GPL. |
14 | */ | 14 | */ |
@@ -231,6 +231,7 @@ static const struct hc_driver ohci_sa1111_hc_driver = { | |||
231 | */ | 231 | */ |
232 | .hub_status_data = ohci_hub_status_data, | 232 | .hub_status_data = ohci_hub_status_data, |
233 | .hub_control = ohci_hub_control, | 233 | .hub_control = ohci_hub_control, |
234 | .hub_irq_enable = ohci_rhsc_enable, | ||
234 | #ifdef CONFIG_PM | 235 | #ifdef CONFIG_PM |
235 | .bus_suspend = ohci_bus_suspend, | 236 | .bus_suspend = ohci_bus_suspend, |
236 | .bus_resume = ohci_bus_resume, | 237 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c index 60f03cc7ec4f..e7ee607278fe 100644 --- a/drivers/usb/host/ohci-sh.c +++ b/drivers/usb/host/ohci-sh.c | |||
@@ -68,6 +68,7 @@ static const struct hc_driver ohci_sh_hc_driver = { | |||
68 | */ | 68 | */ |
69 | .hub_status_data = ohci_hub_status_data, | 69 | .hub_status_data = ohci_hub_status_data, |
70 | .hub_control = ohci_hub_control, | 70 | .hub_control = ohci_hub_control, |
71 | .hub_irq_enable = ohci_rhsc_enable, | ||
71 | #ifdef CONFIG_PM | 72 | #ifdef CONFIG_PM |
72 | .bus_suspend = ohci_bus_suspend, | 73 | .bus_suspend = ohci_bus_suspend, |
73 | .bus_resume = ohci_bus_resume, | 74 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 77204f001b9a..21b164e4abeb 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
@@ -75,6 +75,7 @@ static const struct hc_driver ohci_sm501_hc_driver = { | |||
75 | */ | 75 | */ |
76 | .hub_status_data = ohci_hub_status_data, | 76 | .hub_status_data = ohci_hub_status_data, |
77 | .hub_control = ohci_hub_control, | 77 | .hub_control = ohci_hub_control, |
78 | .hub_irq_enable = ohci_rhsc_enable, | ||
78 | #ifdef CONFIG_PM | 79 | #ifdef CONFIG_PM |
79 | .bus_suspend = ohci_bus_suspend, | 80 | .bus_suspend = ohci_bus_suspend, |
80 | .bus_resume = ohci_bus_resume, | 81 | .bus_resume = ohci_bus_resume, |
@@ -90,7 +91,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) | |||
90 | struct device *dev = &pdev->dev; | 91 | struct device *dev = &pdev->dev; |
91 | struct resource *res, *mem; | 92 | struct resource *res, *mem; |
92 | int retval, irq; | 93 | int retval, irq; |
93 | struct usb_hcd *hcd = 0; | 94 | struct usb_hcd *hcd = NULL; |
94 | 95 | ||
95 | irq = retval = platform_get_irq(pdev, 0); | 96 | irq = retval = platform_get_irq(pdev, 0); |
96 | if (retval < 0) | 97 | if (retval < 0) |
@@ -142,7 +143,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) | |||
142 | goto err2; | 143 | goto err2; |
143 | } | 144 | } |
144 | 145 | ||
145 | hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); | 146 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
146 | if (!hcd) { | 147 | if (!hcd) { |
147 | retval = -ENOMEM; | 148 | retval = -ENOMEM; |
148 | goto err2; | 149 | goto err2; |
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c index c4265caec780..3660c83d80af 100644 --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c | |||
@@ -81,6 +81,7 @@ static const struct hc_driver ssb_ohci_hc_driver = { | |||
81 | 81 | ||
82 | .hub_status_data = ohci_hub_status_data, | 82 | .hub_status_data = ohci_hub_status_data, |
83 | .hub_control = ohci_hub_control, | 83 | .hub_control = ohci_hub_control, |
84 | .hub_irq_enable = ohci_rhsc_enable, | ||
84 | #ifdef CONFIG_PM | 85 | #ifdef CONFIG_PM |
85 | .bus_suspend = ohci_bus_suspend, | 86 | .bus_suspend = ohci_bus_suspend, |
86 | .bus_resume = ohci_bus_resume, | 87 | .bus_resume = ohci_bus_resume, |
@@ -112,7 +113,7 @@ static int ssb_ohci_attach(struct ssb_device *dev) | |||
112 | ssb_device_enable(dev, flags); | 113 | ssb_device_enable(dev, flags); |
113 | 114 | ||
114 | hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev, | 115 | hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev, |
115 | dev->dev->bus_id); | 116 | dev_name(dev->dev)); |
116 | if (!hcd) | 117 | if (!hcd) |
117 | goto err_dev_disable; | 118 | goto err_dev_disable; |
118 | ohcidev = hcd_to_ssb_ohci(hcd); | 119 | ohcidev = hcd_to_ssb_ohci(hcd); |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 16667342b3c3..d5f02dddb120 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -312,9 +312,9 @@ static void put_child_connect_map(struct r8a66597 *r8a66597, int address) | |||
312 | static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch) | 312 | static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch) |
313 | { | 313 | { |
314 | u16 pipenum = pipe->info.pipenum; | 314 | u16 pipenum = pipe->info.pipenum; |
315 | unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO}; | 315 | const unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO}; |
316 | unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL}; | 316 | const unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL}; |
317 | unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR}; | 317 | const unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR}; |
318 | 318 | ||
319 | if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */ | 319 | if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */ |
320 | dma_ch = R8A66597_PIPE_NO_DMA; | 320 | dma_ch = R8A66597_PIPE_NO_DMA; |
@@ -863,6 +863,32 @@ static void disable_r8a66597_pipe_all(struct r8a66597 *r8a66597, | |||
863 | dev->dma_map = 0; | 863 | dev->dma_map = 0; |
864 | } | 864 | } |
865 | 865 | ||
866 | static u16 get_interval(struct urb *urb, __u8 interval) | ||
867 | { | ||
868 | u16 time = 1; | ||
869 | int i; | ||
870 | |||
871 | if (urb->dev->speed == USB_SPEED_HIGH) { | ||
872 | if (interval > IITV) | ||
873 | time = IITV; | ||
874 | else | ||
875 | time = interval ? interval - 1 : 0; | ||
876 | } else { | ||
877 | if (interval > 128) { | ||
878 | time = IITV; | ||
879 | } else { | ||
880 | /* calculate the nearest value for PIPEPERI */ | ||
881 | for (i = 0; i < 7; i++) { | ||
882 | if ((1 << i) < interval && | ||
883 | (1 << (i + 1) > interval)) | ||
884 | time = 1 << i; | ||
885 | } | ||
886 | } | ||
887 | } | ||
888 | |||
889 | return time; | ||
890 | } | ||
891 | |||
866 | static unsigned long get_timer_interval(struct urb *urb, __u8 interval) | 892 | static unsigned long get_timer_interval(struct urb *urb, __u8 interval) |
867 | { | 893 | { |
868 | __u8 i; | 894 | __u8 i; |
@@ -901,10 +927,7 @@ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb, | |||
901 | info.interval = 0; | 927 | info.interval = 0; |
902 | info.timer_interval = 0; | 928 | info.timer_interval = 0; |
903 | } else { | 929 | } else { |
904 | if (ep->bInterval > IITV) | 930 | info.interval = get_interval(urb, ep->bInterval); |
905 | info.interval = IITV; | ||
906 | else | ||
907 | info.interval = ep->bInterval ? ep->bInterval - 1 : 0; | ||
908 | info.timer_interval = get_timer_interval(urb, ep->bInterval); | 931 | info.timer_interval = get_timer_interval(urb, ep->bInterval); |
909 | } | 932 | } |
910 | if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) | 933 | if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
@@ -2244,6 +2267,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
2244 | struct r8a66597 *r8a66597; | 2267 | struct r8a66597 *r8a66597; |
2245 | int ret = 0; | 2268 | int ret = 0; |
2246 | int i; | 2269 | int i; |
2270 | unsigned long irq_trigger; | ||
2247 | 2271 | ||
2248 | if (pdev->dev.dma_mask) { | 2272 | if (pdev->dev.dma_mask) { |
2249 | ret = -EINVAL; | 2273 | ret = -EINVAL; |
@@ -2302,7 +2326,11 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
2302 | INIT_LIST_HEAD(&r8a66597->child_device); | 2326 | INIT_LIST_HEAD(&r8a66597->child_device); |
2303 | 2327 | ||
2304 | hcd->rsrc_start = res->start; | 2328 | hcd->rsrc_start = res->start; |
2305 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); | 2329 | if (irq_sense == INTL) |
2330 | irq_trigger = IRQF_TRIGGER_LOW; | ||
2331 | else | ||
2332 | irq_trigger = IRQF_TRIGGER_FALLING; | ||
2333 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger); | ||
2306 | if (ret != 0) { | 2334 | if (ret != 0) { |
2307 | err("Failed to add hcd"); | 2335 | err("Failed to add hcd"); |
2308 | goto clean_up; | 2336 | goto clean_up; |
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 426575247b23..8a74bbb57d08 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -1026,7 +1026,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) | |||
1026 | if (!list_empty(&hep->urb_list)) | 1026 | if (!list_empty(&hep->urb_list)) |
1027 | msleep(3); | 1027 | msleep(3); |
1028 | if (!list_empty(&hep->urb_list)) | 1028 | if (!list_empty(&hep->urb_list)) |
1029 | WARN("ep %p not empty?\n", ep); | 1029 | WARNING("ep %p not empty?\n", ep); |
1030 | 1030 | ||
1031 | kfree(ep); | 1031 | kfree(ep); |
1032 | hep->hcpriv = NULL; | 1032 | hep->hcpriv = NULL; |
@@ -1674,7 +1674,7 @@ sl811h_probe(struct platform_device *dev) | |||
1674 | } | 1674 | } |
1675 | 1675 | ||
1676 | /* allocate and initialize hcd */ | 1676 | /* allocate and initialize hcd */ |
1677 | hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id); | 1677 | hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev_name(&dev->dev)); |
1678 | if (!hcd) { | 1678 | if (!hcd) { |
1679 | retval = -ENOMEM; | 1679 | retval = -ENOMEM; |
1680 | goto err5; | 1680 | goto err5; |
diff --git a/drivers/usb/host/sl811.h b/drivers/usb/host/sl811.h index 7690d98e42a7..b6b8c1f233dd 100644 --- a/drivers/usb/host/sl811.h +++ b/drivers/usb/host/sl811.h | |||
@@ -261,6 +261,6 @@ sl811_read_buf(struct sl811 *sl811, int addr, void *buf, size_t count) | |||
261 | #endif | 261 | #endif |
262 | 262 | ||
263 | #define ERR(stuff...) printk(KERN_ERR "sl811: " stuff) | 263 | #define ERR(stuff...) printk(KERN_ERR "sl811: " stuff) |
264 | #define WARN(stuff...) printk(KERN_WARNING "sl811: " stuff) | 264 | #define WARNING(stuff...) printk(KERN_WARNING "sl811: " stuff) |
265 | #define INFO(stuff...) printk(KERN_INFO "sl811: " stuff) | 265 | #define INFO(stuff...) printk(KERN_INFO "sl811: " stuff) |
266 | 266 | ||
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index f29307405bb3..20ad3c48fcb2 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -2934,6 +2934,16 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num) | |||
2934 | return 0; | 2934 | return 0; |
2935 | } | 2935 | } |
2936 | 2936 | ||
2937 | static void u132_hub_irq_enable(struct usb_hcd *hcd) | ||
2938 | { | ||
2939 | struct u132 *u132 = hcd_to_u132(hcd); | ||
2940 | if (u132->going > 1) { | ||
2941 | dev_err(&u132->platform_dev->dev, "device has been removed %d\n" | ||
2942 | , u132->going); | ||
2943 | } else if (u132->going > 0) | ||
2944 | dev_err(&u132->platform_dev->dev, "device is being removed\n"); | ||
2945 | } | ||
2946 | |||
2937 | 2947 | ||
2938 | #ifdef CONFIG_PM | 2948 | #ifdef CONFIG_PM |
2939 | static int u132_bus_suspend(struct usb_hcd *hcd) | 2949 | static int u132_bus_suspend(struct usb_hcd *hcd) |
@@ -2985,6 +2995,7 @@ static struct hc_driver u132_hc_driver = { | |||
2985 | .bus_suspend = u132_bus_suspend, | 2995 | .bus_suspend = u132_bus_suspend, |
2986 | .bus_resume = u132_bus_resume, | 2996 | .bus_resume = u132_bus_resume, |
2987 | .start_port_reset = u132_start_port_reset, | 2997 | .start_port_reset = u132_start_port_reset, |
2998 | .hub_irq_enable = u132_hub_irq_enable, | ||
2988 | }; | 2999 | }; |
2989 | 3000 | ||
2990 | /* | 3001 | /* |
@@ -3113,7 +3124,7 @@ static int __devinit u132_probe(struct platform_device *pdev) | |||
3113 | if (pdev->dev.dma_mask) | 3124 | if (pdev->dev.dma_mask) |
3114 | return -EINVAL; | 3125 | return -EINVAL; |
3115 | 3126 | ||
3116 | hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, pdev->dev.bus_id); | 3127 | hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, dev_name(&pdev->dev)); |
3117 | if (!hcd) { | 3128 | if (!hcd) { |
3118 | printk(KERN_ERR "failed to create the usb hcd struct for U132\n" | 3129 | printk(KERN_ERR "failed to create the usb hcd struct for U132\n" |
3119 | ); | 3130 | ); |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 8e4427aebb14..885b585360b9 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu | 12 | * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu |
13 | */ | 13 | */ |
14 | 14 | ||
15 | static __u8 root_hub_hub_des[] = | 15 | static const __u8 root_hub_hub_des[] = |
16 | { | 16 | { |
17 | 0x09, /* __u8 bLength; */ | 17 | 0x09, /* __u8 bLength; */ |
18 | 0x29, /* __u8 bDescriptorType; Hub-descriptor */ | 18 | 0x29, /* __u8 bDescriptorType; Hub-descriptor */ |