Re: [OpenWrt-Devel] [PATCH] ramips: Add support for Head Weblink HDRM200

2019-05-02 Thread Kristian Evensen
Hi Rafał,

On Thu, May 2, 2019 at 9:31 AM Rafał Miłecki  wrote:
> Please include SPDX line with .dts file license, see:
> https://openwrt.org/submitting-patches#dts_checklist

Thanks for your feedback. Will update and submit a V2 later today.

BR,
Kristian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: Add support for Head Weblink HDRM200

2019-05-02 Thread Rafał Miłecki
On Thu, 25 Apr 2019 at 14:18, Kristian Evensen
 wrote:
> diff --git a/target/linux/ramips/dts/HDRM200.dts 
> b/target/linux/ramips/dts/HDRM200.dts
> new file mode 100644
> index 00..b076f30978
> --- /dev/null
> +++ b/target/linux/ramips/dts/HDRM200.dts
> @@ -0,0 +1,226 @@
> +/dts-v1/;
> +
> +#include "mt7620a.dtsi"

Please include SPDX line with .dts file license, see:
https://openwrt.org/submitting-patches#dts_checklist

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: Add support for Head Weblink HDRM200

2019-04-25 Thread Kristian Evensen
Head Weblink HDRM200 is a dual-sim router based on MT7620A. The detailed
specifications are:

- MT7620A (580MHz)
- 64MB RAM
- 16MB of flash (SPI NOR)
- 6x 10/100Mbps Ethernet (MT7620A built-in switch)
- 1x microSD slot
- 1x miniPCIe slot (only USB2.0 bus)
- 2x SIM slots (standard size)
- 1x USB2.0 port
- 1x 2.4GHz wifi (rt2800)
- 1x 5GHz wifi (mt7621)
- 1x reset button
- 1x WPS button
- 3x GPIO-controllable LEDs
- 1x 10 pin terminal block (RS232, RS485, 4 x GPIO)

Tested:
- Ethernet switch
- Wifi
- USB slot
- SD card slot
- miniPCIe-slot
- sysupgrade
- reset button

Installation instructions:

Installing OpenWRT for the first time requires a bit of work, as the
board does not ship with OpenWRT. In addition, the bootloader
automatically reboots when installing an image over tftp.

In order to install OpenWRT, you first need to compile an initramfs
(ramdisk)-image for the device. Once the image is ready, you need to do
the following:

* Copy the initramfs-image to your tftp-root (default filename is
test.bin) and configure networking accordingly (default server IP is
10.10.10.3, client 10.10.10.123). Start your tftp server.
* Open the board and connect to UART. The pins are exposed and clearly
marked.
* Boot the board and press 1.
* Either use the default filename and client/server IP-addresses, or
specify your own.

The image should now be loaded to memory and board boot. If the router
reboots while the image is loading, you need to try again. Once the
board has booted, copy the sysupgrade-image to the router and run
sysupgrade in order to install OpenWRT to the flash.

Notes:

- You control which SIM slot to use by writing 0/1 to
/sys/class/gpio/sim_switch/value. In order for the change to take
effect, you can either use AT-commands (AT+CFUN) or power-cycle the
modem (write 0/1 to /sys/class/gpio/power_mpcie/value).
- RS485 is available on /dev/ttyS0.
- RS232 is available on /dev/ttyS1.
- The name of the ioX-gpios map to the labels on the casing.

Signed-off-by: Kristian Evensen 
---
 .../ramips/base-files/etc/board.d/01_leds |   3 +
 .../ramips/base-files/etc/board.d/02_network  |   1 +
 target/linux/ramips/base-files/lib/ramips.sh  |   3 +
 target/linux/ramips/dts/HDRM200.dts   | 226 ++
 target/linux/ramips/image/mt7620.mk   |   8 +
 5 files changed, 241 insertions(+)
 create mode 100644 target/linux/ramips/dts/HDRM200.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 1fc86c44c3..c9da17ddc9 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -184,6 +184,9 @@ hc5861)
ucidef_set_led_netdev "wifi5g" "wifi5g" "$boardname:blue:wlan5g" "wlan0"
ucidef_set_led_netdev "wifi2g" "wifi2g" "$boardname:blue:wlan2g" "wlan1"
;;
+hdrm200)
+   set_wifi_led "$boardname:green:wifi"
+   ;;
 hg255d)
set_wifi_led "$boardname:green:wlan"
ucidef_set_led_netdev "internet" "internet" "$boardname:green:internet" 
"eth0.2"
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 28fd00926c..69c281aeeb 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -315,6 +315,7 @@ ramips_setup_interfaces()
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
hc5661|\
+   hdrm200|\
y1s)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 6742c5370b..ea12a021b3 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -229,6 +229,9 @@ ramips_board_detect() {
*"HC5962")
name="hc5962"
;;
+   *"HDRM200")
+   name="hdrm200"
+   ;;
*"HG255D")
name="hg255d"
;;
diff --git a/target/linux/ramips/dts/HDRM200.dts 
b/target/linux/ramips/dts/HDRM200.dts
new file mode 100644
index 00..b076f30978
--- /dev/null
+++ b/target/linux/ramips/dts/HDRM200.dts
@@ -0,0 +1,226 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "head-weblink,hdrm200", "ralink,mt7620a-soc";
+   model = "Head Weblink HDRM200";
+
+   aliases {
+   led-boot = _system;
+   led-failsafe = _system;
+   led-running = _system;
+   led-upgrade = _system;
+   };
+
+   chosen {
+   bootargs = "console=ttyS1,57600";
+   };
+
+   gpio-export {
+   compatible = "gpio-export";
+   #size-cells = <0>;
+
+   sim_switch {
+   gpio-export,name