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

INAGAKI Hiroshi musashino.open at gmail.com
Sat Dec 19 08:53:30 EST 2020


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 at 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 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: -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 at OpenWrt:/# cat /sys/class/ieee80211/phy1/macaddress
04:ab:18:58:2f:15
root at OpenWrt:/# . /lib/functions.sh; . /lib/functions/system.sh
root at OpenWrt:/# mtd_get_mac_binary factory 0x4
04:ab:18:58:2f:16root at 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 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
>> _______________________________________________
>> 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