Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for EnGenius ESR1750

2014-07-02 Thread 林書詠
Answers inline.

On Tue, Jul 1, 2014 at 3:16 PM, John Crispin j...@phrozen.org wrote:
 On 01/07/2014 13:44, Jon Suphammer wrote:
 0t 1 +  part=$(find_mtd_part u-boot-env) +  mac=$(strings $part |
 sed -n 's/^'ethaddr'=//p' |sed 's/\//g') +
 mac_lan=$(macaddr_canonicalize $mac) +[ -n $mac_lan ] 
 ucidef_set_interface_macaddr lan $mac_lan +
 mac_wan=$(mtd_get_mac_ascii u-boot-env wanaddr) + [ -n $mac_wan ]
  ucidef_set_interface_macaddr wan $mac_wan +
 mac_wifi2=$(macaddr_add $mac_lan 1) + ;; +

 package/kernel/uboot-env/ can solve this problem for you i believe
The reason for doing it this was is that macaddr_canonicalize will see
LAN mac address as invalid as the string includes quotation marks
which makes the string greater than 17 chars.

A more correct fix for this would be to strip quotation marks in
macaddr_canonicalize. By doing this we can use mtd_get_mac_ascii to
retrieve LAN mac address as we do for WAN mac address.

I suggest we add: mac=$(echo ${mac} | sed 's/\//g') at top of
macaddr_canonicalize function. I can send a separate patch for this if
you prefer this approach.


 + +static void __init esr1750_gmac_setup(void) +{ +   void __iomem
 *base; +  u32 t; + +  base = ioremap(QCA955X_GMAC_BASE,
 QCA955X_GMAC_SIZE); + +   t = __raw_readl(base +
 QCA955X_GMAC_REG_ETH_CFG); + +t = ~(QCA955X_ETH_CFG_RGMII_EN |
 QCA955X_ETH_CFG_GE0_SGMII); + t |= QCA955X_ETH_CFG_RGMII_EN; + +
 __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); + +
 iounmap(base); +} +

 this function looks wrong. are you sure this cannot be fixed with
 existing code ?
There is currently no ath79_setup_qca955x_eth_cfg function. However I
have made this function in dev_eth now, so I can submit this as a
separate patch. Is this ok ?

If the above solutions is acceptable, I will resubmit this patch once
the two above mentioned patches is accepted.

-- 
Best regards,
Jon
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: add support for EnGenius ESR1750

2014-07-01 Thread Jon Suphammer
Signed-off-by: Jon Suphammer j...@suphammer.net
---
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  14 ++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-3.10|   3 +-
 .../ar71xx/files/arch/mips/ath79/mach-esr1750.c| 216 +
 target/linux/ar71xx/generic/profiles/engenius.mk   |  16 ++
 target/linux/ar71xx/image/Makefile |   2 +
 .../713-MIPS-ath79-add-ESR1750-support.patch   |  45 +
 9 files changed, 302 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
 create mode 100644 target/linux/ar71xx/generic/profiles/engenius.mk
 create mode 100644 
target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 687cddf..3a9de0b 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -69,6 +69,9 @@ get_status_led() {
el-m150)
status_led=EasyLink:green:system
;;
+   esr1750)
+   status_led=esr1750:red:status
+   ;;
hiwifi-hc6361)
status_led=hiwifi:blue:system
;;
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 99c0268..166b10c 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -30,6 +30,20 @@ wlr8100)
ucidef_add_switch_vlan switch0 2 0t 1
;;
 
+esr1750)
+   ucidef_set_interfaces_lan_wan eth0.1 eth0.2
+   ucidef_add_switch switch0 1 1
+   ucidef_add_switch_vlan switch0 1 0t 2 3 4 5
+   ucidef_add_switch_vlan switch0 2 0t 1
+   part=$(find_mtd_part u-boot-env)
+   mac=$(strings $part | sed -n 's/^'ethaddr'=//p' |sed 's/\//g')
+   mac_lan=$(macaddr_canonicalize $mac)
+   [ -n $mac_lan ]  ucidef_set_interface_macaddr lan $mac_lan
+   mac_wan=$(mtd_get_mac_ascii u-boot-env wanaddr)
+   [ -n $mac_wan ]  ucidef_set_interface_macaddr wan $mac_wan
+   mac_wifi2=$(macaddr_add $mac_lan 1)
+   ;;
+
 ap136-010)
