Re: [OpenWrt-Devel] [PATCH 2/3] ar71xx: add GL-AR300 support V2

2015-11-21 Thread John Crispin
Hi,

1 comment inline


On 17/11/2015 04:37, alzhao wrote:
> Add support for GL-AR300 for latest trunk. Tested and works well.
> 
> Signed-off-by: Alzhao
> ---
>  .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
>  .../ar71xx/base-files/etc/uci-defaults/02_network  |   6 ++
>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
>  target/linux/ar71xx/config-4.1 |   1 +
>  .../ar71xx/files/arch/mips/ath79/mach-gl-ar300.c   | 106 
> +
>  target/linux/ar71xx/generic/profiles/gli.mk|  11 +++
>  target/linux/ar71xx/image/Makefile |   9 ++
>  .../patches-4.1/912-MIPS-ath79-add-gl_ar300.patch  |  39 
>  9 files changed, 180 insertions(+)
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
>  create mode 100644 
> target/linux/ar71xx/patches-4.1/912-MIPS-ath79-add-gl_ar300.patch
> 
> diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds 
> b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
> index 25f9d13..5da1ef4 100644
> --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
> +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
> @@ -215,6 +215,10 @@ gl-ar150)
>   ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt"
>   ;;
>  
> +gl-ar300)
> + ucidef_set_led_wlan "wlan" "WLAN" "gl_ar300:wlan" "phy0tpt"
> + ;;
> +
>  gl-inet)
>   ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
>   ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
> diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
> b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
> index 2ba1fbd..628d710 100644
> --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
> +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
> @@ -408,6 +408,12 @@ wpe72)
>   ucidef_set_interfaces_lan_wan "eth1" "eth0"
>   ;;
>  
> +gl-ar300)
> + ucidef_set_interfaces_lan_wan "eth1" "eth0"
> + ucidef_add_switch "switch0" "1" "1"
> + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
> + ;;
> +
>  wpj344)
>   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
>   ucidef_add_switch "switch0" "1" "1"
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 9848906..a64d005 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -481,6 +481,9 @@ ar71xx_board_detect() {
>   *"GL AR150")
>  name="gl-ar150"
>  ;;
> + *"GL AR300")
> + name="gl-ar300"
> + ;;
>   *"EnGenius EPG5000")
>   name="epg5000"
>   ;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 8ea11b4..f06919f 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -220,6 +220,7 @@ platform_check_image() {
>   ew-dorin | \
>   ew-dorin-router | \
>   gl-ar150 | \
> + gl-ar300 | \
>   hiwifi-hc6361 | \
>   hornet-ub-x2 | \
>   mzk-w04nu | \
> diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
> index 72b47eb..019d6d6 100644
> --- a/target/linux/ar71xx/config-4.1
> +++ b/target/linux/ar71xx/config-4.1
> @@ -76,6 +76,7 @@ CONFIG_ATH79_MACH_ESR900=y
>  CONFIG_ATH79_MACH_EW_DORIN=y
>  CONFIG_ATH79_MACH_F9K1115V2=y
>  CONFIG_ATH79_MACH_GL_AR150=y
> +CONFIG_ATH79_MACH_GL_AR300=y
>  CONFIG_ATH79_MACH_GL_INET=y
>  CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
>  CONFIG_ATH79_MACH_GS_OOLITE=y
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c 
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
> new file mode 100644
> index 000..565267e
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
> @@ -0,0 +1,106 @@
> +/*
> + *  Domino board support
> + *
> + *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
> + *  Copyright (C) 2011-2012 Gabor Juhos 
> + *  Copyright (C) 2013 alzhao 
> + *  Copyright (C) 2014 Michel Stempin 
> + *
> + *  This program is free software; you can redistribute it and/or modify it
> + *  under the terms of the GNU General Public License version 2 as published
> + *  by the Free Software Foundation.
> +*/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "common.h"
> +#include "dev-eth.h"
> +#include "dev-gpio-buttons.h"
> +#include "dev-leds-gpio.h"
> +#include "dev-m25p80.h"
> +#include "dev-usb.h"
> +#include "dev-wmac.h"
> +#include "machtypes.h"
> +
> +#define GL_AR300_GPIO_LED_WLAN   13
> +#define GL_AR300_GPIO_LED_WAN14
> +#define GL_AR300_GPIO_BTN_RESET 

[OpenWrt-Devel] [PATCH 2/3] ar71xx: add GL-AR300 support V2

2015-11-16 Thread alzhao
Add support for GL-AR300 for latest trunk. Tested and works well.

Signed-off-by: Alzhao
---
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   6 ++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.1 |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-gl-ar300.c   | 106 +
 target/linux/ar71xx/generic/profiles/gli.mk|  11 +++
 target/linux/ar71xx/image/Makefile |   9 ++
 .../patches-4.1/912-MIPS-ath79-add-gl_ar300.patch  |  39 
 9 files changed, 180 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
 create mode 100644 
target/linux/ar71xx/patches-4.1/912-MIPS-ath79-add-gl_ar300.patch

diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds 
b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 25f9d13..5da1ef4 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -215,6 +215,10 @@ gl-ar150)
ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt"
;;
 
+gl-ar300)
+   ucidef_set_led_wlan "wlan" "WLAN" "gl_ar300:wlan" "phy0tpt"
+   ;;
+
 gl-inet)
ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 2ba1fbd..628d710 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -408,6 +408,12 @@ wpe72)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
 
+gl-ar300)
+   ucidef_set_interfaces_lan_wan "eth1" "eth0"
+   ucidef_add_switch "switch0" "1" "1"
+   ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+   ;;
+
 wpj344)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 9848906..a64d005 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -481,6 +481,9 @@ ar71xx_board_detect() {
*"GL AR150")
 name="gl-ar150"
 ;;
+   *"GL AR300")
+   name="gl-ar300"
+   ;;
*"EnGenius EPG5000")
name="epg5000"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8ea11b4..f06919f 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -220,6 +220,7 @@ platform_check_image() {
ew-dorin | \
ew-dorin-router | \
gl-ar150 | \
+   gl-ar300 | \
hiwifi-hc6361 | \
hornet-ub-x2 | \
mzk-w04nu | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 72b47eb..019d6d6 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -76,6 +76,7 @@ CONFIG_ATH79_MACH_ESR900=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_F9K1115V2=y
 CONFIG_ATH79_MACH_GL_AR150=y
+CONFIG_ATH79_MACH_GL_AR300=y
 CONFIG_ATH79_MACH_GL_INET=y
 CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
new file mode 100644
index 000..565267e
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
@@ -0,0 +1,106 @@
+/*
+ *  Domino board support
+ *
+ *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
+ *  Copyright (C) 2011-2012 Gabor Juhos 
+ *  Copyright (C) 2013 alzhao 
+ *  Copyright (C) 2014 Michel Stempin 
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define GL_AR300_GPIO_LED_WLAN 13
+#define GL_AR300_GPIO_LED_WAN  14
+#define GL_AR300_GPIO_BTN_RESET16
+
+
+#define GL_AR300_KEYS_POLL_INTERVAL20  /* msecs */
+#define GL_AR300_KEYS_DEBOUNCE_INTERVAL(3 * 
GL_AR300_KEYS_POLL_INTERVAL)
+
+#define GL_AR300_MAC0_OFFSET   0x
+#defineGL_AR300_MAC1_OFFSET0x
+#define GL_AR300_CALDATA_OFFSET