[LEDE-DEV] [PATCH] mt7621: add support for WeVO W2914NS v2
Mathias Kresin
dev at kresin.me
Wed Nov 16 10:27:10 PST 2016
Hi,
find my comments inline.
2016-11-16 12:47 GMT+01:00 perillamint <perillamint at gentoo.moe>:
> From: "Yong-hyu, Ban" <perillamint at gentoo.moe>
>
> Signed-off-by: Yong-hyu, Ban <perillamint at gentoo.moe>
> ---
> .../linux/ramips/base-files/etc/board.d/02_network | 1 +
> target/linux/ramips/base-files/lib/ramips.sh | 3 +
> .../ramips/base-files/lib/upgrade/platform.sh | 1 +
> target/linux/ramips/dts/W2914NSV2.dts | 126 +++++++++++++++++++++
> target/linux/ramips/image/mt7621.mk | 8 ++
> 5 files changed, 139 insertions(+)
> create mode 100644 target/linux/ramips/dts/W2914NSV2.dts
>
> 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 e2a2f94..52289a4 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -86,6 +86,7 @@ ramips_setup_interfaces()
> sap-g3200u3|\
> sk-wb8|\
> vr500|\
> + w2914nsv2|\
> wf-2881|\
> witi|\
> wl-wn575a3|\
> diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
> index 2560eb7..dbfb650 100755
> --- a/target/linux/ramips/base-files/lib/ramips.sh
> +++ b/target/linux/ramips/base-files/lib/ramips.sh
> @@ -583,6 +583,9 @@ ramips_board_detect() {
> *"YK1")
> name="youku-yk1"
> ;;
> + *"W2914NS v2")
Please keep alphabetical order.
> + name="w2914nsv2"
> + ;;
> *)
> name="generic"
> ;;
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index 7f161f5..169e0ff 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -131,6 +131,7 @@ platform_check_image() {
> vocore|\
> vr500|\
> w150m|\
> + w2914nsv2|\
> w306r-v20|\
> w502u|\
> wf-2881|\
> diff --git a/target/linux/ramips/dts/W2914NSV2.dts b/target/linux/ramips/dts/W2914NSV2.dts
> new file mode 100644
> index 0000000..fd50e4e
> --- /dev/null
> +++ b/target/linux/ramips/dts/W2914NSV2.dts
> @@ -0,0 +1,126 @@
> +/dts-v1/;
> +
> +#include "mt7621.dtsi"
> +
> +#include <dt-bindings/input/input.h>
Please include <dt-bindings/gpio/gpio.h> here as well and put it in
front of the input/input.h include to keep alphabetical order. Use the
constants GPIO_ACTIVE_LOW and GPIO_ACTIVE_HIGH afterwards instead of 1
and 0 for the gpio parameters.
Check the recent board additions to ramips for examples.
> +
> +/ {
> + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc";
Drop this line. Your board isn't the mediatek,mt7621-eval-board and
the mediatek compatible string is inherit from mt7621.dtsi
> + model = "WeVO W2914NS v2";
> +
> + memory at 0 {
> + device_type = "memory";
> + reg = <0x0 0x8000000>;
> + };
> +
> + chosen {
> + bootargs = "console=ttyS0,57600";
> + };
> +
> + gpio-keys-polled {
> + compatible = "gpio-keys-polled";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + poll-interval = <20>;
> +
> + reset {
> + label = "reset";
> + gpios = <&gpio0 29 1>;
> + linux,code = <KEY_RESTART>;
> + };
> +
> + wps {
> + label = "wps";
> + gpios = <&gpio0 18 1>;
> + linux,code = <KEY_WPS_BUTTON>;
> + };
> + };
> +
> + gpio-leds {
> + compatible = "gpio-leds";
> +
> + usb {
> + label = "w2914nsv2:green:usb";
> + gpios = <&gpio0 27 1>;
> + };
> + };
Any reason why you included only the usb led? According to the
pictures I found, it looks like this board does have a WAN, WLAN
2.4GHz, WLAN 5GHz, USB, Power and multiple LAN leds.
The usb led isn't used for indicating a connected usb device (see
target/linux/ramips/base-files/etc/board.d/01_leds). Any specific
reason why?
If you decide to add the power led, please use this led in
target/linux/ramips/base-files/etc/diag.sh. If added, it will be used
for boot status indication.
> +};
> +
> +
Remove the double line break.
> +&sdhci {
> + status = "okay";
> +};
> +
> +&xhci {
> + status = "okay";
> +};
> +
> +&spi0 {
> + status = "okay";
> +
> + m25p80 at 0 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "mx25l12805d";
Does this really work?
>From http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt?v=4.8:
- May include a device-specific string consisting of the manufacturer
_and_ name of the chip.
- Must also include "jedec,spi-nor" for any SPI NOR flash...
Long story short
compatible = "jedec,spi-nor";
should be enough.
> + reg = <0>;
> + linux,modalias = "m25p80", "w25q128";
The modalias shouldn't be required.
> + spi-max-frequency = <10000000>;
> +
> + 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>;
Since changes to this partition might overwrite the wireless EEPROMs,
it could be a good idea to make this partition read-only as well.
> + };
> +
> + partition at 50000 {
> + label = "firmware";
> + reg = <0x50000 0xfb0000>;
> + };
> + };
> +};
> +
> +&pcie {
> + status = "okay";
> +
> + pcie0 {
> + mt76x2e at 0,0 {
It has to be wifi at pciVENDOR,pciDEVICE and should look like the
following in the end:
wifi at 1814,3091 {
compatible = "pci1814,3091";
In my example the pci vendor id is 1814 and the pci device id is 3091.
You should be able to find this information either in the bootlog or
in /sysfs/. Have a look at https://git.lede-project.org/d8dd207 for
more real world examples.
> + reg = <0x0000 0 0 0 0>;
> + device_type = "pci";
Drop the device_type parameter, it doesn't belong to this node. Both
comments to this node apply to mt7603e at 1,0 as well.
> + mediatek,mtd-eeprom = <&factory 0x0000>;
> + mediatek,5ghz = <0>;
> + };
> + };
> +
> + pcie1 {
> + mt7603e at 1,0 {
> + reg = <0x0000 0 0 0 0>;
> + device_type = "pci";
> + mediatek,mtd-eeprom = <&factory 0x8000>;
> + mediatek,2ghz = <0>;
> + };
> + };
> +};
Before sending a v2 of this patch, make sure that the image still
works as expected on your board with the changes done I've requested.
Mathias
More information about the Lede-dev
mailing list