ar71xx: ar913x_wmac device support into a separate file

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18820 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Gabor Juhos 2009-12-18 12:57:09 +00:00
parent 37b67cc5d2
commit f7921c963f
19 changed files with 119 additions and 53 deletions

View File

@ -4,6 +4,7 @@ CONFIG_AG71XX=y
CONFIG_AG71XX_AR8216_SUPPORT=y CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_AG71XX_DEBUG is not set # CONFIG_AG71XX_DEBUG is not set
CONFIG_AR71XX_DEV_AP94_PCI=y CONFIG_AR71XX_DEV_AP94_PCI=y
CONFIG_AR71XX_DEV_AR913X_WMAC=y
CONFIG_AR71XX_DEV_M25P80=y CONFIG_AR71XX_DEV_M25P80=y
CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP81=y
CONFIG_AR71XX_MACH_AP83=y CONFIG_AR71XX_MACH_AP83=y

View File

@ -6,6 +6,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_ALCHEMY_GPIO_INDIRECT is not set # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
# CONFIG_AR7 is not set # CONFIG_AR7 is not set
CONFIG_AR71XX_DEV_AP94_PCI=y CONFIG_AR71XX_DEV_AP94_PCI=y
CONFIG_AR71XX_DEV_AR913X_WMAC=y
CONFIG_AR71XX_DEV_M25P80=y CONFIG_AR71XX_DEV_M25P80=y
CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP81=y
CONFIG_AR71XX_MACH_AP83=y CONFIG_AR71XX_MACH_AP83=y

View File

@ -6,6 +6,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_ALCHEMY_GPIO_INDIRECT is not set # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
# CONFIG_AR7 is not set # CONFIG_AR7 is not set
CONFIG_AR71XX_DEV_AP94_PCI=y CONFIG_AR71XX_DEV_AP94_PCI=y
CONFIG_AR71XX_DEV_AR913X_WMAC=y
CONFIG_AR71XX_DEV_M25P80=y CONFIG_AR71XX_DEV_M25P80=y
CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP81=y
CONFIG_AR71XX_MACH_AP83=y CONFIG_AR71XX_MACH_AP83=y

View File

@ -5,15 +5,18 @@ menu "Atheros AR71xx machine selection"
config AR71XX_MACH_AP81 config AR71XX_MACH_AP81
bool "Atheros AP81 board support" bool "Atheros AP81 board support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_AP83 config AR71XX_MACH_AP83
bool "Atheros AP83 board support" bool "Atheros AP83 board support"
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_DIR_615_C1 config AR71XX_MACH_DIR_615_C1
bool "D-Link DIR-615 rev. C1 support" bool "D-Link DIR-615 rev. C1 support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_DIR_825_B1 config AR71XX_MACH_DIR_825_B1
@ -49,6 +52,7 @@ config AR71XX_MACH_WP543
config AR71XX_MACH_WRT160NL config AR71XX_MACH_WRT160NL
bool "Linksys WRT160NL board support" bool "Linksys WRT160NL board support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_WRT400N config AR71XX_MACH_WRT400N
@ -69,16 +73,19 @@ config AR71XX_MACH_WNDR3700
config AR71XX_MACH_WNR2000 config AR71XX_MACH_WNR2000
bool "NETGEAR WNR2000 board support" bool "NETGEAR WNR2000 board support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_MZK_W04NU config AR71XX_MACH_MZK_W04NU
bool "Planex MZK-W04NU board support" bool "Planex MZK-W04NU board support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_MZK_W300NH config AR71XX_MACH_MZK_W300NH
bool "Planex MZK-W300NH board support" bool "Planex MZK-W300NH board support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_TL_WR741ND config AR71XX_MACH_TL_WR741ND
@ -89,16 +96,19 @@ config AR71XX_MACH_TL_WR741ND
config AR71XX_MACH_TL_WR941ND config AR71XX_MACH_TL_WR941ND
bool "TP-LINK TL-WR941ND support" bool "TP-LINK TL-WR941ND support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_TL_WR1043ND config AR71XX_MACH_TL_WR1043ND
bool "TP-LINK TL-WR1043ND support" bool "TP-LINK TL-WR1043ND support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_TEW_632BRP config AR71XX_MACH_TEW_632BRP
bool "TRENDnet TEW-632BRP support" bool "TRENDnet TEW-632BRP support"
select AR71XX_DEV_M25P80 select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
default y default y
config AR71XX_MACH_UBNT config AR71XX_MACH_UBNT
@ -114,4 +124,7 @@ config AR71XX_DEV_M25P80
config AR71XX_DEV_AP94_PCI config AR71XX_DEV_AP94_PCI
def_bool n def_bool n
config AR71XX_DEV_AR913X_WMAC
def_bool n
endif endif

