diff mbox series

ramips: Adds support for Comfast CF-E538AC

Message ID trinity-280dbeec-5a71-43df-a4f2-1eeb3bb1e36b-1606975007119@3c-app-gmx-bs13
State Changes Requested
Headers show
Series ramips: Adds support for Comfast CF-E538AC | expand

Commit Message

Sven Danner Dec. 3, 2020, 5:56 a.m. UTC
From: Sven Danner <Sven314@gmx.net>
 
Comfast CF-E538AC is a wall mounted access point with an additional
Ethernet LAN access port. It supports 802.11AC Wave2 MU-MIMO.
 
Serial port access for debricking requires simple soldering of 4 pins.
 
Device specifications:
* SoC: MT7620DA @ 580MHz
* RAM: 64MiB DDR2
* Flash: 8iB SPI
* Wireless 2.4GHz (SoC): b/g/n
* Wireless 5Ghz (MT7612E): n/ac, 2x2 MU-MINO
* Ethernet connection back (RTL8211F - port 4): 1× 1GbE, 802.3af PoE
* Ethernet connection front (RTL8211F - port 5): 1× 1GbE
 
Flashing instructions:
* Upgrade using stock web interface's update feature
 
Debricking:
* Serial port can be soldered on top PCB (marked as 1)
  (1: VCC, 2: GND, 3: TX, 4: RX)
    * Use 3.3V, 115200 baud, 8N1
* Recovery only possible via TFTP
* Modified U-Boot environment does not allow recovery via serial
  data transfer (will not commit it to flash)
* Bootloader will show a menu for 1 seconds
* Select 2: Load system code then write to Flash via TFTP.
 
Signed-off-by: Sven Danner <Sven314@gmx.net>
---
This is my third submission.
I hope I have successfully incorporated any feedback
that I have received and am following the right format.
Apologies for any inconvenience caused.
 
A couple of notes:
This speed (which 47 of 68 mt7620a devices use) comes straight
from the stock firmware's DTS file:
 spi-max-frequency = <10000000>;
At this point I rather not increase it unless necessary.
 
This line was suggested to be dropped, but every device
in /target/linux/ramips/image/mt7620.mk
is defining that as well:
+  SUPPORTED_DEVICES += cf-e538ac
I have left it in for this submission.

I have still defined LED white:wifi so it will
appear in LuCI for users
as the device drivers seem to automatically
create 4 LEDs in /sys/class/leds
that are not physically connected:

mt76-phy0
rt2800soc-phy1::quality
rt2800soc-phy1::assoc
rt2800soc-phy1::radio
 
I appreciate all feedback, please be kind and assume
honest mistakes not maliciousness.
---
 
 .../ramips/dts/mt7620a_comfast_cf-e538ac.dts  | 149 ++++++++++++++++++
 target/linux/ramips/image/mt7620.mk           |  10 ++
 .../mt7620/base-files/etc/board.d/01_leds     |   3 +
 .../mt7620/base-files/etc/board.d/02_network  |   4 +
 4 files changed, 166 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
--
2.20.1

Comments

Daniel Golle Dec. 3, 2020, 12:29 p.m. UTC | #1
Hi Sven,

