From b680f088ba6f7e5982143db351d1f817bffbf86d Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Fri, 10 Dec 2010 17:57:51 +0000
Subject: [PATCH] ar71xx: add support for the jjPlus JA79PF

Patch-by: Cezary Jackiewicz

SVN-Revision: 24440
---
 target/linux/ar71xx/base-files/etc/diag.sh            |  3 +++
 target/linux/ar71xx/base-files/lib/ar71xx.sh          |  3 +++
 .../linux/ar71xx/base-files/lib/upgrade/platform.sh   |  4 ++--
 target/linux/ar71xx/config-2.6.32                     |  1 +
 target/linux/ar71xx/config-2.6.36                     |  1 +
 target/linux/ar71xx/config-2.6.37                     |  1 +
 target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig    |  9 +++++++++
 target/linux/ar71xx/files/arch/mips/ar71xx/Makefile   |  1 +
 target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h |  1 +
 target/linux/ar71xx/generic/profiles/jjplus.mk        | 11 +++++++++++
 target/linux/ar71xx/image/Makefile                    |  5 +++++
 11 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 7abedc0a2f..add552ea31 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -57,6 +57,9 @@ get_status_led() {
 	eap7660d)
 		status_led="eap7660d:green:ds4"
 		;;
+	ja76pf)
+		status_led="ja76pf:green:led1"
+		;;
 	ls-sr71)
 		status_led="ubnt:green:d22"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index ae50a23c52..ad173e815a 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -31,6 +31,9 @@ ar71xx_board_name() {
 	*EAP7660D)
 		name="eap7660d"
 		;;
+	*JA76PF)
+		name="ja76pf"
+		;;
 	*"Bullet M")
 		name="bullet-m"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 1cbde8bc66..1f6c62d439 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -103,7 +103,7 @@ platform_check_image() {
 		}
 		return 0
 		;;
-	routerstation | routerstation-pro | ls-sr71 | pb42 | pb44 | eap7660d )
+	routerstation | routerstation-pro | ls-sr71 | pb42 | pb44 | eap7660d | ja76pf )
 		[ "$magic" != "4349" ] && {
 			echo "Invalid image. Use *-sysupgrade.bin files on this board"
 			return 1
@@ -130,7 +130,7 @@ platform_do_upgrade() {
 	local board=$(ar71xx_board_name)
 
 	case "$board" in
-	routerstation | routerstation-pro | ls-sr71 | eap7660d )
+	routerstation | routerstation-pro | ls-sr71 | eap7660d | ja76pf )
 		platform_do_upgrade_combined "$ARGV"
 		;;
 	*)
diff --git a/target/linux/ar71xx/config-2.6.32 b/target/linux/ar71xx/config-2.6.32
index 559c800221..b68f2e7953 100644
--- a/target/linux/ar71xx/config-2.6.32
+++ b/target/linux/ar71xx/config-2.6.32
@@ -24,6 +24,7 @@ CONFIG_AR71XX_MACH_DIR_600_A1=y
 CONFIG_AR71XX_MACH_DIR_615_C1=y
 CONFIG_AR71XX_MACH_DIR_825_B1=y
 CONFIG_AR71XX_MACH_EAP7660D=y
+CONFIG_AR71XX_MACH_JA76PF=y
 CONFIG_AR71XX_MACH_JWAP003=y
 CONFIG_AR71XX_MACH_MZK_W04NU=y
 CONFIG_AR71XX_MACH_MZK_W300NH=y
diff --git a/target/linux/ar71xx/config-2.6.36 b/target/linux/ar71xx/config-2.6.36
index 108855f14c..49f1978d5b 100644
--- a/target/linux/ar71xx/config-2.6.36
+++ b/target/linux/ar71xx/config-2.6.36
@@ -20,6 +20,7 @@ CONFIG_AR71XX_MACH_DIR_600_A1=y
 CONFIG_AR71XX_MACH_DIR_615_C1=y
 CONFIG_AR71XX_MACH_DIR_825_B1=y
 CONFIG_AR71XX_MACH_EAP7660D=y
+CONFIG_AR71XX_MACH_JA76PF=y
 CONFIG_AR71XX_MACH_JWAP003=y
 CONFIG_AR71XX_MACH_MZK_W04NU=y
 CONFIG_AR71XX_MACH_MZK_W300NH=y
