diff mbox series

[1/2] ramips: add support for ELECOM WRC-1167GS2-B

Message ID 20201128094113.1109-2-musashino.open@gmail.com
State Superseded
Delegated to: Adrian Schmutzler
Headers show
Series ramips: add support for ELECOM 2x2 11ac devices with MT7621 | expand

Commit Message

INAGAKI Hiroshi Nov. 28, 2020, 9:41 a.m. UTC
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
- 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@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

Comments

Adrian Schmutzler Dec. 14, 2020, 2:43 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of INAGAKI Hiroshi
> Sent: Samstag, 28. November 2020 10:41
> To: openwrt-devel@lists.openwrt.org
> Cc: INAGAKI Hiroshi <musashino.open@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

> - 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@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@50000 {
> +		compatible = "denx,uimage";
> +		label = "firmware";
> +		reg = <0x50000 0xb00000>;
> +	};
> +
> +	partition@b50000 {
> +		label = "tm_pattern";
> +		reg = <0xb50000 0x380000>;
> +		read-only;
> +	};
> +
> +	partition@ed0000 {
> +		label = "tm_key";
> +		reg = <0xed0000 0x80000>;
> +		read-only;
> +	};
> +
> +	partition@f50000 {
> +		label = "nvram";
> +		reg = <0xf50000 0x30000>;
> +		read-only;
> +	};
> +
> +	partition@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@0 {
> +			status = "okay";
> +			label = "wan";
> +		};
> +
> +		port@1 {
> +			status = "okay";
> +			label = "lan4";
> +		};
> +
> +		port@2 {
> +			status = "okay";
> +			label = "lan3";
> +		};
> +
> +		port@3 {
> +			status = "okay";
> +			label = "lan2";
> +		};
> +
> +		port@4 {
> +			status = "okay";
> +			label = "lan1";
> +		};
> +	};
> +};
> +
> +&spi0 {
> +	status = "okay";
> +
> +	flash@0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <40000000>;
> +
> +		partitions: partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "u-boot";
> +				reg = <0x0 0x30000>;
> +				read-only;
> +			};
> +
> +			partition@30000 {
> +				label = "u-boot-env";
> +				reg = <0x30000 0x10000>;
> +				read-only;
> +			};
> +
> +			factory: partition@40000 {
> +				label = "factory";
> +				reg = <0x40000 0x10000>;
> +				read-only;
> +			};
> +		};
> +	};
> +};
> +
> +&pcie {
> +	status = "okay";
> +};
> +
> +&pcie0 {
> +	wifi: wifi@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@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
INAGAKI Hiroshi Dec. 15, 2020, 8:26 a.m. UTC | #2
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@lists.openwrt.org]
>> On Behalf Of INAGAKI Hiroshi
>> Sent: Samstag, 28. November 2020 10:41
>> To: openwrt-devel@lists.openwrt.org
>> Cc: INAGAKI Hiroshi <musashino.open@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@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@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@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@50000 {
>> +		compatible = "denx,uimage";
>> +		label = "firmware";
>> +		reg = <0x50000 0xb00000>;
>> +	};
>> +
>> +	partition@b50000 {
>> +		label = "tm_pattern";
>> +		reg = <0xb50000 0x380000>;
>> +		read-only;
>> +	};
>> +
>> +	partition@ed0000 {
>> +		label = "tm_key";
>> +		reg = <0xed0000 0x80000>;
>> +		read-only;
>> +	};
>> +
>> +	partition@f50000 {
>> +		label = "nvram";
>> +		reg = <0xf50000 0x30000>;
>> +		read-only;
>> +	};
>> +
>> +	partition@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@0 {
>> +			status = "okay";
>> +			label = "wan";
>> +		};
>> +
>> +		port@1 {
>> +			status = "okay";
>> +			label = "lan4";
>> +		};
>> +
>> +		port@2 {
>> +			status = "okay";
>> +			label = "lan3";
>> +		};
>> +
>> +		port@3 {
>> +			status = "okay";
>> +			label = "lan2";
>> +		};
>> +
>> +		port@4 {
>> +			status = "okay";
>> +			label = "lan1";
>> +		};
>> +	};
>> +};
>> +
>> +&spi0 {
>> +	status = "okay";
>> +
>> +	flash@0 {
>> +		compatible = "jedec,spi-nor";
>> +		reg = <0>;
>> +		spi-max-frequency = <40000000>;
>> +
>> +		partitions: partitions {
>> +			compatible = "fixed-partitions";
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +
>> +			partition@0 {
>> +				label = "u-boot";
>> +				reg = <0x0 0x30000>;
>> +				read-only;
>> +			};
>> +
>> +			partition@30000 {
>> +				label = "u-boot-env";
>> +				reg = <0x30000 0x10000>;
>> +				read-only;
>> +			};
>> +
>> +			factory: partition@40000 {
>> +				label = "factory";
>> +				reg = <0x40000 0x10000>;
>> +				read-only;
>> +			};
>> +		};
>> +	};
>> +};
>> +
>> +&pcie {
>> +	status = "okay";
>> +};
>> +
>> +&pcie0 {
>> +	wifi: wifi@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@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Adrian Schmutzler Dec. 15, 2020, 10:42 a.m. UTC | #3
Hi,

> 
> I've tested it, but doesn't work.

Okay, it was worth a try. Maybe it's a similar driver issue on ramips like that one we had about one year ago, where a similar case was not "picked up" from 10_fix_wifi_mac for a single radio ...

Best

Adrian

> 
> 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@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@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@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@50000 {
> >> +		compatible = "denx,uimage";
> >> +		label = "firmware";
> >> +		reg = <0x50000 0xb00000>;
> >> +	};
> >> +
> >> +	partition@b50000 {
> >> +		label = "tm_pattern";
> >> +		reg = <0xb50000 0x380000>;
> >> +		read-only;
> >> +	};
> >> +
> >> +	partition@ed0000 {
> >> +		label = "tm_key";
> >> +		reg = <0xed0000 0x80000>;
> >> +		read-only;
> >> +	};
> >> +
> >> +	partition@f50000 {
> >> +		label = "nvram";
> >> +		reg = <0xf50000 0x30000>;
> >> +		read-only;
> >> +	};
> >> +
> >> +	partition@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@0 {
> >> +			status = "okay";
> >> +			label = "wan";
> >> +		};
> >> +
> >> +		port@1 {
> >> +			status = "okay";
> >> +			label = "lan4";
> >> +		};
> >> +
> >> +		port@2 {
> >> +			status = "okay";
> >> +			label = "lan3";
> >> +		};
> >> +
> >> +		port@3 {
> >> +			status = "okay";
> >> +			label = "lan2";
> >> +		};
> >> +
> >> +		port@4 {
> >> +			status = "okay";
> >> +			label = "lan1";
> >> +		};
> >> +	};
> >> +};
> >> +
> >> +&spi0 {
> >> +	status = "okay";
> >> +
> >> +	flash@0 {
> >> +		compatible = "jedec,spi-nor";
> >> +		reg = <0>;
> >> +		spi-max-frequency = <40000000>;
> >> +
> >> +		partitions: partitions {
> >> +			compatible = "fixed-partitions";
> >> +			#address-cells = <1>;
> >> +			#size-cells = <1>;
> >> +
> >> +			partition@0 {
> >> +				label = "u-boot";
> >> +				reg = <0x0 0x30000>;
> >> +				read-only;
> >> +			};
> >> +
> >> +			partition@30000 {
> >> +				label = "u-boot-env";
> >> +				reg = <0x30000 0x10000>;
> >> +				read-only;
> >> +			};
> >> +
> >> +			factory: partition@40000 {
> >> +				label = "factory";
> >> +				reg = <0x40000 0x10000>;
> >> +				read-only;
> >> +			};
> >> +		};
> >> +	};
> >> +};
> >> +
> >> +&pcie {
> >> +	status = "okay";
> >> +};
> >> +
> >> +&pcie0 {
> >> +	wifi: wifi@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@lists.openwrt.org
> >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Adrian Schmutzler Dec. 19, 2020, 12:22 a.m. UTC | #4
Hi,

> >> 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,

sorry, but would you test again please with the 10_fix_wifi_mac changes and recent master?

There have been several changes to mt76 in b837534f029da10abbd1069392867e0700134ace that might be relevant/helping.

Best

Adrian

> 
> ```
> 
> 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@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@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@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@50000 {
> >> +		compatible = "denx,uimage";
> >> +		label = "firmware";
> >> +		reg = <0x50000 0xb00000>;
> >> +	};
> >> +
> >> +	partition@b50000 {
> >> +		label = "tm_pattern";
> >> +		reg = <0xb50000 0x380000>;
> >> +		read-only;
> >> +	};
> >> +
> >> +	partition@ed0000 {
> >> +		label = "tm_key";
> >> +		reg = <0xed0000 0x80000>;
> >> +		read-only;
> >> +	};
> >> +
> >> +	partition@f50000 {
> >> +		label = "nvram";
> >> +		reg = <0xf50000 0x30000>;
> >> +		read-only;
> >> +	};
> >> +
> >> +	partition@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@0 {
> >> +			status = "okay";
> >> +			label = "wan";
> >> +		};
> >> +
> >> +		port@1 {
> >> +			status = "okay";
> >> +			label = "lan4";
> >> +		};
> >> +
> >> +		port@2 {
> >> +			status = "okay";
> >> +			label = "lan3";
> >> +		};
> >> +
> >> +		port@3 {
> >> +			status = "okay";
> >> +			label = "lan2";
> >> +		};
> >> +
> >> +		port@4 {
> >> +			status = "okay";
> >> +			label = "lan1";
> >> +		};
> >> +	};
> >> +};
> >> +
> >> +&spi0 {
> >> +	status = "okay";
> >> +
> >> +	flash@0 {
> >> +		compatible = "jedec,spi-nor";
> >> +		reg = <0>;
> >> +		spi-max-frequency = <40000000>;
> >> +
> >> +		partitions: partitions {
> >> +			compatible = "fixed-partitions";
> >> +			#address-cells = <1>;
> >> +			#size-cells = <1>;
> >> +
> >> +			partition@0 {
> >> +				label = "u-boot";
> >> +				reg = <0x0 0x30000>;
> >> +				read-only;
> >> +			};
> >> +
> >> +			partition@30000 {
> >> +				label = "u-boot-env";
> >> +				reg = <0x30000 0x10000>;
> >> +				read-only;
> >> +			};
> >> +
> >> +			factory: partition@40000 {
> >> +				label = "factory";
> >> +				reg = <0x40000 0x10000>;
> >> +				read-only;
> >> +			};
> >> +		};
> >> +	};
> >> +};
> >> +
> >> +&pcie {
> >> +	status = "okay";
> >> +};
> >> +
> >> +&pcie0 {
> >> +	wifi: wifi@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@lists.openwrt.org
> >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
INAGAKI Hiroshi Dec. 19, 2020, 1:53 p.m. UTC | #5
Hello,

On 2020/12/19 9:22, Adrian Schmutzler wrote:
> Hi,
>
>>>> 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,
> sorry, but would you test again please with the 10_fix_wifi_mac changes and recent master?
>
> There have been several changes to mt76 in b837534f029da10abbd1069392867e0700134ace that might be relevant/helping.
>
> Best
>
> Adrian

Thank you for letting me know.

I tried the same modification I did, but it still doesn't works. After 
that

bumping of mt76, secondary phy (ext_phy) uses the same MAC address 
with primary

phy (for 2.4GHz) and the address for secondary phy cannot be configured by

10_fix_wifi_mac...


```

(WRC-1167GS2-B)

root@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: -92 dBm
           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: 04:AB:18:58:2F:15
           Mode: Client  Channel: unknown (unknown)
           Tx-Power: 20 dBm  Link Quality: unknown/70
           Signal: unknown  Noise: -92 dBm
           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@OpenWrt:/# cat /sys/class/ieee80211/phy1/macaddress
04:ab:18:58:2f:15
root@OpenWrt:/# . /lib/functions.sh; . /lib/functions/system.sh
root@OpenWrt:/# mtd_get_mac_binary factory 0x4
04:ab:18:58:2f:16root@OpenWrt:/#

```

regards,

Hiroshi

>> ```
>>
>> 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@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@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@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@50000 {
>>>> +		compatible = "denx,uimage";
>>>> +		label = "firmware";
>>>> +		reg = <0x50000 0xb00000>;
>>>> +	};
>>>> +
>>>> +	partition@b50000 {
>>>> +		label = "tm_pattern";
>>>> +		reg = <0xb50000 0x380000>;
>>>> +		read-only;
>>>> +	};
>>>> +
>>>> +	partition@ed0000 {
>>>> +		label = "tm_key";
>>>> +		reg = <0xed0000 0x80000>;
>>>> +		read-only;
>>>> +	};
>>>> +
>>>> +	partition@f50000 {
>>>> +		label = "nvram";
>>>> +		reg = <0xf50000 0x30000>;
>>>> +		read-only;
>>>> +	};
>>>> +
>>>> +	partition@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@0 {
>>>> +			status = "okay";
>>>> +			label = "wan";
>>>> +		};
>>>> +
>>>> +		port@1 {
>>>> +			status = "okay";
>>>> +			label = "lan4";
>>>> +		};
>>>> +
>>>> +		port@2 {
>>>> +			status = "okay";
>>>> +			label = "lan3";
>>>> +		};
>>>> +
>>>> +		port@3 {
>>>> +			status = "okay";
>>>> +			label = "lan2";
>>>> +		};
>>>> +
>>>> +		port@4 {
>>>> +			status = "okay";
>>>> +			label = "lan1";
>>>> +		};
>>>> +	};
>>>> +};
>>>> +
>>>> +&spi0 {
>>>> +	status = "okay";
>>>> +
>>>> +	flash@0 {
>>>> +		compatible = "jedec,spi-nor";
>>>> +		reg = <0>;
>>>> +		spi-max-frequency = <40000000>;
>>>> +
>>>> +		partitions: partitions {
>>>> +			compatible = "fixed-partitions";
>>>> +			#address-cells = <1>;
>>>> +			#size-cells = <1>;
>>>> +
>>>> +			partition@0 {
>>>> +				label = "u-boot";
>>>> +				reg = <0x0 0x30000>;
>>>> +				read-only;
>>>> +			};
>>>> +
>>>> +			partition@30000 {
>>>> +				label = "u-boot-env";
>>>> +				reg = <0x30000 0x10000>;
>>>> +				read-only;
>>>> +			};
>>>> +
>>>> +			factory: partition@40000 {
>>>> +				label = "factory";
>>>> +				reg = <0x40000 0x10000>;
>>>> +				read-only;
>>>> +			};
>>>> +		};
>>>> +	};
>>>> +};
>>>> +
>>>> +&pcie {
>>>> +	status = "okay";
>>>> +};
>>>> +
>>>> +&pcie0 {
>>>> +	wifi: wifi@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@lists.openwrt.org
>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Adrian Schmutzler Dec. 19, 2020, 7:38 p.m. UTC | #6
Hi,

> -----Original Message-----
> From: INAGAKI Hiroshi [mailto:musashino.open@gmail.com]
> Sent: Samstag, 19. Dezember 2020 14:54
> To: Adrian Schmutzler <mail@adrianschmutzler.de>; openwrt-
> devel@lists.openwrt.org
> Subject: Re: [PATCH 1/2] ramips: add support for ELECOM WRC-1167GS2-B

okay, looks like we can't fix it for now.

I'm considering to merge it in the current state, as the only unfixed issues appear to be the MAC address and the frequency limiting, so the device is generally working?

I've tried to mess with the DTSI files so we can reuse the existing mt7621_elecom_wrc-gs.dtsi. The result has been pushed to my staging:

https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/staging

Please tell me whether you like it or not. Not liking it is also okay ;-)