On Thu, Dec 03, 2020 at 06:56:47AM +0100, Sven Danner wrote:
> From: Sven Danner <Sven314@gmx.net>
>  
> Comfast CF-E538AC is a wall mounted access point with an additional
> Ethernet LAN access port. It supports 802.11AC Wave2 MU-MIMO.
>  
> Serial port access for debricking requires simple soldering of 4 pins.
>  
> Device specifications:
> * SoC: MT7620DA @ 580MHz
> * RAM: 64MiB DDR2
> * Flash: 8iB SPI
> * Wireless 2.4GHz (SoC): b/g/n
> * Wireless 5Ghz (MT7612E): n/ac, 2x2 MU-MINO
> * Ethernet connection back (RTL8211F - port 4): 1× 1GbE, 802.3af PoE
> * Ethernet connection front (RTL8211F - port 5): 1× 1GbE
>  
> Flashing instructions:
> * Upgrade using stock web interface's update feature
>  
> Debricking:
> * Serial port can be soldered on top PCB (marked as 1)
>   (1: VCC, 2: GND, 3: TX, 4: RX)
>     * Use 3.3V, 115200 baud, 8N1
> * Recovery only possible via TFTP
> * Modified U-Boot environment does not allow recovery via serial
>   data transfer (will not commit it to flash)
> * Bootloader will show a menu for 1 seconds
> * Select 2: Load system code then write to Flash via TFTP.
>  
> Signed-off-by: Sven Danner <Sven314@gmx.net>
> ---
> This is my third submission.
> I hope I have successfully incorporated any feedback
> that I have received and am following the right format.
> Apologies for any inconvenience caused.
>  
> A couple of notes:
> This speed (which 47 of 68 mt7620a devices use) comes straight
> from the stock firmware's DTS file:
>  spi-max-frequency = <10000000>;
> At this point I rather not increase it unless necessary.
>  
> This line was suggested to be dropped, but every device
> in /target/linux/ramips/image/mt7620.mk
> is defining that as well:
> +  SUPPORTED_DEVICES += cf-e538ac
> I have left it in for this submission.

Please remove it as it is not needed. Most devices have this in order
to allow upgrading from an older version of OpenWrt. As you are adding
a new device, there are no existing devices already running OpenWrt we
would need to take care of.

> 
> I have still defined LED white:wifi so it will
> appear in LuCI for users
> as the device drivers seem to automatically
> create 4 LEDs in /sys/class/leds
> that are not physically connected:
> 
> mt76-phy0
> rt2800soc-phy1::quality
> rt2800soc-phy1::assoc
> rt2800soc-phy1::radio
>  
> I appreciate all feedback, please be kind and assume
> honest mistakes not maliciousness.

It looks like your email submission got mangled by some email client
which doesn't keep white-space as is. All the tabs became 4 spaces
which means the patch won't apply like this :(
Please use git-send-email, or, in case you really cannot, attach the
output of git-format-patch.

Is there already a device wiki page where I can see dmesg output of
the device booting OpenWrt?