View File

@ -14,6 +14,7 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_AR71XX_DEV_AP94_PCI) += dev-ap94-pci.o obj-$(CONFIG_AR71XX_DEV_AP94_PCI) += dev-ap94-pci.o
obj-$(CONFIG_AR71XX_DEV_AR913X_WMAC) += dev-ar913x-wmac.o
obj-$(CONFIG_AR71XX_DEV_M25P80) += dev-m25p80.o obj-$(CONFIG_AR71XX_DEV_M25P80) += dev-m25p80.o
obj-$(CONFIG_AR71XX_MACH_AP81) += mach-ap81.o obj-$(CONFIG_AR71XX_MACH_AP81) += mach-ap81.o

View File

@ -0,0 +1,63 @@
/*
* Atheros AR913x SoC built-in WMAC device support
*
* Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Parts of this file are based on Atheros' 2.6.15 BSP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/etherdevice.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include "dev-ar913x-wmac.h"
static struct resource ar913x_wmac_resources[] = {
{
.start = AR91XX_WMAC_BASE,
.end = AR91XX_WMAC_BASE + AR91XX_WMAC_SIZE - 1,
.flags = IORESOURCE_MEM,
}, {
.start = AR71XX_CPU_IRQ_WMAC,
.end = AR71XX_CPU_IRQ_WMAC,
.flags = IORESOURCE_IRQ,
},
};
static struct ath9k_platform_data ar913x_wmac_data;
static struct platform_device ar913x_wmac_device = {
.name = "ath9k",
.id = -1,
.resource = ar913x_wmac_resources,
.num_resources = ARRAY_SIZE(ar913x_wmac_resources),
.dev = {
.platform_data = &ar913x_wmac_data,
},
};
void __init ar913x_add_device_wmac(void)
{
u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
memcpy(ar913x_wmac_data.eeprom_data, ee,
sizeof(ar913x_wmac_data.eeprom_data));
ar71xx_device_stop(RESET_MODULE_AMBA2WMAC);
mdelay(10);
ar71xx_device_start(RESET_MODULE_AMBA2WMAC);
mdelay(10);
platform_device_register(&ar913x_wmac_device);
}

View File

@ -0,0 +1,19 @@
/*
* Atheros AR913x SoC built-in WMAC device support
*
* Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Parts of this file are based on Atheros' 2.6.15 BSP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#ifndef _AR71XX_DEV_AR913X_WMAC_H
#define _AR71XX_DEV_AR913X_WMAC_H
void ar913x_add_device_wmac(void) __init;
#endif /* _AR71XX_DEV_AR913X_WMAC_H */

View File

