summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Blake <chrisrblake93@gmail.com>2016-09-20 07:14:29 -0500
committerJohn Crispin <john@phrozen.org>2016-09-27 17:50:22 +0200
commit68d649f5cd9ee2f6fda00df7bde4b9074474becf (patch)
tree8e5364f7fd24c938ca6046ea2d85aa1e24a52826
parentb1f39d3d7ee7ba0714e45af64a935b01877a5175 (diff)
downloadmaster-31e0f0ae-68d649f5cd9ee2f6fda00df7bde4b9074474becf.tar.gz
master-31e0f0ae-68d649f5cd9ee2f6fda00df7bde4b9074474becf.tar.bz2
master-31e0f0ae-68d649f5cd9ee2f6fda00df7bde4b9074474becf.zip
ar71xx: add support for Cisco Meraki Z1 Cloud Managed Teleworker Gateway
This patch adds support for Cisco's Z1. Detailed instructions for the flashing the device can be found in the OpenWrt wiki: <https://wiki.openwrt.org/toh/meraki/z1> Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/board.d/01_leds4
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/board.d/02_network6
-rw-r--r--target/linux/ar71xx/base-files/etc/diag.sh3
-rw-r--r--target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom20
-rw-r--r--target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration1
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh3
-rw-r--r--target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx4
-rw-r--r--target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh61
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh6
-rw-r--r--target/linux/ar71xx/config-4.41
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt12
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-z1.c164
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/machtypes.h1
-rw-r--r--target/linux/ar71xx/image/nand.mk23
-rw-r--r--target/linux/ar71xx/patches-4.4/818-MIPS-ath79-add-nu801-led-driver.patch2
16 files changed, 293 insertions, 19 deletions
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index cf05859813..7551455a8a 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -813,6 +813,10 @@ wzr-hp-g300nh)
ucidef_set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1"
;;
+z1)
+ ucidef_set_led_netdev "wlan1" "WLAN1" "z1:blue:tricolor0" "wlan1"
+ ;;
+
zbt-we1526)
ucidef_set_led_netdev "wan" "WAN" "zbt-we1526:green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "zbt-we1526:green:lan1" "switch0" "0x10"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index b637113eff..2a50c9dca5 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -538,6 +538,12 @@ wndr3700)
ucidef_add_switch_port_attr "switch0" 5 led 2
;;
+z1)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" \
+ "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
+ ;;
+
*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 69ef609332..6ce49b0e9b 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -426,6 +426,9 @@ get_status_led() {
wrt160nl)
status_led="wrt160nl:blue:wps"
;;
+ z1)
+ status_led="z1:green:tricolor0"
+ ;;
zbt-we1526)
status_led="zbt-we1526:green:status"
;;
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 3b0229d3d5..3141625307 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -73,6 +73,16 @@ case "$FIRMWARE" in
ath9k_eeprom_extract "caldata" 4096 2048
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0)
;;
+ z1)
+ . /lib/upgrade/nand.sh
+
+ if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
+ ath9k_ubi_eeprom_extract "caldata" 4096 2048
+ else
+ ath9k_eeprom_extract "origcaldata" 4096 2048
+ fi
+ ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +2)
+ ;;
*)
ath9k_eeprom_die "board $board is not supported yet"
;;
@@ -100,6 +110,16 @@ case "$FIRMWARE" in
ath9k_eeprom_extract "caldata" 20480 2048
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 12)
;;
+ z1)
+ . /lib/upgrade/nand.sh
+
+ if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
+ ath9k_ubi_eeprom_extract "caldata" 86016 4096
+ else
+ ath9k_eeprom_extract "origcaldata" 86016 4096
+ fi
+ ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +3)
+ ;;
*)
ath9k_eeprom_die "board $board is not supported yet"
;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
index aa0e1b4e2f..ee8f63b5d5 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
@@ -78,6 +78,7 @@ whr-hp-g300n|\
whr-hp-gn|\
wzr-hp-ag300h|\
wzr-hp-g450h|\
+z1|\
ew-dorin|\
ew-dorin-router)
migrate_switch_name "eth0" "switch0"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 7a3759e7d5..dae6fb2a2d 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1134,6 +1134,9 @@ ar71xx_board_detect() {
*WHR-HP-G300N)
name="whr-hp-g300n"
;;
+ *Z1)
+ name="z1"
+ ;;
*ZBT-WE1526)
name="zbt-we1526"
;;
diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
index 39da3090f8..60e278782f 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
+++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
@@ -49,6 +49,10 @@ preinit_set_mac_address() {
wrt160nl)
fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
;;
+ z1)
+ mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
+ [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
+ ;;
esac
}
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh b/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
index cc7a86c93d..78cde20a13 100644
--- a/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2015 Chris Blake <chrisrblake93@gmail.com>
+# Copyright (C) 2015-2016 Chris Blake <chrisrblake93@gmail.com>
#
# Custom upgrade script for Meraki NAND devices (ex. MR18)
# Based on dir825.sh and stock nand functions
@@ -14,34 +14,52 @@ get_magic_at() {
dd bs=1 count=2 skip=$pos if=$mtddev 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
-mr18_is_caldata_valid() {
- local mtddev=$1
+meraki_is_caldata_valid() {
+ local board=$1
+ local mtddev=$2
local magic
- magic=$(get_magic_at $mtddev 4096)
- [ "$magic" != "0202" ] && return 0
+ case "$board" in
+ "mr18")
+ magic=$(get_magic_at $mtddev 4096)
+ [ "$magic" != "0202" ] && return 0
+
+ magic=$(get_magic_at $mtddev 20480)
+ [ "$magic" != "0202" ] && return 0
- magic=$(get_magic_at $mtddev 20480)
- [ "$magic" != "0202" ] && return 0
+ magic=$(get_magic_at $mtddev 36864)
+ [ "$magic" != "0202" ] && return 0
+
+ return 1
+ ;;
+ "z1")
+ magic=$(get_magic_at $mtddev 4096)
+ [ "$magic" != "0202" ] && return 0
- magic=$(get_magic_at $mtddev 36864)
- [ "$magic" != "0202" ] && return 0
+ magic=$(get_magic_at $mtddev 86016)
+ [ "$magic" != "a55a" ] && return 0
- return 1
+ return 1
+ ;;
+ *)
+ return 1
+ ;;
+ esac
}
merakinand_copy_caldata() {
local cal_src=$1
local cal_dst=$2
- local ubidev=$( nand_find_ubi $CI_UBIPART )
+ local ubidev="$(nand_find_ubi $CI_UBIPART)"
local board_name="$(cat /tmp/sysinfo/board_name)"
local rootfs_size="$(ubinfo /dev/ubi0 -N rootfs_data | grep "Size" | awk '{ print $6 }')"
# Setup partitions using board name, in case of future platforms
case "$board_name" in
- "mr18")
+ "mr18"|\
+ "z1")
# Src is MTD
- mtd_src=$(find_mtd_chardev $cal_src)
+ mtd_src="$(find_mtd_chardev $cal_src)"
[ -n "$mtd_src" ] || {
echo "no mtd device found for partition $cal_src"
exit 1
@@ -56,12 +74,12 @@ merakinand_copy_caldata() {
exit 1
}
- mr18_is_caldata_valid "$mtd_src" && {
+ meraki_is_caldata_valid "$board_name" "$mtd_src" && {
echo "no valid calibration data found in $cal_src"
exit 1
}
- mr18_is_caldata_valid "/dev/$mtd_dst" && {
+ meraki_is_caldata_valid "$board_name" "/dev/$mtd_dst" && {
echo "Copying calibration data from $cal_src to $cal_dst..."
dd if="$mtd_src" of=/tmp/caldata.tmp 2>/dev/null
ubiupdatevol "/dev/$mtd_dst" /tmp/caldata.tmp
@@ -89,6 +107,11 @@ merakinand_do_kernel_check() {
echo "pass" && return 0
}
;;
+ "z1")
+ [ "$image_magic_word" == "4d495053" ] && {
+ echo "pass" && return 0
+ }
+ ;;
esac
exit 1
@@ -102,7 +125,8 @@ merakinand_do_platform_check() {
local kernel_magic="$(merakinand_do_kernel_check $1 $2)"
case "$board_name" in
- "mr18")
+ "mr18"|\
+ "z1")
[ "$control_length" = 0 -o "$file_type" != "squashfs" -o "$kernel_magic" != "pass" ] && {
echo "Invalid sysupgrade file for $board_name"
return 1
@@ -128,6 +152,11 @@ merakinand_do_upgrade() {
merakinand_copy_caldata "odm-caldata" "caldata"
nand_do_upgrade $1
;;
+ "z1")
+ # Check and create UBI caldata if it's invalid
+ merakinand_copy_caldata "origcaldata" "caldata"
+ nand_do_upgrade $1
+ ;;
*)
echo "Unsupported device $board_name";
exit 1
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 716fa525a9..c78d1fb34f 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -472,7 +472,8 @@ platform_check_image() {
}
return 0
;;
- mr18)
+ mr18 | \
+ z1 )
merakinand_do_platform_check $board $1
return $?;
;;
@@ -543,7 +544,8 @@ platform_pre_upgrade() {
wndr4300 )
nand_do_upgrade "$1"
;;
- mr18)
+ mr18 | \
+ z1 )
merakinand_do_upgrade "$1"
;;
esac
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 0b5e3942f0..f81a74c0c4 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -201,6 +201,7 @@ CONFIG_ATH79_MACH_WZR_HP_AG300H=y
CONFIG_ATH79_MACH_WZR_HP_G300NH=y
CONFIG_ATH79_MACH_WZR_HP_G300NH2=y
CONFIG_ATH79_MACH_WZR_HP_G450H=y
+CONFIG_ATH79_MACH_Z1=y
CONFIG_ATH79_MACH_ZBT_WE1526=y
CONFIG_ATH79_MACH_ZCN_1523H=y
CONFIG_ATH79_NVRAM=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index a6f19daa0d..4cefde1ac2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1552,6 +1552,18 @@ config ATH79_MACH_MYNET_REXT
select ATH79_DEV_WMAC
select ATH79_NVRAM
+config ATH79_MACH_Z1
+ bool "Meraki Z1 board 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_NFC
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+ select LEDS_NU801
+
config ATH79_MACH_ZBT_WE1526
bool "Zbtlink ZBT-WE1526 board support"
select SOC_QCA953X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 3222a76660..a0f8d998e2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -205,6 +205,7 @@ obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH2) += mach-wzr-hp-g300nh2.o
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_WZR_450HP2) += mach-wzr-450hp2.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_CARAMBOLA2) += mach-carambola2.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-z1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-z1.c
new file mode 100644
index 0000000000..552d646370
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-z1.c
@@ -0,0 +1,164 @@
+/*
+ * Cisco Meraki Z1 board support
+ *
+ * Copyright (C) 2016 Chris Blake <chrisrblake93@gmail.com>
+ * Copyright (C) 2016 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * Based on Cisco Meraki GPL Release r23-20150601 Z1 Device Config
+ *
+ * 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/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <linux/platform/ar934x_nfc.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include <linux/leds-nu801.h>
+#include <linux/firmware.h>
+#include <linux/pci.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-nfc.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "dev-ap9x-pci.h"
+#include "machtypes.h"
+
+#define Z1_GPIO_LED_POWER_ORANGE 17
+
+#define Z1_GPIO_NU801_CKI 14
+#define Z1_GPIO_NU801_SDI 15
+
+#define Z1_GPIO_XLNA0 18
+#define Z1_GPIO_XLNA1 19
+
+#define Z1_GPIO_BTN_RESET 12
+#define Z1_KEYS_POLL_INTERVAL 20 /* msecs */
+#define Z1_KEYS_DEBOUNCE_INTERVAL (3 * Z1_KEYS_POLL_INTERVAL)
+
+#define Z1_ETH_SWITCH_PHY 0
+
+static struct gpio_led Z1_leds_gpio[] __initdata = {
+ {
+ .name = "z1:orange:power",
+ .gpio = Z1_GPIO_LED_POWER_ORANGE,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button Z1_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = Z1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = Z1_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+};
+
+static struct led_nu801_template tricolor_led_template = {
+ .device_name = "z1",
+ .name = "tricolor",
+ .num_leds = 1,
+ .cki = Z1_GPIO_NU801_CKI,
+ .sdi = Z1_GPIO_NU801_SDI,
+ .lei = -1,
+ .ndelay = 500,
+ .init_brightness = {
+ LED_OFF,
+ LED_OFF,
+ LED_OFF,
+ },
+ .default_trigger = "none",
+};
+
+static struct led_nu801_platform_data tricolor_led_data = {
+ .num_controllers = 1,
+ .template = &tricolor_led_template,
+};
+
+static struct platform_device tricolor_leds = {
+ .name = "leds-nu801",
+ .id = -1,
+ .dev.platform_data = &tricolor_led_data,
+};
+
+static struct ar8327_pad_cfg z1_ar8327_pad0_cfg = {
+ .mode = AR8327_PAD_MAC_RGMII,
+ .txclk_delay_en = true,
+ .rxclk_delay_en = true,
+ .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
+ .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
+};
+
+static struct ar8327_platform_data z1_ar8327_data = {
+ .pad0_cfg = &z1_ar8327_pad0_cfg,
+ .port0_cfg = {
+ .force_link = 1,
+ .speed = AR8327_PORT_SPEED_1000,
+ .duplex = 1,
+ .txpause = 1,
+ .rxpause = 1,
+ },
+};
+
+static struct mdio_board_info z1_mdio0_info[] = {
+ {
+ .bus_id = "ag71xx-mdio.0",
+ .phy_addr = Z1_ETH_SWITCH_PHY,
+ .platform_data = &z1_ar8327_data,
+ },
+};
+
+static void __init z1_setup(void)
+{
+ /* NAND */
+ ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_SOFT_BCH);
+ ath79_register_nfc();
+
+ /* Eth Config */
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
+ AR934X_ETH_CFG_SW_ONLY_MODE);
+
+ /* MDIO Interface */
+ ath79_register_mdio(1, 0x0);
+ ath79_register_mdio(0, 0x0);
+ mdiobus_register_board_info(z1_mdio0_info,
+ ARRAY_SIZE(z1_mdio0_info));
+
+ /* GMAC0 is connected to an AR8327 switch */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ath79_eth0_data.phy_mask = BIT(Z1_ETH_SWITCH_PHY);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_eth0_pll_data.pll_1000 = 0x06000000;
+ ath79_register_eth(0);
+
+ /* XLNA */
+ ath79_wmac_set_ext_lna_gpio(0, Z1_GPIO_XLNA0);
+ ath79_wmac_set_ext_lna_gpio(1, Z1_GPIO_XLNA1);
+
+ /* LEDs and Buttons */
+ platform_device_register(&tricolor_leds);
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(Z1_leds_gpio),
+ Z1_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, Z1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(Z1_gpio_keys),
+ Z1_gpio_keys);
+
+ /* USB */
+ ath79_register_usb();
+
+ /* Wireless */
+ ath79_register_wmac_simple();
+ ap91_pci_init_simple();
+}
+MIPS_MACHINE(ATH79_MACH_Z1, "Z1", "Meraki Z1", z1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index a3b8c8749d..87acc4a982 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -266,6 +266,7 @@ enum ath79_mach_type {
ATH79_MACH_WZR_HP_G300NH2, /* Buffalo WZR-HP-G300NH2 */
ATH79_MACH_WZR_HP_G450H, /* Buffalo WZR-HP-G450H */
ATH79_MACH_WZR_450HP2, /* Buffalo WZR-450HP2 */
+ ATH79_MACH_Z1, /* Cisco Meraki Z1 */
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 */
diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk
index c6a8d7e410..aa431ac18c 100644
--- a/target/linux/ar71xx/image/nand.mk
+++ b/target/linux/ar71xx/image/nand.mk
@@ -20,6 +20,29 @@ define Device/mr18
endef
TARGET_DEVICES += mr18
+define Build/MerakiNAND-old
+ -$(STAGING_DIR_HOST)/bin/mkmerakifw-old \
+ -B $(BOARDNAME) -s \
+ -i $@ \
+ -o $@.new
+ @mv $@.new $@
+endef
+
+define Device/z1
+ DEVICE_TITLE := Meraki Z1
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev kmod-spi-gpio kmod-ath9k kmod-owl-loader
+ BOARDNAME = Z1
+ BLOCKSIZE := 64k
+ CONSOLE = ttyS0,115200
+ MTDPARTS = ar934x-nfc:128K(loader1)ro,8064K(kernel),128K(loader2)ro,8064K(recovery),114560K(ubi),128K(origcaldata)ro
+ IMAGES := sysupgrade.tar
+ KERNEL := kernel-bin | patch-cmdline | MerakiNAND-old
+ KERNEL_INITRAMFS := kernel-bin | patch-cmdline | MerakiNAND-old
+ IMAGE/sysupgrade.tar := sysupgrade-tar
+endef
+
+TARGET_DEVICES += z1
+
define LegacyDevice/R6100
DEVICE_TITLE := NETGEAR R6100
DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
diff --git a/target/linux/ar71xx/patches-4.4/818-MIPS-ath79-add-nu801-led-driver.patch b/target/linux/ar71xx/patches-4.4/818-MIPS-ath79-add-nu801-led-driver.patch
index ec9f59e3fe..420bbff185 100644
--- a/target/linux/ar71xx/patches-4.4/818-MIPS-ath79-add-nu801-led-driver.patch
+++ b/target/linux/ar71xx/patches-4.4/818-MIPS-ath79-add-nu801-led-driver.patch
@@ -6,7 +6,7 @@
+config LEDS_NU801
+ tristate "LED driver for NU801 RGB LED"
-+ depends on LEDS_CLASS && ATH79_MACH_MR18
++ depends on LEDS_CLASS && (ATH79_MACH_MR18 || ATH79_MACH_Z1)
+ help
+ This option enables support for NU801 RGB LED driver chips
+ accessed via GPIO.