diff mbox series

[OpenWrt-Devel] ramips: add support to JS7628 development board

Message ID 1564114882-63441-1-git-send-email-wurobinson@qq.com
State Changes Requested, archived
Headers show
Series [OpenWrt-Devel] ramips: add support to JS7628 development board | expand

Commit Message

Robinson Wu July 26, 2019, 4:21 a.m. UTC
This commit adds support for the ZhuoTK JS7628 development board,
The device has the following specifications:

- SOC:MT7628AN/NN
- RAM:64/128/256 MB (DDR2)
- FLASH:8/16/32 MB (SPI NOR)
- Ethernet:3x 10/100 Mbps ethernet ports (MT7628 built-in switch)
- WIFI:1x 2T2R 2.4 GHz Wi-Fi
- LEDs:1x system status green LED, 1x wifi green LED,
       3x ethernet green LED
- Buttons:1x reset button, 2x user defined button
- 1x microSD slot
- 4x USB 2.0 port
- 1x mini-usb debug UART
- 1x DC jack for main power (DC 5V)
- 1x TTL/RS232 UART
- 1x TTL/RS485 UART
- 13x GPIO header
- 1x audio codec(wm8960)

Installation via OpenWrt:

The original firmware is OpenWrt, so both LuCI or sysupgrade can be used.

Installation via U-boot web:

1. Power on board with reset button or key1 button pressed, release it
   after wifi led start blinking.
2. Setup static IP 192.168.1.123/4 on your PC.
3. Go to 192.168.1.8 in browser and upload "sysupgrade" image.

Installation via U-boot tftp:
1. Connect to serial console at the mini usb, which has been connected to UART0
   on board (115200 8N1)
2. Setup static IP 192.168.1.123/4 on your PC.
3. Place openwrt-firmware.bin on your PC tftp server (192.168.1.123).
3. Connect one of LAN ports on board to your PC.
4. Start terminal software (e.g. screen /dev/ttyUSB0 115200) on PC.
5. Apply power to board.
6. Interrupt U-boot with keypress of "2".
7. At u-boot prompts:
   Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N) Y
   Input device IP (192.168.1.8) ==:192.168.1.8
   Input server IP (192.168.1.123) ==:192.168.1.123
   Input Linux Kernel filename (root_uImage) ==:openwrt-firmware.bin
8. board will download file from tftp server, write it to flash and reboot.

Other notes:

1. This board is available with three types of RAM with flash
   configuration. Chose one of the right "Target Profile" in
   "make menuconfig" as listed below:

   "ZhuoTK JS7628 8M flash/64M RAM"
   "ZhuoTK JS7628 16M flash/128M RAM"
   "ZhuoTK JS7628 32M flash/256M RAM"

   to fit the board you have.

Vist www.zhuotk.com for further information.

Signed-off-by: Robinson Wu <wurobinson@qq.com>
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   6 ++
 .../linux/ramips/base-files/etc/board.d/02_network |   3 +
 .../ramips/dts/mt7628an_zhuotk_js7628-16m-128m.dts |  60 ++++++++++++
 .../ramips/dts/mt7628an_zhuotk_js7628-32m-256m.dts |  60 ++++++++++++
 .../ramips/dts/mt7628an_zhuotk_js7628-8m-64m.dts   |  60 ++++++++++++
 .../linux/ramips/dts/mt7628an_zhuotk_js76x8.dtsi   | 105 +++++++++++++++++++++
 target/linux/ramips/image/mt76x8.mk                |  33 +++++++
 7 files changed, 327 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7628an_zhuotk_js7628-16m-128m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_zhuotk_js7628-32m-256m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_zhuotk_js7628-8m-64m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_zhuotk_js76x8.dtsi

Comments

Adrian Schmutzler July 29, 2019, 2:42 p.m. UTC | #1
Hi again,

> +	compatible = "zhuotk,js7628-16m-128m", "zhuotk,js76x8",
> "mediatek,mt7628an-soc";
> +	model = "ZhuoTK JS7628 (16M flash/128M RAM)";

