aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/ath79/dev-usb.c31
-rw-r--r--drivers/usb/host/Kconfig12
-rw-r--r--drivers/usb/host/ehci-ath79.c208
-rw-r--r--drivers/usb/host/ehci-hcd.c5
-rw-r--r--drivers/usb/host/ohci-ath79.c151
-rw-r--r--drivers/usb/host/ohci-hcd.c5
6 files changed, 35 insertions, 377 deletions
diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c
index 002d6d2afe04..36e9570e7bc4 100644
--- a/arch/mips/ath79/dev-usb.c
+++ b/arch/mips/ath79/dev-usb.c
@@ -17,6 +17,8 @@
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/usb/ehci_pdriver.h>
21#include <linux/usb/ohci_pdriver.h>
20 22
21#include <asm/mach-ath79/ath79.h> 23#include <asm/mach-ath79/ath79.h>
22#include <asm/mach-ath79/ar71xx_regs.h> 24#include <asm/mach-ath79/ar71xx_regs.h>
@@ -36,14 +38,19 @@ static struct resource ath79_ohci_resources[] = {
36}; 38};
37 39
38static u64 ath79_ohci_dmamask = DMA_BIT_MASK(32); 40static u64 ath79_ohci_dmamask = DMA_BIT_MASK(32);
41
42static struct usb_ohci_pdata ath79_ohci_pdata = {
43};
44
39static struct platform_device ath79_ohci_device = { 45static struct platform_device ath79_ohci_device = {
40 .name = "ath79-ohci", 46 .name = "ohci-platform",
41 .id = -1, 47 .id = -1,
42 .resource = ath79_ohci_resources, 48 .resource = ath79_ohci_resources,
43 .num_resources = ARRAY_SIZE(ath79_ohci_resources), 49 .num_resources = ARRAY_SIZE(ath79_ohci_resources),
44 .dev = { 50 .dev = {
45 .dma_mask = &ath79_ohci_dmamask, 51 .dma_mask = &ath79_ohci_dmamask,
46 .coherent_dma_mask = DMA_BIT_MASK(32), 52 .coherent_dma_mask = DMA_BIT_MASK(32),
53 .platform_data = &ath79_ohci_pdata,
47 }, 54 },
48}; 55};
49 56
@@ -60,8 +67,20 @@ static struct resource ath79_ehci_resources[] = {
60}; 67};
61 68
62static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32); 69static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32);
70
71static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
72 .has_synopsys_hc_bug = 1,
73 .port_power_off = 1,
74};
75
76static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
77 .caps_offset = 0x100,
78 .has_tt = 1,
79 .port_power_off = 1,
80};
81
63static struct platform_device ath79_ehci_device = { 82static struct platform_device ath79_ehci_device = {
64 .name = "ath79-ehci", 83 .name = "ehci-platform",
65 .id = -1, 84 .id = -1,
66 .resource = ath79_ehci_resources, 85 .resource = ath79_ehci_resources,
67 .num_resources = ARRAY_SIZE(ath79_ehci_resources), 86 .num_resources = ARRAY_SIZE(ath79_ehci_resources),
@@ -101,7 +120,7 @@ static void __init ath79_usb_setup(void)
101 120
102 ath79_ehci_resources[0].start = AR71XX_EHCI_BASE; 121 ath79_ehci_resources[0].start = AR71XX_EHCI_BASE;
103 ath79_ehci_resources[0].end = AR71XX_EHCI_BASE + AR71XX_EHCI_SIZE - 1; 122 ath79_ehci_resources[0].end = AR71XX_EHCI_BASE + AR71XX_EHCI_SIZE - 1;
104 ath79_ehci_device.name = "ar71xx-ehci"; 123 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v1;
105 platform_device_register(&ath79_ehci_device); 124 platform_device_register(&ath79_ehci_device);
106} 125}
107 126
@@ -142,7 +161,7 @@ static void __init ar724x_usb_setup(void)
142 161
143 ath79_ehci_resources[0].start = AR724X_EHCI_BASE; 162 ath79_ehci_resources[0].start = AR724X_EHCI_BASE;
144 ath79_ehci_resources[0].end = AR724X_EHCI_BASE + AR724X_EHCI_SIZE - 1; 163 ath79_ehci_resources[0].end = AR724X_EHCI_BASE + AR724X_EHCI_SIZE - 1;
145 ath79_ehci_device.name = "ar724x-ehci"; 164 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
146 platform_device_register(&ath79_ehci_device); 165 platform_device_register(&ath79_ehci_device);
147} 166}
148 167
@@ -159,7 +178,7 @@ static void __init ar913x_usb_setup(void)
159 178
160 ath79_ehci_resources[0].start = AR913X_EHCI_BASE; 179 ath79_ehci_resources[0].start = AR913X_EHCI_BASE;
161 ath79_ehci_resources[0].end = AR913X_EHCI_BASE + AR913X_EHCI_SIZE - 1; 180 ath79_ehci_resources[0].end = AR913X_EHCI_BASE + AR913X_EHCI_SIZE - 1;
162 ath79_ehci_device.name = "ar913x-ehci"; 181 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
163 platform_device_register(&ath79_ehci_device); 182 platform_device_register(&ath79_ehci_device);
164} 183}
165 184
@@ -176,7 +195,7 @@ static void __init ar933x_usb_setup(void)
176 195
177 ath79_ehci_resources[0].start = AR933X_EHCI_BASE; 196 ath79_ehci_resources[0].start = AR933X_EHCI_BASE;
178 ath79_ehci_resources[0].end = AR933X_EHCI_BASE + AR933X_EHCI_SIZE - 1; 197 ath79_ehci_resources[0].end = AR933X_EHCI_BASE + AR933X_EHCI_SIZE - 1;
179 ath79_ehci_device.name = "ar933x-ehci"; 198 ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
180 platform_device_register(&ath79_ehci_device); 199 platform_device_register(&ath79_ehci_device);
181} 200}
182 201
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index cbd3df8477ba..f788eb86707c 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -222,11 +222,15 @@ config USB_CNS3XXX_EHCI
222 support. 222 support.
223 223
224config USB_EHCI_ATH79 224config USB_EHCI_ATH79
225 bool "EHCI support for AR7XXX/AR9XXX SoCs" 225 bool "EHCI support for AR7XXX/AR9XXX SoCs (DEPRECATED)"
226 depends on USB_EHCI_HCD && (SOC_AR71XX || SOC_AR724X || SOC_AR913X || SOC_AR933X) 226 depends on USB_EHCI_HCD && (SOC_AR71XX || SOC_AR724X || SOC_AR913X || SOC_AR933X)
227 select USB_EHCI_ROOT_HUB_TT 227 select USB_EHCI_ROOT_HUB_TT
228 select USB_EHCI_HCD_PLATFORM
228 default y 229 default y
229 ---help--- 230 ---help---
231 This option is deprecated now and the driver was removed, use
232 USB_EHCI_HCD_PLATFORM instead.
233
230 Enables support for the built-in EHCI controller present 234 Enables support for the built-in EHCI controller present
231 on the Atheros AR7XXX/AR9XXX SoCs. 235 on the Atheros AR7XXX/AR9XXX SoCs.
232 236
@@ -316,10 +320,14 @@ config USB_OHCI_HCD_OMAP3
316 OMAP3 and later chips. 320 OMAP3 and later chips.
317 321
318config USB_OHCI_ATH79 322config USB_OHCI_ATH79
319 bool "USB OHCI support for the Atheros AR71XX/AR7240 SoCs" 323 bool "USB OHCI support for the Atheros AR71XX/AR7240 SoCs (DEPRECATED)"
320 depends on USB_OHCI_HCD && (SOC_AR71XX || SOC_AR724X) 324 depends on USB_OHCI_HCD && (SOC_AR71XX || SOC_AR724X)
325 select USB_OHCI_HCD_PLATFORM
321 default y 326 default y
322 help 327 help
328 This option is deprecated now and the driver was removed, use
329 USB_OHCI_HCD_PLATFORM instead.
330
323 Enables support for the built-in OHCI controller present on the 331 Enables support for the built-in OHCI controller present on the
324 Atheros AR71XX/AR7240 SoCs. 332 Atheros AR71XX/AR7240 SoCs.
325 333
diff --git a/drivers/usb/host/ehci-ath79.c b/drivers/usb/host/ehci-ath79.c
deleted file mode 100644
index f1424f9bc363..000000000000
--- a/drivers/usb/host/ehci-ath79.c
+++ /dev/null
@@ -1,208 +0,0 @@
1/*
2 * Bus Glue for Atheros AR7XXX/AR9XXX built-in EHCI controller.
3 *
4 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * Parts of this file are based on Atheros' 2.6.15 BSP
8 * Copyright (C) 2007 Atheros Communications, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published
12 * by the Free Software Foundation.
13 */
14
15#include <linux/platform_device.h>
16
17enum {
18 EHCI_ATH79_IP_V1 = 0,
19 EHCI_ATH79_IP_V2,
20};
21
22static const struct platform_device_id ehci_ath79_id_table[] = {
23 {
24 .name = "ar71xx-ehci",
25 .driver_data = EHCI_ATH79_IP_V1,
26 },
27 {
28 .name = "ar724x-ehci",
29 .driver_data = EHCI_ATH79_IP_V2,
30 },
31 {
32 .name = "ar913x-ehci",
33 .driver_data = EHCI_ATH79_IP_V2,
34 },
35 {
36 .name = "ar933x-ehci",
37 .driver_data = EHCI_ATH79_IP_V2,
38 },
39 {
40 /* terminating entry */
41 },
42};
43
44MODULE_DEVICE_TABLE(platform, ehci_ath79_id_table);
45
46static int ehci_ath79_init(struct usb_hcd *hcd)
47{
48 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
49 struct platform_device *pdev = to_platform_device(hcd->self.controller);
50 const struct platform_device_id *id;
51 int ret;
52
53 id = platform_get_device_id(pdev);
54 if (!id) {
55 dev_err(hcd->self.controller, "missing device id\n");
56 return -EINVAL;
57 }
58
59 switch (id->driver_data) {
60 case EHCI_ATH79_IP_V1:
61 ehci->has_synopsys_hc_bug = 1;
62
63 ehci->caps = hcd->regs;
64 ehci->regs = hcd->regs +
65 HC_LENGTH(ehci,
66 ehci_readl(ehci, &ehci->caps->hc_capbase));
67 break;
68
69 case EHCI_ATH79_IP_V2:
70 hcd->has_tt = 1;
71
72 ehci->caps = hcd->regs + 0x100;
73 ehci->regs = hcd->regs + 0x100 +
74 HC_LENGTH(ehci,
75 ehci_readl(ehci, &ehci->caps->hc_capbase));
76 break;
77
78 default:
79 BUG();
80 }
81
82 dbg_hcs_params(ehci, "reset");
83 dbg_hcc_params(ehci, "reset");
84 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
85 ehci->sbrn = 0x20;
86
87 ehci_reset(ehci);
88
89 ret = ehci_init(hcd);
90 if (ret)
91 return ret;
92
93 ehci_port_power(ehci, 0);
94
95 return 0;
96}
97
98static const struct hc_driver ehci_ath79_hc_driver = {
99 .description = hcd_name,
100 .product_desc = "Atheros built-in EHCI controller",
101 .hcd_priv_size = sizeof(struct ehci_hcd),
102 .irq = ehci_irq,
103 .flags = HCD_MEMORY | HCD_USB2,
104
105 .reset = ehci_ath79_init,
106 .start = ehci_run,
107 .stop = ehci_stop,
108 .shutdown = ehci_shutdown,
109
110 .urb_enqueue = ehci_urb_enqueue,
111 .urb_dequeue = ehci_urb_dequeue,
112 .endpoint_disable = ehci_endpoint_disable,
113 .endpoint_reset = ehci_endpoint_reset,
114
115 .get_frame_number = ehci_get_frame,
116
117 .hub_status_data = ehci_hub_status_data,
118 .hub_control = ehci_hub_control,
119
120 .relinquish_port = ehci_relinquish_port,
121 .port_handed_over = ehci_port_handed_over,
122
123 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
124};
125
126static int ehci_ath79_probe(struct platform_device *pdev)
127{
128 struct usb_hcd *hcd;
129 struct resource *res;
130 int irq;
131 int ret;
132
133 if (usb_disabled())
134 return -ENODEV;
135
136 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
137 if (!res) {
138 dev_dbg(&pdev->dev, "no IRQ specified\n");
139 return -ENODEV;
140 }
141 irq = res->start;
142
143 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
144 if (!res) {
145 dev_dbg(&pdev->dev, "no base address specified\n");
146 return -ENODEV;
147 }
148
149 hcd = usb_create_hcd(&ehci_ath79_hc_driver, &pdev->dev,
150 dev_name(&pdev->dev));
151 if (!hcd)
152 return -ENOMEM;
153
154 hcd->rsrc_start = res->start;
155 hcd->rsrc_len = resource_size(res);
156
157 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
158 dev_dbg(&pdev->dev, "controller already in use\n");
159 ret = -EBUSY;
160 goto err_put_hcd;
161 }
162
163 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
164 if (!hcd->regs) {
165 dev_dbg(&pdev->dev, "error mapping memory\n");
166 ret = -EFAULT;
167 goto err_release_region;
168 }
169
170 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
171 if (ret)
172 goto err_iounmap;
173
174 return 0;
175
176err_iounmap:
177 iounmap(hcd->regs);
178
179err_release_region:
180 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
181err_put_hcd:
182 usb_put_hcd(hcd);
183 return ret;
184}
185
186static int ehci_ath79_remove(struct platform_device *pdev)
187{
188 struct usb_hcd *hcd = platform_get_drvdata(pdev);
189
190 usb_remove_hcd(hcd);
191 iounmap(hcd->regs);
192 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
193 usb_put_hcd(hcd);
194
195 return 0;
196}
197
198static struct platform_driver ehci_ath79_driver = {
199 .probe = ehci_ath79_probe,
200 .remove = ehci_ath79_remove,
201 .id_table = ehci_ath79_id_table,
202 .driver = {
203 .owner = THIS_MODULE,
204 .name = "ath79-ehci",
205 }
206};
207
208MODULE_ALIAS(PLATFORM_MODULE_PREFIX "ath79-ehci");
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c97b2b6378d6..aede6374e4b6 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1351,11 +1351,6 @@ MODULE_LICENSE ("GPL");
1351#define PLATFORM_DRIVER s5p_ehci_driver 1351#define PLATFORM_DRIVER s5p_ehci_driver
1352#endif 1352#endif
1353 1353
1354#ifdef CONFIG_USB_EHCI_ATH79
1355#include "ehci-ath79.c"
1356#define PLATFORM_DRIVER ehci_ath79_driver
1357#endif
1358
1359#ifdef CONFIG_SPARC_LEON 1354#ifdef CONFIG_SPARC_LEON
1360#include "ehci-grlib.c" 1355#include "ehci-grlib.c"
1361#define PLATFORM_DRIVER ehci_grlib_driver 1356#define PLATFORM_DRIVER ehci_grlib_driver
diff --git a/drivers/usb/host/ohci-ath79.c b/drivers/usb/host/ohci-ath79.c
deleted file mode 100644
index 18d574d6958b..000000000000
--- a/drivers/usb/host/ohci-ath79.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * OHCI HCD (Host Controller Driver) for USB.
3 *
4 * Bus Glue for Atheros AR71XX/AR724X built-in OHCI controller.
5 *
6 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 *
9 * Parts of this file are based on Atheros' 2.6.15 BSP
10 * Copyright (C) 2007 Atheros Communications, Inc.
11 *
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.
15 */
16
17#include <linux/platform_device.h>
18
19static int __devinit ohci_ath79_start(struct usb_hcd *hcd)
20{
21 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
22 int ret;
23
24 ret = ohci_init(ohci);
25 if (ret < 0)
26 return ret;
27
28 ret = ohci_run(ohci);
29 if (ret < 0)
30 goto err;
31
32 return 0;
33
34err:
35 ohci_stop(hcd);
36 return ret;
37}
38
39static 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),
43
44 .irq = ohci_irq,
45 .flags = HCD_USB11 | HCD_MEMORY,
46
47 .start = ohci_ath79_start,
48 .stop = ohci_stop,
49 .shutdown = ohci_shutdown,
50
51 .urb_enqueue = ohci_urb_enqueue,
52 .urb_dequeue = ohci_urb_dequeue,
53 .endpoint_disable = ohci_endpoint_disable,
54
55 /*
56 * scheduling support
57 */
58 .get_frame_number = ohci_get_frame,
59
60 /*
61 * root hub support
62 */
63 .hub_status_data = ohci_hub_status_data,
64 .hub_control = ohci_hub_control,
65 .start_port_reset = ohci_start_port_reset,
66};
67
68static int ohci_ath79_probe(struct platform_device *pdev)
69{
70 struct usb_hcd *hcd;
71 struct resource *res;
72 int irq;
73 int ret;
74
75 if (usb_disabled())
76 return -ENODEV;
77
78 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
79 if (!res) {
80 dev_dbg(&pdev->dev, "no IRQ specified\n");
81 return -ENODEV;
82 }
83 irq = res->start;
84
85 hcd = usb_create_hcd(&ohci_ath79_hc_driver, &pdev->dev,
86 dev_name(&pdev->dev));
87 if (!hcd)
88 return -ENOMEM;
89
90 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
91 if (!res) {
92 dev_dbg(&pdev->dev, "no base address specified\n");
93 ret = -ENODEV;
94 goto err_put_hcd;
95 }
96 hcd->rsrc_start = res->start;
97 hcd->rsrc_len = resource_size(res);
98
99 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
100 dev_dbg(&pdev->dev, "controller already in use\n");
101 ret = -EBUSY;
102 goto err_put_hcd;
103 }
104
105 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
106 if (!hcd->regs) {
107 dev_dbg(&pdev->dev, "error mapping memory\n");
108 ret = -EFAULT;
109 goto err_release_region;
110 }
111
112 ohci_hcd_init(hcd_to_ohci(hcd));
113
114 ret = usb_add_hcd(hcd, irq, 0);
115 if (ret)
116 goto err_stop_hcd;
117
118 return 0;
119
120err_stop_hcd:
121 iounmap(hcd->regs);
122err_release_region:
123 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
124err_put_hcd:
125 usb_put_hcd(hcd);
126 return ret;
127}
128
129static int ohci_ath79_remove(struct platform_device *pdev)
130{
131 struct usb_hcd *hcd = platform_get_drvdata(pdev);
132
133 usb_remove_hcd(hcd);
134 iounmap(hcd->regs);
135 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
136 usb_put_hcd(hcd);
137
138 return 0;
139}
140
141static struct platform_driver ohci_hcd_ath79_driver = {
142 .probe = ohci_ath79_probe,
143 .remove = ohci_ath79_remove,
144 .shutdown = usb_hcd_platform_shutdown,
145 .driver = {
146 .name = "ath79-ohci",
147 .owner = THIS_MODULE,
148 },
149};
150
151MODULE_ALIAS(PLATFORM_MODULE_PREFIX "ath79-ohci");
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index ddd54c70d0fd..cd5e382db89c 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1111,11 +1111,6 @@ MODULE_LICENSE ("GPL");
1111#define PLATFORM_DRIVER ohci_hcd_cns3xxx_driver 1111#define PLATFORM_DRIVER ohci_hcd_cns3xxx_driver
1112#endif 1112#endif
1113 1113
1114#ifdef CONFIG_USB_OHCI_ATH79
1115#include "ohci-ath79.c"
1116#define PLATFORM_DRIVER ohci_hcd_ath79_driver
1117#endif
1118
1119#ifdef CONFIG_CPU_XLR 1114#ifdef CONFIG_CPU_XLR
1120#include "ohci-xls.c" 1115#include "ohci-xls.c"
1121#define PLATFORM_DRIVER ohci_xls_driver 1116#define PLATFORM_DRIVER ohci_xls_driver