> ---
>  
>  .../ramips/dts/mt7620a_comfast_cf-e538ac.dts  | 149 ++++++++++++++++++
>  target/linux/ramips/image/mt7620.mk           |  10 ++
>  .../mt7620/base-files/etc/board.d/01_leds     |   3 +
>  .../mt7620/base-files/etc/board.d/02_network  |   4 +
>  4 files changed, 166 insertions(+)
>  create mode 100644 target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> diff --git a/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> new file mode 100644
> index 0000000000..6ccf06531d
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> @@ -0,0 +1,149 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +#include "mt7620a.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +    compatible = "comfast,cf-e538ac", "ralink,mt7620a-soc";
> +    model = "Comfast CF-E538AC";
> +
> +    aliases {
> +        led-boot = &led_wifi;
> +        led-failsafe = &led_wifi;
> +        led-running = &led_wifi;
> +        led-upgrade = &led_wifi;
> +    };
> +
> +    chosen {
> +        bootargs = "console=ttyS0,115200";
> +    };
> +
> +    leds {
> +        compatible = "gpio-leds";
> +
> +        led_wifi: wifi {
> +            label = "white:wifi";
> +            gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
> +        };
> +    };
> +
> +    keys {
> +        compatible = "gpio-keys";
> +
> +        reset {
> +            label = "reset";
> +            gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
> +            linux,code = <KEY_RESTART>;
> +        };
> +    };
> +};
> +
> +&gpio0 {
> +    status = "okay";
> +};
> +
> +&gpio3 {
> +    status = "okay";
> +};
> +
> +&spi0 {
> +    status = "okay";
> +
> +    flash@0 {
> +        compatible = "jedec,spi-nor";
> +        reg = <0>;
> +        spi-max-frequency = <10000000>;
> +
> +        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;
> +            };
> +
> +            partition@50000 {
> +                compatible = "denx,uimage";
> +                label = "firmware";
> +                reg = <0x50000 0x7b0000>;
> +            };
> +        };
> +    };
> +};
> +
> +&ethernet {
> +    status = "okay";
> +    pinctrl-names = "default";
> +    mtd-mac-address = <&factory 0xe000>;
> +    pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
> +    mediatek,portmap = "wllll";
> +
> +    port@4 {
> +        status = "okay";
> +        phy-mode = "rgmii";
> +        phy-handle = <&phy4>;
> +    };
> +
> +    port@5 {
> +        status = "okay";
> +        phy-mode = "rgmii";
> +        phy-handle = <&phy5>;
> +    };
> +
> +    mdio-bus {
> +        status = "okay";
> +
> +        phy4: ethernet-phy@4 {
> +            reg = <0x04>;
> +            phy-mode = "rgmii";
> +        };
> +
> +        phy5: ethernet-phy@5 {
> +            reg = <0x05>;
> +            phy-mode = "rgmii";
> +        };
> +    };
> +};
> +
> +&gsw  {
> +    mediatek,port4 = "gmac";
> +};
> +
> +&wmac {
> +    ralink,mtd-eeprom = <&factory 0x0>;
> +};
> +
> +&pcie {
> +    status = "okay";
> +};
> +
> +&state_default {
> +    gpio {
> +        groups = "wled";
> +        function = "gpio";
> +    };
> +};
> +
> +&pcie0 {
> +    mt76@0,0 {
> +        reg = <0x0000 0 0 0 0>;
> +        mediatek,mtd-eeprom = <&factory 0x8000>;
> +        ieee80211-freq-limit = <5000000 6000000>;
> +    };
> +};
> diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
> index dfdb5f28d3..63aa299545 100644
> --- a/target/linux/ramips/image/mt7620.mk
> +++ b/target/linux/ramips/image/mt7620.mk
> @@ -163,6 +163,16 @@ define Device/buffalo_wmr-300
>  endef
>  TARGET_DEVICES += buffalo_wmr-300
>  
> +define Device/comfast_cf-e538ac
> +  SOC := mt7620a
> +  IMAGE_SIZE := 7872k
> +  DEVICE_VENDOR := Comfast
> +  DEVICE_MODEL := CF-E538AC
> +  SUPPORTED_DEVICES += cf-e538ac
> +  DEVICE_PACKAGES := kmod-mt76x2
> +endef
> +TARGET_DEVICES += comfast_cf-e538ac
> +
>  define Device/comfast_cf-wr800n
>    SOC := mt7620n
>    IMAGE_SIZE := 7872k
> diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> index 292f310d51..22d3e0f783 100755
> --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> @@ -41,6 +41,9 @@ asus,rt-n14u)
>  bdcom,wap2100-sk)
>      ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan0"
>      ;;
> +comfast,cf-e538ac)
> +    ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
> +    ;;
>  comfast,cf-wr800n)
>      ucidef_set_led_netdev "lan" "lan" "white:ethernet" eth0.1
>      ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
> diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> index e884390c31..b069fe75e7 100755
> --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> @@ -99,6 +99,10 @@ ramips_setup_interfaces()
>          ucidef_add_switch "switch0" \
>              "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
>          ;;
> +    comfast,cf-e538ac)
> +        ucidef_add_switch "switch0" \
> +            "4:lan" "5:wan" "6@eth0"
> +        ;;
>      comfast,cf-wr800n|\
>      hnet,c108)
>          ucidef_add_switch "switch0" \
> --
> 2.20.1
>  
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Adrian Schmutzler Dec. 3, 2020, 2:25 p.m. UTC | #2
Hi,

several comments below in addition to what Daniel stated.

As a general comment:
It would have been quicker if you asked the questions first, because now you will have to send another version ...

