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
6 Signed-off-by: John Crispin <john@phrozen.org>
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
35 --- a/arch/mips/ath79/dev-common.c
39 - * Atheros AR71XX/AR724X/AR913X common devices
41 - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
42 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
44 - * Parts of this file are based on Atheros' 2.6.15 BSP
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.
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>
59 -#include <asm/mach-ath79/ath79.h>
60 -#include <asm/mach-ath79/ar71xx_regs.h>
62 -#include "dev-common.h"
64 -static struct resource ath79_uart_resources[] = {
66 - .start = AR71XX_UART_BASE,
67 - .end = AR71XX_UART_BASE + AR71XX_UART_SIZE - 1,
68 - .flags = IORESOURCE_MEM,
72 -#define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
73 -static struct plat_serial8250_port ath79_uart_data[] = {
75 - .mapbase = AR71XX_UART_BASE,
76 - .irq = ATH79_MISC_IRQ(3),
77 - .flags = AR71XX_UART_FLAGS,
78 - .iotype = UPIO_MEM32,
81 - /* terminating entry */
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),
91 - .platform_data = ath79_uart_data
95 -static struct resource ar933x_uart_resources[] = {
97 - .start = AR933X_UART_BASE,
98 - .end = AR933X_UART_BASE + AR71XX_UART_SIZE - 1,
99 - .flags = IORESOURCE_MEM,
102 - .start = ATH79_MISC_IRQ(3),
103 - .end = ATH79_MISC_IRQ(3),
104 - .flags = IORESOURCE_IRQ,
108 -static struct platform_device ar933x_uart_device = {
109 - .name = "ar933x-uart",
111 - .resource = ar933x_uart_resources,
112 - .num_resources = ARRAY_SIZE(ar933x_uart_resources),
115 -void __init ath79_register_uart(void)
117 - unsigned long uart_clk_rate;
119 - uart_clk_rate = ath79_get_sys_clk_rate("uart");
121 - if (soc_is_ar71xx() ||
125 - soc_is_qca953x() ||
126 - soc_is_qca955x() ||
127 - soc_is_qca956x() ||
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);
138 -void __init ath79_register_wdt(void)
140 - struct resource res;
142 - memset(&res, 0, sizeof(res));
144 - res.flags = IORESOURCE_MEM;
145 - res.start = AR71XX_RESET_BASE + AR71XX_RESET_REG_WDOG_CTRL;
146 - res.end = res.start + 0x8 - 1;
148 - platform_device_register_simple("ath79-wdt", -1, &res, 1);
151 -static struct ath79_gpio_platform_data ath79_gpio_pdata;
153 -static struct resource ath79_gpio_resources[] = {
155 - .flags = IORESOURCE_MEM,
156 - .start = AR71XX_GPIO_BASE,
157 - .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1,
160 - .start = ATH79_MISC_IRQ(2),
161 - .end = ATH79_MISC_IRQ(2),
162 - .flags = IORESOURCE_IRQ,
166 -static struct platform_device ath79_gpio_device = {
167 - .name = "ath79-gpio",
169 - .resource = ath79_gpio_resources,
170 - .num_resources = ARRAY_SIZE(ath79_gpio_resources),
172 - .platform_data = &ath79_gpio_pdata
176 -void __init ath79_gpio_init(void)
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;
204 - platform_device_register(&ath79_gpio_device);
206 --- a/arch/mips/ath79/dev-common.h
210 - * Atheros AR71XX/AR724X/AR913X common devices
212 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
213 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
220 -#ifndef _ATH79_DEV_COMMON_H
221 -#define _ATH79_DEV_COMMON_H
223 -void ath79_register_uart(void);
224 -void ath79_register_wdt(void);
226 -#endif /* _ATH79_DEV_COMMON_H */
227 --- a/arch/mips/ath79/dev-gpio-buttons.c
231 - * Atheros AR71XX/AR724X/AR913X GPIO button support
233 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
234 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
241 -#include "linux/init.h"
242 -#include "linux/slab.h"
243 -#include <linux/platform_device.h>
245 -#include "dev-gpio-buttons.h"
247 -void __init ath79_register_gpio_keys_polled(int id,
248 - unsigned poll_interval,
250 - struct gpio_keys_button *buttons)
252 - struct platform_device *pdev;
253 - struct gpio_keys_platform_data pdata;
254 - struct gpio_keys_button *p;
257 - p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
261 - pdev = platform_device_alloc("gpio-keys-polled", id);
263 - goto err_free_buttons;
265 - memset(&pdata, 0, sizeof(pdata));
266 - pdata.poll_interval = poll_interval;
267 - pdata.nbuttons = nbuttons;
270 - err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
274 - err = platform_device_add(pdev);
281 - platform_device_put(pdev);
286 --- a/arch/mips/ath79/dev-gpio-buttons.h
290 - * Atheros AR71XX/AR724X/AR913X GPIO button support
292 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
293 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
300 -#ifndef _ATH79_DEV_GPIO_BUTTONS_H
301 -#define _ATH79_DEV_GPIO_BUTTONS_H
303 -#include <linux/input.h>
304 -#include <linux/gpio_keys.h>
306 -void ath79_register_gpio_keys_polled(int id,
307 - unsigned poll_interval,
309 - struct gpio_keys_button *buttons);
311 -#endif /* _ATH79_DEV_GPIO_BUTTONS_H */
312 --- a/arch/mips/ath79/dev-leds-gpio.c
316 - * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
318 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
319 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
326 -#include <linux/init.h>
327 -#include <linux/slab.h>
328 -#include <linux/platform_device.h>
330 -#include "dev-leds-gpio.h"
332 -void __init ath79_register_leds_gpio(int id,
334 - struct gpio_led *leds)
336 - struct platform_device *pdev;
337 - struct gpio_led_platform_data pdata;
338 - struct gpio_led *p;
341 - p = kmemdup(leds, num_leds * sizeof(*p), GFP_KERNEL);
345 - pdev = platform_device_alloc("leds-gpio", id);
347 - goto err_free_leds;
349 - memset(&pdata, 0, sizeof(pdata));
350 - pdata.num_leds = num_leds;
353 - err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
357 - err = platform_device_add(pdev);
364 - platform_device_put(pdev);
369 --- a/arch/mips/ath79/dev-leds-gpio.h
373 - * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
375 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
376 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
383 -#ifndef _ATH79_DEV_LEDS_GPIO_H
384 -#define _ATH79_DEV_LEDS_GPIO_H
386 -#include <linux/leds.h>
388 -void ath79_register_leds_gpio(int id,
390 - struct gpio_led *leds);
392 -#endif /* _ATH79_DEV_LEDS_GPIO_H */
393 --- a/arch/mips/ath79/dev-spi.c
397 - * Atheros AR71XX/AR724X/AR913X SPI controller device
399 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
400 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
407 -#include <linux/platform_device.h>
408 -#include <asm/mach-ath79/ar71xx_regs.h>
409 -#include "dev-spi.h"
411 -static struct resource ath79_spi_resources[] = {
413 - .start = AR71XX_SPI_BASE,
414 - .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
415 - .flags = IORESOURCE_MEM,
419 -static struct platform_device ath79_spi_device = {
420 - .name = "ath79-spi",
422 - .resource = ath79_spi_resources,
423 - .num_resources = ARRAY_SIZE(ath79_spi_resources),
426 -void __init ath79_register_spi(struct ath79_spi_platform_data *pdata,
427 - struct spi_board_info const *info,
430 - spi_register_board_info(info, n);
431 - ath79_spi_device.dev.platform_data = pdata;
432 - platform_device_register(&ath79_spi_device);
434 --- a/arch/mips/ath79/dev-spi.h
438 - * Atheros AR71XX/AR724X/AR913X SPI controller device
440 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
441 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
448 -#ifndef _ATH79_DEV_SPI_H
449 -#define _ATH79_DEV_SPI_H
451 -#include <linux/spi/spi.h>
452 -#include <asm/mach-ath79/ath79_spi_platform.h>
454 -void ath79_register_spi(struct ath79_spi_platform_data *pdata,
455 - struct spi_board_info const *info,
458 -#endif /* _ATH79_DEV_SPI_H */
459 --- a/arch/mips/ath79/dev-usb.c
463 - * Atheros AR7XXX/AR9XXX USB Host Controller device
465 - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
466 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
468 - * Parts of this file are based on Atheros' 2.6.15 BSP
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.
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>
484 -#include <asm/mach-ath79/ath79.h>
485 -#include <asm/mach-ath79/ar71xx_regs.h>
487 -#include "dev-usb.h"
489 -static u64 ath79_usb_dmamask = DMA_BIT_MASK(32);
491 -static struct usb_ohci_pdata ath79_ohci_pdata = {
494 -static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
495 - .has_synopsys_hc_bug = 1,
498 -static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
499 - .caps_offset = 0x100,
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,
508 - struct resource res[2];
509 - struct platform_device *pdev;
511 - memset(res, 0, sizeof(res));
513 - res[0].flags = IORESOURCE_MEM;
514 - res[0].start = base;
515 - res[0].end = base + size - 1;
517 - res[1].flags = IORESOURCE_IRQ;
518 - res[1].start = irq;
521 - pdev = platform_device_register_resndata(NULL, name, id,
522 - res, ARRAY_SIZE(res),
525 - if (IS_ERR(pdev)) {
526 - pr_err("ath79: unable to register USB at %08lx, err=%d\n",
527 - base, (int) PTR_ERR(pdev));
531 - pdev->dev.dma_mask = &ath79_usb_dmamask;
532 - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
535 -#define AR71XX_USB_RESET_MASK (AR71XX_RESET_USB_HOST | \
536 - AR71XX_RESET_USB_PHY | \
537 - AR71XX_RESET_USB_OHCI_DLL)
539 -static void __init ath79_usb_setup(void)
541 - void __iomem *usb_ctrl_base;
543 - ath79_device_reset_set(AR71XX_USB_RESET_MASK);
545 - ath79_device_reset_clear(AR71XX_USB_RESET_MASK);
547 - usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE);
549 - /* Turning on the Buff and Desc swap bits */
550 - __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG);
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);
555 - iounmap(usb_ctrl_base);
559 - ath79_usb_register("ohci-platform", -1,
560 - AR71XX_OHCI_BASE, AR71XX_OHCI_SIZE,
562 - &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
564 - ath79_usb_register("ehci-platform", -1,
565 - AR71XX_EHCI_BASE, AR71XX_EHCI_SIZE,
567 - &ath79_ehci_pdata_v1, sizeof(ath79_ehci_pdata_v1));
570 -static void __init ar7240_usb_setup(void)
572 - void __iomem *usb_ctrl_base;
574 - ath79_device_reset_clear(AR7240_RESET_OHCI_DLL);
575 - ath79_device_reset_set(AR7240_RESET_USB_HOST);
579 - ath79_device_reset_set(AR7240_RESET_OHCI_DLL);
580 - ath79_device_reset_clear(AR7240_RESET_USB_HOST);
582 - usb_ctrl_base = ioremap(AR7240_USB_CTRL_BASE, AR7240_USB_CTRL_SIZE);
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);
587 - iounmap(usb_ctrl_base);
589 - ath79_usb_register("ohci-platform", -1,
590 - AR7240_OHCI_BASE, AR7240_OHCI_SIZE,
592 - &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
595 -static void __init ar724x_usb_setup(void)
597 - ath79_device_reset_set(AR724X_RESET_USBSUS_OVERRIDE);
600 - ath79_device_reset_clear(AR724X_RESET_USB_HOST);
603 - ath79_device_reset_clear(AR724X_RESET_USB_PHY);
606 - ath79_usb_register("ehci-platform", -1,
607 - AR724X_EHCI_BASE, AR724X_EHCI_SIZE,
609 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
612 -static void __init ar913x_usb_setup(void)
614 - ath79_device_reset_set(AR913X_RESET_USBSUS_OVERRIDE);
617 - ath79_device_reset_clear(AR913X_RESET_USB_HOST);
620 - ath79_device_reset_clear(AR913X_RESET_USB_PHY);
623 - ath79_usb_register("ehci-platform", -1,
624 - AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
626 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
629 -static void __init ar933x_usb_setup(void)
631 - ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE);
634 - ath79_device_reset_clear(AR933X_RESET_USB_HOST);
637 - ath79_device_reset_clear(AR933X_RESET_USB_PHY);
640 - ath79_usb_register("ehci-platform", -1,
641 - AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
643 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
646 -static void __init ar934x_usb_setup(void)
650 - bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
651 - if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
654 - ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
657 - ath79_device_reset_clear(AR934X_RESET_USB_PHY);
660 - ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG);
663 - ath79_device_reset_clear(AR934X_RESET_USB_HOST);
666 - ath79_usb_register("ehci-platform", -1,
667 - AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
669 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
672 -static void __init qca955x_usb_setup(void)
674 - ath79_usb_register("ehci-platform", 0,
675 - QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
677 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
679 - ath79_usb_register("ehci-platform", 1,
680 - QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE,
682 - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
685 -void __init ath79_register_usb(void)
687 - if (soc_is_ar71xx())
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();
704 --- a/arch/mips/ath79/dev-usb.h
708 - * Atheros AR71XX/AR724X/AR913X USB Host Controller support
710 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
711 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
718 -#ifndef _ATH79_DEV_USB_H
719 -#define _ATH79_DEV_USB_H
721 -void ath79_register_usb(void);
723 -#endif /* _ATH79_DEV_USB_H */
724 --- a/arch/mips/ath79/dev-wmac.c
728 - * Atheros AR913X/AR933X SoC built-in WMAC device support
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>
734 - * Parts of this file are based on Atheros 2.6.15/2.6.31 BSP
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.
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>
747 -#include <asm/mach-ath79/ath79.h>
748 -#include <asm/mach-ath79/ar71xx_regs.h>
749 -#include "dev-wmac.h"
751 -static struct ath9k_platform_data ath79_wmac_data;
753 -static struct resource ath79_wmac_resources[] = {
755 - /* .start and .end fields are filled dynamically */
756 - .flags = IORESOURCE_MEM,
758 - /* .start and .end fields are filled dynamically */
759 - .flags = IORESOURCE_IRQ,
763 -static struct platform_device ath79_wmac_device = {
766 - .resource = ath79_wmac_resources,
767 - .num_resources = ARRAY_SIZE(ath79_wmac_resources),
769 - .platform_data = &ath79_wmac_data,
773 -static void __init ar913x_wmac_setup(void)
775 - /* reset the WMAC */
776 - ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
779 - ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
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);
789 -static int ar933x_wmac_reset(void)
791 - ath79_device_reset_set(AR933X_RESET_WMAC);
792 - ath79_device_reset_clear(AR933X_RESET_WMAC);
797 -static int ar933x_r1_get_wmac_revision(void)
799 - return ath79_soc_rev;
802 -static void __init ar933x_wmac_setup(void)
806 - ar933x_wmac_reset();
808 - ath79_wmac_device.name = "ar933x_wmac";
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);
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;
819 - ath79_wmac_data.is_clk_25mhz = true;
821 - if (ath79_soc_rev == 1)
822 - ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision;
824 - ath79_wmac_data.external_reset = ar933x_wmac_reset;
827 -static void ar934x_wmac_setup(void)
831 - ath79_wmac_device.name = "ar934x_wmac";
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);
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;
842 - ath79_wmac_data.is_clk_25mhz = true;
845 -static void qca955x_wmac_setup(void)
849 - ath79_wmac_device.name = "qca955x_wmac";
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);
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;
860 - ath79_wmac_data.is_clk_25mhz = true;
863 -void __init ath79_register_wmac(u8 *cal_data)
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();
877 - memcpy(ath79_wmac_data.eeprom_data, cal_data,
878 - sizeof(ath79_wmac_data.eeprom_data));
880 - platform_device_register(&ath79_wmac_device);
882 --- a/arch/mips/ath79/dev-wmac.h
886 - * Atheros AR913X/AR933X SoC built-in WMAC device support
888 - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
889 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
896 -#ifndef _ATH79_DEV_WMAC_H
897 -#define _ATH79_DEV_WMAC_H
899 -void ath79_register_wmac(u8 *cal_data);
901 -#endif /* _ATH79_DEV_WMAC_H */
902 --- a/arch/mips/ath79/setup.c
903 +++ b/arch/mips/ath79/setup.c
905 #include <asm/mach-ath79/ath79.h>
906 #include <asm/mach-ath79/ar71xx_regs.h>
908 -#include "dev-common.h"
909 #include "machtypes.h"
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)
917 - ath79_register_uart();
918 - ath79_register_wdt();
920 mips_machine_setup();