2 * OHCI HCD (Host Controller Driver) for USB.
4 * Bus Glue for Atheros AR71xx built-in OHCI controller.
6 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
9 * Parts of this file are based on Atheros' 2.6.15 BSP
10 * Copyright (C) 2007 Atheros Communications, Inc.
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published
14 * by the Free Software Foundation.
17 #include <linux/platform_device.h>
18 #include <linux/delay.h>
20 extern int usb_disabled(void);
22 static int usb_hcd_ar71xx_probe(const struct hc_driver *driver,
23 struct platform_device *pdev)
30 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
32 dev_dbg(&pdev->dev, "no IRQ specified for %s\n",
33 dev_name(&pdev->dev));
38 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
42 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
44 dev_dbg(&pdev->dev, "no base address specified for %s\n",
45 dev_name(&pdev->dev));
49 hcd->rsrc_start = res->start;
50 hcd->rsrc_len = res->end - res->start + 1;
52 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
53 dev_dbg(&pdev->dev, "controller already in use\n");
58 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
60 dev_dbg(&pdev->dev, "error mapping memory\n");
62 goto err_release_region;
65 ohci_hcd_init(hcd_to_ohci(hcd));
67 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
76 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
82 void usb_hcd_ar71xx_remove(struct usb_hcd *hcd, struct platform_device *pdev)
86 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
90 static int __devinit ohci_ar71xx_start(struct usb_hcd *hcd)
92 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
95 ret = ohci_init(ohci);
110 static const struct hc_driver ohci_ar71xx_hc_driver = {
111 .description = hcd_name,
112 .product_desc = "Atheros AR71xx built-in OHCI controller",
113 .hcd_priv_size = sizeof(struct ohci_hcd),
116 .flags = HCD_USB11 | HCD_MEMORY,
118 .start = ohci_ar71xx_start,
120 .shutdown = ohci_shutdown,
122 .urb_enqueue = ohci_urb_enqueue,
123 .urb_dequeue = ohci_urb_dequeue,
124 .endpoint_disable = ohci_endpoint_disable,
129 .get_frame_number = ohci_get_frame,
134 .hub_status_data = ohci_hub_status_data,
135 .hub_control = ohci_hub_control,
136 .start_port_reset = ohci_start_port_reset,
139 static int ohci_hcd_ar71xx_drv_probe(struct platform_device *pdev)
144 return usb_hcd_ar71xx_probe(&ohci_ar71xx_hc_driver, pdev);
147 static int ohci_hcd_ar71xx_drv_remove(struct platform_device *pdev)
149 struct usb_hcd *hcd = platform_get_drvdata(pdev);
151 usb_hcd_ar71xx_remove(hcd, pdev);
155 MODULE_ALIAS("platform:ar71xx-ohci");
157 static struct platform_driver ohci_hcd_ar71xx_driver = {
158 .probe = ohci_hcd_ar71xx_drv_probe,
159 .remove = ohci_hcd_ar71xx_drv_remove,
160 .shutdown = usb_hcd_platform_shutdown,
162 .name = "ar71xx-ohci",
163 .owner = THIS_MODULE,