From: John Crispin Date: Mon, 2 Feb 2015 09:00:21 +0000 (+0000) Subject: added board support for compex wpj558 X-Git-Tag: reboot~4461 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bc906ca59e9f437f5cb9543714d1b979ea82838e;p=openwrt%2Fstaging%2Fxback.git added board support for compex wpj558 Signed-off-by: Christian Mehlis SVN-Revision: 44237 --- diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index af6107b489..af53afdf4e 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -288,6 +288,9 @@ get_status_led() { wp543) status_led="wp543:green:diag" ;; + wpj558) + status_led="wpj558:green:sig3" + ;; wrt400n) status_led="wrt400n:blue:wps" ;; 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 a223ae8fe5..1d186deffa 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -359,6 +359,13 @@ wpe72) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +wpj558) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "5 6t" + ucidef_add_switch_vlan "switch0" "2" "1 6t" + ;; + ap121 |\ ap121-mini |\ ap96 |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 02872de145..4c6594fdf8 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -747,6 +747,9 @@ ar71xx_board_detect() { *WP543) name="wp543" ;; + *WPJ558) + name="wpj558" + ;; *WPE72) name="wpe72" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index bc6866da19..0db1625231 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -408,6 +408,7 @@ platform_check_image() { ja76pf | \ ja76pf2 | \ jwap003 | \ + wpj558 | \ wp543 | \ wpe72) [ "$magic" != "4349" ] && { @@ -456,6 +457,7 @@ platform_do_upgrade() { jwap003) platform_do_upgrade_combined "$ARGV" ;; + wpj558|\ wp543|\ wpe72) platform_do_upgrade_compex "$ARGV" diff --git a/target/linux/ar71xx/config-3.14 b/target/linux/ar71xx/config-3.14 index 82b2d130d5..2d9873cbb8 100644 --- a/target/linux/ar71xx/config-3.14 +++ b/target/linux/ar71xx/config-3.14 @@ -130,6 +130,7 @@ CONFIG_ATH79_MACH_WNR2000_V4=y CONFIG_ATH79_MACH_WNR2200=y CONFIG_ATH79_MACH_WP543=y CONFIG_ATH79_MACH_WPE72=y +CONFIG_ATH79_MACH_WPJ558=y CONFIG_ATH79_MACH_WRT160NL=y CONFIG_ATH79_MACH_WRT400N=y CONFIG_ATH79_MACH_WZR_450HP2=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj558.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj558.c new file mode 100644 index 0000000000..a8310a7d51 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj558.c @@ -0,0 +1,187 @@ +/* + * Compex WPJ558 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 +#include + +#include + +#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-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" +#include "pci.h" + +#define WPJ558_GPIO_LED_SIG1 14 +#define WPJ558_GPIO_LED_SIG2 15 +#define WPJ558_GPIO_LED_SIG3 22 +#define WPJ558_GPIO_LED_SIG4 23 +#define WPJ558_GPIO_BUZZER 4 + +#define WPJ558_GPIO_BTN_RESET 17 + +#define WPJ558_KEYS_POLL_INTERVAL 20 /* msecs */ +#define WPJ558_KEYS_DEBOUNCE_INTERVAL (3 * WPJ558_KEYS_POLL_INTERVAL) + +#define WPJ558_MAC0_OFFSET 0x10 +#define WPJ558_MAC1_OFFSET 0x18 +#define WPJ558_WMAC_CALDATA_OFFSET 0x1000 +#define WPJ558_PCIE_CALDATA_OFFSET 0x5000 + +#define WPJ558_ART_SIZE 0x8000 +#if 0 +static char *art_buf; +#endif + +static struct gpio_led wpj558_leds_gpio[] __initdata = { + { + .name = "wpj558:red:sig1", + .gpio = WPJ558_GPIO_LED_SIG1, + .active_low = 1, + }, + { + .name = "wpj558:yellow:sig2", + .gpio = WPJ558_GPIO_LED_SIG2, + .active_low = 1, + }, + { + .name = "wpj558:green:sig3", + .gpio = WPJ558_GPIO_LED_SIG3, + .active_low = 1, + }, + { + .name = "wpj558:green:sig4", + .gpio = WPJ558_GPIO_LED_SIG4, + .active_low = 1, + }, + { + .name = "wpj558:buzzer", + .gpio = WPJ558_GPIO_BUZZER, + .active_low = 0, + } +}; + +static struct gpio_keys_button wpj558_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = WPJ558_KEYS_DEBOUNCE_INTERVAL, + .gpio = WPJ558_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg wpj558_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_SGMII, + .sgmii_delay_en = true, +}; + +static struct ar8327_pad_cfg wpj558_ar8327_pad6_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 wpj558_ar8327_data = { + .pad0_cfg = &wpj558_ar8327_pad0_cfg, + .pad6_cfg = &wpj558_ar8327_pad6_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .port6_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, +}; + +static struct mdio_board_info wpj558_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &wpj558_ar8327_data, + }, +}; + +static void __init wpj558_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + u8 tmpmac[ETH_ALEN]; + + ath79_register_m25p80(NULL); + ath79_register_leds_gpio(-1, ARRAY_SIZE(wpj558_leds_gpio), + wpj558_leds_gpio); + ath79_register_gpio_keys_polled(-1, WPJ558_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wpj558_gpio_keys), + wpj558_gpio_keys); + + ath79_init_mac(tmpmac, mac, -1); + ath79_register_wmac(art + WPJ558_WMAC_CALDATA_OFFSET, tmpmac); + + ath79_register_pci(); + + mdiobus_register_board_info(wpj558_mdio0_info, + ARRAY_SIZE(wpj558_mdio0_info)); + ath79_register_mdio(0, 0x0); + + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + + /* GMAC0 is connected to an AR8327 switch */ + 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 = 0x56000000; + + ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ558_MAC0_OFFSET, 0); + ath79_register_eth(0); + + /* GMAC1 is connected to the SGMII interface */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth1_data.speed = SPEED_1000; + ath79_eth1_data.duplex = DUPLEX_FULL; + ath79_eth1_pll_data.pll_1000 = 0x03000101; + + ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ558_MAC1_OFFSET, 0); + ath79_register_eth(1); + + ath79_register_usb(); +} + +MIPS_MACHINE(ATH79_MACH_WPJ558, "WPJ558", "Compex WPJ558", wpj558_setup); diff --git a/target/linux/ar71xx/generic/profiles/compex.mk b/target/linux/ar71xx/generic/profiles/compex.mk index 3491473810..a6f2239c94 100644 --- a/target/linux/ar71xx/generic/profiles/compex.mk +++ b/target/linux/ar71xx/generic/profiles/compex.mk @@ -26,3 +26,16 @@ define Profile/WPE72/Description endef $(eval $(call Profile,WPE72)) + + +define Profile/WPJ558 + NAME:=Compex WPJ558 + PACKAGES:=kmod-ath10k pciutils +endef + +define Profile/WPJ558/Description + Package set optimized for the Compex WPJ558 board. +endef + +$(eval $(call Profile,WPJ558)) + diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index f7b8381aa4..ecaa126ec5 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -687,10 +687,13 @@ Image/Build/MyLoader/initramfs=$(call PatchKernel/initramfs,$(2),$(3)) define Image/Build/MyLoader $(eval fwsize=$(shell echo $$(($(4)-0x30000-4*64*1024)))) $(eval fwimage=$(KDIR_TMP)/$(2)-$(5)-firmware.bin) - $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).bin.lzma,65536,$(KDIR)/root.$(1),$(fwsize),$(fwimage)) + $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,65536,$(KDIR)/root.$(1),$(fwsize),$(fwimage)) if [ -e "$(fwimage)" ]; then \ $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(4) -v \ - -p0x00030000:0:al:0x80060000:firmware:$(fwimage) \ + -p0x680000:0x160000:al:0x80060000:firmware:$(KDIR_TMP)/vmlinux-$(2).uImage \ + -p0x050000:0x630000:::rootfs:$(KDIR)/root.$(1) \ + -p0x7e0000:0x010000 \ + -p0x7f0000:0x010000 \ $(call imgname,$(1),$(2))-$(5)-factory.img; \ echo -n "" > $(KDIR_TMP)/empty.bin; \ sh $(TOPDIR)/scripts/combined-image.sh \ @@ -1318,6 +1321,9 @@ $(eval $(call SingleProfile,MyLoader,64k,WPE72_4M,wpe72,,ttyS0,115200,0x400000,4 $(eval $(call SingleProfile,MyLoader,64k,WPE72_8M,wpe72,,ttyS0,115200,0x800000,8M)) $(eval $(call SingleProfile,MyLoader,64k,WPE72_16M,wpe72,,ttyS0,115200,0x1000000,16M)) +$(eval $(call SingleProfile,MyLoader,64k,WPJ558_8M,wpj558,WPJ558,ttyS0,115200,0x800000,8M)) +$(eval $(call SingleProfile,MyLoader,64k,WPJ558_16M,wpj558,WPJ558,ttyS0,115200,0x1000000,16M)) + $(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,"" NA,)) $(eval $(call SingleProfile,NetgearLzma,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"" NA,)) $(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,WNR2200,"" NA,)) @@ -1499,6 +1505,7 @@ $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R)) $(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,WPJ558,WPJ558_8M WPJ558_16M)) $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES))) $(eval $(call MultiProfile,Madwifi,EAP7660D UBNTRS UBNTRSPRO UBNTLSSR71 WP543)) diff --git a/target/linux/ar71xx/patches-3.14/507-MIPS-ath79-prom-add-myloader-support.patch b/target/linux/ar71xx/patches-3.14/507-MIPS-ath79-prom-add-myloader-support.patch index 67c1faf9b0..407755e7d6 100644 --- a/target/linux/ar71xx/patches-3.14/507-MIPS-ath79-prom-add-myloader-support.patch +++ b/target/linux/ar71xx/patches-3.14/507-MIPS-ath79-prom-add-myloader-support.patch @@ -8,7 +8,7 @@ #include "common.h" -@@ -69,6 +70,37 @@ static const char * __init ath79_prom_fi +@@ -69,6 +70,40 @@ static const char * __init ath79_prom_fi return ret; } @@ -29,6 +29,9 @@ + case DEVID_COMPEX_WPE72: + ath79_prom_append_cmdline("board", "WPE72"); + break; ++ case DEVID_COMPEX_WPJ558: ++ ath79_prom_append_cmdline("board", "WPJ558"); ++ break; + default: + pr_warn("prom: unknown device id: %x\n", mylo->did); + return 0; diff --git a/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch index b01c5de1ff..b100752f5b 100644 --- a/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.14/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,146 @@ +@@ -16,22 +16,147 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -136,6 +136,7 @@ + ATH79_MACH_WNR612_V2, /* NETGEAR WNR612 v2 */ + ATH79_MACH_WP543, /* Compex WP543 */ + ATH79_MACH_WPE72, /* Compex WPE72 */ ++ ATH79_MACH_WPJ558, /* Compex WPJ558 */ + ATH79_MACH_WRT160NL, /* Linksys WRT160NL */ + ATH79_MACH_WRT400N, /* Linksys WRT400N */ + ATH79_MACH_WZR_HP_AG300H, /* Buffalo WZR-HP-AG300H */ @@ -211,7 +212,7 @@ config ATH79_MACH_AP121 bool "Atheros AP121 reference board" select SOC_AR933X -@@ -11,62 +66,743 @@ config ATH79_MACH_AP121 +@@ -11,62 +66,754 @@ config ATH79_MACH_AP121 select ATH79_DEV_M25P80 select ATH79_DEV_USB select ATH79_DEV_WMAC @@ -416,6 +417,17 @@ + select ATH79_DEV_USB + select MYLOADER + ++config ATH79_MACH_WPJ558 ++ bool "Compex WPJ558 board support" ++ select SOC_QCA955X ++ 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 MYLOADER ++ +config ATH79_MACH_DIR_505_A1 + bool "D-Link DIR-505-A1 support" + select SOC_AR933X @@ -983,7 +995,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM/UniFi boards" -@@ -83,6 +819,65 @@ config ATH79_MACH_UBNT_XM +@@ -83,6 +830,65 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -1049,7 +1061,7 @@ endmenu config SOC_AR71XX -@@ -132,7 +927,10 @@ config ATH79_DEV_DSA +@@ -132,7 +938,10 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -1061,7 +1073,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -164,4 +962,7 @@ config ATH79_PCI_ATH9K_FIXUP +@@ -164,4 +973,7 @@ config ATH79_PCI_ATH9K_FIXUP config ATH79_ROUTERBOOT def_bool n @@ -1071,7 +1083,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -38,9 +38,91 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route +@@ -38,9 +49,92 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route # # Machines # @@ -1155,6 +1167,7 @@ +obj-$(CONFIG_ATH79_MACH_WNR2200) += mach-wnr2200.o +obj-$(CONFIG_ATH79_MACH_WP543) += mach-wp543.o +obj-$(CONFIG_ATH79_MACH_WPE72) += mach-wpe72.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 +obj-$(CONFIG_ATH79_MACH_WZR_HP_G300NH) += mach-wzr-hp-g300nh.o diff --git a/target/linux/generic/files/include/linux/myloader.h b/target/linux/generic/files/include/linux/myloader.h index d89e415fba..bb70460c24 100644 --- a/target/linux/generic/files/include/linux/myloader.h +++ b/target/linux/generic/files/include/linux/myloader.h @@ -37,6 +37,7 @@ /* Devices based on the Atheros AR71xx */ #define DEVID_COMPEX_WP543 0x0640 #define DEVID_COMPEX_WPE72 0x0672 +#define DEVID_COMPEX_WPJ558 0x0688 /* Devices based on the IXP422 */ #define DEVID_COMPEX_WP18 0x047E diff --git a/tools/firmware-utils/src/mkmylofw.c b/tools/firmware-utils/src/mkmylofw.c index b5958ebe0f..539d1163e9 100644 --- a/tools/firmware-utils/src/mkmylofw.c +++ b/tools/firmware-utils/src/mkmylofw.c @@ -157,6 +157,9 @@ struct cpx_board boards[] = { CPX_BOARD_AR71XX(DEVID_COMPEX_WPE72, 8, "WPE72", "Compex WPE72", "BareBoard"), + CPX_BOARD_AR71XX(DEVID_COMPEX_WPJ558, 8, + "WPJ558", "Compex WPJ558", + "BareBoard"), CPX_BOARD_AR23XX(DEVID_COMPEX_NP25G, 4, "NP25G", "Compex NetPassage 25G", diff --git a/tools/firmware-utils/src/myloader.h b/tools/firmware-utils/src/myloader.h index 7be1d49369..529cb46dd7 100644 --- a/tools/firmware-utils/src/myloader.h +++ b/tools/firmware-utils/src/myloader.h @@ -64,6 +64,8 @@ #define DEVID_COMPEX_WP543 0x0640 #define DEVID_COMPEX_WPE72 0x0672 +#define DEVID_COMPEX_WPJ558 0x0688 + /* Devices based on the IXP422 */ #define DEVID_COMPEX_WP18 0x047E #define DEVID_COMPEX_NP18A 0x0489