ar71xx: add support for compex wpj558
authorLuka Perkov <luka@openwrt.org>
Fri, 6 Mar 2015 14:41:57 +0000 (14:41 +0000)
committerLuka Perkov <luka@openwrt.org>
Fri, 6 Mar 2015 14:41:57 +0000 (14:41 +0000)
OpenWrt can be flashed with following uboot commands:

tftpboot 0x80500000 openwrt-ar71xx-generic-wpj558-16M-squashfs-sysupgrade.bin
erase 0x9f030000 +$filesize
cp.b $fileaddr 0x9f030000 $filesize

Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 44620

target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/uci-defaults/02_network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-3.18
target/linux/ar71xx/files/arch/mips/ath79/mach-wpj558.c [new file with mode: 0644]
target/linux/ar71xx/generic/profiles/compex.mk
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch

index 3cbf7fb..56f9560 100644 (file)
@@ -293,6 +293,9 @@ get_status_led() {
        wp543)
                status_led="wp543:green:diag"
                ;;
+       wpj558)
+               status_led="wpj558:green:sig3"
+               ;;
        wrt400n)
                status_led="wrt400n:blue:wps"
                ;;
index fdefb5a..20f34d5 100644 (file)
@@ -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 |\
index 52acc6b..d5be238 100755 (executable)
@@ -771,6 +771,9 @@ ar71xx_board_detect() {
        *WPE72)
                name="wpe72"
                ;;
+       *WPJ558)
+               name="wpj558"
+               ;;
        *WNDAP360)
                name="wndap360"
                ;;
index 15fcf89..4353efd 100755 (executable)
@@ -180,10 +180,11 @@ platform_check_image() {
        ap136-020 | \
        ap135-020 | \
        ap96 | \
+       bxu2000n-2-a1 | \
        db120 | \
        f9k1115v2 |\
        hornet-ub | \
-       bxu2000n-2-a1 | \
+       wpj558 | \
        zcn-1523h-2 | \
        zcn-1523h-5)
                [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
index fa287e2..f881a29 100644 (file)
@@ -132,6 +132,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 (file)
index 0000000..7c5509c
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Compex WPJ558 board support
+ *
+ * Copyright (c) 2012 Qualcomm Atheros
+ * Copyright (c) 2012-2013 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * 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 <linux/pci.h>
+#include <linux/phy.h>
+#include <linux/gpio.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 "pci.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-spi.h"
+#include "dev-wmac.h"
+#include "machtypes.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_MAC_OFFSET                      0x1002
+#define WPJ558_WMAC_CALDATA_OFFSET     0x1000
+
+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 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+       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_register_wmac(art + WPJ558_WMAC_CALDATA_OFFSET, NULL);
+
+       ath79_register_pci();
+
+       mdiobus_register_board_info(wpj558_mdio0_info,
+                                       ARRAY_SIZE(wpj558_mdio0_info));
+       ath79_register_mdio(0, 0x0);
+
+       ath79_init_mac(ath79_eth0_data.mac_addr, art + WPJ558_MAC_OFFSET, 0);
+       ath79_init_mac(ath79_eth1_data.mac_addr, art + WPJ558_MAC_OFFSET, 0);
+
+       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;
+
+       /* 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_register_eth(0);
+       ath79_register_eth(1);
+}
+
+MIPS_MACHINE(ATH79_MACH_WPJ558, "WPJ558", "Compex WPJ558", wpj558_setup);
index 3491473..d1a4f12 100644 (file)
@@ -26,3 +26,13 @@ define Profile/WPE72/Description
 endef
 
 $(eval $(call Profile,WPE72))
+
+define Profile/WPJ558
+       NAME:=Compex WPJ558
+endef
+
+define Profile/WPJ558/Description
+       Package set optimized for the Compex WPJ558 board.
+endef
+
+$(eval $(call Profile,WPJ558))
index caab404..b4b75a1 100644 (file)
@@ -398,6 +398,7 @@ uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel)
 ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
 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)
+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
 wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro
@@ -1269,6 +1270,7 @@ $(eval $(call SingleProfile,AthLzma,64k,HORNETUBx2,hornet-ub-x2,HORNET-UB,ttyATH
 $(eval $(call SingleProfile,AthLzma,64k,PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),KRuImage))
 $(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,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))
 
@@ -1504,6 +1506,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_16M))
 
 $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
 $(eval $(call MultiProfile,Madwifi,EAP7660D UBNTRS UBNTRSPRO UBNTLSSR71 WP543))
index 6a0dfff..2c7e663 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,189 @@
+@@ -16,22 +16,190 @@
  
  enum ath79_mach_type {
        ATH79_MACH_GENERIC = 0,
 +      ATH79_MACH_WNR1000_V2,          /* NETGEAR WNR1000 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 */
  config ATH79_MACH_AP121
        bool "Atheros AP121 reference board"
        select SOC_AR933X
-@@ -11,62 +75,970 @@ config ATH79_MACH_AP121
+@@ -11,62 +75,979 @@ config ATH79_MACH_AP121
        select ATH79_DEV_M25P80
        select ATH79_DEV_USB
        select ATH79_DEV_WMAC
 +      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_WMAC
++
 +config ATH79_MACH_DGL_5500_A1
 +      bool "D-Link DGL-5500 A1 support"
 +      select SOC_QCA955X
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,118 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)             += route
+@@ -38,9 +38,119 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)             += route
  #
  # Machines
  #
 +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