BigW Consortium Gitlab

Commit 3bd9e3db by Andrzej Surowiec

Add support for ZSUN WiFi SD Card Reader

parent 483dac82
......@@ -345,6 +345,9 @@ get_status_led() {
wlr8100)
status_led="sitecom:amber:status"
;;
zsun-sdreader)
status_led="zsunsdreader:green:system"
;;
esac
}
......
......@@ -361,6 +361,7 @@ tl-wr703n |\
tube2h |\
wndap360 |\
mynet-rext |\
zsun-sdreader |\
wp543)
ucidef_set_interface_lan "eth0"
;;
......
#!/bin/sh
uci set wireless.@wifi-device[0].disabled=0
uci commit wireless
wifi
exit 0
\ No newline at end of file
......@@ -925,6 +925,9 @@ ar71xx_board_detect() {
*"HiWiFi HC6361")
name="hiwifi-hc6361"
;;
*"ZSUN WiFi SD Card Reader")
name="zsun-sdreader"
;;
esac
[ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
......
#!/bin/sh
failsafe_wipe() {
echo "Doing a factory reset."
mount_root
firstboot -y
sleep 10
reboot -f
}
boot_hook_add failsafe failsafe_wipe
\ No newline at end of file
......@@ -188,7 +188,8 @@ platform_check_image() {
mr16 | \
wpj558 | \
zcn-1523h-2 | \
zcn-1523h-5)
zcn-1523h-5 | \
zsun-sdreader)
[ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
echo "Invalid image type."
return 1
......
......@@ -156,6 +156,7 @@ CONFIG_ATH79_MACH_WZR_HP_G300NH=y
CONFIG_ATH79_MACH_WZR_HP_G300NH2=y
CONFIG_ATH79_MACH_WZR_HP_G450H=y
CONFIG_ATH79_MACH_ZCN_1523H=y
CONFIG_ATH79_MACH_ZSUN_SDREADER=y
CONFIG_ATH79_NVRAM=y
CONFIG_ATH79_PCI_ATH9K_FIXUP=y
# CONFIG_ATH79_ROUTERBOOT is not set
......
/*
* ZSUN WiFi SD Card Reader support
*
* Copyright (C) 2015 by Andrzej Surowiec <emeryth@hackerspace.pl>
* Based on mach-carambola2.c copyright (C) 2013 Darius Augulis <darius@8devices.com>
*
* 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 <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.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-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"
#define ZSUN_SDREADER_GPIO_LED_SYSTEM 0
#define ZSUN_SDREADER_GPIO_SW_SD 22
#define ZSUN_SDREADER_MAC0_OFFSET 0x0000
#define ZSUN_SDREADER_MAC1_OFFSET 0x0006
#define ZSUN_SDREADER_CALDATA_OFFSET 0x1000
#define ZSUN_SDREADER_WMAC_MAC_OFFSET 0x1002
#define ZSUN_SDREADER_KEYS_POLL_INTERVAL 20 /* msecs */
#define ZSUN_SDREADER_KEYS_DEBOUNCE_INTERVAL (3 * ZSUN_SDREADER_KEYS_POLL_INTERVAL)
static struct gpio_led zsun_sdreader_leds_gpio[] __initdata = {
{
.name = "zsunsdreader:green:system",
.gpio = ZSUN_SDREADER_GPIO_LED_SYSTEM,
.active_low = 0,
}
};
static struct gpio_keys_button zsun_sdreader_gpio_keys[] __initdata = {
{
.desc = "SD Card insert switch",
.type = EV_KEY,
.code = BTN_1,
.debounce_interval = ZSUN_SDREADER_KEYS_DEBOUNCE_INTERVAL,
.gpio = ZSUN_SDREADER_GPIO_SW_SD,
.active_low = 1,
}
};
static void __init zsun_sdreader_common_setup(void)
{
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
ath79_register_m25p80(NULL);
ath79_register_wmac(art + ZSUN_SDREADER_CALDATA_OFFSET,
art + ZSUN_SDREADER_WMAC_MAC_OFFSET);
ath79_setup_ar933x_phy4_switch(true, true);
//ath79_init_mac(ath79_eth0_data.mac_addr, art + ZSUN_SDREADER_MAC0_OFFSET, 0);
ath79_init_mac(ath79_eth1_data.mac_addr, art + ZSUN_SDREADER_MAC1_OFFSET, 0);
ath79_register_mdio(0, 0x0);
//ath79_register_eth(0);
ath79_register_eth(1);
}
static void __init zsun_sdreader_setup(void)
{
zsun_sdreader_common_setup();
ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
ath79_register_leds_gpio(-1, ARRAY_SIZE(zsun_sdreader_leds_gpio),
zsun_sdreader_leds_gpio);
ath79_register_gpio_keys_polled(-1, ZSUN_SDREADER_KEYS_POLL_INTERVAL,
ARRAY_SIZE(zsun_sdreader_gpio_keys),
zsun_sdreader_gpio_keys);
ath79_register_usb();
}
MIPS_MACHINE(ATH79_MACH_ZSUN_SDREADER, "ZSUN-SDREADER", "ZSUN WiFi SD Card Reader",
zsun_sdreader_setup);
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Profile/ZSUNSDREADER
NAME:=ZSUN WiFi SD Card reader
PACKAGES:=kmod-usb-core kmod-usb2 kmod-usb-storage
endef
define Profile/ZSUNSDREADER/Description
Package set optimized for the ZSUN WiFi SD Card Reader.
endef
$(eval $(call Profile,ZSUNSDREADER))
\ No newline at end of file
......@@ -661,6 +661,12 @@ define Device/oolite
endef
TARGET_DEVICES += oolite
define Device/zsun-sdreader
BOARDNAME := ZSUN-SDREADER
CONSOLE = ttyATH0,115200
endef
TARGET_DEVICES += zsun-sdreader
rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
# $(1): rootfs type.
......@@ -988,7 +994,7 @@ mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdat
mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
zsun_sdreader_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(u-boot-env)ro,14912k(rootfs),1216k(kernel),64k(nvram),64k(art),16128k@0x20000(firmware)
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
......@@ -1866,6 +1872,8 @@ $(eval $(call SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(
$(eval $(call SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
$(eval $(call SingleProfile,AthLzma,64k,WPJ531_16M,wpj531-16M,WPJ531,ttyS0,115200,$$(wpj531_mtdlayout_16M),KRuImage,65536))
$(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
$(eval $(call SingleProfile,AthLzma,64k,ZSUNSDREADER,zsun-sdreader,ZSUN-SDREADER,ttyATH0,115200,$$(zsun_sdreader_mtdlayout),RKuImage))
$(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
......
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -312,7 +312,7 @@ static const struct spi_device_id m25p_i
{"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"},
{"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"},
{"w25x64"}, {"w25q64"}, {"w25q80"}, {"w25q80bl"},
- {"w25q128"}, {"w25q256"}, {"cat25c11"},
+ {"w25q128"}, {"w25q128fw"}, {"w25q256"}, {"cat25c11"},
{"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"},
{ },
};
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -634,6 +634,7 @@ static const struct spi_device_id spi_no
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
+ { "w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256, SECT_4K) },
{ "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K) },
/* Catalyst / On Semiconductor -- non-JEDEC */
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
@@ -16,22 +16,195 @@
@@ -16,22 +16,196 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
......@@ -193,6 +193,7 @@
+ ATH79_MACH_WZR_450HP2, /* Buffalo WZR-450HP2 */
+ ATH79_MACH_ZCN_1523H_2, /* Zcomax ZCN-1523H-2-xx */
+ ATH79_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */
+ ATH79_MACH_ZSUN_SDREADER, /* Zsun WiFi SD Card Reader */
};
#endif /* _ATH79_MACHTYPE_H */
......@@ -1328,7 +1329,7 @@
config ATH79_MACH_UBNT_XM
bool "Ubiquiti Networks XM/UniFi boards"
@@ -83,6 +1115,97 @@ config ATH79_MACH_UBNT_XM
@@ -83,6 +1115,107 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.
......@@ -1423,10 +1424,20 @@
+ select ATH79_DEV_USB
+ select ATH79_NVRAM
+
+config ATH79_MACH_ZSUN_SDREADER
+ bool "ZSUN WiFi SD Card Reader"
+ select SOC_AR933X
+ 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
+
endmenu
config SOC_AR71XX
@@ -124,7 +1247,10 @@ config ATH79_DEV_DSA
@@ -124,7 +1257,10 @@ config ATH79_DEV_DSA
config ATH79_DEV_ETH
def_bool n
......@@ -1438,7 +1449,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
@@ -154,6 +1280,11 @@ config ATH79_PCI_ATH9K_FIXUP
@@ -154,6 +1290,11 @@ config ATH79_PCI_ATH9K_FIXUP
def_bool n
config ATH79_ROUTERBOOT
......@@ -1452,7 +1463,7 @@
endif
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
@@ -38,9 +38,124 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
@@ -38,9 +38,126 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
#
# Machines
#
......@@ -1577,6 +1588,8 @@
+obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o
+obj-$(CONFIG_ATH79_MACH_CARAMBOLA2) += mach-carambola2.o
+obj-$(CONFIG_ATH79_MACH_NBG6716) += mach-nbg6716.o
+obj-$(CONFIG_ATH79_MACH_ZSUN_SDREADER) += mach-zsun-sdreader.o
+
--- a/arch/mips/ath79/prom.c
+++ b/arch/mips/ath79/prom.c
@@ -180,6 +180,12 @@ void __init prom_init(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment