From: Gabor Juhos Date: Wed, 8 May 2013 17:03:34 +0000 (+0000) Subject: ar71xx: add kernel support for Netgear WNDAP360 X-Git-Tag: reboot~10481 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=10b3ca5ccbd602c6d38456431631269018809b87;p=openwrt%2Fstaging%2Fnoltari.git ar71xx: add kernel support for Netgear WNDAP360 Here is corrected version (only thing not working are wifi LEDs). [juhosg: this has been created from the following patch: http://patchwork.openwrt.org/patch/3620/ ] Signed-off-by: Jacek Kikiewicz Signed-off-by: Gabor Juhos SVN-Revision: 36578 --- diff --git a/target/linux/ar71xx/config-3.8 b/target/linux/ar71xx/config-3.8 index 32393fb33d..e25966b68f 100644 --- a/target/linux/ar71xx/config-3.8 +++ b/target/linux/ar71xx/config-3.8 @@ -82,6 +82,7 @@ CONFIG_ATH79_MACH_UBNT=y CONFIG_ATH79_MACH_UBNT_XM=y CONFIG_ATH79_MACH_WHR_HP_G300N=y CONFIG_ATH79_MACH_WLAE_AG300N=y +CONFIG_ATH79_MACH_WNDAP360=y CONFIG_ATH79_MACH_WNDR3700=y CONFIG_ATH79_MACH_WNDR4300=y CONFIG_ATH79_MACH_WNR2000=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wndap360.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wndap360.c new file mode 100644 index 0000000000..3d8d6b0af1 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wndap360.c @@ -0,0 +1,105 @@ +/* + * Netgear WNDAP360 board support (proper leds / button support missing) + * + * Based on AP96 + * Copyright (C) 2013 Jacek Kikiewicz + * Copyright (C) 2009 Marco Porsch + * Copyright (C) 2009-2012 Gabor Juhos + * Copyright (C) 2010 Atheros Communications + * + * 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 +#include + +#include + +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-usb.h" +#include "machtypes.h" + +#define WNDAP360_GPIO_LED_POWER_ORANGE 0 +#define WNDAP360_GPIO_LED_POWER_GREEN 2 + +/* Reset button - next to the power connector */ +#define WNDAP360_GPIO_BTN_RESET 3 +/* WPS button - next to a led on right */ +#define WNDAP360_GPIO_BTN_WPS 8 + +#define WNDAP360_KEYS_POLL_INTERVAL 20 /* msecs */ +#define WNDAP360_KEYS_DEBOUNCE_INTERVAL (3 * WNDAP360_KEYS_POLL_INTERVAL) + +#define WNDAP360_WMAC0_MAC_OFFSET 0x120c +#define WNDAP360_WMAC1_MAC_OFFSET 0x520c +#define WNDAP360_CALDATA0_OFFSET 0x1000 +#define WNDAP360_CALDATA1_OFFSET 0x5000 + +/* + * WNDAP360 this still uses leds definitions from AP96 + * + */ +static struct gpio_led wndap360_leds_gpio[] __initdata = { + { + .name = "wndap360:green:power", + .gpio = WNDAP360_GPIO_LED_POWER_GREEN, + .active_low = 1, + }, { + .name = "wndap360:orange:power", + .gpio = WNDAP360_GPIO_LED_POWER_ORANGE, + .active_low = 1, + } +}; + +static struct gpio_keys_button wndap360_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WNDAP360_KEYS_DEBOUNCE_INTERVAL, + .gpio = WNDAP360_GPIO_BTN_RESET, + .active_low = 1, + } +}; + +#define WNDAP360_LAN_PHYMASK 0x0f + +static void __init wndap360_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_mdio(0, ~(WNDAP360_LAN_PHYMASK)); + + ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); + ath79_eth0_pll_data.pll_1000 = 0x11110000; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = WNDAP360_LAN_PHYMASK; + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + + ath79_register_eth(0); + + ath79_register_usb(); + + ath79_register_m25p80(NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(wndap360_leds_gpio), + wndap360_leds_gpio); + + ath79_register_gpio_keys_polled(-1, WNDAP360_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wndap360_gpio_keys), + wndap360_gpio_keys); + + ap94_pci_init(art + WNDAP360_CALDATA0_OFFSET, + art + WNDAP360_WMAC0_MAC_OFFSET, + art + WNDAP360_CALDATA1_OFFSET, + art + WNDAP360_WMAC1_MAC_OFFSET); +} + +MIPS_MACHINE(ATH79_MACH_WNDAP360, "WNDAP360", "Netgear WNDAP360", wndap360_setup); diff --git a/target/linux/ar71xx/patches-3.8/619-MIPS-ath79-add-Netgear-WDNAP360-support.patch b/target/linux/ar71xx/patches-3.8/619-MIPS-ath79-add-Netgear-WDNAP360-support.patch new file mode 100644 index 0000000000..ba92ec6cf4 --- /dev/null +++ b/target/linux/ar71xx/patches-3.8/619-MIPS-ath79-add-Netgear-WDNAP360-support.patch @@ -0,0 +1,44 @@ +--- a/arch/mips/ath79/machtypes.h ++++ b/arch/mips/ath79/machtypes.h +@@ -117,6 +117,7 @@ enum ath79_mach_type { + ATH79_MACH_WHR_HP_G300N, /* Buffalo WHR-HP-G300N */ + ATH79_MACH_WHR_HP_GN, /* Buffalo WHR-HP-GN */ + ATH79_MACH_WLAE_AG300N, /* Buffalo WLAE-AG300N */ ++ ATH79_MACH_WNDAP360, /* NETGEAR WNDAP360 */ + ATH79_MACH_WNDR3700, /* NETGEAR WNDR3700/WNDR3800/WNDRMAC */ + ATH79_MACH_WNDR4300, /* NETGEAR WNDR4300 */ + ATH79_MACH_WNR2000, /* NETGEAR WNR2000 */ +--- a/arch/mips/ath79/Kconfig ++++ b/arch/mips/ath79/Kconfig +@@ -378,6 +378,16 @@ config ATH79_MACH_RB2011 + select ATH79_DEV_WMAC + select ATH79_ROUTERBOOT + ++config ATH79_MACH_WNDAP360 ++ bool "NETGEAR WNDAP360 board support" ++ select SOC_AR71XX ++ select ATH79_DEV_AP9X_PCI if PCI ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ + config ATH79_MACH_WNDR3700 + bool "NETGEAR WNDR3700 board support" + select SOC_AR71XX +--- a/arch/mips/ath79/Makefile ++++ b/arch/mips/ath79/Makefile +@@ -98,6 +98,7 @@ obj-$(CONFIG_ATH79_MACH_UBNT) += mach-u + obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o + obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o + obj-$(CONFIG_ATH79_MACH_WLAE_AG300N) += mach-wlae-ag300n.o ++obj-$(CONFIG_ATH79_MACH_WNDAP360) += mach-wndap360.o + obj-$(CONFIG_ATH79_MACH_WNDR3700) += mach-wndr3700.o + obj-$(CONFIG_ATH79_MACH_WNDR4300) += mach-wndr4300.o + obj-$(CONFIG_ATH79_MACH_WNR2000) += mach-wnr2000.o +@@ -111,4 +112,3 @@ obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH2) + obj-$(CONFIG_ATH79_MACH_WZR_HP_AG300H) += mach-wzr-hp-ag300h.o + obj-$(CONFIG_ATH79_MACH_WZR_HP_G450H) += mach-wzr-hp-g450h.o + obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o +-