Please use versions on your patch (-v parameter to git format-patch) so we can track the changes more easily.

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Sven Danner
> Sent: Donnerstag, 3. Dezember 2020 06:57
> To: john@phrozen.org
> Cc: openwrt-devel@lists.openwrt.org
> Subject: [PATCH] ramips: Adds support for Comfast CF-E538AC
> 
> From: Sven Danner <Sven314@gmx.net>
> 
> Comfast CF-E538AC is a wall mounted access point with an additional
> Ethernet LAN access port. It supports 802.11AC Wave2 MU-MIMO.
> 
> Serial port access for debricking requires simple soldering of 4 pins.
> 
> Device specifications:
> * SoC: MT7620DA @ 580MHz
> * RAM: 64MiB DDR2
> * Flash: 8iB SPI
> * Wireless 2.4GHz (SoC): b/g/n
> * Wireless 5Ghz (MT7612E): n/ac, 2x2 MU-MINO
> * Ethernet connection back (RTL8211F - port 4): 1× 1GbE, 802.3af PoE
> * Ethernet connection front (RTL8211F - port 5): 1× 1GbE
> 
> Flashing instructions:
> * Upgrade using stock web interface's update feature
> 
> Debricking:
> * Serial port can be soldered on top PCB (marked as 1)
>   (1: VCC, 2: GND, 3: TX, 4: RX)
>     * Use 3.3V, 115200 baud, 8N1
> * Recovery only possible via TFTP
> * Modified U-Boot environment does not allow recovery via serial
>   data transfer (will not commit it to flash)
> * Bootloader will show a menu for 1 seconds
> * Select 2: Load system code then write to Flash via TFTP.
> 
> Signed-off-by: Sven Danner <Sven314@gmx.net>
> ---
> This is my third submission.
> I hope I have successfully incorporated any feedback that I have received
> and am following the right format.
> Apologies for any inconvenience caused.
> 
> A couple of notes:
> This speed (which 47 of 68 mt7620a devices use) comes straight from the
> stock firmware's DTS file:
>  spi-max-frequency = <10000000>;
> At this point I rather not increase it unless necessary.

Yes, this is a copy-paste thing. It's just always kept slow unnecessarily, although it could be considerably faster on most devices.

> 
> This line was suggested to be dropped, but every device in
> /target/linux/ramips/image/mt7620.mk
> is defining that as well:
> +  SUPPORTED_DEVICES += cf-e538ac
> I have left it in for this submission.
> 
> I have still defined LED white:wifi so it will appear in LuCI for users as the

If you insist on not using DT trigger, please at least convert this to the appropriate phy0tpt/phy0radio trigger in 01_leds. With the current setup, the LED is restricted to a specific name of the WiFi interface, which is an unnecessary drawback.

