From 8b4909d9d11e4aab3e25fd3f9cae73266817fe72 Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 18 Jun 2015 18:21:15 +0000 Subject: [PATCH] ar71xx: add support for compex wpj531 tftpboot 0x80500000 openwrt-ar71xx-generic-wpj531-16M-squashfs-sysupgrade.bin erase 0x9f030000 +$filesize erase 0x9f680000 +1 cp.b $fileaddr 0x9f030000 $filesize Signed-off-by: Christian Mehlis git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46045 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../ar71xx/base-files/etc/uci-defaults/02_network | 4 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-3.18 | 1 + .../ar71xx/files/arch/mips/ath79/mach-wpj531.c | 136 +++++++++++++++++++++ target/linux/ar71xx/generic/profiles/compex.mk | 10 ++ target/linux/ar71xx/image/Makefile | 3 + .../610-MIPS-ath79-openwrt-machines.patch | 24 +++- 9 files changed, 179 insertions(+), 6 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index f6e4a875fc..4bdb53db93 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -311,6 +311,9 @@ get_status_led() { wpj344) status_led="wpj344:green:status" ;; + wpj531) + status_led="wpj531:green:sig3" + ;; wpj558) status_led="wpj558:green:sig3" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index 9fdaca0721..4fe951e3ca 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -369,6 +369,10 @@ wpj344) ucidef_add_switch_vlan "switch0" "2" "0t 2" ;; +wpj531) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; + wpj558) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_add_switch "switch0" "1" "1" diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 4a4101de33..85258d2fef 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -820,6 +820,9 @@ ar71xx_board_detect() { *WPJ344) name="wpj344" ;; + *WPJ531) + name="wpj531" + ;; *WPJ558) name="wpj558" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 3dbd91cfc7..ade47fb852 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -229,6 +229,7 @@ platform_check_image() { rocket-m-xw | \ nanostation-m-xw | \ rw2458n | \ + wpj531 | \ wndap360 | \ wpj344 | \ wzr-hp-g300nh2 | \ diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 index 196006016f..05c98ebf69 100644 --- a/target/linux/ar71xx/config-3.18 +++ b/target/linux/ar71xx/config-3.18 @@ -140,6 +140,7 @@ CONFIG_ATH79_MACH_WNR2200=y CONFIG_ATH79_MACH_WP543=y CONFIG_ATH79_MACH_WPE72=y CONFIG_ATH79_MACH_WPJ344=y +CONFIG_ATH79_MACH_WPJ531=y CONFIG_ATH79_MACH_WPJ558=y CONFIG_ATH79_MACH_WRT160NL=y CONFIG_ATH79_MACH_WRT400N=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c new file mode 100644 index 0000000000..bc13d7019f --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c @@ -0,0 +1,136 @@ +/* + * Compex WPJ531 board support + * + * Copyright (c) 2012 Qualcomm Atheros + * Copyright (c) 2012 Gabor Juhos + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include +#include +#include + +#include + +#include "pci.h" +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-gpio-buttons.h" +#include "dev-eth.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define WPJ531_GPIO_LED_SIG1 14 +#define WPJ531_GPIO_LED_SIG2 15 +#define WPJ531_GPIO_LED_SIG3 22 +#define WPJ531_GPIO_LED_SIG4 23 +#define WPJ531_GPIO_BUZZER 4 + +#define WPJ531_GPIO_BTN_RESET 17 + +#define WPJ531_KEYS_POLL_INTERVAL 20 /* msecs */ +#define WPJ531_KEYS_DEBOUNCE_INTERVAL (3 * WPJ531_KEYS_POLL_INTERVAL) + +#define WPJ531_MAC0_OFFSET 0x10 +#define WPJ531_MAC1_OFFSET 0x18 +#define WPJ531_WMAC_CALDATA_OFFSET 0x1000 +#define WPJ531_PCIE_CALDATA_OFFSET 0x5000 + +#define WPJ531_ART_SIZE 0x8000 + +static struct gpio_led wpj531_leds_gpio[] __initdata = { + { + .name = "wpj531:red:sig1", + .gpio = WPJ531_GPIO_LED_SIG1, + .active_low = 1, + }, + { + .name = "wpj531:yellow:sig2", + .gpio = WPJ531_GPIO_LED_SIG2, + .active_low = 1, + }, + { + .name = "wpj531:green:sig3", + .gpio = WPJ531_GPIO_LED_SIG3, + .active_low = 1, + }, + { + .name = "wpj531:green:sig4", + .gpio = WPJ531_GPIO_LED_SIG4, + .active_low = 1, + }, + { + .name = "wpj531:buzzer", + .gpio = WPJ531_GPIO_BUZZER, + .active_low = 0, + } +}; + +static struct gpio_keys_button wpj531_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WPJ531_KEYS_DEBOUNCE_INTERVAL, + .gpio = WPJ531_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static void __init common_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + u8 tmpmac[ETH_ALEN]; + + ath79_register_m25p80(NULL); + + ath79_setup_ar933x_phy4_switch(false, false); + + ath79_register_mdio(0, 0x0); + + /* LAN */ + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_register_eth(0); + + /* WAN */ + ath79_switch_data.phy4_mii_en = 1; + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); + ath79_register_eth(1); + + ath79_register_wmac(ee, tmpmac); + + ath79_register_pci(); +} + +static void __init wpj531_setup(void) +{ + common_setup(); + + ath79_register_leds_gpio(-1, + ARRAY_SIZE(wpj531_leds_gpio), + wpj531_leds_gpio); + + ath79_register_gpio_keys_polled(-1, + WPJ531_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wpj531_gpio_keys), + wpj531_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_WPJ531, "WPJ531", "Compex WPJ531", wpj531_setup); diff --git a/target/linux/ar71xx/generic/profiles/compex.mk b/target/linux/ar71xx/generic/profiles/compex.mk index 6528d4a197..2f6e0b2211 100644 --- a/target/linux/ar71xx/generic/profiles/compex.mk +++ b/target/linux/ar71xx/generic/profiles/compex.mk @@ -37,6 +37,16 @@ endef $(eval $(call Profile,WPJ344)) +define Profile/WPJ531 + NAME:=Compex WPJ531 +endef + +define Profile/WPJ531/Description + Package set optimized for the Compex WPJ531 board. +endef + +$(eval $(call Profile,WPJ531)) + define Profile/WPJ558 NAME:=Compex WPJ558 endef diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 5a82b7caf0..57c58ace79 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -1164,6 +1164,7 @@ ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware) whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k@0x40000(firmware) wpj344_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro +wpj531_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro wpj558_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware) wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro @@ -1970,6 +1971,7 @@ $(eval $(call SingleProfile,AthLzma,64k,PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdl $(eval $(call SingleProfile,AthLzma,64k,TUBE2H16M,tube2h-16M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536)) $(eval $(call SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(wlr8100_mtdlayout),KRuImage)) $(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,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC)) @@ -2126,6 +2128,7 @@ $(eval $(call MultiProfile,WNR1000V2,REALWNR1000V2 WNR1000V2_VC)) $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M)) $(eval $(call MultiProfile,WPE72,WPE72_4M WPE72_8M WPE72_16M)) $(eval $(call MultiProfile,WPJ344,WPJ344_16M)) +$(eval $(call MultiProfile,WPJ531,WPJ531_16M)) $(eval $(call MultiProfile,WPJ558,WPJ558_16M)) $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES))) diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch index f8a561c0b0..d3749666e3 100644 --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,22 +16,191 @@ +@@ -16,22 +16,192 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -179,6 +179,7 @@ + ATH79_MACH_WP543, /* Compex WP543 */ + ATH79_MACH_WPE72, /* Compex WPE72 */ + ATH79_MACH_WPJ344, /* Compex WPJ344 */ ++ ATH79_MACH_WPJ531, /* Compex WPJ531 */ + ATH79_MACH_WPJ558, /* Compex WPJ558 */ + ATH79_MACH_WRT160NL, /* Linksys WRT160NL */ + ATH79_MACH_WRT400N, /* Linksys WRT400N */ @@ -265,7 +266,7 @@ config ATH79_MACH_AP121 bool "Atheros AP121 reference board" select SOC_AR933X -@@ -11,62 +75,986 @@ config ATH79_MACH_AP121 +@@ -11,62 +75,996 @@ config ATH79_MACH_AP121 select ATH79_DEV_M25P80 select ATH79_DEV_USB select ATH79_DEV_WMAC @@ -510,6 +511,16 @@ + select ATH79_DEV_USB + select ATH79_DEV_WMAC + ++config ATH79_MACH_WPJ531 ++ bool "Compex WPJ531 board support" ++ select SOC_QCA953X ++ 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 ++ +config ATH79_MACH_WPJ558 + bool "Compex WPJ558 board support" + select SOC_QCA955X @@ -1280,7 +1291,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM/UniFi boards" -@@ -83,6 +1071,97 @@ config ATH79_MACH_UBNT_XM +@@ -83,6 +1081,97 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -1378,7 +1389,7 @@ endmenu config SOC_AR71XX -@@ -124,7 +1203,10 @@ config ATH79_DEV_DSA +@@ -124,7 +1213,10 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -1390,7 +1401,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -154,6 +1236,11 @@ config ATH79_PCI_ATH9K_FIXUP +@@ -154,6 +1246,11 @@ config ATH79_PCI_ATH9K_FIXUP def_bool n config ATH79_ROUTERBOOT @@ -1404,7 +1415,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -38,9 +38,120 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route +@@ -38,9 +48,121 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route # # Machines # @@ -1514,6 +1525,7 @@ +obj-$(CONFIG_ATH79_MACH_WP543) += mach-wp543.o +obj-$(CONFIG_ATH79_MACH_WPE72) += mach-wpe72.o +obj-$(CONFIG_ATH79_MACH_WPJ344) += mach-wpj344.o ++obj-$(CONFIG_ATH79_MACH_WPJ531) += mach-wpj531.o +obj-$(CONFIG_ATH79_MACH_WPJ558) += mach-wpj558.o +obj-$(CONFIG_ATH79_MACH_WRT160NL) += mach-wrt160nl.o +obj-$(CONFIG_ATH79_MACH_WRT400N) += mach-wrt400n.o -- 2.11.0