Merge branch 'overlayfs-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mszere...
[cascardo/linux.git] / drivers / usb / host / ohci-at91.c
1 /*
2  * OHCI HCD (Host Controller Driver) for USB.
3  *
4  *  Copyright (C) 2004 SAN People (Pty) Ltd.
5  *  Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
6  *
7  * AT91 Bus Glue
8  *
9  * Based on fragments of 2.4 driver by Rick Bronson.
10  * Based on ohci-omap.c
11  *
12  * This file is licenced under the GPL.
13  */
14
15 #include <linux/clk.h>
16 #include <linux/dma-mapping.h>
17 #include <linux/of_platform.h>
18 #include <linux/of_gpio.h>
19 #include <linux/platform_device.h>
20 #include <linux/platform_data/atmel.h>
21 #include <linux/io.h>
22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/usb.h>
25 #include <linux/usb/hcd.h>
26
27 #include <asm/gpio.h>
28
29 #include "ohci.h"
30
31 #define valid_port(index)       ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS)
32 #define at91_for_each_port(index)       \
33                 for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++)
34
35 /* interface, function and usb clocks; sometimes also an AHB clock */
36 #define hcd_to_ohci_at91_priv(h) \
37         ((struct ohci_at91_priv *)hcd_to_ohci(h)->priv)
38
39 struct ohci_at91_priv {
40         struct clk *iclk;
41         struct clk *fclk;
42         struct clk *uclk;
43         struct clk *hclk;
44         bool clocked;
45         bool wakeup;            /* Saved wake-up state for resume */
46 };
47 /* interface and function clocks; sometimes also an AHB clock */
48
49 #define DRIVER_DESC "OHCI Atmel driver"
50
51 static const char hcd_name[] = "ohci-atmel";
52
53 static struct hc_driver __read_mostly ohci_at91_hc_driver;
54
55 static const struct ohci_driver_overrides ohci_at91_drv_overrides __initconst = {
56         .extra_priv_size = sizeof(struct ohci_at91_priv),
57 };
58
59 extern int usb_disabled(void);
60
61 /*-------------------------------------------------------------------------*/
62
63 static void at91_start_clock(struct ohci_at91_priv *ohci_at91)
64 {
65         if (ohci_at91->clocked)
66                 return;
67         if (IS_ENABLED(CONFIG_COMMON_CLK)) {
68                 clk_set_rate(ohci_at91->uclk, 48000000);
69                 clk_prepare_enable(ohci_at91->uclk);
70         }
71         clk_prepare_enable(ohci_at91->hclk);
72         clk_prepare_enable(ohci_at91->iclk);
73         clk_prepare_enable(ohci_at91->fclk);
74         ohci_at91->clocked = true;
75 }
76
77 static void at91_stop_clock(struct ohci_at91_priv *ohci_at91)
78 {
79         if (!ohci_at91->clocked)
80                 return;
81         clk_disable_unprepare(ohci_at91->fclk);
82         clk_disable_unprepare(ohci_at91->iclk);
83         clk_disable_unprepare(ohci_at91->hclk);
84         if (IS_ENABLED(CONFIG_COMMON_CLK))
85                 clk_disable_unprepare(ohci_at91->uclk);
86         ohci_at91->clocked = false;
87 }
88
89 static void at91_start_hc(struct platform_device *pdev)
90 {
91         struct usb_hcd *hcd = platform_get_drvdata(pdev);
92         struct ohci_regs __iomem *regs = hcd->regs;
93         struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
94
95         dev_dbg(&pdev->dev, "start\n");
96
97         /*
98          * Start the USB clocks.
99          */
100         at91_start_clock(ohci_at91);
101
102         /*
103          * The USB host controller must remain in reset.
104          */
105         writel(0, &regs->control);
106 }
107
108 static void at91_stop_hc(struct platform_device *pdev)
109 {
110         struct usb_hcd *hcd = platform_get_drvdata(pdev);
111         struct ohci_regs __iomem *regs = hcd->regs;
112         struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
113
114         dev_dbg(&pdev->dev, "stop\n");
115
116         /*
117          * Put the USB host controller into reset.
118          */
119         writel(0, &regs->control);
120
121         /*
122          * Stop the USB clocks.
123          */
124         at91_stop_clock(ohci_at91);
125 }
126
127
128 /*-------------------------------------------------------------------------*/
129
130 static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
131
132 /* configure so an HC device and id are always provided */
133 /* always called with process context; sleeping is OK */
134
135
136 /**
137  * usb_hcd_at91_probe - initialize AT91-based HCDs
138  * Context: !in_interrupt()
139  *
140  * Allocates basic resources for this USB host controller, and
141  * then invokes the start() method for the HCD associated with it
142  * through the hotplug entry's driver_data.
143  */
144 static int usb_hcd_at91_probe(const struct hc_driver *driver,
145                         struct platform_device *pdev)
146 {
147         struct at91_usbh_data *board;
148         struct ohci_hcd *ohci;
149         int retval;
150         struct usb_hcd *hcd;
151         struct ohci_at91_priv *ohci_at91;
152         struct device *dev = &pdev->dev;
153         struct resource *res;
154         int irq;
155
156         irq = platform_get_irq(pdev, 0);
157         if (irq < 0) {
158                 dev_dbg(dev, "hcd probe: missing irq resource\n");
159                 return irq;
160         }
161
162         hcd = usb_create_hcd(driver, dev, "at91");
163         if (!hcd)
164                 return -ENOMEM;
165         ohci_at91 = hcd_to_ohci_at91_priv(hcd);
166
167         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
168         hcd->regs = devm_ioremap_resource(dev, res);
169         if (IS_ERR(hcd->regs)) {
170                 retval = PTR_ERR(hcd->regs);
171                 goto err;
172         }
173         hcd->rsrc_start = res->start;
174         hcd->rsrc_len = resource_size(res);
175
176         ohci_at91->iclk = devm_clk_get(dev, "ohci_clk");
177         if (IS_ERR(ohci_at91->iclk)) {
178                 dev_err(dev, "failed to get ohci_clk\n");
179                 retval = PTR_ERR(ohci_at91->iclk);
180                 goto err;
181         }
182         ohci_at91->fclk = devm_clk_get(dev, "uhpck");
183         if (IS_ERR(ohci_at91->fclk)) {
184                 dev_err(dev, "failed to get uhpck\n");
185                 retval = PTR_ERR(ohci_at91->fclk);
186                 goto err;
187         }
188         ohci_at91->hclk = devm_clk_get(dev, "hclk");
189         if (IS_ERR(ohci_at91->hclk)) {
190                 dev_err(dev, "failed to get hclk\n");
191                 retval = PTR_ERR(ohci_at91->hclk);
192                 goto err;
193         }
194         if (IS_ENABLED(CONFIG_COMMON_CLK)) {
195                 ohci_at91->uclk = devm_clk_get(dev, "usb_clk");
196                 if (IS_ERR(ohci_at91->uclk)) {
197                         dev_err(dev, "failed to get uclk\n");
198                         retval = PTR_ERR(ohci_at91->uclk);
199                         goto err;
200                 }
201         }
202
203         board = hcd->self.controller->platform_data;
204         ohci = hcd_to_ohci(hcd);
205         ohci->num_ports = board->ports;
206         at91_start_hc(pdev);
207
208         retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
209         if (retval == 0) {
210                 device_wakeup_enable(hcd->self.controller);
211                 return retval;
212         }
213
214         /* Error handling */
215         at91_stop_hc(pdev);
216
217  err:
218         usb_put_hcd(hcd);
219         return retval;
220 }
221
222
223 /* may be called with controller, bus, and devices active */
224
225 /**
226  * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs
227  * @dev: USB Host Controller being removed
228  * Context: !in_interrupt()
229  *
230  * Reverses the effect of usb_hcd_at91_probe(), first invoking
231  * the HCD's stop() method.  It is always called from a thread
232  * context, "rmmod" or something similar.
233  *
234  */
235 static void usb_hcd_at91_remove(struct usb_hcd *hcd,
236                                 struct platform_device *pdev)
237 {
238         usb_remove_hcd(hcd);
239         at91_stop_hc(pdev);
240         usb_put_hcd(hcd);
241 }
242
243 /*-------------------------------------------------------------------------*/
244 static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
245 {
246         if (!valid_port(port))
247                 return;
248
249         if (!gpio_is_valid(pdata->vbus_pin[port]))
250                 return;
251
252         gpio_set_value(pdata->vbus_pin[port],
253                        pdata->vbus_pin_active_low[port] ^ enable);
254 }
255
256 static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
257 {
258         if (!valid_port(port))
259                 return -EINVAL;
260
261         if (!gpio_is_valid(pdata->vbus_pin[port]))
262                 return -EINVAL;
263
264         return gpio_get_value(pdata->vbus_pin[port]) ^
265                 pdata->vbus_pin_active_low[port];
266 }
267
268 /*
269  * Update the status data from the hub with the over-current indicator change.
270  */
271 static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
272 {
273         struct at91_usbh_data *pdata = hcd->self.controller->platform_data;
274         int length = ohci_hub_status_data(hcd, buf);
275         int port;
276
277         at91_for_each_port(port) {
278                 if (pdata->overcurrent_changed[port]) {
279                         if (!length)
280                                 length = 1;
281                         buf[0] |= 1 << (port + 1);
282                 }
283         }
284
285         return length;
286 }
287
288 /*
289  * Look at the control requests to the root hub and see if we need to override.
290  */
291 static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
292                                  u16 wIndex, char *buf, u16 wLength)
293 {
294         struct at91_usbh_data *pdata = dev_get_platdata(hcd->self.controller);
295         struct usb_hub_descriptor *desc;
296         int ret = -EINVAL;
297         u32 *data = (u32 *)buf;
298
299         dev_dbg(hcd->self.controller,
300                 "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
301                 hcd, typeReq, wValue, wIndex, buf, wLength);
302
303         wIndex--;
304
305         switch (typeReq) {
306         case SetPortFeature:
307                 if (wValue == USB_PORT_FEAT_POWER) {
308                         dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
309                         if (valid_port(wIndex)) {
310                                 ohci_at91_usb_set_power(pdata, wIndex, 1);
311                                 ret = 0;
312                         }
313
314                         goto out;
315                 }
316                 break;
317
318         case ClearPortFeature:
319                 switch (wValue) {
320                 case USB_PORT_FEAT_C_OVER_CURRENT:
321                         dev_dbg(hcd->self.controller,
322                                 "ClearPortFeature: C_OVER_CURRENT\n");
323
324                         if (valid_port(wIndex)) {
325                                 pdata->overcurrent_changed[wIndex] = 0;
326                                 pdata->overcurrent_status[wIndex] = 0;
327                         }
328
329                         goto out;
330
331                 case USB_PORT_FEAT_OVER_CURRENT:
332                         dev_dbg(hcd->self.controller,
333                                 "ClearPortFeature: OVER_CURRENT\n");
334
335                         if (valid_port(wIndex))
336                                 pdata->overcurrent_status[wIndex] = 0;
337
338                         goto out;
339
340                 case USB_PORT_FEAT_POWER:
341                         dev_dbg(hcd->self.controller,
342                                 "ClearPortFeature: POWER\n");
343
344                         if (valid_port(wIndex)) {
345                                 ohci_at91_usb_set_power(pdata, wIndex, 0);
346                                 return 0;
347                         }
348                 }
349                 break;
350         }
351
352         ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength);
353         if (ret)
354                 goto out;
355
356         switch (typeReq) {
357         case GetHubDescriptor:
358
359                 /* update the hub's descriptor */
360
361                 desc = (struct usb_hub_descriptor *)buf;
362
363                 dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
364                         desc->wHubCharacteristics);
365
366                 /* remove the old configurations for power-switching, and
367                  * over-current protection, and insert our new configuration
368                  */
369
370                 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
371                 desc->wHubCharacteristics |=
372                         cpu_to_le16(HUB_CHAR_INDV_PORT_LPSM);
373
374                 if (pdata->overcurrent_supported) {
375                         desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM);
376                         desc->wHubCharacteristics |=
377                                 cpu_to_le16(HUB_CHAR_INDV_PORT_OCPM);
378                 }
379
380                 dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
381                         desc->wHubCharacteristics);
382
383                 return ret;
384
385         case GetPortStatus:
386                 /* check port status */
387
388                 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
389
390                 if (valid_port(wIndex)) {
391                         if (!ohci_at91_usb_get_power(pdata, wIndex))
392                                 *data &= ~cpu_to_le32(RH_PS_PPS);
393
394                         if (pdata->overcurrent_changed[wIndex])
395                                 *data |= cpu_to_le32(RH_PS_OCIC);
396
397                         if (pdata->overcurrent_status[wIndex])
398                                 *data |= cpu_to_le32(RH_PS_POCI);
399                 }
400         }
401
402  out:
403         return ret;
404 }
405
406 /*-------------------------------------------------------------------------*/
407
408 static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
409 {
410         struct platform_device *pdev = data;
411         struct at91_usbh_data *pdata = dev_get_platdata(&pdev->dev);
412         int val, gpio, port;
413
414         /* From the GPIO notifying the over-current situation, find
415          * out the corresponding port */
416         at91_for_each_port(port) {
417                 if (gpio_is_valid(pdata->overcurrent_pin[port]) &&
418                                 gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
419                         gpio = pdata->overcurrent_pin[port];
420                         break;
421                 }
422         }
423
424         if (port == AT91_MAX_USBH_PORTS) {
425                 dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n");
426                 return IRQ_HANDLED;
427         }
428
429         val = gpio_get_value(gpio);
430
431         /* When notified of an over-current situation, disable power
432            on the corresponding port, and mark this port in
433            over-current. */
434         if (!val) {
435                 ohci_at91_usb_set_power(pdata, port, 0);
436                 pdata->overcurrent_status[port]  = 1;
437                 pdata->overcurrent_changed[port] = 1;
438         }
439
440         dev_dbg(& pdev->dev, "overcurrent situation %s\n",
441                 val ? "exited" : "notified");
442
443         return IRQ_HANDLED;
444 }
445
446 #ifdef CONFIG_OF
447 static const struct of_device_id at91_ohci_dt_ids[] = {
448         { .compatible = "atmel,at91rm9200-ohci" },
449         { /* sentinel */ }
450 };
451
452 MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
453
454 static int ohci_at91_of_init(struct platform_device *pdev)
455 {
456         struct device_node *np = pdev->dev.of_node;
457         int i, gpio, ret;
458         enum of_gpio_flags flags;
459         struct at91_usbh_data   *pdata;
460         u32 ports;
461
462         if (!np)
463                 return 0;
464
465         /* Right now device-tree probed devices don't get dma_mask set.
466          * Since shared usb code relies on it, set it here for now.
467          * Once we have dma capability bindings this can go away.
468          */
469         ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
470         if (ret)
471                 return ret;
472
473         pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
474         if (!pdata)
475                 return -ENOMEM;
476
477         if (!of_property_read_u32(np, "num-ports", &ports))
478                 pdata->ports = ports;
479
480         at91_for_each_port(i) {
481                 gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
482                 pdata->vbus_pin[i] = gpio;
483                 if (!gpio_is_valid(gpio))
484                         continue;
485                 pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
486         }
487
488         at91_for_each_port(i)
489                 pdata->overcurrent_pin[i] =
490                         of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
491
492         pdev->dev.platform_data = pdata;
493
494         return 0;
495 }
496 #else
497 static int ohci_at91_of_init(struct platform_device *pdev)
498 {
499         return 0;
500 }
501 #endif
502
503 /*-------------------------------------------------------------------------*/
504
505 static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
506 {
507         struct at91_usbh_data   *pdata;
508         int                     i;
509         int                     gpio;
510         int                     ret;
511
512         ret = ohci_at91_of_init(pdev);
513         if (ret)
514                 return ret;
515
516         pdata = dev_get_platdata(&pdev->dev);
517
518         if (pdata) {
519                 at91_for_each_port(i) {
520                         /*
521                          * do not configure PIO if not in relation with
522                          * real USB port on board
523                          */
524                         if (i >= pdata->ports) {
525                                 pdata->vbus_pin[i] = -EINVAL;
526                                 pdata->overcurrent_pin[i] = -EINVAL;
527                                 break;
528                         }
529
530                         if (!gpio_is_valid(pdata->vbus_pin[i]))
531                                 continue;
532                         gpio = pdata->vbus_pin[i];
533
534                         ret = gpio_request(gpio, "ohci_vbus");
535                         if (ret) {
536                                 dev_err(&pdev->dev,
537                                         "can't request vbus gpio %d\n", gpio);
538                                 continue;
539                         }
540                         ret = gpio_direction_output(gpio,
541                                                 !pdata->vbus_pin_active_low[i]);
542                         if (ret) {
543                                 dev_err(&pdev->dev,
544                                         "can't put vbus gpio %d as output %d\n",
545                                         gpio, !pdata->vbus_pin_active_low[i]);
546                                 gpio_free(gpio);
547                                 continue;
548                         }
549
550                         ohci_at91_usb_set_power(pdata, i, 1);
551                 }
552
553                 at91_for_each_port(i) {
554                         if (!gpio_is_valid(pdata->overcurrent_pin[i]))
555                                 continue;
556                         gpio = pdata->overcurrent_pin[i];
557
558                         ret = gpio_request(gpio, "ohci_overcurrent");
559                         if (ret) {
560                                 dev_err(&pdev->dev,
561                                         "can't request overcurrent gpio %d\n",
562                                         gpio);
563                                 continue;
564                         }
565
566                         ret = gpio_direction_input(gpio);
567                         if (ret) {
568                                 dev_err(&pdev->dev,
569                                         "can't configure overcurrent gpio %d as input\n",
570                                         gpio);
571                                 gpio_free(gpio);
572                                 continue;
573                         }
574
575                         ret = request_irq(gpio_to_irq(gpio),
576                                           ohci_hcd_at91_overcurrent_irq,
577                                           IRQF_SHARED, "ohci_overcurrent", pdev);
578                         if (ret) {
579                                 gpio_free(gpio);
580                                 dev_err(&pdev->dev,
581                                         "can't get gpio IRQ for overcurrent\n");
582                         }
583                 }
584         }
585
586         device_init_wakeup(&pdev->dev, 1);
587         return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
588 }
589
590 static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
591 {
592         struct at91_usbh_data   *pdata = dev_get_platdata(&pdev->dev);
593         int                     i;
594
595         if (pdata) {
596                 at91_for_each_port(i) {
597                         if (!gpio_is_valid(pdata->vbus_pin[i]))
598                                 continue;
599                         ohci_at91_usb_set_power(pdata, i, 0);
600                         gpio_free(pdata->vbus_pin[i]);
601                 }
602
603                 at91_for_each_port(i) {
604                         if (!gpio_is_valid(pdata->overcurrent_pin[i]))
605                                 continue;
606                         free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev);
607                         gpio_free(pdata->overcurrent_pin[i]);
608                 }
609         }
610
611         device_init_wakeup(&pdev->dev, 0);
612         usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev);
613         return 0;
614 }
615
616 #ifdef CONFIG_PM
617
618 static int
619 ohci_hcd_at91_drv_suspend(struct device *dev)
620 {
621         struct usb_hcd  *hcd = dev_get_drvdata(dev);
622         struct ohci_hcd *ohci = hcd_to_ohci(hcd);
623         struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
624         int             ret;
625
626         /*
627          * Disable wakeup if we are going to sleep with slow clock mode
628          * enabled.
629          */
630         ohci_at91->wakeup = device_may_wakeup(dev)
631                         && !at91_suspend_entering_slow_clock();
632
633         if (ohci_at91->wakeup)
634                 enable_irq_wake(hcd->irq);
635
636         ret = ohci_suspend(hcd, ohci_at91->wakeup);
637         if (ret) {
638                 if (ohci_at91->wakeup)
639                         disable_irq_wake(hcd->irq);
640                 return ret;
641         }
642         /*
643          * The integrated transceivers seem unable to notice disconnect,
644          * reconnect, or wakeup without the 48 MHz clock active.  so for
645          * correctness, always discard connection state (using reset).
646          *
647          * REVISIT: some boards will be able to turn VBUS off...
648          */
649         if (!ohci_at91->wakeup) {
650                 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
651                 ohci->hc_control &= OHCI_CTRL_RWC;
652                 ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
653                 ohci->rh_state = OHCI_RH_HALTED;
654
655                 /* flush the writes */
656                 (void) ohci_readl (ohci, &ohci->regs->control);
657                 at91_stop_clock(ohci_at91);
658         }
659
660         return ret;
661 }
662
663 static int ohci_hcd_at91_drv_resume(struct device *dev)
664 {
665         struct usb_hcd  *hcd = dev_get_drvdata(dev);
666         struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
667
668         if (ohci_at91->wakeup)
669                 disable_irq_wake(hcd->irq);
670
671         at91_start_clock(ohci_at91);
672
673         ohci_resume(hcd, false);
674         return 0;
675 }
676 #endif
677
678 static SIMPLE_DEV_PM_OPS(ohci_hcd_at91_pm_ops, ohci_hcd_at91_drv_suspend,
679                                         ohci_hcd_at91_drv_resume);
680
681 static struct platform_driver ohci_hcd_at91_driver = {
682         .probe          = ohci_hcd_at91_drv_probe,
683         .remove         = ohci_hcd_at91_drv_remove,
684         .shutdown       = usb_hcd_platform_shutdown,
685         .driver         = {
686                 .name   = "at91_ohci",
687                 .pm     = &ohci_hcd_at91_pm_ops,
688                 .of_match_table = of_match_ptr(at91_ohci_dt_ids),
689         },
690 };
691
692 static int __init ohci_at91_init(void)
693 {
694         if (usb_disabled())
695                 return -ENODEV;
696
697         pr_info("%s: " DRIVER_DESC "\n", hcd_name);
698         ohci_init_driver(&ohci_at91_hc_driver, &ohci_at91_drv_overrides);
699
700         /*
701          * The Atmel HW has some unusual quirks, which require Atmel-specific
702          * workarounds. We override certain hc_driver functions here to
703          * achieve that. We explicitly do not enhance ohci_driver_overrides to
704          * allow this more easily, since this is an unusual case, and we don't
705          * want to encourage others to override these functions by making it
706          * too easy.
707          */
708
709         ohci_at91_hc_driver.hub_status_data     = ohci_at91_hub_status_data;
710         ohci_at91_hc_driver.hub_control         = ohci_at91_hub_control;
711
712         return platform_driver_register(&ohci_hcd_at91_driver);
713 }
714 module_init(ohci_at91_init);
715
716 static void __exit ohci_at91_cleanup(void)
717 {
718         platform_driver_unregister(&ohci_hcd_at91_driver);
719 }
720 module_exit(ohci_at91_cleanup);
721
722 MODULE_DESCRIPTION(DRIVER_DESC);
723 MODULE_LICENSE("GPL");
724 MODULE_ALIAS("platform:at91_ohci");