Best

Adrian

> 
> Hello,
> 
> On 2020/12/19 9:22, Adrian Schmutzler wrote:
> > Hi,
> >
> >>>> 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,
> > sorry, but would you test again please with the 10_fix_wifi_mac changes
> and recent master?
> >
> > There have been several changes to mt76 in
> b837534f029da10abbd1069392867e0700134ace that might be
> relevant/helping.
> >
> > Best
> >
> > Adrian
> 
> Thank you for letting me know.
> 
> I tried the same modification I did, but it still doesn't works. After that
> 
> bumping of mt76, secondary phy (ext_phy) uses the same MAC address with
> primary
> 
> phy (for 2.4GHz) and the address for secondary phy cannot be configured by
> 
> 10_fix_wifi_mac...
> 
> 
> ```
> 
> (WRC-1167GS2-B)
> 
> root@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: -92 dBm
>            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: 04:AB:18:58:2F:15
>            Mode: Client  Channel: unknown (unknown)
>            Tx-Power: 20 dBm  Link Quality: unknown/70
>            Signal: unknown  Noise: -92 dBm
>            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@OpenWrt:/# cat /sys/class/ieee80211/phy1/macaddress
> 04:ab:18:58:2f:15
> root@OpenWrt:/# . /lib/functions.sh; . /lib/functions/system.sh
> root@OpenWrt:/# mtd_get_mac_binary factory 0x4
> 04:ab:18:58:2f:16root@OpenWrt:/#
> 
> ```
> 
> regards,
> 
> Hiroshi
> 
> >> ```
> >>
> >> 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@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@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@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@50000 {
> >>>> +		compatible = "denx,uimage";
> >>>> +		label = "firmware";
> >>>> +		reg = <0x50000 0xb00000>;
> >>>> +	};
> >>>> +
> >>>> +	partition@b50000 {
> >>>> +		label = "tm_pattern";
> >>>> +		reg = <0xb50000 0x380000>;
> >>>> +		read-only;
> >>>> +	};
> >>>> +
> >>>> +	partition@ed0000 {
> >>>> +		label = "tm_key";
> >>>> +		reg = <0xed0000 0x80000>;
> >>>> +		read-only;
> >>>> +	};
> >>>> +
> >>>> +	partition@f50000 {
> >>>> +		label = "nvram";
> >>>> +		reg = <0xf50000 0x30000>;
> >>>> +		read-only;
> >>>> +	};
> >>>> +
> >>>> +	partition@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@0 {
> >>>> +			status = "okay";
> >>>> +			label = "wan";
> >>>> +		};
> >>>> +
> >>>> +		port@1 {
> >>>> +			status = "okay";
> >>>> +			label = "lan4";
> >>>> +		};
> >>>> +
> >>>> +		port@2 {
> >>>> +			status = "okay";
> >>>> +			label = "lan3";
> >>>> +		};
> >>>> +
> >>>> +		port@3 {
> >>>> +			status = "okay";
> >>>> +			label = "lan2";
> >>>> +		};
> >>>> +
> >>>> +		port@4 {
> >>>> +			status = "okay";
> >>>> +			label = "lan1";
> >>>> +		};
> >>>> +	};
> >>>> +};
> >>>> +
> >>>> +&spi0 {
> >>>> +	status = "okay";
> >>>> +
> >>>> +	flash@0 {
> >>>> +		compatible = "jedec,spi-nor";
> >>>> +		reg = <0>;
> >>>> +		spi-max-frequency = <40000000>;
> >>>> +
> >>>> +		partitions: partitions {
> >>>> +			compatible = "fixed-partitions";
> >>>> +			#address-cells = <1>;
> >>>> +			#size-cells = <1>;
> >>>> +
> >>>> +			partition@0 {
> >>>> +				label = "u-boot";
> >>>> +				reg = <0x0 0x30000>;
> >>>> +				read-only;
> >>>> +			};
> >>>> +
> >>>> +			partition@30000 {
> >>>> +				label = "u-boot-env";
> >>>> +				reg = <0x30000 0x10000>;
> >>>> +				read-only;
> >>>> +			};
> >>>> +
> >>>> +			factory: partition@40000 {
> >>>> +				label = "factory";
> >>>> +				reg = <0x40000 0x10000>;
> >>>> +				read-only;
> >>>> +			};
> >>>> +		};
> >>>> +	};
> >>>> +};
> >>>> +
> >>>> +&pcie {
> >>>> +	status = "okay";
> >>>> +};
> >>>> +
> >>>> +&pcie0 {
> >>>> +	wifi: wifi@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@lists.openwrt.org
> >>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >> _______________________________________________
> >> openwrt-devel mailing list
> >> openwrt-devel@lists.openwrt.org
> >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
INAGAKI Hiroshi Dec. 20, 2020, 7:34 a.m. UTC | #7
Hello,

On 2020/12/20 4:38, Adrian Schmutzler wrote:
> Hi,
>
>> -----Original Message-----
>> From: INAGAKI Hiroshi [mailto:musashino.open@gmail.com]
>> Sent: Samstag, 19. Dezember 2020 14:54
>> To: Adrian Schmutzler <mail@adrianschmutzler.de>; openwrt-
>> devel@lists.openwrt.org
>> Subject: Re: [PATCH 1/2] ramips: add support for ELECOM WRC-1167GS2-B
> okay, looks like we can't fix it for now.
>
> I'm considering to merge it in the current state, as the only unfixed issues appear to be the MAC address and the frequency limiting, so the device is generally working?
Yes, WRC-1167GS2-B and WRC-1167GST2 are generally working.
>
> I've tried to mess with the DTSI files so we can reuse the existing mt7621_elecom_wrc-gs.dtsi. The result has been pushed to my staging:
>
> https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/staging
>
> Please tell me whether you like it or not. Not liking it is also okay ;-)
>
> Best
>
> Adrian

Thank you for your work, looks good to me :)


regards,

Hiroshi

>> Hello,
>>
>> On 2020/12/19 9:22, Adrian Schmutzler wrote:
>>> Hi,
>>>
>>>>>> 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,
>>> sorry, but would you test again please with the 10_fix_wifi_mac changes
>> and recent master?
>>> There have been several changes to mt76 in
>> b837534f029da10abbd1069392867e0700134ace that might be
>> relevant/helping.
>>> Best
>>>
>>> Adrian
>> Thank you for letting me know.
>>
>> I tried the same modification I did, but it still doesn't works. After that
>>
>> bumping of mt76, secondary phy (ext_phy) uses the same MAC address with
>> primary
>>
>> phy (for 2.4GHz) and the address for secondary phy cannot be configured by
>>
>> 10_fix_wifi_mac...
>>
>>
>> ```
>>
>> (WRC-1167GS2-B)
>>
>> root@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: -92 dBm
>>             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: 04:AB:18:58:2F:15
>>             Mode: Client  Channel: unknown (unknown)
>>             Tx-Power: 20 dBm  Link Quality: unknown/70
>>             Signal: unknown  Noise: -92 dBm
>>             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@OpenWrt:/# cat /sys/class/ieee80211/phy1/macaddress
>> 04:ab:18:58:2f:15
>> root@OpenWrt:/# . /lib/functions.sh; . /lib/functions/system.sh
>> root@OpenWrt:/# mtd_get_mac_binary factory 0x4
>> 04:ab:18:58:2f:16root@OpenWrt:/#
>>
>> ```
>>
>> regards,
>>
>> Hiroshi
>>
>>>> ```
>>>>
>>>> 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@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@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@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@50000 {
>>>>>> +		compatible = "denx,uimage";
>>>>>> +		label = "firmware";
>>>>>> +		reg = <0x50000 0xb00000>;
>>>>>> +	};
>>>>>> +
>>>>>> +	partition@b50000 {
>>>>>> +		label = "tm_pattern";
>>>>>> +		reg = <0xb50000 0x380000>;
>>>>>> +		read-only;
>>>>>> +	};
>>>>>> +
>>>>>> +	partition@ed0000 {
>>>>>> +		label = "tm_key";
>>>>>> +		reg = <0xed0000 0x80000>;
>>>>>> +		read-only;
>>>>>> +	};
>>>>>> +
>>>>>> +	partition@f50000 {
>>>>>> +		label = "nvram";
>>>>>> +		reg = <0xf50000 0x30000>;
>>>>>> +		read-only;
>>>>>> +	};
>>>>>> +
>>>>>> +	partition@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@0 {
>>>>>> +			status = "okay";
>>>>>> +			label = "wan";
>>>>>> +		};
>>>>>> +
>>>>>> +		port@1 {
>>>>>> +			status = "okay";
>>>>>> +			label = "lan4";
>>>>>> +		};
>>>>>> +
>>>>>> +		port@2 {
>>>>>> +			status = "okay";
>>>>>> +			label = "lan3";
>>>>>> +		};
>>>>>> +
>>>>>> +		port@3 {
>>>>>> +			status = "okay";
>>>>>> +			label = "lan2";
>>>>>> +		};
>>>>>> +
>>>>>> +		port@4 {
>>>>>> +			status = "okay";
>>>>>> +			label = "lan1";
>>>>>> +		};
>>>>>> +	};
>>>>>> +};
>>>>>> +
>>>>>> +&spi0 {
>>>>>> +	status = "okay";
>>>>>> +
>>>>>> +	flash@0 {
>>>>>> +		compatible = "jedec,spi-nor";
>>>>>> +		reg = <0>;
>>>>>> +		spi-max-frequency = <40000000>;
>>>>>> +
>>>>>> +		partitions: partitions {
>>>>>> +			compatible = "fixed-partitions";
>>>>>> +			#address-cells = <1>;
>>>>>> +			#size-cells = <1>;
>>>>>> +
>>>>>> +			partition@0 {
>>>>>> +				label = "u-boot";
>>>>>> +				reg = <0x0 0x30000>;
>>>>>> +				read-only;
>>>>>> +			};
>>>>>> +
>>>>>> +			partition@30000 {
>>>>>> +				label = "u-boot-env";
>>>>>> +				reg = <0x30000 0x10000>;
>>>>>> +				read-only;
>>>>>> +			};
>>>>>> +
>>>>>> +			factory: partition@40000 {
>>>>>> +				label = "factory";
>>>>>> +				reg = <0x40000 0x10000>;
>>>>>> +				read-only;
>>>>>> +			};
>>>>>> +		};
>>>>>> +	};
>>>>>> +};
>>>>>> +
>>>>>> +&pcie {
>>>>>> +	status = "okay";
>>>>>> +};
>>>>>> +
>>>>>> +&pcie0 {
>>>>>> +	wifi: wifi@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@lists.openwrt.org
>>>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>> _______________________________________________
>>>> openwrt-devel mailing list
>>>> openwrt-devel@lists.openwrt.org
>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

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@50000 {
+		compatible = "denx,uimage";
+		label = "firmware";
+		reg = <0x50000 0xb00000>;
+	};
+
+	partition@b50000 {
+		label = "tm_pattern";
+		reg = <0xb50000 0x380000>;
+		read-only;
+	};
+
+	partition@ed0000 {
+		label = "tm_key";
+		reg = <0xed0000 0x80000>;
+		read-only;
+	};
+
+	partition@f50000 {
+		label = "nvram";
+		reg = <0xf50000 0x30000>;
+		read-only;
+	};
+
+	partition@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@0 {
+			status = "okay";
+			label = "wan";
+		};
+
+		port@1 {
+			status = "okay";
+			label = "lan4";
+		};
+
+		port@2 {
+			status = "okay";
+			label = "lan3";
+		};
+
+		port@3 {
+			status = "okay";
+			label = "lan2";
+		};
+
+		port@4 {
+			status = "okay";
+			label = "lan1";
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+
+		partitions: partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition@30000 {
+				label = "u-boot-env";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			factory: partition@40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
+
+&pcie0 {
+	wifi: wifi@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