[PATCH 1/2] ramips: mt7621: Add Arcadyan WE420223-99 support

Arınç ÜNAL arinc.unal at arinc9.com
Mon Jan 2 07:37:27 PST 2023


On 2.01.2023 18:34, Harm Berntsen wrote:
> On Mon, 2023-01-02 at 18:18 +0300, Arınç ÜNAL wrote:
>> On 2.01.2023 18:03, Harm Berntsen wrote:
>>> On Wed, 2022-12-28 at 23:11 +0300, Arınç ÜNAL wrote:
>>>>> The Arcadyan WE420223-99 is a WiFi AC simultaneous dual-band
>>>>> access
>>>>> point distributed as Experia WiFi by KPN in the Netherlands. It
>>>>> features
>>>>> two ethernet ports and 2 internal antennas.
>>>>>
>>>>> Specifications
>>>>> --------------
>>>>> SOC   : Mediatek MT7621AT
>>>>> ETH   : Two 1 gigabit ports, built into the SOC
>>>>> WIFI  : MT7615DN
>>>>> BUTTON: Reset
>>>>> BUTTON: WPS
>>>>> LED   : Power (green+red)
>>>>> LED   : WiFi (green+blue)
>>>>> LED   : WPS (green+red)
>>>>> LED   : Followme (green+red)
>>>>> Power : 12 VDC, 1A barrel plug
>>>>>
>>>>> Winbond variant:
>>>>> RAM   : Winbond W631GG6MB12J, 1GBIT DDR3 SDRAM
>>>>> Flash : Winbond W25Q256JVFQ, 256Mb SPI
>>>>> U-Boot: 1.1.3 (Nov 23 2017 - 16:40:17), Ralink 5.0.0.1
>>>>>
>>>>> Macronix variant:
>>>>> RAM   : Nanya NT5CC64M16GP-DI, 1GBIT DDR3 SDRAM
>>>>> Flash : MX25l25635FMI-10G, 256Mb SPI
>>>>> U-Boot: 1.1.3 (Dec  4 2017 - 11:37:57), Ralink 5.0.0.1
>>>>>
>>>>> Serial
>>>>> ------
>>>>> The serial port needs a TTL/RS-232 3V3 level converter! The
>>>>> Serial
>>>>> setting is 57600-8-N-1. The board has an unpopulated 2.54mm
>>>>> straight pin
>>>>> header.
>>>>>
>>>>> The pinout is: VCC (the square), RX, TX, GND.
>>>>>
>>>>> Installation
>>>>> ------------
>>>>> 1. Open the device, take off the heat sink
>>>>> 2. Connect the SPI flash chip to a flasher, e.g. a Raspberry
>>>>> Pi.
>>>>> Also
>>>>>      connect the RESET pin for stability (thanks @FPSUsername
>>>>> for
>>>>> reporting)
>>>>> 3. Make a backup in case you want to revert to stock later
>>>>> 4. Flash the squashfs-factory.trx file to offset 0x50000 of the
>>>>> flash
>>>>> 5. Ensure the bootpartition variable is set to 0 in the U-Boot
>>>>>      environment located at 0x30000
>>>>>
>>>>> Note that the U-Boot is password protected, this can optionally
>>>>> be
>>>>> removed. See the forum for more details [1]
>>>>>
>>>>> MAC Addresses(stock)
>>>>> --------------------
>>>>> +----------+------------------+-------------------+
>>>>>> use      | address          | example           |
>>>>> +----------+------------------+-------------------+
>>>>>> Device   | label            | 00:00:00:11:00:00 |
>>>>>> Ethernet | + 3              | 00:00:00:11:00:03 |
>>>>>> 2g       | + 0x020000f00001 | 02:00:00:01:00:01 |
>>>>>> 5g       | + 1              | 00:00:00:11:00:01 |
>>>>> +----------+------------------+-------------------+
>>>>>
>>>>> The label address is stored in ASCII in the board_data
>>>>> partition
>>>>>
>>>>> Known issues
>>>>> ------------
>>>>> - 2g MAC address does not match stock due to missing support
>>>>> for
>>>>> that in
>>>>>     macaddr_add
>>>>> - Only the power LED is configured by default
>>>>>
>>>>> References
>>>>> ----------
>>>>> [1]
>>>>> https://forum.openwrt.org/t/adding-openwrt-support-for-arcadyan-we420223-99-kpn-experia-wifi/132653?u=harm
>>>>>
>>>>> Signed-off-by: Harm Berntsen <git at harmberntsen.nl>
>>>>> ---
>>>>>    package/boot/uboot-envtools/files/ramips      |   3 +
>>>>>    .../dts/mt7621_arcadyan_we420223-99.dts       | 210
>>>>> ++++++++++++++++++
>>>>>    target/linux/ramips/image/mt7621.mk           |  25 +++
>>>>>    .../mt7621/base-files/etc/board.d/02_network  |   8 +
>>>>>    .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   9 +
>>>>>    .../mt7621/base-files/lib/upgrade/platform.sh |   1 +
>>>>>    6 files changed, 256 insertions(+)
>>>>>    create mode 100644
>>>>> target/linux/ramips/dts/mt7621_arcadyan_we420223-99.dts
>>>>>
>>>>> diff --git a/package/boot/uboot-envtools/files/ramips
>>>>> b/package/boot/uboot-envtools/files/ramips
>>>>> index f7f4821cef..8d4960e7a3 100644
>>>>> --- a/package/boot/uboot-envtools/files/ramips
>>>>> +++ b/package/boot/uboot-envtools/files/ramips
>>>>> @@ -17,6 +17,9 @@ alfa-network,awusfree1|\
>>>>>    alfa-network,quad-e4g|\
>>>>>    alfa-network,r36m-e4g|\
>>>>>    alfa-network,tube-e4g|\
>>>>> +arcadyan,we420223-99)
>>>>> +       ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000"
>>>>> "0x1000"
>>>>> +       ;;
>>>>>    engenius,esr600h|\
>>>>>    sitecom,wlr-4100-v1-002)
>>>>>           ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000"
>>>>> "0x1000"
>>>>> diff --git a/target/linux/ramips/dts/mt7621_arcadyan_we420223-
>>>>> 99.dts b/target/linux/ramips/dts/mt7621_arcadyan_we420223-
>>>>> 99.dts
>>>>> new file mode 100644
>>>>> index 0000000000..f68d79af15
>>>>> --- /dev/null
>>>>> +++ b/target/linux/ramips/dts/mt7621_arcadyan_we420223-99.dts
>>>>> @@ -0,0 +1,210 @@
>>>>> +// 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>
>>>>> +#include <dt-bindings/leds/common.h>
>>>>> +
>>>>> +/ {
>>>>> +       model = "Arcadyan WE420223-99";
>>>>> +       compatible = "arcadyan,we420223-99", "mediatek,mt7621-
>>>>> soc";
>>>>> +
>>>>> +       aliases {
>>>>> +               led-boot = &led_power_green;
>>>>> +               led-failsafe = &led_power_red;
>>>>> +               led-running = &led_power_green;
>>>>> +               led-upgrade = &led_wps_green;
>>>>> +               led-wifi = &led_wifi_green;
>>>>> +       };
>>>>> +
>>>>> +       chosen {
>>>>> +               bootargs = "console=ttyS0,57600 ubi.mtd=5
>>>>> root=/dev/ubiblock0_0";
>>>>> +       };
>>>>> +
>>>>> +       keys {
>>>>> +               compatible = "gpio-keys";
>>>>> +
>>>>> +               reset {
>>>>> +                       label = "reset";
>>>>> +                       gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
>>>>> +                       linux,code = <KEY_RESTART>;
>>>>> +               };
>>>>> +
>>>>> +               wps {
>>>>> +                       label = "wps";
>>>>> +                       gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
>>>>> +                       linux,code = <KEY_WPS_BUTTON>;
>>>>> +               };
>>>>> +       };
>>>>> +
>>>>> +       leds {
>>>>> +               compatible = "gpio-leds";
>>>>> +
>>>>> +               led_power_green: power_green {
>>>>> +                       label = "green:power";
>>>>> +                       gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_GREEN>;
>>>>> +                       function = LED_FUNCTION_POWER;
>>>>> +                       default-state = "on";
>>>>> +               };
>>>>> +
>>>>> +               led_power_red: power_red {
>>>>> +                       label = "red:power";
>>>>> +                       gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_RED>;
>>>>> +                       function = LED_FUNCTION_FAULT;
>>>>> +               };
>>>>> +
>>>>> +               led_wifi_blue: wifi_blue {
>>>>> +                       label = "blue:wifi";
>>>>> +                       gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_BLUE>;
>>>>> +                       function = LED_FUNCTION_WLAN;
>>>>> +               };
>>>>> +
>>>>> +               led_wifi_green: wifi_green {
>>>>> +                       label = "green:wifi";
>>>>> +                       gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_GREEN>;
>>>>> +                       function = LED_FUNCTION_WLAN;
>>>>> +               };
>>>>> +
>>>>> +               led_wps_red: wps_red {
>>>>> +                       label = "red:wps";
>>>>> +                       gpios = <&gpio 45 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_RED>;
>>>>> +                       function = LED_FUNCTION_WPS;
>>>>> +               };
>>>>> +
>>>>> +               led_wps_green: wps_green {
>>>>> +                       label = "green:wps";
>>>>> +                       gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_GREEN>;
>>>>> +                       function = LED_FUNCTION_WPS;
>>>>> +               };
>>>>> +
>>>>> +               led_followme_r: followme_red {
>>>>> +                       label = "red:followme";
>>>>> +                       gpios = <&gpio 47 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_RED>;
>>>>> +               };
>>>>> +
>>>>> +               led_followme_g: followme_green {
>>>>> +                       label = "green:followme";
>>>>> +                       gpios = <&gpio 48 GPIO_ACTIVE_LOW>;
>>>>> +                       color = <LED_COLOR_ID_GREEN>;
>>>>> +               };
>>>>> +       };
>>>>> +};
>>>>> +
>>>>> +&spi0 {
>>>>> +       status = "okay";
>>>>> +
>>>>> +       flash at 0 {
>>>>> +               compatible = "jedec,spi-nor";
>>>>> +
>>>>> +               reg = <0>;
>>>>> +               spi-max-frequency = <70000000>;
>>>>> +
>>>>> +               partitions {
>>>>> +                       compatible = "fixed-partitions";
>>>>> +                       #address-cells = <1>;
>>>>> +                       #size-cells = <1>;
>>>>> +
>>>>> +                       partition at 0 {
>>>>> +                               label = "ALL";
>>>>> +                               reg = <0x0 0x2000000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1 {
>>>>> +                               label = "Bootloader";
>>>>> +                               reg = <0x0 0x30000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 30000 {
>>>>> +                               label = "Config";
>>>>> +                               reg = <0x30000 0x10000>;
>>>>> +                       };
>>>>> +
>>>>> +                       factory: partition at 40000 {
>>>>> +                               label = "Factory";
>>>>> +                               reg = <0x40000 0x10000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 50000 {
>>>>> +                               label = "kernel";
>>>>> +                               reg = <0x50000 0x1f60000>;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 490000 {
>>>>> +                               label = "rootfs";
>>>>> +                               reg = <0x490000 0x1b20000>;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1000000 {
>>>>> +                               label = "Kernel2";
>>>>> +                               reg = <0x1000000 0xfb0000>;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1440000 {
>>>>> +                               label = "RootFS2";
>>>>> +                               reg = <0x1440000 0xb70000>;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1fb0000 {
>>>>> +                               label = "glbcfg";
>>>>> +                               reg = <0x1fb0000 0x10000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1fc0000 {
>>>>> +                               label = "board_data";
>>>>> +                               reg = <0x1fc0000 0x10000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1fd0000 {
>>>>> +                               label = "glbcfg2";
>>>>> +                               reg = <0x1fd0000 0x10000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +
>>>>> +                       partition at 1fe0000 {
>>>>> +                               label = "board_data2";
>>>>> +                               reg = <0x1fe0000 0x10000>;
>>>>> +                               read-only;
>>>>> +                       };
>>>>> +               };
>>>>> +       };
>>>>> +};
>>>>> +
>>>>> +&xhci {
>>>>> +       status = "disabled";
>>>>> +};
>>>>> +
>>>>> +&switch0 {
>>>>> +       ports {
>>>>> +               port at 0 {
>>>>> +                       status = "okay";
>>>>> +               };
>>>>> +
>>>>> +               port at 1 {
>>>>> +                       status = "okay";
>>>>
>>>> Please define the label for the ports here.
>>>>
>>>> Arınç
>>>
>>> Thanks for reviewing Arınç.
>>>
>>> The mt7621.dtsi already contains the label "lan0" and "lan1" for
>>> these
>>
>> That's bound to change.
>>
>> https://patchwork.ozlabs.org/project/openwrt/patch/20221129111315.17005-1-arinc.unal@arinc9.com/
>>
>>> ports. On the outside[1] of the device the ports are simply named
>>> Ethernet. Shall I put a "lan0" and "lan1" label there? It felt a
>>> bit
>>> redundant to me so I did not put it in initially.
>>
>> You should put swp0 and swp1, then define them on 02_network.
>>
>> Arınç
> 
> Right, with patch 2/2 (which I'm about to squash into this one) one
> port will be directly mapped to the CPU and the other one into the
> switch. Does the swp0 and swp1 naming still apply to that case?

Yeah, swp0 on gmac0, swp1 on port at 1.

Arınç



More information about the openwrt-devel mailing list