@ -18,7 +18,6 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/ath9k_platform.h>
#include <asm/mach-ar71xx/ar71xx.h> #include <asm/mach-ar71xx/ar71xx.h>
@ -777,46 +776,6 @@ void __init ar71xx_parse_mac_addr(char *mac_str)
"\"%s\"\n", mac_str); "\"%s\"\n", mac_str);
} }
static struct resource ar91xx_wmac_resources[] = {
{
.start = AR91XX_WMAC_BASE,
.end = AR91XX_WMAC_BASE + AR91XX_WMAC_SIZE - 1,
.flags = IORESOURCE_MEM,
}, {
.start = AR71XX_CPU_IRQ_WMAC,
.end = AR71XX_CPU_IRQ_WMAC,
.flags = IORESOURCE_IRQ,
},
};
static struct ath9k_platform_data ar91xx_wmac_data;
static struct platform_device ar91xx_wmac_device = {
.name = "ath9k",
.id = -1,
.resource = ar91xx_wmac_resources,
.num_resources = ARRAY_SIZE(ar91xx_wmac_resources),
.dev = {
.platform_data = &ar91xx_wmac_data,
},
};
void __init ar91xx_add_device_wmac(void)
{
u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
memcpy(ar91xx_wmac_data.eeprom_data, ee,
sizeof(ar91xx_wmac_data.eeprom_data));
ar71xx_device_stop(RESET_MODULE_AMBA2WMAC);
mdelay(10);
ar71xx_device_start(RESET_MODULE_AMBA2WMAC);
mdelay(10);
platform_device_register(&ar91xx_wmac_device);
}
static struct platform_device ar71xx_dsa_switch_device = { static struct platform_device ar71xx_dsa_switch_device = {
.name = "dsa", .name = "dsa",
.id = 0, .id = 0,

View File

@ -54,8 +54,6 @@ void ar71xx_add_device_uart(void) __init;
void ar71xx_add_device_wdt(void) __init; void ar71xx_add_device_wdt(void) __init;
void ar91xx_add_device_wmac(void) __init;
void ar71xx_add_device_dsa(unsigned int id, void ar71xx_add_device_dsa(unsigned int id,
struct dsa_platform_data *d) __init; struct dsa_platform_data *d) __init;

View File

@ -19,6 +19,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define AP81_GPIO_LED_STATUS 1 #define AP81_GPIO_LED_STATUS 1
#define AP81_GPIO_LED_AOSS 3 #define AP81_GPIO_LED_AOSS 3
@ -133,7 +134,7 @@ static void __init ap81_setup(void)
ARRAY_SIZE(ap81_gpio_buttons), ARRAY_SIZE(ap81_gpio_buttons),
ap81_gpio_buttons); ap81_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup); MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);

View File

@ -23,6 +23,7 @@
#include <asm/mach-ar71xx/ar91xx_flash.h> #include <asm/mach-ar71xx/ar91xx_flash.h>
#include "devices.h" #include "devices.h"
#include "dev-ar913x-wmac.h"
#define AP83_GPIO_LED_WLAN 6 #define AP83_GPIO_LED_WLAN 6
#define AP83_GPIO_LED_POWER 14 #define AP83_GPIO_LED_POWER 14
@ -217,7 +218,7 @@ static void __init ap83_generic_setup(void)
ar71xx_add_device_usb(); ar71xx_add_device_usb();
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
platform_device_register(&ap83_flash_device); platform_device_register(&ap83_flash_device);

View File

@ -20,6 +20,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */ #define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */
#define DIR_615C1_GPIO_LED_BLUE_WPS 3 /* BLUE:WPS */ #define DIR_615C1_GPIO_LED_BLUE_WPS 3 /* BLUE:WPS */
@ -148,7 +149,7 @@ static void __init dir_615c1_setup(void)
ARRAY_SIZE(dir_615c1_gpio_buttons), ARRAY_SIZE(dir_615c1_gpio_buttons),
dir_615c1_gpio_buttons); dir_615c1_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup); MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup);

View File

@ -20,6 +20,7 @@
#include <asm/mach-ar71xx/ar71xx.h> #include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h" #include "devices.h"
#include "dev-ar913x-wmac.h"
#define MZK_W04NU_GPIO_LED_USB 0 #define MZK_W04NU_GPIO_LED_USB 0
#define MZK_W04NU_GPIO_LED_STATUS 1 #define MZK_W04NU_GPIO_LED_STATUS 1
@ -167,7 +168,7 @@ static void __init mzk_w04nu_setup(void)
mzk_w04nu_gpio_buttons); mzk_w04nu_gpio_buttons);
ar71xx_add_device_usb(); ar71xx_add_device_usb();
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "Planex MZK-W04NU", mzk_w04nu_setup); MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "Planex MZK-W04NU", mzk_w04nu_setup);

View File

@ -20,6 +20,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define MZK_W300NH_GPIO_LED_STATUS 1 #define MZK_W300NH_GPIO_LED_STATUS 1
#define MZK_W300NH_GPIO_LED_WPS 3 #define MZK_W300NH_GPIO_LED_WPS 3
@ -153,7 +154,7 @@ static void __init mzk_w300nh_setup(void)
ar71xx_add_device_gpio_buttons(-1, MZK_W04NU_BUTTONS_POLL_INTERVAL, ar71xx_add_device_gpio_buttons(-1, MZK_W04NU_BUTTONS_POLL_INTERVAL,
ARRAY_SIZE(mzk_w300nh_gpio_buttons), ARRAY_SIZE(mzk_w300nh_gpio_buttons),
mzk_w300nh_gpio_buttons); mzk_w300nh_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "Planex MZK-W300NH", mzk_w300nh_setup); MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "Planex MZK-W300NH", mzk_w300nh_setup);

