added board support for compex wpj558
authorJohn Crispin <john@openwrt.org>
Mon, 2 Feb 2015 09:00:21 +0000 (09:00 +0000)
committerJohn Crispin <john@openwrt.org>
Mon, 2 Feb 2015 09:00:21 +0000 (09:00 +0000)
Signed-off-by: Christian Mehlis <christian@m3hlis.de>
SVN-Revision: 44237

13 files changed:
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.14
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.14/507-MIPS-ath79-prom-add-myloader-support.patch
target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch
target/linux/generic/files/include/linux/myloader.h
tools/firmware-utils/src/mkmylofw.c
tools/firmware-utils/src/myloader.h

index af6107b4895fa5e7b8cb9b086fb12010e40e9b63..af53afdf4e62db6fc84baa2edda24211a0519935 100755 (executable)
@@ -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"
                ;;
index a223ae8fe52d3b5930e02b1b2a261c905d7068a3..1d186deffa9a361080b374cdb12b520af8825548 100755 (executable)
@@ -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 02872de1457d8a14bcf762c55f523b692dcb9256..4c6594fdf860b7944b8b6b3de94deb7832c96281 100755 (executable)
@@ -747,6 +747,9 @@ ar71xx_board_detect() {
        *WP543)
                name="wp543"
                ;;
+       *WPJ558)
+               name="wpj558"
+               ;;
        *WPE72)
                name="wpe72"
                ;;
index bc6866da1997cbf820b3fcdd79d0cb42b74c962a..0db162523138174265c9679f00b6b315bb99a1c3 100755 (executable)
@@ -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"
index 82b2d130d56fd7a97aadc19cc7175b42a20b66ee..2d9873cbb8a8d83fc0fc9b53f0ad0a9286713aeb 100644 (file)
@@ -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 (file)
index 0000000..a8310a7
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * Compex WPJ558 board support
+ *
+ * Copyright (c) 2012 Qualcomm Atheros
+ * Copyright (c) 2012 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 "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);
index 34914738100abc2a5abfbb07b1b04646a410f5f7..a6f2239c94ea11600c146ef519c2ef198a3b29c2 100644 (file)
@@ -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))
+
index f7b8381aa422e65b9076a4df390118bed9dd1a56..ecaa126ec59744631a50f8c670312ae3e73ca5e1 100644 (file)
@@ -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))
index 67c1faf9b078f9819cf5aeab569afb98b5e2e329..407755e7d6a8b59c0206981a2a1cbc49030c6f5c 100644 (file)
@@ -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;
index b01c5de1ff58d72e7ed422a314945db56a91dde3..b100752f5b37dfcd9189a68a6bcd910888d680c6 100644 (file)
@@ -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,
 +      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 */
  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
 +      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
  
  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.
  
  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
  
        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
  
  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
  #
 +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
index d89e415fba6cae436d422db72b24141bbb8d08b4..bb70460c24efa9144e601ad6b7d25e9b814f0af5 100644 (file)
@@ -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
index b5958ebe0fe57b3f37c8ee30ad6570b800af6784..539d1163e9ae006c7425a591448b077de1b85ca7 100644 (file)
@@ -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",
index 7be1d49369dafaf30651e7a75266a33d534627f4..529cb46dd750516e7586f51c3a00654f39625cba 100644 (file)
@@ -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