[LEDE-DEV] [PATCH] ramips: Add support for Sanlinking D240
Mathias Kresin
dev at kresin.me
Thu Feb 2 11:13:46 PST 2017
Hey Kristian,
thanks a lot for the patch. Find my comments inline.
2017-02-02 12:54 GMT+01:00 Kristian Evensen <kristian.evensen at gmail.com>:
> The Sanlinking Technologies D240
> (http://www.sanlinking.com/en/29-dual-4g-wifi-router.html) is basically the same
> device as the ZBT WE826, so adding support for it in LEDE is straight forward.
> The differences is that the D240 has two mini-PCIe slots (instead of one), blue
> LEDs and supports PoE.
>
> Wifi, USB, switch and both mini-PCIe slots are working. I have not been able to
> test the SD card reader on the device.
>
> Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>
> ---
> target/linux/ramips/base-files/etc/board.d/01_leds | 5 +
> .../linux/ramips/base-files/etc/board.d/02_network | 1 +
> target/linux/ramips/base-files/etc/diag.sh | 3 +
> target/linux/ramips/base-files/lib/ramips.sh | 3 +
> .../ramips/base-files/lib/upgrade/platform.sh | 1 +
> target/linux/ramips/dts/SANLINKING-D240.dts | 124 +++++++++++++++++++++
> target/linux/ramips/image/mt7620.mk | 8 ++
> 7 files changed, 145 insertions(+)
> create mode 100644 target/linux/ramips/dts/SANLINKING-D240.dts
>
> diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
> index 545d6a4..1238a50 100755
> --- a/target/linux/ramips/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds
> @@ -300,6 +300,11 @@ rt-n14u)
> set_wifi_led "$board:blue:air"
> set_usb_led "$board:blue:usb"
> ;;
> +sanlinking-d240)
> + ucidef_set_led_default "power" "power" "$board:blue:power" "1"
Drop the board:blue:power here.
> + set_wifi_led "$board:blue:wifi"
> + set_usb_led "$board:blue:usb"
> + ;;
> tew-714tru)
> set_usb_led "$board:red:usb"
> set_wifi_led "$board:green:wifi"
> 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 c001dfe..bf2edf0 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -92,6 +92,7 @@ ramips_setup_interfaces()
> pbr-m1|\
> psg1208|\
> psg1218|\
> + sanlinking-d240|\
> sap-g3200u3|\
> sk-wb8|\
> vr500|\
> diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
> index 5fb2213..83a9353 100644
> --- a/target/linux/ramips/base-files/etc/diag.sh
> +++ b/target/linux/ramips/base-files/etc/diag.sh
> @@ -247,6 +247,9 @@ get_status_led() {
> zbt-cpe102)
> status_led="$board:green:4g-0"
> ;;
> + sanlinking-d240)
> + status_led="$board:blue:wifi"
use the $board:blue:power led here and merge it into the existing
blue:power block.
> + ;;
> esac
> }
>
> diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
> index d9918cc..dc86a82 100755
> --- a/target/linux/ramips/base-files/lib/ramips.sh
> +++ b/target/linux/ramips/base-files/lib/ramips.sh
> @@ -442,6 +442,9 @@ ramips_board_detect() {
> *"SamKnows Whitebox 8")
> name="sk-wb8"
> ;;
> + *"SANLINKING-D240")
> + name="sanlinking-d240"
> + ;;
> *"SAP-G3200U3")
> name="sap-g3200u3"
> ;;
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index d83e5c1..afc6014 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -123,6 +123,7 @@ platform_check_image() {
> rt-n15|\
> rt-n56u|\
> rut5xx|\
> + sanlinking-d240|\
> sap-g3200u3|\
> sk-wb8|\
> sl-r7205|\
> diff --git a/target/linux/ramips/dts/SANLINKING-D240.dts b/target/linux/ramips/dts/SANLINKING-D240.dts
> new file mode 100644
> index 0000000..522b36d
> --- /dev/null
> +++ b/target/linux/ramips/dts/SANLINKING-D240.dts
> @@ -0,0 +1,124 @@
> +/dts-v1/;
> +
> +#include "mt7620a.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. Have a look at the recent ramips
board additions for examples.
> +
> +/ {
> + compatible = "sanlinking,sanlinking-d240", "ralink,mt7620a-soc";
> + model = "SANLINKING-D240";
> +
> + chosen {
> + bootargs = "console=ttyS0,115200";
> + };
> +
> + gpio-leds {
> + compatible = "gpio-leds";
> + power {
> + label = "sanlinking-d240:blue:power";
> + gpios = <&gpio1 14 0>;
> + };
> + usb {
> + label = "sanlinking-d240:blue:usb";
> + gpios = <&gpio1 15 0>;
> + };
> + air {
> + label = "sanlinking-d240:blue:wifi";
> + gpios = <&gpio3 0 1>;
> + };
> + };
> +
> + gpio-keys-polled {
> + compatible = "gpio-keys-polled";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + poll-interval = <20>;
> + reset {
> + label = "reset";
> + gpios = <&gpio0 1 1>;
> + linux,code = <KEY_RESTART>;
> + };
> + };
> +};
> +
> +&gpio0 {
> + status = "okay";
> +};
The gpio0 node can be dropped. gpio0 is enabled by default.
> +
> +&gpio1 {
> + status = "okay";
> +};
> +
> +&gpio3 {
> + status = "okay";
> +};
> +
> +&spi0 {
> + status = "okay";
> +
> + en25q128 at 0 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "w25q128";
should be: compatible = "jedec,spi-nor";
> + reg = <0>;
> + linux,modalias = "m25p80";
drop the linux,modalias it is obsolete since kernel 4.4
Mathias
More information about the Lede-dev
mailing list