Hello,

Support for jjPlus JWAP003 in Backfire

Signed-off-by: Artur Wronowski <art...@gmail.com>

Index: target/linux/ar71xx/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ar71xx/base-files/lib/upgrade/platform.sh      (wersja 32765)
+++ target/linux/ar71xx/base-files/lib/upgrade/platform.sh      (kopia robocza)
@@ -104,7 +104,7 @@
                }
                return 0
                ;;
-       routerstation | routerstation-pro | ls-sr71 | pb42 | pb44)
+       routerstation | routerstation-pro | jwap003 | ls-sr71 | pb42 | pb44)
                [ "$magic" != "4349" ] && {
                        echo "Invalid image. Use *-sysupgrade.bin files on this 
board"
                        return 1
@@ -131,7 +131,7 @@
        local board=$(ar71xx_board_name)

        case "$board" in
-       routerstation | routerstation-pro | ls-sr71)
+       routerstation | routerstation-pro | ls-sr71 | jwap003)
                platform_do_upgrade_combined "$ARGV"
                ;;
        *)
Index: target/linux/ar71xx/base-files/lib/ar71xx.sh
===================================================================
--- target/linux/ar71xx/base-files/lib/ar71xx.sh        (wersja 32765)
+++ target/linux/ar71xx/base-files/lib/ar71xx.sh        (kopia robocza)
@@ -121,6 +121,9 @@
        *WZR-HP-G300NH)
                name="wzr-hp-g300nh"
                ;;
+       *"jjPlus JWAP003")
+               name="jwap003"
+               ;;
        *)
                name="generic"
                ;;
Index: target/linux/ar71xx/base-files/etc/diag.sh
===================================================================
--- target/linux/ar71xx/base-files/etc/diag.sh  (wersja 32765)
+++ target/linux/ar71xx/base-files/etc/diag.sh  (kopia robocza)
@@ -51,6 +51,9 @@
        dir-825-b1)
                status_led="dir825b1:orange:power"
                ;;
+       jwap003)
+               status_led="jwap003:green:system"
+               ;;
        ls-sr71)
                status_led="ubnt:green:d22"
                ;;
Index: target/linux/ar71xx/config-2.6.32
===================================================================
--- target/linux/ar71xx/config-2.6.32   (wersja 32765)
+++ target/linux/ar71xx/config-2.6.32   (kopia robocza)
@@ -1,7 +1,7 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 CONFIG_AG71XX=y
-CONFIG_AG71XX_AR8216_SUPPORT=y
+# CONFIG_AG71XX_AR8216_SUPPORT
 # CONFIG_AG71XX_DEBUG is not set
 # CONFIG_AG71XX_DEBUG_FS is not set
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
@@ -42,9 +42,10 @@
 CONFIG_AR71XX_MACH_WRT160NL=y
 CONFIG_AR71XX_MACH_WRT400N=y
 CONFIG_AR71XX_MACH_WZR_HP_G300NH=y
+CONFIG_AR71XX_MACH_JWAP003=y
 CONFIG_AR71XX_NVRAM=y
 CONFIG_AR71XX_WDT=y
-CONFIG_AR8216_PHY=y
+# CONFIG_AR8216_PHY
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
Index: target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
===================================================================
--- target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h       (wersja 32765)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h       (kopia robocza)
@@ -22,6 +22,7 @@
        AR71XX_MACH_DIR_600_A1, /* D-Link DIR-600 rev. A1 */
        AR71XX_MACH_DIR_615_C1, /* D-Link DIR-615 rev. C1 */
        AR71XX_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */
+       AR71XX_MACH_JWAP003,    /* jjPlus JWAP003 */
        AR71XX_MACH_RB_411,     /* MikroTik RouterBOARD 411/411A/411AH */
        AR71XX_MACH_RB_411U,    /* MikroTik RouterBOARD 411U */
        AR71XX_MACH_RB_433,     /* MikroTik RouterBOARD 433/433AH */
Index: target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
===================================================================
--- target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig  (wersja 32765)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig  (kopia robocza)
@@ -46,6 +46,15 @@
        select AR71XX_DEV_USB
        default n

+config AR71XX_MACH_JWAP003
+       bool "jjPlus JWAP003 board support"
+       select AR71XX_DEV_M25P80
+       select AR71XX_DEV_GPIO_BUTTONS
+       select AR71XX_DEV_LEDS_GPIO
+       select AR71XX_DEV_PB42_PCI if PCI
+       select AR71XX_DEV_USB
+       default n
+
 config AR71XX_MACH_PB42
        bool "Atheros PB42 board support"
        select AR71XX_DEV_M25P80