diff --git a/target/linux/ar71xx/config-2.6.37 b/target/linux/ar71xx/config-2.6.37
index 108855f14c..49f1978d5b 100644
--- a/target/linux/ar71xx/config-2.6.37
+++ b/target/linux/ar71xx/config-2.6.37
@@ -20,6 +20,7 @@ CONFIG_AR71XX_MACH_DIR_600_A1=y
 CONFIG_AR71XX_MACH_DIR_615_C1=y
 CONFIG_AR71XX_MACH_DIR_825_B1=y
 CONFIG_AR71XX_MACH_EAP7660D=y
+CONFIG_AR71XX_MACH_JA76PF=y
 CONFIG_AR71XX_MACH_JWAP003=y
 CONFIG_AR71XX_MACH_MZK_W04NU=y
 CONFIG_AR71XX_MACH_MZK_W300NH=y
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
index 3524dfe6b8..57b17bddd2 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
@@ -55,6 +55,15 @@ config AR71XX_MACH_DIR_825_B1
 	select AR71XX_DEV_USB
 	default n
 
+config AR71XX_MACH_JA76PF
+	bool "jjPlus JA76PF board support"
+	select AR71XX_DEV_M25P80
+	select AR71XX_DEV_GPIO_BUTTONS
+	select AR71XX_DEV_PB42_PCI if PCI
+	select AR71XX_DEV_LEDS_GPIO
+	select AR71XX_DEV_USB
+	default n
+
 config AR71XX_MACH_JWAP003
 	bool "jjPlus JWAP003 board support"
 	select AR71XX_DEV_M25P80
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
index b5b971a781..d4e5536738 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
@@ -35,6 +35,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_EAP7660D)	+= mach-eap7660d.o
+obj-$(CONFIG_AR71XX_MACH_JA76PF)	+= mach-ja76pf.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
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
index 620e009677..2a233d79f0 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
@@ -22,6 +22,7 @@ enum ar71xx_mach_type {
 	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_JA76PF,	/* jjPlus JA76PF */
 	AR71XX_MACH_JWAP003,	/* jjPlus JWAP003 */
 	AR71XX_MACH_RB_411,	/* MikroTik RouterBOARD 411/411A/411AH */
 	AR71XX_MACH_RB_411U,	/* MikroTik RouterBOARD 411U */
diff --git a/target/linux/ar71xx/generic/profiles/jjplus.mk b/target/linux/ar71xx/generic/profiles/jjplus.mk
index b74d7a5fbb..13fde805e3 100644
--- a/target/linux/ar71xx/generic/profiles/jjplus.mk
+++ b/target/linux/ar71xx/generic/profiles/jjplus.mk
@@ -5,6 +5,17 @@
 # See /LICENSE for more information.
 #
 
+define Profile/JA76PF
+	NAME:=jjPlus JA76PF
+	PACKAGES:=wpad-mini kmod-ath9k kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-hwmon-core kmod-i2c-core kmod-hwmon-lm75
+endef
+
+define Profile/JA76PF/Description
+	Package set optimized for the jjPlus JA76PF board.
+endef
+
+$(eval $(call Profile,JA76PF))
+
 define Profile/JWAP003
 	NAME:=jjPlus JWAP0003
 	PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 66be14b48f..f6dc3b01fd 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -495,6 +495,10 @@ define Image/Build/Profile/EAP7660D
 	$(call Image/Build/Template/$(fs_128k)/$(1),PB4X,eap7660d,board=EAP7660D)
 endef
 
+define Image/Build/Profile/JA76PF
+	$(call Image/Build/Template/$(fs_64k)/$(1),PB4X,ja76pf,board=JA76PF)
+endef
+
 define Image/Build/Profile/JWAP003
 	$(call Image/Build/Template/$(fs_64k)/$(1),PB4X,jwap003,board=JWAP003)
 endef
@@ -659,6 +663,7 @@ define Image/Build/Profile/Default
 	$(call Image/Build/Profile/DIR825B1,$(1))
 	$(call Image/Build/Profile/EAP7660D,$(1))
 	$(call Image/Build/Profile/FR54RTR,$(1))
+	$(call Image/Build/Profile/JA76PF,$(1))
 	$(call Image/Build/Profile/JWAP003,$(1))
 	$(call Image/Build/Profile/MZKW04NU,$(1))
 	$(call Image/Build/Profile/MZKW300NH,$(1))
-- 
GitLab