ar71xx: add support for the jjPlus JA76PF2 board
authorGabor Juhos <juhosg@openwrt.org>
Fri, 16 Mar 2012 18:00:34 +0000 (18:00 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 16 Mar 2012 18:00:34 +0000 (18:00 +0000)
SVN-Revision: 30957

target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/uci-defaults/network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/files/arch/mips/ath79/mach-ja76pf.c
target/linux/ar71xx/patches-3.2/612-MIPS-ath79-JA76PF2-support.patch [new file with mode: 0644]
target/linux/ar71xx/patches-3.3/612-MIPS-ath79-JA76PF2-support.patch [new file with mode: 0644]

index 9552b8aa3f44bfcbae37b4de295dc5828b0a20d7..cbe15c68cc39cbb36fce42666eac6cda179c8ba1 100755 (executable)
@@ -67,7 +67,8 @@ get_status_led() {
        hornet-ub)
                status_led="alfa:blue:wps"
                ;;
-       ja76pf)
+       ja76pf | \
+       ja76pf2)
                status_led="jjplus:green:led1"
                ;;
        ls-sr71)
index 4dfb43c6733b9915eda40ba03add2a6af530256d..ce5bc5a64e6b443027e576e57c4fbdfca0da4b2d 100755 (executable)
@@ -15,7 +15,8 @@ ucidef_set_interface_loopback
 board=$(ar71xx_board_name)
 
 case "$board" in
-all0258n)
+all0258n |\
+ja76pf2)
        ucidef_set_interface_lan "eth0 eth1"
        ;;
 
index b9d797cac160ee99f78873d05fb6332f8b20d26b..b51f3a7c637a5ed82cde993104b872463008bad6 100755 (executable)
@@ -181,6 +181,9 @@ ar71xx_board_detect() {
        *JA76PF)
                name="ja76pf"
                ;;
+       *JA76PF2)
+               name="ja76pf2"
+               ;;
        *"Bullet M")
                name="bullet-m"
                ;;
index 91b04c5deaa09ee0e84eed8ea7bf59dfa20b9780..a53c73dca4849d098c383be7757446e613eeb6d7 100755 (executable)
@@ -15,7 +15,7 @@ platform_find_partitions() {
        while read dev size erasesize name; do
                name=${name#'"'}; name=${name%'"'}
                case "$name" in
-                       vmlinux.bin.l7|vmlinux|kernel|linux|rootfs)
+                       vmlinux.bin.l7|vmlinux|kernel|linux|rootfs|filesystem)
                                if [ -z "$first" ]; then
                                        first="$name"
                                else
@@ -179,7 +179,8 @@ platform_check_image() {
        pb42 | \
        pb44 | \
        eap7660d | \
-       ja76pf )
+       ja76pf | \
+       ja76pf2)
                [ "$magic" != "4349" ] && {
                        echo "Invalid image. Use *-sysupgrade.bin files on this board"
                        return 1
@@ -212,7 +213,8 @@ platform_do_upgrade() {
        eap7660d | \
        pb42 | \
        pb44 | \
-       ja76pf)
+       ja76pf | \
+       ja76pf2)
                platform_do_upgrade_combined "$ARGV"
                ;;
        all0258n )
index 1f170763a4602f01f818ebdf172340cc5c00c17d..d1fe0f8a260a2b37e85135ebbc77b5981304bc5c 100644 (file)
@@ -112,3 +112,79 @@ static void __init ja76pf_init(void)
 }
 
 MIPS_MACHINE(ATH79_MACH_JA76PF, "JA76PF", "jjPlus JA76PF", ja76pf_init);
