[PATCH 1/2] ramips: add support for ELECOM WRC-1167GS2-B
INAGAKI Hiroshi
musashino.open at gmail.com
Tue Dec 15 03:26:51 EST 2020
Hello,
Thank you for your comment.
On 2020/12/14 23:43, Adrian Schmutzler wrote:
> Hi,
>
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>> On Behalf Of INAGAKI Hiroshi
>> Sent: Samstag, 28. November 2020 10:41
>> To: openwrt-devel at lists.openwrt.org
>> Cc: INAGAKI Hiroshi <musashino.open at gmail.com>
>> Subject: [PATCH 1/2] ramips: add support for ELECOM WRC-1167GS2-B
>>
>> ELECOM WRC-1167GS2-B is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on
>> MT7621A.
>>
>> Specification:
>>
>> - SoC : MediaTek MT7621A
>> - RAM : DDR3 128 MiB
>> - Flash : SPI-NOR 16 MiB
>> - WLAN : 2.4/5 GHz 2T2R (MediaTek MT7615D)
>> - Ethernet : 10/100/1000 Mbps x5
>> - Switch : MediaTek MT7530 (SoC)
>> - LED/keys : 6x/6x (2x buttons, 1x slide-switch)
>> - UART : through-hole on PCB
>> - J4: 3.3V, GND, TX, RX from ethernet port side
>> - 57600n8
>> - Power : 12VDC, 1A
>>
>> MAC addresses:
>>
>> LAN : 04:AB:18:**:**:13 (Factory, 0xFFF4 (hex))
>> WAN : 04:AB:18:**:**:14 (Factory, 0xFFFA (hex))
>> 2.4 GHz : 04:AB:18:**:**:15 (none)
>> 5 GHz : 04:AB:18:**:**:16 (Factory, 0x4 (hex))
>>
>> Flash instruction using factory image:
>>
>> 1. Boot WRC-1167GS2-B normally
>> 2. Access to "http://192.168.2.1/" and open firmware update page
>> ("ファームウェア更新")
>> 3. Select the OpenWrt factory image and click apply ("適用") button 4. Wait
>> ~120 seconds to complete flashing
>>
>> Notes:
>>
>> - there is no way to configure the correct MAC address for secondary phy
>> (5GHz) on MT7615D
> This one seems to address a similar case (just scroll to the very bottom):
>
> https://patchwork.ozlabs.org/project/openwrt/patch/1607939702-85475-1-git-send-email-xinfa.deng@gl-inet.com/
>
> Would this work for you as well (at least for the MAC address)?
>
> Best
>
> Adrian
I've tested it, but doesn't work.
I made the following change,
```
diff --git
a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index b7a41f038c..f0093d4337 100644
---
a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++
b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -10,6 +10,14 @@ PHYNBR=${DEVPATH##*/phy}
board=$(board_name)
case "$board" in
+ elecom,wrc-1167gs2-b)
+ [ "$PHYNBR" = "1" ] && \
+ $(mtd_get_mac_binary factory 0x4) >
/sys${DEVPATH}/macaddress
+ ;;
+ elecom,wrc-1167gst2)
+ [ "$PHYNBR" = "1" ] && \
+ macaddr_add $(mtd_get_mac_binary factory
0xe006) 2 > /sys${DEVPATH}/macaddress
+ ;;
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2)
```
but iwinfo still reports the MAC address generated from phy0 by mt76
driver.
```
(WRC-1167GS2-B)
root at OpenWrt:/# iwinfo
wlan0 ESSID: unknown
Access Point: 04:AB:18:58:2F:15
Mode: Client Channel: unknown (unknown)
Tx-Power: 3 dBm Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11bgnac
Hardware: 14C3:7615 7615:14C3 [MediaTek MT7615E]
TX power offset: none
Frequency offset: none
Supports VAPs: yes PHY name: phy0
wlan1 ESSID: unknown
Access Point: 86:AB:18:58:2F:15
Mode: Client Channel: unknown (unknown)
Tx-Power: 3 dBm Link Quality: unknown/70
Signal: unknown Noise: unknown
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11nac
Hardware: 14C3:7615 7615:14C3 [MediaTek MT7615E]
TX power offset: none
Frequency offset: none
Supports VAPs: yes PHY name: phy1
root at OpenWrt:/# cat /sys/class/ieee80211/phy1/macaddress
86:ab:18:58:2f:15
```
>> - Wi-Fi band on primary phy (2.4GHz) cannot be limitted by specifying
>> ieee80211-freq-limit
>> (fail to register secondary phy due to error)
>> - mtd-mac-address in the wifi node is required for using
>> mtd-mac-address-increment
>>
>> Signed-off-by: INAGAKI Hiroshi <musashino.open at gmail.com>
>> ---
>> .../dts/mt7621_elecom_wrc-1167gs2-b.dts | 57 ++++++
>> .../dts/mt7621_elecom_wrc-1167gsxx.dtsi | 179 ++++++++++++++++++
>> target/linux/ramips/image/mt7621.mk | 8 +
>> 3 files changed, 244 insertions(+)
>> create mode 100644 target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-
>> b.dts
>> create mode 100644 target/linux/ramips/dts/mt7621_elecom_wrc-
>> 1167gsxx.dtsi
>>
>> diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts
>> b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts
>> new file mode 100644
>> index 0000000000..af0c580c64
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts
>> @@ -0,0 +1,57 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>> +
>> +#include "mt7621_elecom_wrc-1167gsxx.dtsi"
>> +
>> +/ {
>> + compatible = "elecom,wrc-1167gs2-b", "mediatek,mt7621-soc";
>> + model = "ELECOM WRC-1167GS2-B";
>> +
>> + aliases {
>> + label-mac-device = &wan;
>> + };
>> +};
>> +
>> +&gmac0 {
>> + mtd-mac-address = <&factory 0xfff4>;
>> +};
>> +
>> +&wan {
>> + mtd-mac-address = <&factory 0xfffa>;
>> +};
>> +
>> +&partitions {
>> + partition at 50000 {
>> + compatible = "denx,uimage";
>> + label = "firmware";
>> + reg = <0x50000 0xb00000>;
>> + };
>> +
>> + partition at b50000 {
>> + label = "tm_pattern";
>> + reg = <0xb50000 0x380000>;
>> + read-only;
>> + };
>> +
>> + partition at ed0000 {
>> + label = "tm_key";
>> + reg = <0xed0000 0x80000>;
>> + read-only;
>> + };
>> +
>> + partition at f50000 {
>> + label = "nvram";
>> + reg = <0xf50000 0x30000>;
>> + read-only;
>> + };
>> +
>> + partition at f80000 {
>> + label = "user_data";
>> + reg = <0xf80000 0x80000>;
>> + read-only;
>> + };
>> +};
>> +
>> +&wifi {
>> + mtd-mac-address = <&factory 0x4>;
>> + mtd-mac-address-increment = <(-1)>;
>> +};
>> diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1167gsxx.dtsi
>> b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gsxx.dtsi
>> new file mode 100644
>> index 0000000000..a13ddc963f
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gsxx.dtsi
>> @@ -0,0 +1,179 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>> +
>> +#include "mt7621.dtsi"
>> +
>> +#include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/input/input.h>
>> +
>> +/ {
>> + aliases {
>> + led-boot = &led_power_green;
>> + led-failsafe = &led_power_green;
>> + led-running = &led_power_green;
>> + led-upgrade = &led_power_green;
>> + };
>> +
>> + leds {
>> + compatible = "gpio-leds";
>> +
>> + wlan2g {
>> + label = "white:wlan2g";
>> + gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
>> + };
>> +
>> + wlan5g {
>> + label = "white:wlan5g";
>> + gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
>> + };
>> +
>> + led_power_green: power_green {
>> + label = "green:power";
>> + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
>> + };
>> +
>> + power_blue {
>> + label = "blue:power";
>> + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
>> + };
>> +
>> + wps {
>> + label = "red:wps";
>> + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
>> + };
>> +
>> + power_red {
>> + label = "red:power";
>> + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
>> + };
>> + };
>> +
>> + keys {
>> + compatible = "gpio-keys";
>> +
>> + reset {
>> + label = "reset";
>> + gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
>> + linux,code = <KEY_RESTART>;
>> + };
>> +
>> + wps {
>> + label = "wps";
>> + gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
>> + linux,code = <KEY_WPS_BUTTON>;
>> + };
>> +
>> + client {
>> + label = "client";
>> + gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
>> + linux,code = <BTN_0>;
>> + linux,input-type = <EV_SW>;
>> + };
>> +
>> + ap {
>> + label = "ap";
>> + gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
>> + linux,code = <BTN_0>;
>> + linux,input-type = <EV_SW>;
>> + };
>> +
>> + extender {
>> + label = "extender";
>> + gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
>> + linux,code = <BTN_0>;
>> + linux,input-type = <EV_SW>;
>> + };
>> +
>> + router {
>> + label = "router";
>> + gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
>> + linux,code = <BTN_0>;
>> + linux,input-type = <EV_SW>;
>> + };
>> + };
>> +};
>> +
>> +&switch0 {
>> + ports {
>> + wan: port at 0 {
>> + status = "okay";
>> + label = "wan";
>> + };
>> +
>> + port at 1 {
>> + status = "okay";
>> + label = "lan4";
>> + };
>> +
>> + port at 2 {
>> + status = "okay";
>> + label = "lan3";
>> + };
>> +
>> + port at 3 {
>> + status = "okay";
>> + label = "lan2";
>> + };
>> +
>> + port at 4 {
>> + status = "okay";
>> + label = "lan1";
>> + };
>> + };
>> +};
>> +
>> +&spi0 {
>> + status = "okay";
>> +
>> + flash at 0 {
>> + compatible = "jedec,spi-nor";
>> + reg = <0>;
>> + spi-max-frequency = <40000000>;
>> +
>> + partitions: partitions {
>> + compatible = "fixed-partitions";
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> +
>> + partition at 0 {
>> + label = "u-boot";
>> + reg = <0x0 0x30000>;
>> + read-only;
>> + };
>> +
>> + partition at 30000 {
>> + label = "u-boot-env";
>> + reg = <0x30000 0x10000>;
>> + read-only;
>> + };
>> +
>> + factory: partition at 40000 {
>> + label = "factory";
>> + reg = <0x40000 0x10000>;
>> + read-only;
>> + };
>> + };
>> + };
>> +};
>> +
>> +&pcie {
>> + status = "okay";
>> +};
>> +
>> +&pcie0 {
>> + wifi: wifi at 0,0 {
>> + compatible = "mediatek,mt76";
>> + reg = <0x0000 0 0 0 0>;
>> + mediatek,mtd-eeprom = <&factory 0x0>;
>> + };
>> +};
>> +
>> +&state_default {
>> + gpio {
>> + groups = "i2c", "uart3", "jtag", "wdt", "sdhci";
>> + function = "gpio";
>> + };
>> +};
>> +
>> +&xhci {
>> + status = "disabled";
>> +};
>> diff --git a/target/linux/ramips/image/mt7621.mk
>> b/target/linux/ramips/image/mt7621.mk
>> index ce9a3ae3d2..468c6ad4da 100644
>> --- a/target/linux/ramips/image/mt7621.mk
>> +++ b/target/linux/ramips/image/mt7621.mk
>> @@ -404,6 +404,14 @@ define Device/elecom_wrc-gs
>> DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware endef
>>
>> +define Device/elecom_wrc-1167gs2-b
>> + $(Device/elecom_wrc-gs)
>> + IMAGE_SIZE := 11264k
>> + DEVICE_MODEL := WRC-1167GS2-B
>> + ELECOM_HWNAME := WRC-1167GS2
>> +endef
>> +TARGET_DEVICES += elecom_wrc-1167gs2-b
>> +
>> define Device/elecom_wrc-1750gs
>> $(Device/elecom_wrc-gs)
>> IMAGE_SIZE := 11264k
>> --
>> 2.28.0.windows.1
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list