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