Index: target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c   (wersja 0)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c   (wersja 0)
@@ -0,0 +1,121 @@
+/*
+ *  jjPlus JWAP003 board support
+ *
+ */
+
+#include <asm/mach-ar71xx/ar71xx.h>
+#include <linux/i2c.h>
+#include <linux/i2c-gpio.h>
+#include <linux/platform_device.h>
+
+#include "machtype.h"
+#include "devices.h"
+#include "dev-m25p80.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-pb42-pci.h"
+#include "dev-usb.h"
+
+#define JWAP003_BUTTONS_POLL_INTERVAL  20
+#define JWAP003_GPIO_WPS       11
+#define JWAP003_GPIO_I2C_SCL   0
+#define JWAP003_GPIO_I2C_SDA   1
+#define JWAP003_GPIO_LED_POWER 5
+#define JWAP003_GPIO_LED_USB0 2
+#define JWAP003_GPIO_LED_USB1 3
+#define JWAP003_GPIO_LED_WPS 4
+
+
+static struct gpio_led jwap003_leds_gpio[] __initdata = {
+       {
+               .name           = "jwap003:green:system",
+               .gpio           = JWAP003_GPIO_LED_POWER,
+               .active_low     = 1,
+       }, {
+               .name           = "jwap003:green:wps",
+               .gpio           = JWAP003_GPIO_LED_WPS,
+       }, {
+               .name           = "jwap003:green:usb0",
+               .gpio           = JWAP003_GPIO_LED_USB0,
+       }, {
+               .name           = "jwap003:green:usb1",
+               .gpio           = JWAP003_GPIO_LED_USB1,
+       }
+};
+
+static struct gpio_button jwap003_gpio_buttons[] __initdata = {
+       {
+               .desc           = "wps",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .threshold      = 3,
+               .gpio           = JWAP003_GPIO_WPS,
+               .active_low     = 1,
+       }
+};
+
+static struct i2c_gpio_platform_data jwap003_i2c_gpio_data = {
+       .sda_pin        = JWAP003_GPIO_I2C_SDA,
+       .scl_pin        = JWAP003_GPIO_I2C_SCL,
+};
+
+static struct platform_device jwap003_i2c_gpio_device = {
+       .name           = "i2c-gpio",
+       .id             = 0,
+       .dev = {
+               .platform_data  = &jwap003_i2c_gpio_data,
+       }
+};
+
+static struct resource jwap003_gpio_resource = {
+               .name   = "gpio",
+               .start  = (1 << 7) | (1 << 8) | (1 << 0),
+               .flags  = 0,
+};
+
+static struct platform_device jwap003_gpio = {
+       .name                   = "GPIODEV",
+       .id                     = -1,
+       .num_resources          = 1,
+       .resource               = &jwap003_gpio_resource,
+};
+
+#define JWAP003_WAN_PHYMASK    BIT(0)
+#define JWAP003_LAN_PHYMASK    BIT(4)
+
+static void __init jwap003_init(void)
+{
+       ar71xx_add_device_m25p80(NULL);
+
+       ar71xx_add_device_mdio(0x0);
+
+       ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+       ar71xx_eth0_data.phy_mask = JWAP003_WAN_PHYMASK;
+       ar71xx_eth0_data.speed = SPEED_100;
+       ar71xx_eth0_data.duplex = DUPLEX_FULL;
+       ar71xx_eth0_data.has_ar8216 = 1;
+
+       ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+       ar71xx_eth1_data.phy_mask = JWAP003_LAN_PHYMASK;
+       ar71xx_eth1_data.speed = SPEED_100;
+       ar71xx_eth1_data.duplex = DUPLEX_FULL;
+
+       ar71xx_add_device_eth(0);
+       ar71xx_add_device_eth(1);
+
+       platform_device_register(&jwap003_i2c_gpio_device);
+       platform_device_register(&jwap003_gpio);
+
+       ar71xx_add_device_usb();
+       
+       ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(jwap003_leds_gpio),
+                                       jwap003_leds_gpio);
+
+       ar71xx_add_device_gpio_buttons(-1, JWAP003_BUTTONS_POLL_INTERVAL,
+                                      ARRAY_SIZE(jwap003_gpio_buttons),
+                                      jwap003_gpio_buttons);
+
+       pb42_pci_init();
+}
+
+MIPS_MACHINE(AR71XX_MACH_JWAP003, "JWAP003", "jjPlus JWAP003", jwap003_init);
Index: target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
===================================================================
--- target/linux/ar71xx/files/arch/mips/ar71xx/Makefile (wersja 32765)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/Makefile (kopia robocza)
@@ -32,6 +32,7 @@
 obj-$(CONFIG_AR71XX_MACH_DIR_600_A1)   += mach-dir-600-a1.o
 obj-$(CONFIG_AR71XX_MACH_DIR_615_C1)   += mach-dir-615-c1.o
 obj-$(CONFIG_AR71XX_MACH_DIR_825_B1)   += mach-dir-825-b1.o
+obj-$(CONFIG_AR71XX_MACH_JWAP003)      += mach-jwap003.o
 obj-$(CONFIG_AR71XX_MACH_MZK_W04NU)    += mach-mzk-w04nu.o
 obj-$(CONFIG_AR71XX_MACH_MZK_W300NH)   += mach-mzk-w300nh.o
 obj-$(CONFIG_AR71XX_MACH_PB42)         += mach-pb42.o
Index: target/linux/ar71xx/image/Makefile
===================================================================
--- target/linux/ar71xx/image/Makefile  (wersja 32765)
+++ target/linux/ar71xx/image/Makefile  (kopia robocza)
@@ -556,6 +556,11 @@
        $(call 
Image/Build/Template/$(fs_128k)/$(1),WZRHPG300NH,wzr-hp-g300nh,board=WZR-HP-G300NH)
 endef

+define Image/Build/Profile/JWAP003
+       $(call Image/Build/Template/$(fs_64k)/$(1),PB4X,jwap003,board=JWAP003)
+endef
+
+
 define Image/Build/Profile/Default
        $(call Image/Build/Profile/AP81,$(1))
        $(call Image/Build/Profile/AP83,$(1))
@@ -586,6 +591,7 @@
        $(call Image/Build/Profile/WRT400N,$(1))
        $(call Image/Build/Profile/WRT160NL,$(1))
        $(call Image/Build/Profile/WZRHPG300NH,$(1))
+       $(call Image/Build/Profile/JWAP003,$(1))
 endef

 define Image/Build/Profile/Madwifi


-- 
Pozdrawiam, Artur
http://artekw.net / http://digi-led.pl / GG: 1518171 / Jabber: art...@jabbim.pl
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to