[LEDE-DEV] [PATCH] ramips: add support for AsiaRF AWM688

Russell Senior russell at personaltelco.net
Mon Apr 10 02:46:53 PDT 2017


>Hey Russell,
>thanks a lot for your contribution. Find my comments inline.
>
>2017-04-05 5:38 GMT+02:00 Russell Senior <russell at personaltelco.net>:
>>
>> Add initial support for an mtk7688 board from Asia RF.
>>
>> It boots, flashes and runs.
>>
>> Signed-off-by: Russell Senior <russell at personaltelco.net>
>
>As you wrote initial support, what does not work?

Thanks for the feedback.

It isn't thoroughly tested.  These were the minimal changes I needed to
get it to boot and flash.  The DTS was copied from the LinkIt7688 and
tweaked minimally.

>
>Would you please add a brief description of the hardware and outline how
>LEDE can be installed on the board. Have a look at the recent ramips
>board additions for some good examples.

I booted an initramfs image and sysupgraded.

I'll have a look at recent ramips additions.  

>
>> ---
>>
>> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
>> index 3216b300c1..9327bcbcf4 100644
>> --- a/package/boot/uboot-envtools/files/ramips
>> +++ b/package/boot/uboot-envtools/files/ramips
>> @@ -19,6 +19,7 @@ all0256n|\
>>  all5002)
>>         ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
>>         ;;
>> +awm688|\
>>  br-6425|\
>>  linkits7688|\
>>  linkits7688d|\
>
>Why is access to the u-boot env from userspace required?

I'm not sure it is.