Is memory auto-detected on this target (to me it looks that)?

If yes, I'd remove all information concerning RAM size (except from hardware specs in commit description), meaning
- compatible
- model
- device definition in mt76x8.mk
- DEVICE_VARIANT
- (name adjustments in other files)

Best

Adrian Schmutzler
Robinson Wu July 30, 2019, 5:49 a.m. UTC | #2
Hi Adrian,
    Before I did this commit, I referred to "mt7628an_unielec_u7628-01-128m-16m.dts". Yes, I use the memory auto-detected function. Will you help me to modiy information concerning RAM size? Or if you have more advices, you can tell me, so I can modify them in the next commit.


Best
Robinson wu
Adrian Schmutzler July 30, 2019, 11:43 a.m. UTC | #3
Hi,

 

I had a look at u7628-01-128m-16m .

 

You are right that this case is similar to your example, but I also think that it should be renamed, too.

 

There are other examples in mt7628an using only flash size for name distinction, e.g.

mt7628an_widora_neo-16m

mt7628an_widora_neo-32m

 

In mt7621, we recently added auto-detection and even did rename devices with different memory sizes there:

https://github.com/openwrt/openwrt/commit/087e14ab5994986802739b57e2de227760102bf4

 

So, one definition will be available for all (auto-detected) memory sizes.

 

So, I would call your devices:

zhuotk,js7628-8m

zhuotk,js7628-16m

zhuotk,js7628-32m

 

model = "ZhuoTK JS7628 (8M flash)"

etc.

 

define Device/zhuotk_js7628-8m

etc.

 

DEVICE_VARIANT := 8M

etc.

 

Despite, is there a reason why call common DTSI and compatible “zhuotk,js76x8” and not “zhuotk,js7628”?

 

And I still do not see the reason for

SUPPORTED_DEVICES += js7628-8m-64m js7688-8m-64m ztk7628p-8m-64m

or do you have OpenWrt-based firmware with those strings installed previously?

 

Best

 

Adrian Schmutzler

 

 

From: 且听风吟 [mailto:wurobinson@qq.com] 
Sent: Dienstag, 30. Juli 2019 07:50
To: Adrian Schmutzler <mail@adrianschmutzler.de>
Cc: openwrt-devel <openwrt-devel@lists.openwrt.org>
Subject: RE:RE: [OpenWrt-Devel] [PATCH] ramips: add support to JS7628 development board

 

Hi Adrian,

    Before I did this commit, I referred to "mt7628an_unielec_u7628-01-128m-16m.dts". Yes, I use the memory auto-detected function. Will you help me to modiy information concerning RAM size? Or if you have more advices, you can tell me, so I can modify them in the next commit.

 

Best

Robinson wu
Robinson Wu July 31, 2019, 7:14 a.m. UTC | #4
Hi Adrian,
It is ok to rename my devices without memory size. I will add two types of board which are named "JS7688"(MT7688AN chip) and "ZTK7628P"(MT7628DAN chip), after "JS7628" commit succeed . 
These boards are based on "*js76x8.dtsi" as they all have the same chip core.


Best
Robinson wu
Robinson Wu Aug. 7, 2019, 9:32 a.m. UTC | #5
Hi Adrian,
I would like to know how the patch I submitted is going? Should I submit it again? Or will you help me to fix it? Please tell me what should I do.


Best wishes
Robinson Wu
Adrian Schmutzler Aug. 7, 2019, 11:45 a.m. UTC | #6
Hi,

> I would like to know how the patch I submitted is going? Should I submit it again?

I’m only a developer, too, so I cannot speak with authority and also cannot push this forward myself.

If you ask for my _opinion_, I’d send a v2 with the RAM-removal renames (as this introduces several changes), and then you will have to wait.
Typically device support patches take quite some time …

> Or will you help me to fix it?

Do you look for any specific help here or this meant as a general statement?

Best

Adrian
Robinson Wu Aug. 8, 2019, 5:52 a.m. UTC | #7
Hi,
Thank you for your advices.  I will submit patch again. 


