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