>
>> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
>> index 7bdebbe97f..19ff14df83 100755
>> --- a/target/linux/ramips/base-files/etc/board.d/02_network
>> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
>> @@ -44,6 +44,7 @@ ramips_setup_interfaces()
>>         all0256n|\
>>         all5002|\
>>         all5003|\
>> +       awm688|\
>>         broadway|\
>>         dcs-930|\
>>         dcs-930l-b1|\
>> diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
>> index 786aecb99b..cd944ed207 100755
>> --- a/target/linux/ramips/base-files/lib/ramips.sh
>> +++ b/target/linux/ramips/base-files/lib/ramips.sh
>> @@ -79,6 +79,9 @@ ramips_board_detect() {
>>         *"AWM003 EVB")
>>                 name="awm003-evb"
>>                 ;;
>> +       *"AWM688")
>> +               name="awm688"
>> +               ;;
>>         *"BC2")
>>                 name="bc2"
>>                 ;;
>> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
>> index 08fa45ad98..6360fe83a0 100755
>> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
>> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
>> @@ -29,6 +29,7 @@ platform_check_image() {
>>         awapn2403|\
>>         awm002-evb|\
>>         awm003-evb|\
>> +       awm688|\
>>         bc2|\
>>         broadway|\
>>         carambola|\
>> diff --git a/target/linux/ramips/dts/AWM688.dts b/target/linux/ramips/dts/AWM688.dts
>> new file mode 100644
>> index 0000000000..1c5230ed84
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/AWM688.dts
>> @@ -0,0 +1,183 @@
>> +/dts-v1/;
>> +
>> +#include "mt7628an.dtsi"
>> +
>> +#include <dt-bindings/input/input.h>
>
>Please include dt-bindings/gpio/gpio.h here as well and keep
>alphabetical order.
>
>Use the GPIO_ACTIVE_LOW and GPIO_ACTIVE_HIGH macros afterwards instead
>of 1 and 0 in the gpio parameters.
>
>Check the recent ramips board additions for examples.

Okay.

>
>> +
>> +/ {
>> +       compatible = "mediatek,awm688", "mediatek,mt7628an-soc";
>> +       model = "AsiaRF AWM688";
>> +
>> +       chosen {
>> +               bootargs = "console=ttyS0,57600";
>> +       };
>> +
>> +       aliases {
>> +               serial0 = &uart1;
>> +       };
>> +
>> +       memory at 0 {
>> +               device_type = "memory";
>> +               reg = <0x0 0x4000000>;
>> +       };
>> +
>> +       bootstrap {
>> +               compatible = "mediatek,awm688";
>> +
>> +               status = "okay";
>> +       };
>> +
>> +       gpio-leds {
>> +               compatible = "gpio-leds";
>> +
>> +               wifi {
>> +                       label = "mediatek:orange:wifi";
>> +                       gpios = <&wgpio 0 0>;
>> +                       default-state = "on";
>
>Why do you switch the led to default on? Could it be that the polarity
>is wrong for this led (active low instead of active high) and you are
>trying to switch the led to off?

This is an artifact of the LinkIt7688 DTS.

>
>> +               };
>> +       };
>> +
>> +       gpio-keys-polled {
>> +               compatible = "gpio-keys-polled";
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +               poll-interval = <20>;
>> +
>> +               wps {
>> +                       label = "reset";
>> +                       gpios = <&gpio1 6 1>;
>> +                       linux,code = <KEY_WPS_BUTTON>;
>> +               };
>> +       };
>> +
>> +       wgpio: gpio-wifi {
>> +               compatible = "mediatek,gpio-wifi";
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +               gpio-controller;
>> +               #gpio-cells = <2>;
>> +       };
>> +};
>> +
>> +&pinctrl {
>> +       state_default: pinctrl0 {
>> +               gpio {
>> +                       ralink,group = "gpio";
>> +                       ralink,function = "gpio";
>> +               };
>> +
>> +               perst {
>> +                       ralink,group = "perst";
>> +                       ralink,function = "gpio";
>> +               };
>> +
>> +               refclk {
>> +                       ralink,group = "refclk";
>> +                       ralink,function = "gpio";
>> +               };
>> +
>> +               i2s {
>> +                       ralink,group = "i2s";
>> +                       ralink,function = "gpio";
>> +               };
>> +
>> +               spis {
>> +                       ralink,group = "spis";
>> +                       ralink,function = "gpio";
>> +               };
>> +
>> +               wled_kn {
>> +                       ralink,group = "wled_kn";
>> +                       ralink,function = "gpio";
>> +               };
>> +
>> +               wled_an {
>> +                       ralink,group = "wled_an";
>> +                       ralink,function = "wled_an";
>> +               };
>> +
>> +               wdt {
>> +                       ralink,group = "wdt";
>> +                       ralink,function = "gpio";
>> +               };
>> +       };
>> +};
>> +
>> +&wmac {
>> +       status = "okay";
>> +};
>> +
>> +&spi0 {
>> +       status = "okay";
>> +
>> +       pinctrl-names = "default";
>> +       pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
>> +
>> +       m25p80 at 0 {
>> +               #address-cells = <1>;
>> +               #size-cells = <1>;
>> +               compatible = "jedec,spi-nor";
>> +               reg = <0>;
>> +               spi-max-frequency = <40000000>;
>> +               m25p,chunked-io = <31>;
>> +
>> +               partition at 0 {
>> +                       label = "u-boot";
>> +                       reg = <0x0 0x30000>;
>> +                       read-only;
>> +               };
>> +
>> +               partition at 30000 {
>> +                       label = "u-boot-env";
>> +                       reg = <0x30000 0x10000>;
>> +               };
>> +
>> +               factory: partition at 40000 {
>> +                       label = "factory";
>> +                       reg = <0x40000 0x10000>;
>> +                       read-only;
>> +               };
>> +
>> +               partition at 50000 {
>> +                       label = "firmware";
>> +                       reg = <0x50000 0xfb0000>;
>> +               };
>> +       };
>> +
>> +       spidev at 1 {
>> +               #address-cells = <1>;
>> +               #size-cells = <1>;
>> +               compatible = "linux,spidev";
>> +               reg = <1>;
>> +               spi-max-frequency = <40000000>;
>> +       };
>> +};
>> +
>> +&i2c {
>> +       status = "okay";
>> +};
>> +
>> +&uart1 {
>> +       status = "okay";
>> +};
>> +
>> +&uart2 {
>> +       status = "okay";
>> +};
>> +
>> +&pwm {
>> +       status = "okay";
>> +};
>> +
>> +&ethernet {
>> +       mtd-mac-address = <&factory 0x2e>;
>> +};
>> +
>> +&sdhci {
>> +       status = "okay";
>> +       mediatek,cd-high;
>> +};
>> +
>> +&wmac {
>> +       status = "okay";
>> +};
>> diff --git a/target/linux/ramips/image/mt7688.mk b/target/linux/ramips/image/mt7688.mk
>> index 4a50275a8d..8b59d2afb9 100644
>> --- a/target/linux/ramips/image/mt7688.mk
>> +++ b/target/linux/ramips/image/mt7688.mk
>> @@ -2,6 +2,15 @@
>>  # MT7688 Profiles
>>  #
>>
>> +define Device/AWM688
>> +  DTS := AWM688
>> +  IMAGE_SIZE := $(ralink_default_fw_size_16M)
>> +  SUPPORTED_DEVICES := awm688
>> +  DEVICE_TITLE := AsiaRF AWM688
>> +  DEVICE_PACKAGES:= kmod-usb2 kmod-usb-ohci uboot-envtools
>> +endef
>> +TARGET_DEVICES += AWM688
>> +
>>  define Device/LinkIt7688
>>    DTS := LINKIT7688
>>    IMAGE_SIZE := $(ralink_default_fw_size_32M)
>>
>>
>> --
>> Russell Senior, President
>> russell at personaltelco.net
>>
>> _______________________________________________
>> Lede-dev mailing list
>> Lede-dev at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
>
>_______________________________________________
>Lede-dev mailing list
>Lede-dev at lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/lede-dev



-- 
Russell Senior, President
russell at personaltelco.net



More information about the Lede-dev mailing list