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
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
10 Signed-off-by: John Crispin <john@phrozen.org>
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
41 --- a/arch/mips/ath79/Makefile
42 +++ b/arch/mips/ath79/Makefile
44 obj-y := prom.o setup.o common.o clock.o
46 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
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
61 void ath79_ddr_ctrl_init(void);
63 -void ath79_gpio_init(void);
65 #endif /* __ATH79_COMMON_H */
66 --- a/arch/mips/ath79/dev-common.c
70 - * Atheros AR71XX/AR724X/AR913X common devices
72 - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
73 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
75 - * Parts of this file are based on Atheros' 2.6.15 BSP
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.
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>
90 -#include <asm/mach-ath79/ath79.h>
91 -#include <asm/mach-ath79/ar71xx_regs.h>
93 -#include "dev-common.h"
95 -static struct resource ath79_uart_resources[] = {
97 - .start = AR71XX_UART_BASE,
98 - .end = AR71XX_UART_BASE + AR71XX_UART_SIZE - 1,
99 - .flags = IORESOURCE_MEM,
103 -#define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
104 -static struct plat_serial8250_port ath79_uart_data[] = {
106 - .mapbase = AR71XX_UART_BASE,
107 - .irq = ATH79_MISC_IRQ(3),
108 - .flags = AR71XX_UART_FLAGS,
109 - .iotype = UPIO_MEM32,
112 - /* terminating entry */
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),
122 - .platform_data = ath79_uart_data
126 -static struct resource ar933x_uart_resources[] = {
128 - .start = AR933X_UART_BASE,
129 - .end = AR933X_UART_BASE + AR71XX_UART_SIZE - 1,
130 - .flags = IORESOURCE_MEM,
133 - .start = ATH79_MISC_IRQ(3),
134 - .end = ATH79_MISC_IRQ(3),
135 - .flags = IORESOURCE_IRQ,
139 -static struct platform_device ar933x_uart_device = {
140 - .name = "ar933x-uart",
142 - .resource = ar933x_uart_resources,
143 - .num_resources = ARRAY_SIZE(ar933x_uart_resources),
146 -void __init ath79_register_uart(void)
148 - unsigned long uart_clk_rate;
150 - uart_clk_rate = ath79_get_sys_clk_rate("uart");
152 - if (soc_is_ar71xx() ||
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);
166 -void __init ath79_register_wdt(void)
168 - struct resource res;
170 - memset(&res, 0, sizeof(res));
172 - res.flags = IORESOURCE_MEM;
173 - res.start = AR71XX_RESET_BASE + AR71XX_RESET_REG_WDOG_CTRL;
174 - res.end = res.start + 0x8 - 1;
176 - platform_device_register_simple("ath79-wdt", -1, &res, 1);
179 -static struct ath79_gpio_platform_data ath79_gpio_pdata;
181 -static struct resource ath79_gpio_resources[] = {
183 - .flags = IORESOURCE_MEM,
184 - .start = AR71XX_GPIO_BASE,
185 - .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1,
188 - .start = ATH79_MISC_IRQ(2),
189 - .end = ATH79_MISC_IRQ(2),
190 - .flags = IORESOURCE_IRQ,
194 -static struct platform_device ath79_gpio_device = {
195 - .name = "ath79-gpio",
197 - .resource = ath79_gpio_resources,
198 - .num_resources = ARRAY_SIZE(ath79_gpio_resources),
200 - .platform_data = &ath79_gpio_pdata
204 -void __init ath79_gpio_init(void)
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;
226 - platform_device_register(&ath79_gpio_device);
228 --- a/arch/mips/ath79/dev-common.h
232 - * Atheros AR71XX/AR724X/AR913X common devices
234 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
235 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
242 -#ifndef _ATH79_DEV_COMMON_H
243 -#define _ATH79_DEV_COMMON_H
245 -void ath79_register_uart(void);
246 -void ath79_register_wdt(void);
248 -#endif /* _ATH79_DEV_COMMON_H */
249 --- a/arch/mips/ath79/dev-gpio-buttons.c
253 - * Atheros AR71XX/AR724X/AR913X GPIO button support
255 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
256 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
263 -#include "linux/init.h"
264 -#include "linux/slab.h"
265 -#include <linux/platform_device.h>
267 -#include "dev-gpio-buttons.h"
269 -void __init ath79_register_gpio_keys_polled(int id,
270 - unsigned poll_interval,
272 - struct gpio_keys_button *buttons)
274 - struct platform_device *pdev;
275 - struct gpio_keys_platform_data pdata;
276 - struct gpio_keys_button *p;
279 - p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
283 - pdev = platform_device_alloc("gpio-keys-polled", id);
285 - goto err_free_buttons;
287 - memset(&pdata, 0, sizeof(pdata));
288 - pdata.poll_interval = poll_interval;
289 - pdata.nbuttons = nbuttons;
292 - err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
296 - err = platform_device_add(pdev);
303 - platform_device_put(pdev);
308 --- a/arch/mips/ath79/dev-gpio-buttons.h
312 - * Atheros AR71XX/AR724X/AR913X GPIO button support
314 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
315 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
322 -#ifndef _ATH79_DEV_GPIO_BUTTONS_H
323 -#define _ATH79_DEV_GPIO_BUTTONS_H
325 -#include <linux/input.h>
326 -#include <linux/gpio_keys.h>
328 -void ath79_register_gpio_keys_polled(int id,
329 - unsigned poll_interval,
331 - struct gpio_keys_button *buttons);
333 -#endif /* _ATH79_DEV_GPIO_BUTTONS_H */
334 --- a/arch/mips/ath79/dev-leds-gpio.c
338 - * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
340 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
341 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
348 -#include <linux/init.h>
349 -#include <linux/slab.h>
350 -#include <linux/platform_device.h>
352 -#include "dev-leds-gpio.h"
354 -void __init ath79_register_leds_gpio(int id,
356 - struct gpio_led *leds)
358 - struct platform_device *pdev;
359 - struct gpio_led_platform_data pdata;
360 - struct gpio_led *p;
363 - p = kmemdup(leds, num_leds * sizeof(*p), GFP_KERNEL);
367 - pdev = platform_device_alloc("leds-gpio", id);
369 - goto err_free_leds;
371 - memset(&pdata, 0, sizeof(pdata));
372 - pdata.num_leds = num_leds;
375 - err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
379 - err = platform_device_add(pdev);
386 - platform_device_put(pdev);
391 --- a/arch/mips/ath79/dev-leds-gpio.h
395 - * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
397 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
398 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
405 -#ifndef _ATH79_DEV_LEDS_GPIO_H
406 -#define _ATH79_DEV_LEDS_GPIO_H
408 -#include <linux/leds.h>
410 -void ath79_register_leds_gpio(int id,
412 - struct gpio_led *leds);
414 -#endif /* _ATH79_DEV_LEDS_GPIO_H */
415 --- a/arch/mips/ath79/dev-spi.c
419 - * Atheros AR71XX/AR724X/AR913X SPI controller device
421 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
422 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
429 -#include <linux/platform_device.h>
430 -#include <asm/mach-ath79/ar71xx_regs.h>
431 -#include "dev-spi.h"
433 -static struct resource ath79_spi_resources[] = {
435 - .start = AR71XX_SPI_BASE,
436 - .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
437 - .flags = IORESOURCE_MEM,
441 -static struct platform_device ath79_spi_device = {
442 - .name = "ath79-spi",
444 - .resource = ath79_spi_resources,
445 - .num_resources = ARRAY_SIZE(ath79_spi_resources),
448 -void __init ath79_register_spi(struct ath79_spi_platform_data *pdata,
449 - struct spi_board_info const *info,
452 - spi_register_board_info(info, n);
453 - ath79_spi_device.dev.platform_data = pdata;
454 - platform_device_register(&ath79_spi_device);
456 --- a/arch/mips/ath79/dev-spi.h
460 - * Atheros AR71XX/AR724X/AR913X SPI controller device
462 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
463 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
470 -#ifndef _ATH79_DEV_SPI_H
471 -#define _ATH79_DEV_SPI_H
473 -#include <linux/spi/spi.h>
474 -#include <asm/mach-ath79/ath79_spi_platform.h>
476 -void ath79_register_spi(struct ath79_spi_platform_data *pdata,
477 - struct spi_board_info const *info,
480 -#endif /* _ATH79_DEV_SPI_H */
481 --- a/arch/mips/ath79/dev-usb.c
485 - * Atheros AR7XXX/AR9XXX USB Host Controller device
487 - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
488 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
490 - * Parts of this file are based on Atheros' 2.6.15 BSP
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.
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>
506 -#include <asm/mach-ath79/ath79.h>
507 -#include <asm/mach-ath79/ar71xx_regs.h>
509 -#include "dev-usb.h"
511 -static u64 ath79_usb_dmamask = DMA_BIT_MASK(32);
513 -static struct usb_ohci_pdata ath79_ohci_pdata = {
516 -static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
517 - .has_synopsys_hc_bug = 1,
520 -static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
521 - .caps_offset = 0x100,
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,
530 - struct resource res[2];
531 - struct platform_device *pdev;
533 - memset(res, 0, sizeof(res));
535 - res[0].flags = IORESOURCE_MEM;
536 - res[0].start = base;
537 - res[0].end = base + size - 1;
539 - res[1].flags = IORESOURCE_IRQ;
540 - res[1].start = irq;
543 - pdev = platform_device_register_resndata(NULL, name, id,
544 - res, ARRAY_SIZE(res),
547 - if (IS_ERR(pdev)) {
548 - pr_err("ath79: unable to register USB at %08lx, err=%d\n",
549 - base, (int) PTR_ERR(pdev));
553 - pdev->dev.dma_mask = &ath79_usb_dmamask;
554 - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
557 -#define AR71XX_USB_RESET_MASK (AR71XX_RESET_USB_HOST | \
558 - AR71XX_RESET_USB_PHY | \
559 - AR71XX_RESET_USB_OHCI_DLL)
561 -static void __init ath79_usb_setup(void)
563 - void __iomem *usb_ctrl_base;
565 - ath79_device_reset_set(AR71XX_USB_RESET_MASK);
567 - ath79_device_reset_clear(AR71XX_USB_RESET_MASK);
569 - usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE);
571 - /* Turning on the Buff and Desc swap bits */
572 - __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG);
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);
577 - iounmap(usb_ctrl_base);
581 - ath79_usb_register("ohci-platform", -1,
582 - AR71XX_OHCI_BASE, AR71XX_OHCI_SIZE,
584 - &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
586 - ath79_usb_register("ehci-platform", -1,
587 - AR71XX_EHCI_BASE, AR71XX_EHCI_SIZE,
589 - &ath79_ehci_pdata_v1, sizeof(ath79_ehci_pdata_v1));
592 -static void __init ar7240_usb_setup(void)
594 - void __iomem *usb_ctrl_base;
596 - ath79_device_reset_clear(AR7240_RESET_OHCI_DLL);
597 - ath79_device_reset_set(AR7240_RESET_USB_HOST);
601 - ath79_device_reset_set(AR7240_RESET_OHCI_DLL);
602 - ath79_device_reset_clear(AR7240_RESET_USB_HOST);
604 - usb_ctrl_base = ioremap(AR7240_USB_CTRL_BASE, AR7240_USB_CTRL_SIZE);
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);
609 - iounmap(usb_ctrl_base);
611 - ath79_usb_register("ohci-platform", -1,
612 - AR7240_OHCI_BASE, AR7240_OHCI_SIZE,
614 - &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
617 -static void __init ar724x_usb_setup(void)
619 - ath79_device_reset_set(AR724X_RESET_USBSUS_OVERRIDE);
622 - ath79_device_reset_clear(AR724X_RESET_USB_HOST);
625 - ath79_device_reset_clear(AR724X_RESET_USB_PHY);
628 - ath79_usb_register("ehci-platform", -1,
629 - AR724X_EHCI_BASE, AR724X_EHCI_SIZE,
631 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
634 -static void __init ar913x_usb_setup(void)
636 - ath79_device_reset_set(AR913X_RESET_USBSUS_OVERRIDE);
639 - ath79_device_reset_clear(AR913X_RESET_USB_HOST);
642 - ath79_device_reset_clear(AR913X_RESET_USB_PHY);
645 - ath79_usb_register("ehci-platform", -1,
646 - AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
648 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
651 -static void __init ar933x_usb_setup(void)
653 - ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE);
656 - ath79_device_reset_clear(AR933X_RESET_USB_HOST);
659 - ath79_device_reset_clear(AR933X_RESET_USB_PHY);
662 - ath79_usb_register("ehci-platform", -1,
663 - AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
665 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
668 -static void __init ar934x_usb_setup(void)
672 - bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
673 - if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
676 - ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
679 - ath79_device_reset_clear(AR934X_RESET_USB_PHY);
682 - ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG);
685 - ath79_device_reset_clear(AR934X_RESET_USB_HOST);
688 - ath79_usb_register("ehci-platform", -1,
689 - AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
691 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
694 -static void __init qca955x_usb_setup(void)
696 - ath79_usb_register("ehci-platform", 0,
697 - QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
699 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
701 - ath79_usb_register("ehci-platform", 1,
702 - QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE,
704 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
707 -void __init ath79_register_usb(void)
709 - if (soc_is_ar71xx())
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();
726 --- a/arch/mips/ath79/dev-usb.h
730 - * Atheros AR71XX/AR724X/AR913X USB Host Controller support
732 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
733 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
740 -#ifndef _ATH79_DEV_USB_H
741 -#define _ATH79_DEV_USB_H
743 -void ath79_register_usb(void);
745 -#endif /* _ATH79_DEV_USB_H */
746 --- a/arch/mips/ath79/dev-wmac.c
750 - * Atheros AR913X/AR933X SoC built-in WMAC device support
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>
756 - * Parts of this file are based on Atheros 2.6.15/2.6.31 BSP
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.
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>
769 -#include <asm/mach-ath79/ath79.h>
770 -#include <asm/mach-ath79/ar71xx_regs.h>
771 -#include "dev-wmac.h"
773 -static struct ath9k_platform_data ath79_wmac_data;
775 -static struct resource ath79_wmac_resources[] = {
777 - /* .start and .end fields are filled dynamically */
778 - .flags = IORESOURCE_MEM,
780 - /* .start and .end fields are filled dynamically */
781 - .flags = IORESOURCE_IRQ,
785 -static struct platform_device ath79_wmac_device = {
788 - .resource = ath79_wmac_resources,
789 - .num_resources = ARRAY_SIZE(ath79_wmac_resources),
791 - .platform_data = &ath79_wmac_data,
795 -static void __init ar913x_wmac_setup(void)
797 - /* reset the WMAC */
798 - ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
801 - ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
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);
811 -static int ar933x_wmac_reset(void)
813 - ath79_device_reset_set(AR933X_RESET_WMAC);
814 - ath79_device_reset_clear(AR933X_RESET_WMAC);
819 -static int ar933x_r1_get_wmac_revision(void)
821 - return ath79_soc_rev;
824 -static void __init ar933x_wmac_setup(void)
828 - ar933x_wmac_reset();
830 - ath79_wmac_device.name = "ar933x_wmac";
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);
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;
841 - ath79_wmac_data.is_clk_25mhz = true;
843 - if (ath79_soc_rev == 1)
844 - ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision;
846 - ath79_wmac_data.external_reset = ar933x_wmac_reset;
849 -static void ar934x_wmac_setup(void)
853 - ath79_wmac_device.name = "ar934x_wmac";
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);
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;
864 - ath79_wmac_data.is_clk_25mhz = true;
867 -static void qca955x_wmac_setup(void)
871 - ath79_wmac_device.name = "qca955x_wmac";
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);
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;
882 - ath79_wmac_data.is_clk_25mhz = true;
885 -void __init ath79_register_wmac(u8 *cal_data)
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();
899 - memcpy(ath79_wmac_data.eeprom_data, cal_data,
900 - sizeof(ath79_wmac_data.eeprom_data));
902 - platform_device_register(&ath79_wmac_device);
904 --- a/arch/mips/ath79/dev-wmac.h
908 - * Atheros AR913X/AR933X SoC built-in WMAC device support
910 - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
911 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
918 -#ifndef _ATH79_DEV_WMAC_H
919 -#define _ATH79_DEV_WMAC_H
921 -void ath79_register_wmac(u8 *cal_data);
923 -#endif /* _ATH79_DEV_WMAC_H */
924 --- a/arch/mips/ath79/setup.c
925 +++ b/arch/mips/ath79/setup.c
927 #include <asm/mach-ath79/ath79.h>
928 #include <asm/mach-ath79/ar71xx_regs.h>
930 -#include "dev-common.h"
932 #define ATH79_SYS_TYPE_LEN 64