summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-03-09 10:10:20 -0500
committerArnd Bergmann <arnd@arndb.de>2018-03-26 09:57:10 -0400
commit03f4c9abd73284193f70e64da1a266d393650530 (patch)
treed46d1585d4f3e14271f9af9158dff2892c4dbf30
parent4dab216d1fc1ec6783df1b78de5a00df1a7d6991 (diff)
usb: host: remove tilegx platform glue
The tile architecture is getting removed, so the ehci and ohci platform glue drivers are no longer needed. In case of ohci, this is the last one to define a PLATFORM_DRIVER macro, so we can remove even more. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--drivers/usb/host/ehci-hcd.c5
-rw-r--r--drivers/usb/host/ehci-tilegx.c207
-rw-r--r--drivers/usb/host/ohci-hcd.c18
-rw-r--r--drivers/usb/host/ohci-tilegx.c196
-rw-r--r--include/linux/usb/tilegx.h35
5 files changed, 0 insertions, 461 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 7f0737449df7..d927adf3afcd 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1275,11 +1275,6 @@ MODULE_LICENSE ("GPL");
1275#define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver 1275#define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver
1276#endif 1276#endif
1277 1277
1278#ifdef CONFIG_TILE_USB
1279#include "ehci-tilegx.c"
1280#define PLATFORM_DRIVER ehci_hcd_tilegx_driver
1281#endif
1282
1283#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP 1278#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP
1284#include "ehci-pmcmsp.c" 1279#include "ehci-pmcmsp.c"
1285#define PLATFORM_DRIVER ehci_hcd_msp_driver 1280#define PLATFORM_DRIVER ehci_hcd_msp_driver
diff --git a/drivers/usb/host/ehci-tilegx.c b/drivers/usb/host/ehci-tilegx.c
deleted file mode 100644
index 610ed437ed2c..000000000000
--- a/drivers/usb/host/ehci-tilegx.c
+++ /dev/null
@@ -1,207 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2012 Tilera Corporation. All Rights Reserved.
4 */
5
6/*
7 * Tilera TILE-Gx USB EHCI host controller driver.
8 */
9
10#include <linux/irq.h>
11#include <linux/platform_device.h>
12#include <linux/usb/tilegx.h>
13#include <linux/usb.h>
14
15#include <asm/homecache.h>
16
17#include <gxio/iorpc_usb_host.h>
18#include <gxio/usb_host.h>
19
20static void tilegx_start_ehc(void)
21{
22}
23
24static void tilegx_stop_ehc(void)
25{
26}
27
28static int tilegx_ehci_setup(struct usb_hcd *hcd)
29{
30 int ret = ehci_init(hcd);
31
32 /*
33 * Some drivers do:
34 *
35 * struct ehci_hcd *ehci = hcd_to_ehci(hcd);
36 * ehci->need_io_watchdog = 0;
37 *
38 * here, but since this is a new driver we're going to leave the
39 * watchdog enabled. Later we may try to turn it off and see
40 * whether we run into any problems.
41 */
42
43 return ret;
44}
45
46static const struct hc_driver ehci_tilegx_hc_driver = {
47 .description = hcd_name,
48 .product_desc = "Tile-Gx EHCI",
49 .hcd_priv_size = sizeof(struct ehci_hcd),
50
51 /*
52 * Generic hardware linkage.
53 */
54 .irq = ehci_irq,
55 .flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
56
57 /*
58 * Basic lifecycle operations.
59 */
60 .reset = tilegx_ehci_setup,
61 .start = ehci_run,
62 .stop = ehci_stop,
63 .shutdown = ehci_shutdown,
64
65 /*
66 * Managing I/O requests and associated device resources.
67 */
68 .urb_enqueue = ehci_urb_enqueue,
69 .urb_dequeue = ehci_urb_dequeue,
70 .endpoint_disable = ehci_endpoint_disable,
71 .endpoint_reset = ehci_endpoint_reset,
72
73 /*
74 * Scheduling support.
75 */
76 .get_frame_number = ehci_get_frame,
77
78 /*
79 * Root hub support.
80 */
81 .hub_status_data = ehci_hub_status_data,
82 .hub_control = ehci_hub_control,
83 .bus_suspend = ehci_bus_suspend,
84 .bus_resume = ehci_bus_resume,
85 .relinquish_port = ehci_relinquish_port,
86 .port_handed_over = ehci_port_handed_over,
87
88 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
89};
90
91static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev)
92{
93 struct usb_hcd *hcd;
94 struct ehci_hcd *ehci;
95 struct tilegx_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
96 pte_t pte = { 0 };
97 int my_cpu = smp_processor_id();
98 int ret;
99
100 if (usb_disabled())
101 return -ENODEV;
102
103 /*
104 * Try to initialize our GXIO context; if we can't, the device
105 * doesn't exist.
106 */
107 if (gxio_usb_host_init(&pdata->usb_ctx, pdata->dev_index, 1) != 0)
108 return -ENXIO;
109
110 hcd = usb_create_hcd(&ehci_tilegx_hc_driver, &pdev->dev,
111 dev_name(&pdev->dev));
112 if (!hcd) {
113 ret = -ENOMEM;
114 goto err_hcd;
115 }
116
117 /*
118 * We don't use rsrc_start to map in our registers, but seems like
119 * we ought to set it to something, so we use the register VA.
120 */
121 hcd->rsrc_start =
122 (ulong) gxio_usb_host_get_reg_start(&pdata->usb_ctx);
123 hcd->rsrc_len = gxio_usb_host_get_reg_len(&pdata->usb_ctx);
124 hcd->regs = gxio_usb_host_get_reg_start(&pdata->usb_ctx);
125
126 tilegx_start_ehc();
127
128 ehci = hcd_to_ehci(hcd);
129 ehci->caps = hcd->regs;
130 ehci->regs =
131 hcd->regs + HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
132 /* cache this readonly data; minimize chip reads */
133 ehci->hcs_params = readl(&ehci->caps->hcs_params);
134
135 /* Create our IRQs and register them. */
136 pdata->irq = irq_alloc_hwirq(-1);
137 if (!pdata->irq) {
138 ret = -ENXIO;
139 goto err_no_irq;
140 }
141
142 tile_irq_activate(pdata->irq, TILE_IRQ_PERCPU);
143
144 /* Configure interrupts. */
145 ret = gxio_usb_host_cfg_interrupt(&pdata->usb_ctx,
146 cpu_x(my_cpu), cpu_y(my_cpu),
147 KERNEL_PL, pdata->irq);
148 if (ret) {
149 ret = -ENXIO;
150 goto err_have_irq;
151 }
152
153 /* Register all of our memory. */
154 pte = pte_set_home(pte, PAGE_HOME_HASH);
155 ret = gxio_usb_host_register_client_memory(&pdata->usb_ctx, pte, 0);
156 if (ret) {
157 ret = -ENXIO;
158 goto err_have_irq;
159 }
160
161 ret = usb_add_hcd(hcd, pdata->irq, IRQF_SHARED);
162 if (ret == 0) {
163 platform_set_drvdata(pdev, hcd);
164 device_wakeup_enable(hcd->self.controller);
165 return ret;
166 }
167
168err_have_irq:
169 irq_free_hwirq(pdata->irq);
170err_no_irq:
171 tilegx_stop_ehc();
172 usb_put_hcd(hcd);
173err_hcd:
174 gxio_usb_host_destroy(&pdata->usb_ctx);
175 return ret;
176}
177
178static int ehci_hcd_tilegx_drv_remove(struct platform_device *pdev)
179{
180 struct usb_hcd *hcd = platform_get_drvdata(pdev);
181 struct tilegx_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
182
183 usb_remove_hcd(hcd);
184 usb_put_hcd(hcd);
185 tilegx_stop_ehc();
186 gxio_usb_host_destroy(&pdata->usb_ctx);
187 irq_free_hwirq(pdata->irq);
188
189 return 0;
190}
191
192static void ehci_hcd_tilegx_drv_shutdown(struct platform_device *pdev)
193{
194 usb_hcd_platform_shutdown(pdev);
195 ehci_hcd_tilegx_drv_remove(pdev);
196}
197
198static struct platform_driver ehci_hcd_tilegx_driver = {
199 .probe = ehci_hcd_tilegx_drv_probe,
200 .remove = ehci_hcd_tilegx_drv_remove,
201 .shutdown = ehci_hcd_tilegx_drv_shutdown,
202 .driver = {
203 .name = "tilegx-ehci",
204 }
205};
206
207MODULE_ALIAS("platform:tilegx-ehci");
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 84f88fa411cd..199f1b7a91a3 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1244,11 +1244,6 @@ MODULE_LICENSE ("GPL");
1244#define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver 1244#define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver
1245#endif 1245#endif
1246 1246
1247#ifdef CONFIG_TILE_USB
1248#include "ohci-tilegx.c"
1249#define PLATFORM_DRIVER ohci_hcd_tilegx_driver
1250#endif
1251
1252static int __init ohci_hcd_mod_init(void) 1247static int __init ohci_hcd_mod_init(void)
1253{ 1248{
1254 int retval = 0; 1249 int retval = 0;
@@ -1273,12 +1268,6 @@ static int __init ohci_hcd_mod_init(void)
1273 goto error_ps3; 1268 goto error_ps3;
1274#endif 1269#endif
1275 1270
1276#ifdef PLATFORM_DRIVER
1277 retval = platform_driver_register(&PLATFORM_DRIVER);
1278 if (retval < 0)
1279 goto error_platform;
1280#endif
1281
1282#ifdef OF_PLATFORM_DRIVER 1271#ifdef OF_PLATFORM_DRIVER
1283 retval = platform_driver_register(&OF_PLATFORM_DRIVER); 1272 retval = platform_driver_register(&OF_PLATFORM_DRIVER);
1284 if (retval < 0) 1273 if (retval < 0)
@@ -1322,10 +1311,6 @@ static int __init ohci_hcd_mod_init(void)
1322 platform_driver_unregister(&OF_PLATFORM_DRIVER); 1311 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1323 error_of_platform: 1312 error_of_platform:
1324#endif 1313#endif
1325#ifdef PLATFORM_DRIVER
1326 platform_driver_unregister(&PLATFORM_DRIVER);
1327 error_platform:
1328#endif
1329#ifdef PS3_SYSTEM_BUS_DRIVER 1314#ifdef PS3_SYSTEM_BUS_DRIVER
1330 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1315 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1331 error_ps3: 1316 error_ps3:
@@ -1353,9 +1338,6 @@ static void __exit ohci_hcd_mod_exit(void)
1353#ifdef OF_PLATFORM_DRIVER 1338#ifdef OF_PLATFORM_DRIVER
1354 platform_driver_unregister(&OF_PLATFORM_DRIVER); 1339 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1355#endif 1340#endif
1356#ifdef PLATFORM_DRIVER
1357 platform_driver_unregister(&PLATFORM_DRIVER);
1358#endif
1359#ifdef PS3_SYSTEM_BUS_DRIVER 1341#ifdef PS3_SYSTEM_BUS_DRIVER
1360 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1342 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1361#endif 1343#endif
diff --git a/drivers/usb/host/ohci-tilegx.c b/drivers/usb/host/ohci-tilegx.c
deleted file mode 100644
index d21ca3ce9a30..000000000000
--- a/drivers/usb/host/ohci-tilegx.c
+++ /dev/null
@@ -1,196 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2012 Tilera Corporation. All Rights Reserved.
4 */
5
6/*
7 * Tilera TILE-Gx USB OHCI host controller driver.
8 */
9
10#include <linux/irq.h>
11#include <linux/platform_device.h>
12#include <linux/usb/tilegx.h>
13#include <linux/usb.h>
14
15#include <asm/homecache.h>
16
17#include <gxio/iorpc_usb_host.h>
18#include <gxio/usb_host.h>
19
20static void tilegx_start_ohc(void)
21{
22}
23
24static void tilegx_stop_ohc(void)
25{
26}
27
28static int tilegx_ohci_start(struct usb_hcd *hcd)
29{
30 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
31 int ret;
32
33 ret = ohci_init(ohci);
34 if (ret < 0)
35 return ret;
36
37 ret = ohci_run(ohci);
38 if (ret < 0) {
39 dev_err(hcd->self.controller, "can't start %s\n",
40 hcd->self.bus_name);
41 ohci_stop(hcd);
42 return ret;
43 }
44
45 return 0;
46}
47
48static const struct hc_driver ohci_tilegx_hc_driver = {
49 .description = hcd_name,
50 .product_desc = "Tile-Gx OHCI",
51 .hcd_priv_size = sizeof(struct ohci_hcd),
52
53 /*
54 * Generic hardware linkage.
55 */
56 .irq = ohci_irq,
57 .flags = HCD_MEMORY | HCD_LOCAL_MEM | HCD_USB11,
58
59 /*
60 * Basic lifecycle operations.
61 */
62 .start = tilegx_ohci_start,
63 .stop = ohci_stop,
64 .shutdown = ohci_shutdown,
65
66 /*
67 * Managing I/O requests and associated device resources.
68 */
69 .urb_enqueue = ohci_urb_enqueue,
70 .urb_dequeue = ohci_urb_dequeue,
71 .endpoint_disable = ohci_endpoint_disable,
72
73 /*
74 * Scheduling support.
75 */
76 .get_frame_number = ohci_get_frame,
77
78 /*
79 * Root hub support.
80 */
81 .hub_status_data = ohci_hub_status_data,
82 .hub_control = ohci_hub_control,
83 .start_port_reset = ohci_start_port_reset,
84};
85
86static int ohci_hcd_tilegx_drv_probe(struct platform_device *pdev)
87{
88 struct usb_hcd *hcd;
89 struct tilegx_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
90 pte_t pte = { 0 };
91 int my_cpu = smp_processor_id();
92 int ret;
93
94 if (usb_disabled())
95 return -ENODEV;
96
97 /*
98 * Try to initialize our GXIO context; if we can't, the device
99 * doesn't exist.
100 */
101 if (gxio_usb_host_init(&pdata->usb_ctx, pdata->dev_index, 0) != 0)
102 return -ENXIO;
103
104 hcd = usb_create_hcd(&ohci_tilegx_hc_driver, &pdev->dev,
105 dev_name(&pdev->dev));
106 if (!hcd) {
107 ret = -ENOMEM;
108 goto err_hcd;
109 }
110
111 /*
112 * We don't use rsrc_start to map in our registers, but seems like
113 * we ought to set it to something, so we use the register VA.
114 */
115 hcd->rsrc_start =
116 (ulong) gxio_usb_host_get_reg_start(&pdata->usb_ctx);
117 hcd->rsrc_len = gxio_usb_host_get_reg_len(&pdata->usb_ctx);
118 hcd->regs = gxio_usb_host_get_reg_start(&pdata->usb_ctx);
119
120 tilegx_start_ohc();
121
122 /* Create our IRQs and register them. */
123 pdata->irq = irq_alloc_hwirq(-1);
124 if (!pdata->irq) {
125 ret = -ENXIO;
126 goto err_no_irq;
127 }
128
129 tile_irq_activate(pdata->irq, TILE_IRQ_PERCPU);
130
131 /* Configure interrupts. */
132 ret = gxio_usb_host_cfg_interrupt(&pdata->usb_ctx,
133 cpu_x(my_cpu), cpu_y(my_cpu),
134 KERNEL_PL, pdata->irq);
135 if (ret) {
136 ret = -ENXIO;
137 goto err_have_irq;
138 }
139
140 /* Register all of our memory. */
141 pte = pte_set_home(pte, PAGE_HOME_HASH);
142 ret = gxio_usb_host_register_client_memory(&pdata->usb_ctx, pte, 0);
143 if (ret) {
144 ret = -ENXIO;
145 goto err_have_irq;
146 }
147
148 ohci_hcd_init(hcd_to_ohci(hcd));
149
150 ret = usb_add_hcd(hcd, pdata->irq, IRQF_SHARED);
151 if (ret == 0) {
152 platform_set_drvdata(pdev, hcd);
153 device_wakeup_enable(hcd->self.controller);
154 return ret;
155 }
156
157err_have_irq:
158 irq_free_hwirq(pdata->irq);
159err_no_irq:
160 tilegx_stop_ohc();
161 usb_put_hcd(hcd);
162err_hcd:
163 gxio_usb_host_destroy(&pdata->usb_ctx);
164 return ret;
165}
166
167static int ohci_hcd_tilegx_drv_remove(struct platform_device *pdev)
168{
169 struct usb_hcd *hcd = platform_get_drvdata(pdev);
170 struct tilegx_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
171
172 usb_remove_hcd(hcd);
173 usb_put_hcd(hcd);
174 tilegx_stop_ohc();
175 gxio_usb_host_destroy(&pdata->usb_ctx);
176 irq_free_hwirq(pdata->irq);
177
178 return 0;
179}
180
181static void ohci_hcd_tilegx_drv_shutdown(struct platform_device *pdev)
182{
183 usb_hcd_platform_shutdown(pdev);
184 ohci_hcd_tilegx_drv_remove(pdev);
185}
186
187static struct platform_driver ohci_hcd_tilegx_driver = {
188 .probe = ohci_hcd_tilegx_drv_probe,
189 .remove = ohci_hcd_tilegx_drv_remove,
190 .shutdown = ohci_hcd_tilegx_drv_shutdown,
191 .driver = {
192 .name = "tilegx-ohci",
193 }
194};
195
196MODULE_ALIAS("platform:tilegx-ohci");
diff --git a/include/linux/usb/tilegx.h b/include/linux/usb/tilegx.h
deleted file mode 100644
index 817908573fe8..000000000000
--- a/include/linux/usb/tilegx.h
+++ /dev/null
@@ -1,35 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2012 Tilera Corporation. All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation, version 2.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for
13 * more details.
14 *
15 * Structure to contain platform-specific data related to Tile-Gx USB
16 * controllers.
17 */
18
19#ifndef _LINUX_USB_TILEGX_H
20#define _LINUX_USB_TILEGX_H
21
22#include <gxio/usb_host.h>
23
24struct tilegx_usb_platform_data {
25 /* GXIO device index. */
26 int dev_index;
27
28 /* GXIO device context. */
29 gxio_usb_host_context_t usb_ctx;
30
31 /* Device IRQ. */
32 unsigned int irq;
33};
34
35#endif /* _LINUX_USB_TILEGX_H */