+
+#define JA76PF2_GPIO_LED_D2            5
+#define JA76PF2_GPIO_LED_D3            4
+#define JA76PF2_GPIO_LED_D4            3
+#define JA76PF2_GPIO_BTN_RESET         7
+#define JA76PF2_GPIO_BTN_WPS           8
+
+static struct gpio_led ja76pf2_leds_gpio[] __initdata = {
+       {
+               .name           = "jjplus:green:led1",
+               .gpio           = JA76PF2_GPIO_LED_D2,
+               .active_low     = 1,
+       }, {
+               .name           = "jjplus:green:led2",
+               .gpio           = JA76PF2_GPIO_LED_D3,
+               .active_low     = 0,
+       }, {
+               .name           = "jjplus:green:led3",
+               .gpio           = JA76PF2_GPIO_LED_D4,
+               .active_low     = 0,
+       }
+};
+
+static struct gpio_keys_button ja76pf2_gpio_keys[] __initdata = {
+       {
+               .desc           = "reset",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = JA76PF2_GPIO_BTN_RESET,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "wps",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = JA76PF2_GPIO_BTN_WPS,
+               .active_low     = 1,
+       },
+};
+
+#define JA76PF2_LAN_PHYMASK    BIT(0)
+#define JA76PF2_WAN_PHYMASK    BIT(4)
+#define JA76PF2_MDIO_PHYMASK   (JA76PF2_LAN_PHYMASK | JA76PF2_WAN_PHYMASK)
+
+static void __init ja76pf2_init(void)
+{
+       ath79_register_m25p80(&ja76pf_flash_data);
+
+       ath79_register_mdio(0, ~JA76PF2_MDIO_PHYMASK);
+
+       /* MAC0 is connected to the CPU port of the AR8316 switch */
+       ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+       ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+       ath79_eth0_data.phy_mask = BIT(0);
+
+       /* MAC1 is connected to the PHY4 of the AR8316 switch */
+       ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
+       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+       ath79_eth1_data.phy_mask = BIT(4);
+
+       ath79_register_eth(0);
+       ath79_register_eth(1);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(ja76pf2_leds_gpio),
+                                ja76pf2_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(ja76pf2_gpio_keys),
+                                       ja76pf2_gpio_keys);
+
+       ath79_register_pci();
+}
+
+MIPS_MACHINE(ATH79_MACH_JA76PF2, "JA76PF2", "jjPlus JA76PF2", ja76pf2_init);
diff --git a/target/linux/ar71xx/patches-3.2/612-MIPS-ath79-JA76PF2-support.patch b/target/linux/ar71xx/patches-3.2/612-MIPS-ath79-JA76PF2-support.patch
new file mode 100644 (file)
index 0000000..fc69e42
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -34,6 +34,7 @@ enum ath79_mach_type {
+       ATH79_MACH_DIR_825_B1,          /* D-Link DIR-825 rev. B1 */
+       ATH79_MACH_EAP7660D,            /* Senao EAP7660D */
+       ATH79_MACH_JA76PF,              /* jjPlus JA76PF */
++      ATH79_MACH_JA76PF2,             /* jjPlus JA76PF2 */
+       ATH79_MACH_JWAP003,             /* jjPlus JWAP003 */
+       ATH79_MACH_HORNET_UB,           /* ALFA Networks Hornet-UB */
+       ATH79_MACH_MZK_W04NU,           /* Planex MZK-W04NU */
diff --git a/target/linux/ar71xx/patches-3.3/612-MIPS-ath79-JA76PF2-support.patch b/target/linux/ar71xx/patches-3.3/612-MIPS-ath79-JA76PF2-support.patch
new file mode 100644 (file)
index 0000000..fc69e42
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -34,6 +34,7 @@ enum ath79_mach_type {
+       ATH79_MACH_DIR_825_B1,          /* D-Link DIR-825 rev. B1 */
+       ATH79_MACH_EAP7660D,            /* Senao EAP7660D */
+       ATH79_MACH_JA76PF,              /* jjPlus JA76PF */
++      ATH79_MACH_JA76PF2,             /* jjPlus JA76PF2 */
+       ATH79_MACH_JWAP003,             /* jjPlus JWAP003 */
+       ATH79_MACH_HORNET_UB,           /* ALFA Networks Hornet-UB */
+       ATH79_MACH_MZK_W04NU,           /* Planex MZK-W04NU */