Best wishes


Robinson Wu
diff mbox series

Patch

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 57f0939..0d876c4 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -458,6 +458,12 @@  zbtlink,zbt-we1226)
 	ucidef_set_led_switch "lan2" "LAN2" "$boardname:green:lan2" "switch0" "0x02"
 	ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x10"
 	;;
+zhuotk,js7628-8m-64m|\
+zhuotk,js7628-16m-128m|\
+zhuotk,js7628-32m-256m)
+	ucidef_set_led_timer "system" "system" "js76x8:green:system" "1000" "1000"
+	set_wifi_led "js76x8:green:wifi"
+	;;
 zorlik,zl5900v2)
 	ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" eth0
 	;;
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 a2b7d1c..f438b46 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -103,6 +103,9 @@  ramips_setup_interfaces()
 	zbtlink,zbt-wg3526-16m|\
 	zbtlink,zbt-wg3526-32m|\
 	zbtlink,zbt-wr8305rt|\
+	zhuotk,js7628-8m-64m|\
+	zhuotk,js7628-16m-128m|\
+	zhuotk,js7628-32m-256m|\
 	zyxel,keenetic|\
 	zyxel,keenetic-omni)
 		ucidef_add_switch "switch0" \
diff --git a/target/linux/ramips/dts/mt7628an_zhuotk_js7628-16m-128m.dts b/target/linux/ramips/dts/mt7628an_zhuotk_js7628-16m-128m.dts
new file mode 100644
index 0000000..4fdaade
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_zhuotk_js7628-16m-128m.dts
@@ -0,0 +1,60 @@ 
+/dts-v1/;
+
+#include "mt7628an_zhuotk_js76x8.dtsi"
+
+/ {
+	compatible = "zhuotk,js7628-16m-128m", "zhuotk,js76x8", "mediatek,mt7628an-soc";
+	model = "ZhuoTK JS7628 (16M flash/128M RAM)";
+};
+
+&spi0 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
+
+	m25p80@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		m25p,chunked-io = <32>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition@30000 {
+				label = "u-boot-env";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			factory: partition@40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+			};
+
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0xfb0000>;
+			};
+		};
+	};
+
+	spidev@1 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "linux,spidev";
+		reg = <1>;
+		spi-max-frequency = <40000000>;
+	};
+};
diff --git a/target/linux/ramips/dts/mt7628an_zhuotk_js7628-32m-256m.dts b/target/linux/ramips/dts/mt7628an_zhuotk_js7628-32m-256m.dts
new file mode 100644
index 0000000..a309926
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_zhuotk_js7628-32m-256m.dts
@@ -0,0 +1,60 @@ 
+/dts-v1/;
+
+#include "mt7628an_zhuotk_js76x8.dtsi"
+
+/ {
+	compatible = "zhuotk,js7628-32m-256m", "zhuotk,js76x8", "mediatek,mt7628an-soc";
+	model = "ZhuoTK JS7628 (32M flash/256M RAM)";
+};
+
+&spi0 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
+
+	m25p80@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		m25p,chunked-io = <32>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition@30000 {
+				label = "u-boot-env";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			factory: partition@40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+			};
+
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0x1fb0000>;
+			};
+		};
+	};
+
+	spidev@1 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "linux,spidev";
+		reg = <1>;
+		spi-max-frequency = <40000000>;
+	};
+};
diff --git a/target/linux/ramips/dts/mt7628an_zhuotk_js7628-8m-64m.dts b/target/linux/ramips/dts/mt7628an_zhuotk_js7628-8m-64m.dts
new file mode 100644
index 0000000..a1a1de1
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_zhuotk_js7628-8m-64m.dts
@@ -0,0 +1,60 @@ 
+/dts-v1/;
+
+#include "mt7628an_zhuotk_js76x8.dtsi"
+
+/ {
+	compatible = "zhuotk,js7628-8m-64m", "zhuotk,js76x8", "mediatek,mt7628an-soc";
+	model = "ZhuoTK JS7628 (8M flash/64M RAM)";
+};
+
+&spi0 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
+
+	m25p80@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		m25p,chunked-io = <32>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition@30000 {
+				label = "u-boot-env";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			factory: partition@40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+			};
+
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0x7b0000>;
+			};
+		};
+	};
+
+	spidev@1 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "linux,spidev";
+		reg = <1>;
+		spi-max-frequency = <40000000>;
+	};
+};
diff --git a/target/linux/ramips/dts/mt7628an_zhuotk_js76x8.dtsi b/target/linux/ramips/dts/mt7628an_zhuotk_js76x8.dtsi
new file mode 100644
index 0000000..4fbf7f6
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_zhuotk_js76x8.dtsi
@@ -0,0 +1,105 @@ 
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "zhuotk,js76x8", "mediatek,mt7628an-soc";
+
+	aliases {
+		led-boot = &led_system;
+		led-failsafe = &led_system;
+		led-running = &led_system;
+		led-upgrade = &led_system;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		led_system: system {
+			label = "js76x8:green:system";
+			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+		};
+
+		wifi {
+			label = "js76x8:green:wifi";
+			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "gpio","p3led_an","p4led_an",
+				"pwm0","pwm1","refclk","wdt","wled_an";
+			ralink,function = "gpio";
+		};
+
+		p0led {
+			ralink,group = "p0led_an";
+			ralink,function = "p0led_an";
+		};
+
+		p1led {
+			ralink,group = "p1led_an";
+			ralink,function = "p1led_an";
+		};
+
+		p2led {
+			ralink,group = "p2led_an";
+			ralink,function = "p2led_an";
+		};
+
+		pwm_2_3 {
+			ralink,group = "uart2";
+			ralink,function = "pwm";
+		};
+	};
+
+	uart2 {
+		uart2 {
+			ralink,group = "spis";
+			ralink,function = "pwm_uart2";
+		};
+	};
+};
+
+&i2c {
+	status = "okay";
+};
+
+&uart1 {
+	status = "okay";
+};
+
+&uart2 {
+	status = "okay";
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0x28>;
+};
+
+&sdhci {
+	status = "okay";
+	mediatek,cd-low;
+};
+
+&wmac {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index fae9fb0..9fa8b7b 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -549,6 +549,39 @@  define Device/zbtlink_zbt-we1226
 endef
 TARGET_DEVICES += zbtlink_zbt-we1226
 
+define Device/zhuotk_js7628-8m-64m
+  MTK_SOC := mt7628an
+  IMAGE_SIZE := 7872k
+  DEVICE_VENDOR := ZhuoTK
+  DEVICE_MODEL := JS7628
+  DEVICE_VARIANT := 8M flash/64M RAM
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
+  SUPPORTED_DEVICES += js7628-8m-64m js7688-8m-64m ztk7628p-8m-64m
+endef
+TARGET_DEVICES += zhuotk_js7628-8m-64m
+
+define Device/zhuotk_js7628-16m-128m
+  MTK_SOC := mt7628an
+  IMAGE_SIZE := 16064k
+  DEVICE_VENDOR := ZhuoTK
+  DEVICE_MODEL := JS7628
+  DEVICE_VARIANT := 16M flash/128M RAM
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
+  SUPPORTED_DEVICES += js7628-16m-128m js7688-16m-128m ztk7628p-16m-64m
+endef
+TARGET_DEVICES += zhuotk_js7628-16m-128m
+
+define Device/zhuotk_js7628-32m-256m
+  MTK_SOC := mt7628an
+  IMAGE_SIZE := 32448k
+  DEVICE_VENDOR := ZhuoTK
+  DEVICE_MODEL := JS7628
+  DEVICE_VARIANT := 32M flash/256M RAM
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
+  SUPPORTED_DEVICES += js7628-32m-256 js7688-32m-256m ztk7628p-32m-64m
+endef
+TARGET_DEVICES += zhuotk_js7628-32m-256m
+
 define Device/zyxel_keenetic-extra-ii
   MTK_SOC := mt7628an
   IMAGE_SIZE := 14912k