> device drivers seem to automatically create 4 LEDs in /sys/class/leds that are
> not physically connected:
> 
> mt76-phy0
> rt2800soc-phy1::quality
> rt2800soc-phy1::assoc
> rt2800soc-phy1::radio
> 
> I appreciate all feedback, please be kind and assume honest mistakes not
> maliciousness.
> ---
> 
>  .../ramips/dts/mt7620a_comfast_cf-e538ac.dts  | 149
> ++++++++++++++++++
>  target/linux/ramips/image/mt7620.mk           |  10 ++
>  .../mt7620/base-files/etc/board.d/01_leds     |   3 +
>  .../mt7620/base-files/etc/board.d/02_network  |   4 +
>  4 files changed, 166 insertions(+)
>  create mode 100644 target/linux/ramips/dts/mt7620a_comfast_cf-
> e538ac.dts
> diff --git a/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> new file mode 100644
> index 0000000000..6ccf06531d
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> @@ -0,0 +1,149 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include
> +"mt7620a.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +    compatible = "comfast,cf-e538ac", "ralink,mt7620a-soc";
> +    model = "Comfast CF-E538AC";
> +
> +    aliases {
> +        led-boot = &led_wifi;
> +        led-failsafe = &led_wifi;
> +        led-running = &led_wifi;
> +        led-upgrade = &led_wifi;
> +    };
> +
> +    chosen {
> +        bootargs = "console=ttyS0,115200";
> +    };
> +
> +    leds {
> +        compatible = "gpio-leds";
> +
> +        led_wifi: wifi {
> +            label = "white:wifi";
> +            gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
> +        };
> +    };
> +
> +    keys {
> +        compatible = "gpio-keys";
> +
> +        reset {
> +            label = "reset";
> +            gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
> +            linux,code = <KEY_RESTART>;
> +        };
> +    };
> +};
> +
> +&gpio0 {
> +    status = "okay";
> +};
> +
> +&gpio3 {
> +    status = "okay";
> +};
> +
> +&spi0 {
> +    status = "okay";
> +
> +    flash@0 {
> +        compatible = "jedec,spi-nor";
> +        reg = <0>;
> +        spi-max-frequency = <10000000>;
> +
> +        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;
> +            };
> +
> +            partition@50000 {
> +                compatible = "denx,uimage";
> +                label = "firmware";
> +                reg = <0x50000 0x7b0000>;
> +            };
> +        };
> +    };
> +};
> +
> +&ethernet {
> +    status = "okay";
> +    pinctrl-names = "default";
> +    mtd-mac-address = <&factory 0xe000>;
> +    pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
> +    mediatek,portmap = "wllll";

Does this make sense? Your wan port is 5, so not covered by this syntax...

Best

Adrian

> +
> +    port@4 {
> +        status = "okay";
> +        phy-mode = "rgmii";
> +        phy-handle = <&phy4>;
> +    };
> +
> +    port@5 {
> +        status = "okay";
> +        phy-mode = "rgmii";
> +        phy-handle = <&phy5>;
> +    };
> +
> +    mdio-bus {
> +        status = "okay";
> +
> +        phy4: ethernet-phy@4 {
> +            reg = <0x04>;
> +            phy-mode = "rgmii";
> +        };
> +
> +        phy5: ethernet-phy@5 {
> +            reg = <0x05>;
> +            phy-mode = "rgmii";
> +        };
> +    };
> +};
> +
> +&gsw  {
> +    mediatek,port4 = "gmac";
> +};
> +
> +&wmac {
> +    ralink,mtd-eeprom = <&factory 0x0>; };
> +
> +&pcie {
> +    status = "okay";
> +};
> +
> +&state_default {
> +    gpio {
> +        groups = "wled";
> +        function = "gpio";
> +    };
> +};
> +
> +&pcie0 {
> +    mt76@0,0 {
> +        reg = <0x0000 0 0 0 0>;
> +        mediatek,mtd-eeprom = <&factory 0x8000>;
> +        ieee80211-freq-limit = <5000000 6000000>;
> +    };
> +};
> diff --git a/target/linux/ramips/image/mt7620.mk
> b/target/linux/ramips/image/mt7620.mk
> index dfdb5f28d3..63aa299545 100644
> --- a/target/linux/ramips/image/mt7620.mk
> +++ b/target/linux/ramips/image/mt7620.mk
> @@ -163,6 +163,16 @@ define Device/buffalo_wmr-300
>  endef
>  TARGET_DEVICES += buffalo_wmr-300
> 
> +define Device/comfast_cf-e538ac
> +  SOC := mt7620a
> +  IMAGE_SIZE := 7872k
> +  DEVICE_VENDOR := Comfast
> +  DEVICE_MODEL := CF-E538AC
> +  SUPPORTED_DEVICES += cf-e538ac
> +  DEVICE_PACKAGES := kmod-mt76x2
> +endef
> +TARGET_DEVICES += comfast_cf-e538ac
> +
>  define Device/comfast_cf-wr800n
>    SOC := mt7620n
>    IMAGE_SIZE := 7872k
> diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> index 292f310d51..22d3e0f783 100755
> --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
> @@ -41,6 +41,9 @@ asus,rt-n14u)
>  bdcom,wap2100-sk)
>      ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan0"
>      ;;
> +comfast,cf-e538ac)
> +    ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
> +    ;;
>  comfast,cf-wr800n)
>      ucidef_set_led_netdev "lan" "lan" "white:ethernet" eth0.1
>      ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
> diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> index e884390c31..b069fe75e7 100755
> --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
> @@ -99,6 +99,10 @@ ramips_setup_interfaces()
>          ucidef_add_switch "switch0" \
>              "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
>          ;;
> +    comfast,cf-e538ac)
> +        ucidef_add_switch "switch0" \
> +            "4:lan" "5:wan" "6@eth0"
> +        ;;
>      comfast,cf-wr800n|\
>      hnet,c108)
>          ucidef_add_switch "switch0" \
> --
> 2.20.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Thomas Endt Dec. 30, 2020, 10:13 p.m. UTC | #3
> Is there already a device wiki page where I can see dmesg output of the
> device booting OpenWrt?

See https://openwrt.org/inbox/toh/comfast/comfast_cf-e538ac

Regards, Thomas
diff mbox series

Patch

