[PATCH] Adds support for Comfast CF-E538AC

Adrian Schmutzler mail at adrianschmutzler.de
Mon Nov 23 07:02:47 EST 2020


Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Sven Danner
> Sent: Montag, 23. November 2020 03:23
> To: john at phrozen.org
> Cc: openwrt-devel at lists.openwrt.org
> Subject: [PATCH] Adds support for Comfast CF-E538AC

Please use proper title prefix according to submitting-patches guidelines.

> 
> Comfast CF-E538AC is an 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 (RTL8211F): 1× 1GbE, 802.3af PoE
> * Ethernet (RTL8211F): 1× 1GbE
> 
> Flashing instructions:
> * Upgrade using web interface
> 
> 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
>   (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.

Missing Signed-off-by.

> ---
>  .../ramips/dts/mt7620a_comfast_cf-e538ac.dts  | 158
> ++++++++++++++++++
>  target/linux/ramips/image/mt7620.mk           |  11 ++
>  .../mt7620/base-files/etc/board.d/01_leds     |   3 +
>  .../mt7620/base-files/etc/board.d/02_network  |   4 +
>  4 files changed, 176 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..b857c8db9c
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7620a_comfast_cf-e538ac.dts
> @@ -0,0 +1,158 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/;

dts-v1 can be dropped here.

> +
> +#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 0x00 GPIO_ACTIVE_LOW>;

We prefer numeric (decimal) values for the GPIO.

> +		};
> +	};
> +
> +	keys {
> +		compatible = "gpio-keys-polled";
> +		poll-interval = <0x14>;

Try "gpio-keys" without poll-interval, please.

> +
> +		reset {
> +			label = "reset";
> +			gpios = <&gpio0 0x0d GPIO_ACTIVE_LOW>;

decimal ...

> +			linux,code = <KEY_RESTART>;
> +		};
> +	};
> +
> +};
> +
> +&gpio0 {
> +	status = "okay";
> +};
> +
> +&gpio2 {
> +	status = "okay";
> +};

What do you need that for?

> +
> +&gpio3 {
> +	status = "okay";
> +};
> +
> +&spi0 {
> +	status = "okay";
> +
> +	m25p80 at 0 {

flash at 0

> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <10000000>;

Can this go faster?

> +
> +		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;
> +			};
> +
> +			partition at 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 = "llllw";

This doesn't make sense if WAN is on port 5.

> +
> +	port at 4 {
> +		status = "okay";
> +		phy-mode = "rgmii";
> +		phy-handle = <&phy4>;
> +	};
> +
> +	port at 5 {
> +		status = "okay";
> +		phy-mode = "rgmii";
> +		phy-handle = <&phy5>;
> +	};
> +
> +	mdio-bus {
> +		status = "okay";
> +
> +		phy4: ethernet-phy at 4 {
> +			reg = <0x04>;
> +			phy-mode = "rgmii";
> +		};
> +
> +		phy5: ethernet-phy at 5 {
> +			reg = <0x05>;
> +			phy-mode = "rgmii";
> +		};
> +	};
> +};
> +
> +&gsw  {
> +	mediatek,port4 = "gmac";
> +};
> +
> +&wmac {
> +	ralink,mtd-eeprom = <&factory 0x0>;
> +};
> +
> +

Drop second empty line.

> +&pcie {
> +	status = "okay";
> +};
> +
> +&state_default {
> +	gpio {
> +			groups = "uartf", "ephy", "wled";
> +			function = "gpio";

Broken indent. Apart from that, I only see two GPIOs above, so no need for three groups?

> +	};
> +};
> +
> +&pcie0 {
> +	mt76 at 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..19b693f812 100644
> --- a/target/linux/ramips/image/mt7620.mk
> +++ b/target/linux/ramips/image/mt7620.mk
> @@ -172,6 +172,17 @@ define Device/comfast_cf-wr800n  endef
> TARGET_DEVICES += comfast_cf-wr800n
> 
> +define Device/comfast_cf-e538ac

Please care about alphabetic sorting.

> +  SOC := mt7620a
> +  DTS := CF-E538AC

This is not required (but always interesting how people invent values for variables that are not used at all).

> +  IMAGE_SIZE := 7872k
> +  DEVICE_VENDOR := Comfast
> +  DEVICE_MODEL := CF-E538AC
> +  SUPPORTED_DEVICES += cf-e538ac

This line can be dropped as well.

> +  DEVICE_PACKAGES := kmod-mt76x2
> +endef
> +TARGET_DEVICES += comfast_cf-e538ac
> +
>  define Device/dlink_dch-m225
>    $(Device/seama)
>    SOC := mt7620a
> 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"
> +	;;

Using a phyX trigger would be preferred, since that does not depend on the name of the interface.

Best

Adrian

>  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 at eth0"
>  		;;
> +	comfast,cf-e538ac)
> +		ucidef_add_switch "switch0" \
> +			"4:lan" "5:wan" "6 at eth0"
> +		;;
>  	comfast,cf-wr800n|\
>  	hnet,c108)
>  		ucidef_add_switch "switch0" \
> --
> 2.20.1
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20201123/8d0c20b8/attachment.sig>


More information about the openwrt-devel mailing list