View File

@ -19,6 +19,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define TEW_632BRP_GPIO_LED_STATUS 1 #define TEW_632BRP_GPIO_LED_STATUS 1
#define TEW_632BRP_GPIO_LED_WPS 3 #define TEW_632BRP_GPIO_LED_WPS 3
@ -123,7 +124,7 @@ static void __init tew_632brp_setup(void)
ARRAY_SIZE(tew_632brp_gpio_buttons), ARRAY_SIZE(tew_632brp_gpio_buttons),
tew_632brp_gpio_buttons); tew_632brp_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TRENDnet TEW-632BRP", tew_632brp_setup); MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TRENDnet TEW-632BRP", tew_632brp_setup);

View File

@ -19,6 +19,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define TL_WR1043ND_GPIO_LED_SYSTEM 2 #define TL_WR1043ND_GPIO_LED_SYSTEM 2
#define TL_WR1043ND_GPIO_LED_QSS 5 #define TL_WR1043ND_GPIO_LED_QSS 5
@ -118,7 +119,7 @@ static void __init tl_wr1043nd_setup(void)
ar71xx_add_device_gpio_buttons(-1, TL_WR1043ND_BUTTONS_POLL_INTERVAL, ar71xx_add_device_gpio_buttons(-1, TL_WR1043ND_BUTTONS_POLL_INTERVAL,
ARRAY_SIZE(tl_wr1043nd_gpio_buttons), ARRAY_SIZE(tl_wr1043nd_gpio_buttons),
tl_wr1043nd_gpio_buttons); tl_wr1043nd_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TP-LINK TL-WR1043ND", tl_wr1043nd_setup); MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TP-LINK TL-WR1043ND", tl_wr1043nd_setup);

View File

@ -19,6 +19,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define TL_WR941ND_GPIO_LED_SYSTEM 2 #define TL_WR941ND_GPIO_LED_SYSTEM 2
#define TL_WR941ND_GPIO_LED_QSS 5 #define TL_WR941ND_GPIO_LED_QSS 5
@ -131,7 +132,7 @@ static void __init tl_wr941nd_setup(void)
ar71xx_add_device_gpio_buttons(-1, TL_WR941ND_BUTTONS_POLL_INTERVAL, ar71xx_add_device_gpio_buttons(-1, TL_WR941ND_BUTTONS_POLL_INTERVAL,
ARRAY_SIZE(tl_wr941nd_gpio_buttons), ARRAY_SIZE(tl_wr941nd_gpio_buttons),
tl_wr941nd_gpio_buttons); tl_wr941nd_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TP-LINK TL-WR941ND", tl_wr941nd_setup); MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TP-LINK TL-WR941ND", tl_wr941nd_setup);

View File

@ -21,6 +21,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define WNR2000_GPIO_LED_PWR_GREEN 14 #define WNR2000_GPIO_LED_PWR_GREEN 14
#define WNR2000_GPIO_LED_PWR_AMBER 7 #define WNR2000_GPIO_LED_PWR_AMBER 7
@ -143,7 +144,7 @@ static void __init wnr2000_setup(void)
wnr2000_gpio_buttons); wnr2000_gpio_buttons);
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
} }
MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup); MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);

View File

@ -18,6 +18,7 @@
#include "devices.h" #include "devices.h"
#include "dev-m25p80.h" #include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
#define WRT160NL_GPIO_LED_POWER 14 #define WRT160NL_GPIO_LED_POWER 14
#define WRT160NL_GPIO_LED_WPS_AMBER 9 #define WRT160NL_GPIO_LED_WPS_AMBER 9
@ -124,7 +125,7 @@ static void __init wrt160nl_setup(void)
ar71xx_add_device_m25p80(&wrt160nl_flash_data); ar71xx_add_device_m25p80(&wrt160nl_flash_data);
ar71xx_add_device_usb(); ar71xx_add_device_usb();
ar91xx_add_device_wmac(); ar913x_add_device_wmac();
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio), ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio),
wrt160nl_leds_gpio); wrt160nl_leds_gpio);