[LEDE-DEV] [PATCH v2] ramips: add support for RATOC REX-WIFISD2
John Crispin
john at phrozen.org
Thu Feb 9 06:13:54 PST 2017
On 28/01/2017 17:03, FUKAUMI Naoki wrote:
> RATOC REX-WIFISD2 is a battery-powered wireless SD card reader with
>
> - MT7620A + MT7610E
> - 64MiB DDR2 SDRAM
> - 16MiB SPI flash
> - 2T2R 11b/g/n + 1T1R 11ac/a/n Wi-Fi
> - 1x 10/100Mbps ethernet switch
> - 1x SD card
> - 1x USB 2.0
> - 2x programmable LED
> - 1x button
>
> stock firmware is very similar to HooToo Tripmate travel routers. you
> can do almost anything as a root user with telnet and/or shell script
> (factory image or "EnterRouterMode.sh") on stock firmware.
>
> "EnterRouterMode.sh" will be the easiest way to install. put the
> following shell script into SD card (or USB storage) as
> "EnterRouterMode.sh" with "kernel.bin" and "rootfs.bin" files.
>
> ----
> #!/bin/sh
>
> dir=`dirname $0`
>
> mtd_write write ${dir}/kernel.bin Kernel_RootFS
> mtd_write -r write ${dir}/rootfs.bin Rootfs
> ----
>
> it will be run automatically when SD card is mounted on stock firmware.
>
> TFTP can also be used to flash kernel and rootfs. it will be run by
> press & hold RESET button while power on. (serverip=10.10.10.254)
>
> you may use all partitions between "kernel" and "rootfs" as a single
> "firmware" partition (please edit dts yourself), but "params" partition
> should be kept if you want to restore stock firmware.
>
> Signed-off-by: FUKAUMI Naoki <naobsd at gmail.com>
Hi,
patch fails to apply, please rebase/resend it
John
> ---
> Changes in v2:
> - add "read-only" property to "params", "user_backup", and "user" partitions
>
> .../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/REX-WIFISD2.dts | 148 +++++++++++++++++++++
> target/linux/ramips/image/mt7620.mk | 10 ++
> 6 files changed, 165 insertions(+), 1 deletion(-)
> create mode 100644 target/linux/ramips/dts/REX-WIFISD2.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 91f1aaa..b27954f 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -192,6 +192,7 @@ ramips_setup_interfaces()
> mzk-ex750np|\
> na930|\
> pbr-d1|\
> + rex-wifisd2|\
> wli-tx4-ag300n|\
> wmr-300|\
> wrh-300cr)
> diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
> index 9499833..84031d1 100644
> --- a/target/linux/ramips/base-files/etc/diag.sh
> +++ b/target/linux/ramips/base-files/etc/diag.sh
> @@ -41,7 +41,8 @@ get_status_led() {
> xdxrn502j)
> status_led="$board:green:power"
> ;;
> - 3g-6200nl)
> + 3g-6200nl|\
> + rex-wifisd2)
> status_led="$board:green:internet"
> ;;
> a5-v11|\
> diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
> index 8292da1..5ab46de 100755
> --- a/target/linux/ramips/base-files/lib/ramips.sh
> +++ b/target/linux/ramips/base-files/lib/ramips.sh
> @@ -406,6 +406,9 @@ ramips_board_detect() {
> *"RE6500")
> name="re6500"
> ;;
> + *"REX-WIFISD2")
> + name="rex-wifisd2"
> + ;;
> *"RN502J")
> name="xdxrn502j"
> ;;
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index c6ad8ca..05d2759 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -113,6 +113,7 @@ platform_check_image() {
> px-4885|\
> rb750gr3|\
> re6500|\
> + rex-wifisd2|\
> rp-n53|\
> rt5350f-olinuxino|\
> rt5350f-olinuxino-evb|\
> diff --git a/target/linux/ramips/dts/REX-WIFISD2.dts b/target/linux/ramips/dts/REX-WIFISD2.dts
> new file mode 100644
> index 0000000..4d8819a
> --- /dev/null
> +++ b/target/linux/ramips/dts/REX-WIFISD2.dts
> @@ -0,0 +1,148 @@
> +/dts-v1/;
> +
> +#include "mt7620a.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> + compatible = "ratoc,rex-wifisd2", "ralink,mt7620a-soc";
> + model = "RATOC REX-WIFISD2";
> +
> + gpio-keys-polled {
> + compatible = "gpio-keys-polled";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + poll-interval = <20>;
> +
> + reset {
> + label = "reset";
> + gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
> + linux,code = <KEY_RESTART>;
> + };
> + };
> +
> + gpio-leds {
> + compatible = "gpio-leds";
> +
> + internet {
> + label = "rex-wifisd2:green:internet";
> + gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
> + };
> +
> + wifi {
> + label = "rex-wifisd2:blue:wifi";
> + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
> + };
> + };
> +};
> +
> +&ehci {
> + status = "okay";
> +};
> +
> +ðernet {
> + mtd-mac-address = <&factory 0x2e>;
> + mediatek,portmap = "llllw";
> +};
> +
> +&gpio1 {
> + status = "okay";
> +};
> +
> +&gpio2 {
> + status = "okay";
> +};
> +
> +&gpio3 {
> + status = "okay";
> +};
> +
> +&ohci {
> + status = "okay";
> +};
> +
> +&pcie {
> + status = "okay";
> +
> + pcie-bridge {
> + mt76 at 0,0 {
> + reg = <0x0000 0 0 0 0>;
> + device_type = "pci";
> + mediatek,mtd-eeprom = <&factory 0x8000>;
> + mediatek,2ghz = <0>;
> + };
> + };
> +};
> +
> +&pinctrl {
> + state_default: pinctrl0 {
> + gpio {
> + ralink,group = "wled", "ephy";
> + ralink,function = "gpio";
> + };
> + };
> +};
> +
> +&spi0 {
> + status = "okay";
> +
> + m25p80 at 0 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + spi-max-frequency = <10000000>;
> + m25p,chunked-io = <32>;
> +
> + 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 {
> + label = "kernel";
> + reg = <0x50000 0x180000>;
> + };
> +
> + partition at 1d0000 {
> + label = "params";
> + reg = <0x1d0000 0x10000>;
> + read-only;
> + };
> +
> + partition at 1e0000 {
> + label = "user_backup";
> + reg = <0x1e0000 0x10000>;
> + read-only;
> + };
> +
> + partition at 1f0000 {
> + label = "user";
> + reg = <0x1f0000 0x10000>;
> + read-only;
> + };
> +
> + partition at 200000 {
> + label = "rootfs";
> + reg = <0x200000 0xe00000>;
> + };
> + };
> +};
> +
> +&wmac {
> + ralink,mtd-eeprom = <&factory 0>;
> +};
> diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
> index 50eae2f..0728d93 100644
> --- a/target/linux/ramips/image/mt7620.mk
> +++ b/target/linux/ramips/image/mt7620.mk
> @@ -465,3 +465,13 @@ define Device/kng_rc
> zyimage -d 8997 -v "ZyXEL Keenetic Viva"
> endef
> TARGET_DEVICES += kng_rc
> +
> +define Device/rex-wifisd2
> + DTS := REX-WIFISD2
> + IMAGES := kernel.bin rootfs.bin
> + IMAGE/kernel.bin := append-kernel
> + IMAGE/rootfs.bin := append-rootfs | pad-rootfs
> + DEVICE_TITLE := RATOC REX-WIFISD2
> + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
> +endef
> +TARGET_DEVICES += rex-wifisd2
>
More information about the Lede-dev
mailing list