ucidef_set_interfaces_lan_wan eth0 eth1
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 4656ac2..954fc9d 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -319,6 +319,9 @@ ar71xx_board_detect() {
*EL-MINI)
name=el-mini
;;
+   *EnGenius ESR1750)
+   name=esr1750
+   ;;
*JA76PF)
name=ja76pf
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8af9580..70f7fc2 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -151,6 +151,7 @@ platform_check_image() {
dir-825-c1 | \
dir-835-a1 | \
dragino2 | \
+   esr1750 | \
ew-dorin | \
ew-dorin-router | \
hiwifi-hc6361 | \
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 1346c3f..3080c9f 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -49,10 +49,11 @@ CONFIG_ATH79_MACH_DRAGINO2=y
 CONFIG_ATH79_MACH_EAP7660D=y
 CONFIG_ATH79_MACH_EL_M150=y
 CONFIG_ATH79_MACH_EL_MINI=y
+CONFIG_ATH79_MACH_ESR1750=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
-CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y
+CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
 CONFIG_ATH79_MACH_JWAP003=y
 CONFIG_ATH79_MACH_MR600=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
new file mode 100644
index 000..6488d70
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
@@ -0,0 +1,216 @@
+/*
+ * EnGenius ESR1750 board support
+ *
+ * Based on the Qualcomm Atheros AP135/AP136 reference board support code
+ * Copyright (c) 2012 Qualcomm Atheros
+ * Copyright (c) 2012-2013 Gabor Juhos juh...@openwrt.org
+ * Copyright (c) 2014 Jon Suphammer j...@suphammer.net
+ *
+ * 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
+ 

Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for EnGenius ESR1750

2014-07-01 Thread John Crispin
Hi,

2 comments inline



On 01/07/2014 13:44, Jon Suphammer wrote:
 Signed-off-by: Jon Suphammer j...@suphammer.net --- 
 target/linux/ar71xx/base-files/etc/diag.sh |   3 + 
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  14 ++ 
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 + 
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 + 
 target/linux/ar71xx/config-3.10|   3 +- 
 .../ar71xx/files/arch/mips/ath79/mach-esr1750.c| 216
 + 
 target/linux/ar71xx/generic/profiles/engenius.mk   |  16 ++ 
 target/linux/ar71xx/image/Makefile |   2 + 
 .../713-MIPS-ath79-add-ESR1750-support.patch   |  45 + 9
 files changed, 302 insertions(+), 1 deletion(-) create mode 100644
 target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c create
 mode 100644 target/linux/ar71xx/generic/profiles/engenius.mk create
 mode 100644
 target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch

  diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
 b/target/linux/ar71xx/base-files/etc/diag.sh index 687cddf..3a9de0b
 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++
 b/target/linux/ar71xx/base-files/etc/diag.sh @@ -69,6 +69,9 @@
 get_status_led() { el-m150) status_led=EasyLink:green:system ;; +
 esr1750) +status_led=esr1750:red:status +   ;; 
 hiwifi-hc6361) 
 status_led=hiwifi:blue:system ;; 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
 99c0268..166b10c 100755 ---
 a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++
 b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@
 -30,6 +30,20 @@ wlr8100) ucidef_add_switch_vlan switch0 2 0t
 1 ;;
 
 +esr1750) +   ucidef_set_interfaces_lan_wan eth0.1 eth0.2 +
 ucidef_add_switch switch0 1 1 + ucidef_add_switch_vlan
 switch0 1 0t 2 3 4 5 +  ucidef_add_switch_vlan switch0 2
 0t 1 +  part=$(find_mtd_part u-boot-env) +  mac=$(strings $part |
 sed -n 's/^'ethaddr'=//p' |sed 's/\//g') +
 mac_lan=$(macaddr_canonicalize $mac) +[ -n $mac_lan ] 
 ucidef_set_interface_macaddr lan $mac_lan +
 mac_wan=$(mtd_get_mac_ascii u-boot-env wanaddr) + [ -n $mac_wan ]
  ucidef_set_interface_macaddr wan $mac_wan +
 mac_wifi2=$(macaddr_add $mac_lan 1) + ;; +

package/kernel/uboot-env/ can solve this problem for you i believe




 ap136-010) ucidef_set_interfaces_lan_wan eth0 eth1 
 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
 4656ac2..954fc9d 100755 ---
 a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++
 b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -319,6 +319,9 @@
 ar71xx_board_detect() { *EL-MINI) name=el-mini ;; + *EnGenius
 ESR1750) +   name=esr1750 +;; *JA76PF) 
 name=ja76pf ;; diff
 --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
 b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index
 8af9580..70f7fc2 100755 ---
 a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++
 b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -151,6
 +151,7 @@ platform_check_image() { dir-825-c1 | \ dir-835-a1 | \ 
 dragino2 | \ +esr1750 | \ ew-dorin | \ ew-dorin-router | \ 
 hiwifi-hc6361 | \ diff --git a/target/linux/ar71xx/config-3.10
 b/target/linux/ar71xx/config-3.10 index 1346c3f..3080c9f 100644 ---
 a/target/linux/ar71xx/config-3.10 +++
 b/target/linux/ar71xx/config-3.10 @@ -49,10 +49,11 @@
 CONFIG_ATH79_MACH_DRAGINO2=y CONFIG_ATH79_MACH_EAP7660D=y 
 CONFIG_ATH79_MACH_EL_M150=y CONFIG_ATH79_MACH_EL_MINI=y 
 +CONFIG_ATH79_MACH_ESR1750=y CONFIG_ATH79_MACH_EW_DORIN=y 
 CONFIG_ATH79_MACH_GS_OOLITE=y -CONFIG_ATH79_MACH_HORNET_UB=y 
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y +CONFIG_ATH79_MACH_HORNET_UB=y 
 CONFIG_ATH79_MACH_JA76PF=y CONFIG_ATH79_MACH_JWAP003=y 
 CONFIG_ATH79_MACH_MR600=y diff --git
 a/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
 b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c new file
 mode 100644 index 000..6488d70 --- /dev/null +++
 b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c @@ -0,0
 +1,216 @@ +/* + * EnGenius ESR1750 board support + * + * Based on
 the Qualcomm Atheros AP135/AP136 reference board support code + *
 Copyright (c) 2012 Qualcomm Atheros + * Copyright (c) 2012-2013
 Gabor Juhos juh...@openwrt.org + * Copyright (c) 2014 Jon
 Suphammer j...@suphammer.net + * + * 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