diff --git a/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
new file mode 100644
index 0000000000..6ccf06531d
--- /dev/null
+++ b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
@@ -0,0 +1,149 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+    compatible = "comfast,cf-e538ac", "ralink,mt7620a-soc";
+    model = "Comfast CF-E538AC";
+
+    aliases {
+        led-boot = &led_wifi;
+        led-failsafe = &led_wifi;
+        led-running = &led_wifi;
+        led-upgrade = &led_wifi;
+    };
+
+    chosen {
+        bootargs = "console=ttyS0,115200";
+    };
+
+    leds {
+        compatible = "gpio-leds";
+
+        led_wifi: wifi {
+            label = "white:wifi";
+            gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+        };
+    };
+
+    keys {
+        compatible = "gpio-keys";
+
+        reset {
+            label = "reset";
+            gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+            linux,code = <KEY_RESTART>;
+        };
+    };
+};
+
+&gpio0 {
+    status = "okay";
+};
+
+&gpio3 {
+    status = "okay";
+};
+
+&spi0 {
+    status = "okay";
+
+    flash@0 {
+        compatible = "jedec,spi-nor";
+        reg = <0>;
+        spi-max-frequency = <10000000>;
+
+        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;
+            };
+
+            partition@50000 {
+                compatible = "denx,uimage";
+                label = "firmware";
+                reg = <0x50000 0x7b0000>;
+            };
+        };
+    };
+};
+
+&ethernet {
+    status = "okay";
+    pinctrl-names = "default";
+    mtd-mac-address = <&factory 0xe000>;
+    pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
+    mediatek,portmap = "wllll";
+
+    port@4 {
+        status = "okay";
+        phy-mode = "rgmii";
+        phy-handle = <&phy4>;
+    };
+
+    port@5 {
+        status = "okay";
+        phy-mode = "rgmii";
+        phy-handle = <&phy5>;
+    };
+
+    mdio-bus {
+        status = "okay";
+
+        phy4: ethernet-phy@4 {
+            reg = <0x04>;
+            phy-mode = "rgmii";
+        };
+
+        phy5: ethernet-phy@5 {
+            reg = <0x05>;
+            phy-mode = "rgmii";
+        };
+    };
+};
+
+&gsw  {
+    mediatek,port4 = "gmac";
+};
+
+&wmac {
+    ralink,mtd-eeprom = <&factory 0x0>;
+};
+
+&pcie {
+    status = "okay";
+};
+
+&state_default {
+    gpio {
+        groups = "wled";
+        function = "gpio";
+    };
+};
+
+&pcie0 {
+    mt76@0,0 {
+        reg = <0x0000 0 0 0 0>;
+        mediatek,mtd-eeprom = <&factory 0x8000>;
+        ieee80211-freq-limit = <5000000 6000000>;
+    };
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index dfdb5f28d3..63aa299545 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -163,6 +163,16 @@  define Device/buffalo_wmr-300
 endef
 TARGET_DEVICES += buffalo_wmr-300
 
+define Device/comfast_cf-e538ac
+  SOC := mt7620a
+  IMAGE_SIZE := 7872k
+  DEVICE_VENDOR := Comfast
+  DEVICE_MODEL := CF-E538AC
+  SUPPORTED_DEVICES += cf-e538ac
+  DEVICE_PACKAGES := kmod-mt76x2
+endef
+TARGET_DEVICES += comfast_cf-e538ac
+
 define Device/comfast_cf-wr800n
   SOC := mt7620n
   IMAGE_SIZE := 7872k
diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
index 292f310d51..22d3e0f783 100755
--- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
@@ -41,6 +41,9 @@  asus,rt-n14u)
 bdcom,wap2100-sk)
     ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan0"
     ;;
+comfast,cf-e538ac)
+    ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
+    ;;
 comfast,cf-wr800n)
     ucidef_set_led_netdev "lan" "lan" "white:ethernet" eth0.1
     ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
index e884390c31..b069fe75e7 100755
--- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
@@ -99,6 +99,10 @@  ramips_setup_interfaces()
         ucidef_add_switch "switch0" \
             "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
         ;;
+    comfast,cf-e538ac)
+        ucidef_add_switch "switch0" \
+            "4:lan" "5:wan" "6@eth0"
+        ;;
     comfast,cf-wr800n|\
     hnet,c108)
         ucidef_add_switch "switch0" \