ath79: remove unused TP-Link partition parser
[oweals/openwrt.git] / target / linux / ath79 / patches-4.19 / 0030-MIPS-ath79-drop-platform-device-registration-code.patch
1 From dce930fba8ad3a90ccd164f199e57c2d61937ccd Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Sat, 23 Jun 2018 15:12:38 +0200
4 Subject: [PATCH 30/33] MIPS: ath79: drop platform device registration code
5
6 With the target now being fully OF based, we can drop the legacy platform
7 device registration code. All devices and their drivers are now probed
8 via OF.
9
10 Signed-off-by: John Crispin <john@phrozen.org>
11 ---
12  arch/mips/ath79/Makefile           |  10 --
13  arch/mips/ath79/common.h           |   2 -
14  arch/mips/ath79/dev-common.c       | 159 ------------------------
15  arch/mips/ath79/dev-common.h       |  18 ---
16  arch/mips/ath79/dev-gpio-buttons.c |  56 ---------
17  arch/mips/ath79/dev-gpio-buttons.h |  23 ----
18  arch/mips/ath79/dev-leds-gpio.c    |  54 ---------
19  arch/mips/ath79/dev-leds-gpio.h    |  21 ----
20  arch/mips/ath79/dev-spi.c          |  38 ------
21  arch/mips/ath79/dev-spi.h          |  22 ----
22  arch/mips/ath79/dev-usb.c          | 242 -------------------------------------
23  arch/mips/ath79/dev-usb.h          |  17 ---
24  arch/mips/ath79/dev-wmac.c         | 155 ------------------------
25  arch/mips/ath79/dev-wmac.h         |  17 ---
26  arch/mips/ath79/setup.c            |   1 -
27  15 files changed, 835 deletions(-)
28  delete mode 100644 arch/mips/ath79/dev-common.c
29  delete mode 100644 arch/mips/ath79/dev-common.h
30  delete mode 100644 arch/mips/ath79/dev-gpio-buttons.c
31  delete mode 100644 arch/mips/ath79/dev-gpio-buttons.h
32  delete mode 100644 arch/mips/ath79/dev-leds-gpio.c
33  delete mode 100644 arch/mips/ath79/dev-leds-gpio.h
34  delete mode 100644 arch/mips/ath79/dev-spi.c
35  delete mode 100644 arch/mips/ath79/dev-spi.h
36  delete mode 100644 arch/mips/ath79/dev-usb.c
37  delete mode 100644 arch/mips/ath79/dev-usb.h
38  delete mode 100644 arch/mips/ath79/dev-wmac.c
39  delete mode 100644 arch/mips/ath79/dev-wmac.h
40
41 --- a/arch/mips/ath79/Makefile
42 +++ b/arch/mips/ath79/Makefile
43 @@ -11,13 +11,3 @@
44  obj-y  := prom.o setup.o common.o clock.o
45  
46  obj-$(CONFIG_EARLY_PRINTK)             += early_printk.o
47 -
48 -#
49 -# Devices
50 -#
51 -obj-y                                  += dev-common.o
52 -obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS)   += dev-gpio-buttons.o
53 -obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)      += dev-leds-gpio.o
54 -obj-$(CONFIG_ATH79_DEV_SPI)            += dev-spi.o
55 -obj-$(CONFIG_ATH79_DEV_USB)            += dev-usb.o
56 -obj-$(CONFIG_ATH79_DEV_WMAC)           += dev-wmac.o
57 --- a/arch/mips/ath79/common.h
58 +++ b/arch/mips/ath79/common.h
59 @@ -24,6 +24,4 @@ unsigned long ath79_get_sys_clk_rate(con
60  
61  void ath79_ddr_ctrl_init(void);
62  
63 -void ath79_gpio_init(void);
64 -
65  #endif /* __ATH79_COMMON_H */
66 --- a/arch/mips/ath79/dev-common.c
67 +++ /dev/null
68 @@ -1,159 +0,0 @@
69 -/*
70 - *  Atheros AR71XX/AR724X/AR913X common devices
71 - *
72 - *  Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
73 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
74 - *
75 - *  Parts of this file are based on Atheros' 2.6.15 BSP
76 - *
77 - *  This program is free software; you can redistribute it and/or modify it
78 - *  under the terms of the GNU General Public License version 2 as published
79 - *  by the Free Software Foundation.
80 - */
81 -
82 -#include <linux/kernel.h>
83 -#include <linux/init.h>
84 -#include <linux/platform_device.h>
85 -#include <linux/platform_data/gpio-ath79.h>
86 -#include <linux/serial_8250.h>
87 -#include <linux/clk.h>
88 -#include <linux/err.h>
89 -
90 -#include <asm/mach-ath79/ath79.h>
91 -#include <asm/mach-ath79/ar71xx_regs.h>
92 -#include "common.h"
93 -#include "dev-common.h"
94 -
95 -static struct resource ath79_uart_resources[] = {
96 -       {
97 -               .start  = AR71XX_UART_BASE,
98 -               .end    = AR71XX_UART_BASE + AR71XX_UART_SIZE - 1,
99 -               .flags  = IORESOURCE_MEM,
100 -       },
101 -};
102 -
103 -#define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
104 -static struct plat_serial8250_port ath79_uart_data[] = {
105 -       {
106 -               .mapbase        = AR71XX_UART_BASE,
107 -               .irq            = ATH79_MISC_IRQ(3),
108 -               .flags          = AR71XX_UART_FLAGS,
109 -               .iotype         = UPIO_MEM32,
110 -               .regshift       = 2,
111 -       }, {
112 -               /* terminating entry */
113 -       }
114 -};
115 -
116 -static struct platform_device ath79_uart_device = {
117 -       .name           = "serial8250",
118 -       .id             = PLAT8250_DEV_PLATFORM,
119 -       .resource       = ath79_uart_resources,
120 -       .num_resources  = ARRAY_SIZE(ath79_uart_resources),
121 -       .dev = {
122 -               .platform_data  = ath79_uart_data
123 -       },
124 -};
125 -
126 -static struct resource ar933x_uart_resources[] = {
127 -       {
128 -               .start  = AR933X_UART_BASE,
129 -               .end    = AR933X_UART_BASE + AR71XX_UART_SIZE - 1,
130 -               .flags  = IORESOURCE_MEM,
131 -       },
132 -       {
133 -               .start  = ATH79_MISC_IRQ(3),
134 -               .end    = ATH79_MISC_IRQ(3),
135 -               .flags  = IORESOURCE_IRQ,
136 -       },
137 -};
138 -
139 -static struct platform_device ar933x_uart_device = {
140 -       .name           = "ar933x-uart",
141 -       .id             = -1,
142 -       .resource       = ar933x_uart_resources,
143 -       .num_resources  = ARRAY_SIZE(ar933x_uart_resources),
144 -};
145 -
146 -void __init ath79_register_uart(void)
147 -{
148 -       unsigned long uart_clk_rate;
149 -
150 -       uart_clk_rate = ath79_get_sys_clk_rate("uart");
151 -
152 -       if (soc_is_ar71xx() ||
153 -           soc_is_ar724x() ||
154 -           soc_is_ar913x() ||
155 -           soc_is_ar934x() ||
156 -           soc_is_qca955x()) {
157 -               ath79_uart_data[0].uartclk = uart_clk_rate;
158 -               platform_device_register(&ath79_uart_device);
159 -       } else if (soc_is_ar933x()) {
160 -               platform_device_register(&ar933x_uart_device);
161 -       } else {
162 -               BUG();
163 -       }
164 -}
165 -
166 -void __init ath79_register_wdt(void)
167 -{
168 -       struct resource res;
169 -
170 -       memset(&res, 0, sizeof(res));
171 -
172 -       res.flags = IORESOURCE_MEM;
173 -       res.start = AR71XX_RESET_BASE + AR71XX_RESET_REG_WDOG_CTRL;
174 -       res.end = res.start + 0x8 - 1;
175 -
176 -       platform_device_register_simple("ath79-wdt", -1, &res, 1);
177 -}
178 -
179 -static struct ath79_gpio_platform_data ath79_gpio_pdata;
180 -
181 -static struct resource ath79_gpio_resources[] = {
182 -       {
183 -               .flags = IORESOURCE_MEM,
184 -               .start = AR71XX_GPIO_BASE,
185 -               .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1,
186 -       },
187 -       {
188 -               .start  = ATH79_MISC_IRQ(2),
189 -               .end    = ATH79_MISC_IRQ(2),
190 -               .flags  = IORESOURCE_IRQ,
191 -       },
192 -};
193 -
194 -static struct platform_device ath79_gpio_device = {
195 -       .name           = "ath79-gpio",
196 -       .id             = -1,
197 -       .resource       = ath79_gpio_resources,
198 -       .num_resources  = ARRAY_SIZE(ath79_gpio_resources),
199 -       .dev = {
200 -               .platform_data  = &ath79_gpio_pdata
201 -       },
202 -};
203 -
204 -void __init ath79_gpio_init(void)
205 -{
206 -       if (soc_is_ar71xx()) {
207 -               ath79_gpio_pdata.ngpios = AR71XX_GPIO_COUNT;
208 -       } else if (soc_is_ar7240()) {
209 -               ath79_gpio_pdata.ngpios = AR7240_GPIO_COUNT;
210 -       } else if (soc_is_ar7241() || soc_is_ar7242()) {
211 -               ath79_gpio_pdata.ngpios = AR7241_GPIO_COUNT;
212 -       } else if (soc_is_ar913x()) {
213 -               ath79_gpio_pdata.ngpios = AR913X_GPIO_COUNT;
214 -       } else if (soc_is_ar933x()) {
215 -               ath79_gpio_pdata.ngpios = AR933X_GPIO_COUNT;
216 -       } else if (soc_is_ar934x()) {
217 -               ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT;
218 -               ath79_gpio_pdata.oe_inverted = 1;
219 -       } else if (soc_is_qca955x()) {
220 -               ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT;
221 -               ath79_gpio_pdata.oe_inverted = 1;
222 -       } else {
223 -               BUG();
224 -       }
225 -
226 -       platform_device_register(&ath79_gpio_device);
227 -}
228 --- a/arch/mips/ath79/dev-common.h
229 +++ /dev/null
230 @@ -1,18 +0,0 @@
231 -/*
232 - *  Atheros AR71XX/AR724X/AR913X common devices
233 - *
234 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
235 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
236 - *
237 - *  This program is free software; you can redistribute it and/or modify it
238 - *  under the terms of the GNU General Public License version 2 as published
239 - *  by the Free Software Foundation.
240 - */
241 -
242 -#ifndef _ATH79_DEV_COMMON_H
243 -#define _ATH79_DEV_COMMON_H
244 -
245 -void ath79_register_uart(void);
246 -void ath79_register_wdt(void);
247 -
248 -#endif /* _ATH79_DEV_COMMON_H */
249 --- a/arch/mips/ath79/dev-gpio-buttons.c
250 +++ /dev/null
251 @@ -1,56 +0,0 @@
252 -/*
253 - *  Atheros AR71XX/AR724X/AR913X GPIO button support
254 - *
255 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
256 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
257 - *
258 - *  This program is free software; you can redistribute it and/or modify it
259 - *  under the terms of the GNU General Public License version 2 as published
260 - *  by the Free Software Foundation.
261 - */
262 -
263 -#include "linux/init.h"
264 -#include "linux/slab.h"
265 -#include <linux/platform_device.h>
266 -
267 -#include "dev-gpio-buttons.h"
268 -
269 -void __init ath79_register_gpio_keys_polled(int id,
270 -                                           unsigned poll_interval,
271 -                                           unsigned nbuttons,
272 -                                           struct gpio_keys_button *buttons)
273 -{
274 -       struct platform_device *pdev;
275 -       struct gpio_keys_platform_data pdata;
276 -       struct gpio_keys_button *p;
277 -       int err;
278 -
279 -       p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
280 -       if (!p)
281 -               return;
282 -
283 -       pdev = platform_device_alloc("gpio-keys-polled", id);
284 -       if (!pdev)
285 -               goto err_free_buttons;
286 -
287 -       memset(&pdata, 0, sizeof(pdata));
288 -       pdata.poll_interval = poll_interval;
289 -       pdata.nbuttons = nbuttons;
290 -       pdata.buttons = p;
291 -
292 -       err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
293 -       if (err)
294 -               goto err_put_pdev;
295 -
296 -       err = platform_device_add(pdev);
297 -       if (err)
298 -               goto err_put_pdev;
299 -
300 -       return;
301 -
302 -err_put_pdev:
303 -       platform_device_put(pdev);
304 -
305 -err_free_buttons:
306 -       kfree(p);
307 -}
308 --- a/arch/mips/ath79/dev-gpio-buttons.h
309 +++ /dev/null
310 @@ -1,23 +0,0 @@
311 -/*
312 - *  Atheros AR71XX/AR724X/AR913X GPIO button support
313 - *
314 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
315 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
316 - *
317 - *  This program is free software; you can redistribute it and/or modify it
318 - *  under the terms of the GNU General Public License version 2 as published
319 - *  by the Free Software Foundation.
320 - */
321 -
322 -#ifndef _ATH79_DEV_GPIO_BUTTONS_H
323 -#define _ATH79_DEV_GPIO_BUTTONS_H
324 -
325 -#include <linux/input.h>
326 -#include <linux/gpio_keys.h>
327 -
328 -void ath79_register_gpio_keys_polled(int id,
329 -                                    unsigned poll_interval,
330 -                                    unsigned nbuttons,
331 -                                    struct gpio_keys_button *buttons);
332 -
333 -#endif /* _ATH79_DEV_GPIO_BUTTONS_H */
334 --- a/arch/mips/ath79/dev-leds-gpio.c
335 +++ /dev/null
336 @@ -1,54 +0,0 @@
337 -/*
338 - *  Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
339 - *
340 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
341 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
342 - *
343 - *  This program is free software; you can redistribute it and/or modify it
344 - *  under the terms of the GNU General Public License version 2 as published
345 - *  by the Free Software Foundation.
346 - */
347 -
348 -#include <linux/init.h>
349 -#include <linux/slab.h>
350 -#include <linux/platform_device.h>
351 -
352 -#include "dev-leds-gpio.h"
353 -
354 -void __init ath79_register_leds_gpio(int id,
355 -                                    unsigned num_leds,
356 -                                    struct gpio_led *leds)
357 -{
358 -       struct platform_device *pdev;
359 -       struct gpio_led_platform_data pdata;
360 -       struct gpio_led *p;
361 -       int err;
362 -
363 -       p = kmemdup(leds, num_leds * sizeof(*p), GFP_KERNEL);
364 -       if (!p)
365 -               return;
366 -
367 -       pdev = platform_device_alloc("leds-gpio", id);
368 -       if (!pdev)
369 -               goto err_free_leds;
370 -
371 -       memset(&pdata, 0, sizeof(pdata));
372 -       pdata.num_leds = num_leds;
373 -       pdata.leds = p;
374 -
375 -       err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
376 -       if (err)
377 -               goto err_put_pdev;
378 -
379 -       err = platform_device_add(pdev);
380 -       if (err)
381 -               goto err_put_pdev;
382 -
383 -       return;
384 -
385 -err_put_pdev:
386 -       platform_device_put(pdev);
387 -
388 -err_free_leds:
389 -       kfree(p);
390 -}
391 --- a/arch/mips/ath79/dev-leds-gpio.h
392 +++ /dev/null
393 @@ -1,21 +0,0 @@
394 -/*
395 - *  Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
396 - *
397 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
398 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
399 - *
400 - *  This program is free software; you can redistribute it and/or modify it
401 - *  under the terms of the GNU General Public License version 2 as published
402 - *  by the Free Software Foundation.
403 - */
404 -
405 -#ifndef _ATH79_DEV_LEDS_GPIO_H
406 -#define _ATH79_DEV_LEDS_GPIO_H
407 -
408 -#include <linux/leds.h>
409 -
410 -void ath79_register_leds_gpio(int id,
411 -                             unsigned num_leds,
412 -                             struct gpio_led *leds);
413 -
414 -#endif /* _ATH79_DEV_LEDS_GPIO_H */
415 --- a/arch/mips/ath79/dev-spi.c
416 +++ /dev/null
417 @@ -1,38 +0,0 @@
418 -/*
419 - *  Atheros AR71XX/AR724X/AR913X SPI controller device
420 - *
421 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
422 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
423 - *
424 - *  This program is free software; you can redistribute it and/or modify it
425 - *  under the terms of the GNU General Public License version 2 as published
426 - *  by the Free Software Foundation.
427 - */
428 -
429 -#include <linux/platform_device.h>
430 -#include <asm/mach-ath79/ar71xx_regs.h>
431 -#include "dev-spi.h"
432 -
433 -static struct resource ath79_spi_resources[] = {
434 -       {
435 -               .start  = AR71XX_SPI_BASE,
436 -               .end    = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
437 -               .flags  = IORESOURCE_MEM,
438 -       },
439 -};
440 -
441 -static struct platform_device ath79_spi_device = {
442 -       .name           = "ath79-spi",
443 -       .id             = -1,
444 -       .resource       = ath79_spi_resources,
445 -       .num_resources  = ARRAY_SIZE(ath79_spi_resources),
446 -};
447 -
448 -void __init ath79_register_spi(struct ath79_spi_platform_data *pdata,
449 -                              struct spi_board_info const *info,
450 -                              unsigned n)
451 -{
452 -       spi_register_board_info(info, n);
453 -       ath79_spi_device.dev.platform_data = pdata;
454 -       platform_device_register(&ath79_spi_device);
455 -}
456 --- a/arch/mips/ath79/dev-spi.h
457 +++ /dev/null
458 @@ -1,22 +0,0 @@
459 -/*
460 - *  Atheros AR71XX/AR724X/AR913X SPI controller device
461 - *
462 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
463 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
464 - *
465 - *  This program is free software; you can redistribute it and/or modify it
466 - *  under the terms of the GNU General Public License version 2 as published
467 - *  by the Free Software Foundation.
468 - */
469 -
470 -#ifndef _ATH79_DEV_SPI_H
471 -#define _ATH79_DEV_SPI_H
472 -
473 -#include <linux/spi/spi.h>
474 -#include <asm/mach-ath79/ath79_spi_platform.h>
475 -
476 -void ath79_register_spi(struct ath79_spi_platform_data *pdata,
477 -                        struct spi_board_info const *info,
478 -                        unsigned n);
479 -
480 -#endif /* _ATH79_DEV_SPI_H */
481 --- a/arch/mips/ath79/dev-usb.c
482 +++ /dev/null
483 @@ -1,242 +0,0 @@
484 -/*
485 - *  Atheros AR7XXX/AR9XXX USB Host Controller device
486 - *
487 - *  Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
488 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
489 - *
490 - *  Parts of this file are based on Atheros' 2.6.15 BSP
491 - *
492 - *  This program is free software; you can redistribute it and/or modify it
493 - *  under the terms of the GNU General Public License version 2 as published
494 - *  by the Free Software Foundation.
495 - */
496 -
497 -#include <linux/kernel.h>
498 -#include <linux/init.h>
499 -#include <linux/delay.h>
500 -#include <linux/irq.h>
501 -#include <linux/dma-mapping.h>
502 -#include <linux/platform_device.h>
503 -#include <linux/usb/ehci_pdriver.h>
504 -#include <linux/usb/ohci_pdriver.h>
505 -
506 -#include <asm/mach-ath79/ath79.h>
507 -#include <asm/mach-ath79/ar71xx_regs.h>
508 -#include "common.h"
509 -#include "dev-usb.h"
510 -
511 -static u64 ath79_usb_dmamask = DMA_BIT_MASK(32);
512 -
513 -static struct usb_ohci_pdata ath79_ohci_pdata = {
514 -};
515 -
516 -static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
517 -       .has_synopsys_hc_bug    = 1,
518 -};
519 -
520 -static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
521 -       .caps_offset            = 0x100,
522 -       .has_tt                 = 1,
523 -};
524 -
525 -static void __init ath79_usb_register(const char *name, int id,
526 -                                     unsigned long base, unsigned long size,
527 -                                     int irq, const void *data,
528 -                                     size_t data_size)
529 -{
530 -       struct resource res[2];
531 -       struct platform_device *pdev;
532 -
533 -       memset(res, 0, sizeof(res));
534 -
535 -       res[0].flags = IORESOURCE_MEM;
536 -       res[0].start = base;
537 -       res[0].end = base + size - 1;
538 -
539 -       res[1].flags = IORESOURCE_IRQ;
540 -       res[1].start = irq;
541 -       res[1].end = irq;
542 -
543 -       pdev = platform_device_register_resndata(NULL, name, id,
544 -                                                res, ARRAY_SIZE(res),
545 -                                                data, data_size);
546 -
547 -       if (IS_ERR(pdev)) {
548 -               pr_err("ath79: unable to register USB at %08lx, err=%d\n",
549 -                      base, (int) PTR_ERR(pdev));
550 -               return;
551 -       }
552 -
553 -       pdev->dev.dma_mask = &ath79_usb_dmamask;
554 -       pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
555 -}
556 -
557 -#define AR71XX_USB_RESET_MASK  (AR71XX_RESET_USB_HOST | \
558 -                                AR71XX_RESET_USB_PHY | \
559 -                                AR71XX_RESET_USB_OHCI_DLL)
560 -
561 -static void __init ath79_usb_setup(void)
562 -{
563 -       void __iomem *usb_ctrl_base;
564 -
565 -       ath79_device_reset_set(AR71XX_USB_RESET_MASK);
566 -       mdelay(1000);
567 -       ath79_device_reset_clear(AR71XX_USB_RESET_MASK);
568 -
569 -       usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE);
570 -
571 -       /* Turning on the Buff and Desc swap bits */
572 -       __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG);
573 -
574 -       /* WAR for HW bug. Here it adjusts the duration between two SOFS */
575 -       __raw_writel(0x20c00, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ);
576 -
577 -       iounmap(usb_ctrl_base);
578 -
579 -       mdelay(900);
580 -
581 -       ath79_usb_register("ohci-platform", -1,
582 -                          AR71XX_OHCI_BASE, AR71XX_OHCI_SIZE,
583 -                          ATH79_MISC_IRQ(6),
584 -                          &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
585 -
586 -       ath79_usb_register("ehci-platform", -1,
587 -                          AR71XX_EHCI_BASE, AR71XX_EHCI_SIZE,
588 -                          ATH79_CPU_IRQ(3),
589 -                          &ath79_ehci_pdata_v1, sizeof(ath79_ehci_pdata_v1));
590 -}
591 -
592 -static void __init ar7240_usb_setup(void)
593 -{
594 -       void __iomem *usb_ctrl_base;
595 -
596 -       ath79_device_reset_clear(AR7240_RESET_OHCI_DLL);
597 -       ath79_device_reset_set(AR7240_RESET_USB_HOST);
598 -
599 -       mdelay(1000);
600 -
601 -       ath79_device_reset_set(AR7240_RESET_OHCI_DLL);
602 -       ath79_device_reset_clear(AR7240_RESET_USB_HOST);
603 -
604 -       usb_ctrl_base = ioremap(AR7240_USB_CTRL_BASE, AR7240_USB_CTRL_SIZE);
605 -
606 -       /* WAR for HW bug. Here it adjusts the duration between two SOFS */
607 -       __raw_writel(0x3, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ);
608 -
609 -       iounmap(usb_ctrl_base);
610 -
611 -       ath79_usb_register("ohci-platform", -1,
612 -                          AR7240_OHCI_BASE, AR7240_OHCI_SIZE,
613 -                          ATH79_CPU_IRQ(3),
614 -                          &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
615 -}
616 -
617 -static void __init ar724x_usb_setup(void)
618 -{
619 -       ath79_device_reset_set(AR724X_RESET_USBSUS_OVERRIDE);
620 -       mdelay(10);
621 -
622 -       ath79_device_reset_clear(AR724X_RESET_USB_HOST);
623 -       mdelay(10);
624 -
625 -       ath79_device_reset_clear(AR724X_RESET_USB_PHY);
626 -       mdelay(10);
627 -
628 -       ath79_usb_register("ehci-platform", -1,
629 -                          AR724X_EHCI_BASE, AR724X_EHCI_SIZE,
630 -                          ATH79_CPU_IRQ(3),
631 -                          &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
632 -}
633 -
634 -static void __init ar913x_usb_setup(void)
635 -{
636 -       ath79_device_reset_set(AR913X_RESET_USBSUS_OVERRIDE);
637 -       mdelay(10);
638 -
639 -       ath79_device_reset_clear(AR913X_RESET_USB_HOST);
640 -       mdelay(10);
641 -
642 -       ath79_device_reset_clear(AR913X_RESET_USB_PHY);
643 -       mdelay(10);
644 -
645 -       ath79_usb_register("ehci-platform", -1,
646 -                          AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
647 -                          ATH79_CPU_IRQ(3),
648 -                          &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
649 -}
650 -
651 -static void __init ar933x_usb_setup(void)
652 -{
653 -       ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE);
654 -       mdelay(10);
655 -
656 -       ath79_device_reset_clear(AR933X_RESET_USB_HOST);
657 -       mdelay(10);
658 -
659 -       ath79_device_reset_clear(AR933X_RESET_USB_PHY);
660 -       mdelay(10);
661 -
662 -       ath79_usb_register("ehci-platform", -1,
663 -                          AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
664 -                          ATH79_CPU_IRQ(3),
665 -                          &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
666 -}
667 -
668 -static void __init ar934x_usb_setup(void)
669 -{
670 -       u32 bootstrap;
671 -
672 -       bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
673 -       if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
674 -               return;
675 -
676 -       ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
677 -       udelay(1000);
678 -
679 -       ath79_device_reset_clear(AR934X_RESET_USB_PHY);
680 -       udelay(1000);
681 -
682 -       ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG);
683 -       udelay(1000);
684 -
685 -       ath79_device_reset_clear(AR934X_RESET_USB_HOST);
686 -       udelay(1000);
687 -
688 -       ath79_usb_register("ehci-platform", -1,
689 -                          AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
690 -                          ATH79_CPU_IRQ(3),
691 -                          &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
692 -}
693 -
694 -static void __init qca955x_usb_setup(void)
695 -{
696 -       ath79_usb_register("ehci-platform", 0,
697 -                          QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
698 -                          ATH79_IP3_IRQ(0),
699 -                          &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
700 -
701 -       ath79_usb_register("ehci-platform", 1,
702 -                          QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE,
703 -                          ATH79_IP3_IRQ(1),
704 -                          &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
705 -}
706 -
707 -void __init ath79_register_usb(void)
708 -{
709 -       if (soc_is_ar71xx())
710 -               ath79_usb_setup();
711 -       else if (soc_is_ar7240())
712 -               ar7240_usb_setup();
713 -       else if (soc_is_ar7241() || soc_is_ar7242())
714 -               ar724x_usb_setup();
715 -       else if (soc_is_ar913x())
716 -               ar913x_usb_setup();
717 -       else if (soc_is_ar933x())
718 -               ar933x_usb_setup();
719 -       else if (soc_is_ar934x())
720 -               ar934x_usb_setup();
721 -       else if (soc_is_qca955x())
722 -               qca955x_usb_setup();
723 -       else
724 -               BUG();
725 -}
726 --- a/arch/mips/ath79/dev-usb.h
727 +++ /dev/null
728 @@ -1,17 +0,0 @@
729 -/*
730 - *  Atheros AR71XX/AR724X/AR913X USB Host Controller support
731 - *
732 - *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
733 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
734 - *
735 - *  This program is free software; you can redistribute it and/or modify it
736 - *  under the terms of the GNU General Public License version 2 as published
737 - *  by the Free Software Foundation.
738 - */
739 -
740 -#ifndef _ATH79_DEV_USB_H
741 -#define _ATH79_DEV_USB_H
742 -
743 -void ath79_register_usb(void);
744 -
745 -#endif /* _ATH79_DEV_USB_H */
746 --- a/arch/mips/ath79/dev-wmac.c
747 +++ /dev/null
748 @@ -1,155 +0,0 @@
749 -/*
750 - *  Atheros AR913X/AR933X SoC built-in WMAC device support
751 - *
752 - *  Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
753 - *  Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
754 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
755 - *
756 - *  Parts of this file are based on Atheros 2.6.15/2.6.31 BSP
757 - *
758 - *  This program is free software; you can redistribute it and/or modify it
759 - *  under the terms of the GNU General Public License version 2 as published
760 - *  by the Free Software Foundation.
761 - */
762 -
763 -#include <linux/init.h>
764 -#include <linux/delay.h>
765 -#include <linux/irq.h>
766 -#include <linux/platform_device.h>
767 -#include <linux/ath9k_platform.h>
768 -
769 -#include <asm/mach-ath79/ath79.h>
770 -#include <asm/mach-ath79/ar71xx_regs.h>
771 -#include "dev-wmac.h"
772 -
773 -static struct ath9k_platform_data ath79_wmac_data;
774 -
775 -static struct resource ath79_wmac_resources[] = {
776 -       {
777 -               /* .start and .end fields are filled dynamically */
778 -               .flags  = IORESOURCE_MEM,
779 -       }, {
780 -               /* .start and .end fields are filled dynamically */
781 -               .flags  = IORESOURCE_IRQ,
782 -       },
783 -};
784 -
785 -static struct platform_device ath79_wmac_device = {
786 -       .name           = "ath9k",
787 -       .id             = -1,
788 -       .resource       = ath79_wmac_resources,
789 -       .num_resources  = ARRAY_SIZE(ath79_wmac_resources),
790 -       .dev = {
791 -               .platform_data = &ath79_wmac_data,
792 -       },
793 -};
794 -
795 -static void __init ar913x_wmac_setup(void)
796 -{
797 -       /* reset the WMAC */
798 -       ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
799 -       mdelay(10);
800 -
801 -       ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
802 -       mdelay(10);
803 -
804 -       ath79_wmac_resources[0].start = AR913X_WMAC_BASE;
805 -       ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
806 -       ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
807 -       ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
808 -}
809 -
810 -
811 -static int ar933x_wmac_reset(void)
812 -{
813 -       ath79_device_reset_set(AR933X_RESET_WMAC);
814 -       ath79_device_reset_clear(AR933X_RESET_WMAC);
815 -
816 -       return 0;
817 -}
818 -
819 -static int ar933x_r1_get_wmac_revision(void)
820 -{
821 -       return ath79_soc_rev;
822 -}
823 -
824 -static void __init ar933x_wmac_setup(void)
825 -{
826 -       u32 t;
827 -
828 -       ar933x_wmac_reset();
829 -
830 -       ath79_wmac_device.name = "ar933x_wmac";
831 -
832 -       ath79_wmac_resources[0].start = AR933X_WMAC_BASE;
833 -       ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1;
834 -       ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
835 -       ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
836 -
837 -       t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
838 -       if (t & AR933X_BOOTSTRAP_REF_CLK_40)
839 -               ath79_wmac_data.is_clk_25mhz = false;
840 -       else
841 -               ath79_wmac_data.is_clk_25mhz = true;
842 -
843 -       if (ath79_soc_rev == 1)
844 -               ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision;
845 -
846 -       ath79_wmac_data.external_reset = ar933x_wmac_reset;
847 -}
848 -
849 -static void ar934x_wmac_setup(void)
850 -{
851 -       u32 t;
852 -
853 -       ath79_wmac_device.name = "ar934x_wmac";
854 -
855 -       ath79_wmac_resources[0].start = AR934X_WMAC_BASE;
856 -       ath79_wmac_resources[0].end = AR934X_WMAC_BASE + AR934X_WMAC_SIZE - 1;
857 -       ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1);
858 -       ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1);
859 -
860 -       t = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
861 -       if (t & AR934X_BOOTSTRAP_REF_CLK_40)
862 -               ath79_wmac_data.is_clk_25mhz = false;
863 -       else
864 -               ath79_wmac_data.is_clk_25mhz = true;
865 -}
866 -
867 -static void qca955x_wmac_setup(void)
868 -{
869 -       u32 t;
870 -
871 -       ath79_wmac_device.name = "qca955x_wmac";
872 -
873 -       ath79_wmac_resources[0].start = QCA955X_WMAC_BASE;
874 -       ath79_wmac_resources[0].end = QCA955X_WMAC_BASE + QCA955X_WMAC_SIZE - 1;
875 -       ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1);
876 -       ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1);
877 -
878 -       t = ath79_reset_rr(QCA955X_RESET_REG_BOOTSTRAP);
879 -       if (t & QCA955X_BOOTSTRAP_REF_CLK_40)
880 -               ath79_wmac_data.is_clk_25mhz = false;
881 -       else
882 -               ath79_wmac_data.is_clk_25mhz = true;
883 -}
884 -
885 -void __init ath79_register_wmac(u8 *cal_data)
886 -{
887 -       if (soc_is_ar913x())
888 -               ar913x_wmac_setup();
889 -       else if (soc_is_ar933x())
890 -               ar933x_wmac_setup();
891 -       else if (soc_is_ar934x())
892 -               ar934x_wmac_setup();
893 -       else if (soc_is_qca955x())
894 -               qca955x_wmac_setup();
895 -       else
896 -               BUG();
897 -
898 -       if (cal_data)
899 -               memcpy(ath79_wmac_data.eeprom_data, cal_data,
900 -                      sizeof(ath79_wmac_data.eeprom_data));
901 -
902 -       platform_device_register(&ath79_wmac_device);
903 -}
904 --- a/arch/mips/ath79/dev-wmac.h
905 +++ /dev/null
906 @@ -1,17 +0,0 @@
907 -/*
908 - *  Atheros AR913X/AR933X SoC built-in WMAC device support
909 - *
910 - *  Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
911 - *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
912 - *
913 - *  This program is free software; you can redistribute it and/or modify it
914 - *  under the terms of the GNU General Public License version 2 as published
915 - *  by the Free Software Foundation.
916 - */
917 -
918 -#ifndef _ATH79_DEV_WMAC_H
919 -#define _ATH79_DEV_WMAC_H
920 -
921 -void ath79_register_wmac(u8 *cal_data);
922 -
923 -#endif /* _ATH79_DEV_WMAC_H */
924 --- a/arch/mips/ath79/setup.c
925 +++ b/arch/mips/ath79/setup.c
926 @@ -32,7 +32,6 @@
927  #include <asm/mach-ath79/ath79.h>
928  #include <asm/mach-ath79/ar71xx_regs.h>
929  #include "common.h"
930 -#include "dev-common.h"
931  
932  #define ATH79_SYS_TYPE_LEN     64
933