2 * OHCI HCD (Host Controller Driver) for USB.
4 * Bus Glue for Atheros AR71XX/AR724X built-in OHCI controller.
6 * Copyright (C) 2008-2011 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>
19 static int __devinit
ohci_ath79_start(struct usb_hcd
*hcd
)
21 struct ohci_hcd
*ohci
= hcd_to_ohci(hcd
);
24 ret
= ohci_init(ohci
);
39 static const struct hc_driver ohci_ath79_hc_driver
= {
40 .description
= hcd_name
,
41 .product_desc
= "Atheros built-in OHCI controller",
42 .hcd_priv_size
= sizeof(struct ohci_hcd
),
45 .flags
= HCD_USB11
| HCD_MEMORY
,
47 .start
= ohci_ath79_start
,
49 .shutdown
= ohci_shutdown
,
51 .urb_enqueue
= ohci_urb_enqueue
,
52 .urb_dequeue
= ohci_urb_dequeue
,
53 .endpoint_disable
= ohci_endpoint_disable
,
58 .get_frame_number
= ohci_get_frame
,
63 .hub_status_data
= ohci_hub_status_data
,
64 .hub_control
= ohci_hub_control
,
65 .start_port_reset
= ohci_start_port_reset
,
68 static int ohci_ath79_probe(struct platform_device
*pdev
)
78 res
= platform_get_resource(pdev
, IORESOURCE_IRQ
, 0);
80 dev_dbg(&pdev
->dev
, "no IRQ specified\n");
85 hcd
= usb_create_hcd(&ohci_ath79_hc_driver
, &pdev
->dev
,
86 dev_name(&pdev
->dev
));
90 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
92 dev_dbg(&pdev
->dev
, "no base address specified\n");
96 hcd
->rsrc_start
= res
->start
;
97 hcd
->rsrc_len
= resource_size(res
);
99 if (!request_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
, hcd_name
)) {
100 dev_dbg(&pdev
->dev
, "controller already in use\n");
105 hcd
->regs
= ioremap(hcd
->rsrc_start
, hcd
->rsrc_len
);
107 dev_dbg(&pdev
->dev
, "error mapping memory\n");
109 goto err_release_region
;
112 ohci_hcd_init(hcd_to_ohci(hcd
));
114 ret
= usb_add_hcd(hcd
, irq
, IRQF_DISABLED
);
123 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
129 static int ohci_ath79_remove(struct platform_device
*pdev
)
131 struct usb_hcd
*hcd
= platform_get_drvdata(pdev
);
135 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
141 static struct platform_driver ohci_hcd_ath79_driver
= {
142 .probe
= ohci_ath79_probe
,
143 .remove
= ohci_ath79_remove
,
144 .shutdown
= usb_hcd_platform_shutdown
,
146 .name
= "ath79-ohci",
147 .owner
= THIS_MODULE
,
151 MODULE_ALIAS(PLATFORM_MODULE_PREFIX
"ath79-ohci");