Add support for Zyxel NWA1121-NI 802.11abgn access point.

From 159cda7e026f3042f950248b4e62490fd7a6bbc6 Mon Sep 17 00:00:00 2001
From: Alex Prokofiev <alex...@itp.ac.ru>
Date: Wed, 25 Jan 2017 21:42:38 +0300
Subject: [PATCH] Support for Zyxel NWA1121-NI

Signed-off-by: Alex Prokofiev <alex...@itp.ac.ru>
---
.../ar71xx/files/arch/mips/ath79/mach-nwa1121.c | 108 +++++++++++++++++++++
 1 file changed, 108 insertions(+)
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-nwa1121.c

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..783351b50f
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-nwa1121.c
@@ -0,0 +1,108 @@
+/*
+ * 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);
+        int err;
+
+       printk(KERN_INFO "get_env: %s\n", name);
+
+ err = ath79_nvram_parse_mac_addr(env, 0x10000 /*64k*/, name, mac);
+
+        return err;
+}
+
+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);
--
2.11.0



_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to