[LEDE-DEV] ar71xx: support for Zyxel NWA1121-NI (updated)
alexpro
alexpro at itp.ac.ru
Wed Feb 1 00:51:39 PST 2017
Hi,
This is updated patch for Zyxel NWA1121-NI support:
- added files, forgotten last time
- cleaned up the patch
- updated ar71xx.sh, platform.sh
- checked sysupgrade - works
From d7372b409d6c69781f147949a511e61f539dbf2f Mon Sep 17 00:00:00 2001
From: Alex Prokofiev <alexpro at itp.ac.ru>
Date: Wed, 25 Jan 2017 21:42:38 +0300
Subject: [PATCH] Support for Zyxel NWA1121-NI
Signed-off-by: Alex Prokofiev <alexpro at itp.ac.ru>
---
target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +
.../ar71xx/base-files/lib/upgrade/platform.sh | 6 +-
.../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 12 +++
target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 +
.../ar71xx/files/arch/mips/ath79/mach-nwa1121.c | 105
+++++++++++++++++++++
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
target/linux/ar71xx/image/generic.mk | 12 +++
7 files changed, 138 insertions(+), 2 deletions(-)
create mode 100644
target/linux/ar71xx/files/arch/mips/ath79/mach-nwa1121.c
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index ad73ec1520..f81b4e4e46 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1235,6 +1235,9 @@ ar71xx_board_detect() {
*"HiWiFi HC6361")
name="hiwifi-hc6361"
;;
+ *"ZYXEL NWA1121")
+ name="nwa1121"
+ ;;
esac
[ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index e0ba5d37ff..1651363cb1 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -344,7 +344,8 @@ platform_check_image() {
routerstation-pro|\
routerstation|\
wp543|\
- wpe72)
+ wpe72|\
+ nwa1121)
[ "$magic" != "4349" ] && {
echo "Invalid image. Use *-sysupgrade.bin files on this board"
return 1
@@ -643,7 +644,8 @@ platform_do_upgrade() {
local board=$(ar71xx_board_name)
case "$board" in
- rb-941-2nd)
+ rb-941-2nd|\
+ nwa1121)
PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=1
platform_do_upgrade_combined "$ARGV"
;;
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index c3f958869e..62abf6c143 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1888,3 +1888,15 @@ config ATH79_MACH_TL_WPA8630
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
+
+config ATH79_MACH_NWA1121
+ bool "Zyxel NWA1121 support"
+ select SOC_AR934X
+ 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
+ select ATH79_DEV_WMAC
+ select ATH79_NVRAM
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index ac0bbc46bf..01ba23742a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -232,3 +232,4 @@ obj-$(CONFIG_ATH79_MACH_XD3200) += mach-sr3200.o
obj-$(CONFIG_ATH79_MACH_Z1) += mach-z1.o
obj-$(CONFIG_ATH79_MACH_ZBT_WE1526) += mach-zbt-we1526.o
obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o
+obj-$(CONFIG_ATH79_MACH_NWA1121) += mach-nwa1121.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-nwa1121.c
b/target/linux/ar71xx/files/arch/mips/ath79/mach-nwa1121.c
new file mode 100644
index 0000000000..f52662920c
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-nwa1121.c
@@ -0,0 +1,105 @@
+/*
+ * Zyxel NWA1121-NI support
+ * Alex Prokofiev <alexpro at itp.ac.ru>
+ *
+ * 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/pci.h>
+#include <linux/phy.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#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-spi.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "nvram.h"
+
+#define NWA1121_GPIO_RESET 4
+#define NWA1121_GPIO_ORANGE 11
+#define NWA1121_GPIO_GREEN 12
+
+#define NWA1121_ENV 0x1ffe0000
+#define NWA1121_ART 0x1fff1000
+
+
+static const char *nwa1121_part_probes[] = {
+ "cmdlinepart",
+ NULL,
+};
+
+static struct flash_platform_data nwa1121_flash_data = {
+ .part_probes = nwa1121_part_probes,
+};
+
+static struct gpio_led nwa1121_leds_gpio[] __initdata = {
+ {
+ .name = "zyxel:orange",
+ .gpio = NWA1121_GPIO_ORANGE,
+ .active_low = 1,
+ }, {
+ .name = "zyxel:green",
+ .gpio = NWA1121_GPIO_GREEN,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_button nwa1121_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .gpio = NWA1121_GPIO_RESET,
+ .debounce_interval = 60,
+ .active_low = 1,
+ }
+};
+
+static int nwa1121_get_env(const char *name, char *mac)
+{
+ u8 *env = (u8 *) KSEG1ADDR(NWA1121_ENV);
+ return ath79_nvram_parse_mac_addr(env, 0x10000, name, mac);
+}
+
+static void __init nwa1121_setup(void)
+{
+ u8 *ee = (u8 *) KSEG1ADDR(NWA1121_ART);
+ u8 wifi0mac[ETH_ALEN];
+ u8 eth0mac[ETH_ALEN];
+
+ ath79_register_m25p80(&nwa1121_flash_data);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(nwa1121_leds_gpio),
nwa1121_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, 20, ARRAY_SIZE(nwa1121_gpio_keys),
nwa1121_gpio_keys);
+
+ nwa1121_get_env("wifi0mac=", wifi0mac);
+ ath79_register_wmac(ee, wifi0mac);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 /* |
AR934X_ETH_CFG_SW_ONLY_MODE */);
+ ath79_setup_ar934x_eth_rx_delay(1, 1);
+ ath79_register_mdio(0, 0x0);
+
+ nwa1121_get_env("eth0mac=", eth0mac);
+ ath79_init_mac(ath79_eth0_data.mac_addr, eth0mac, 0);
+
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_eth0_pll_data.pll_1000 = 0x0e000000;
+ ath79_eth0_data.speed = SPEED_1000;
+ ath79_register_eth(0);
+}
+
+MIPS_MACHINE(ATH79_MACH_NWA1121, "NWA1121",
+ "ZYXEL NWA1121", nwa1121_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 857d0eee89..528e4e5c95 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -294,6 +294,7 @@ enum ath79_mach_type {
ATH79_MACH_ZBT_WE1526, /* Zbtlink ZBT-WE1526 */
ATH79_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */
ATH79_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */
+ ATH79_MACH_NWA1121, /* Zyxel NWA1121-NI */
};
#endif /* _ATH79_MACHTYPE_H */
diff --git a/target/linux/ar71xx/image/generic.mk
b/target/linux/ar71xx/image/generic.mk
index ab64e76d7c..febc4a98e0 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -766,3 +766,15 @@ define Device/bhr-4grv2
IMAGE/factory.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) |
append-rootfs | mkbuffaloimg
endef
TARGET_DEVICES += bhr-4grv2
+
+define Device/nwa1121
+ DEVICE_TITLE := Zyxel NWA1121
+ BOARDNAME := NWA1121
+ ROOTFS_SIZE := 8192k
+ KERNEL_SIZE := 7488k
+ IMAGE_SIZE := 15680k
+ MTDPARTS :=
spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,8192k(rootfs),2m(kernel),5440k(reserve),256k(config),64k(mib0),64k(art)ro
+ IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image
+endef
+TARGET_DEVICES += nwa1121
+
--
2.11.0
More information about the Lede-dev
mailing list