RE: Re: [OpenWrt-Devel] [PATCH v6] ramips: add support for JS76x8 series DEV boards

2020-07-14 Thread mail
> 2.About "missing reg property".
> Adrian Schmutzler wrote a letter to me about that, then I tested as he said, 
> it was ok. Here is the letter from him.

@Petr: The reg property is in the DTS files, while everything else is in the 
DTSI. It's also a case of DRY :-)

> 5.About "Be DRY, use some common Device and just change IMAGE_SIZE and 
> DEVICE_VARIANT".
> Here are three real type of boards by my hand, each has different flash, I 
> don't think it's good way to change board types by modifying the DTS file, 
> it's better to do that by selecting in menuconfig.

@Robinson Wu: That's a misunderstanding from your side. What Petr meant was 
just to rearrange the definitions inside mt76x8.mk like this, so you define a 
common blueprint and then use that for the actual device definitions (note that 
MTK_SOC is not required anymore, as it's defined globally at the top of the 
file):

+define Device/jotale_js76x8
+  DEVICE_VENDOR := Jotale
+  DEVICE_MODEL := JS76x8
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
+endef

+define Device/jotale_js76x8-16m
+  $(Device/jotale_js76x8)
+  IMAGE_SIZE := 16064k
+  DEVICE_VARIANT := 16M
+endef
+TARGET_DEVICES += jotale_js76x8-16m

and so on for the other two devices.

I just didn't request that as I personally prefer individual statement if it's 
"just" three lines for the common definition.

Apart from that, please note these additional comments:

7. In master, gpio setup has changed, so you only have one &gpio now. So you 
will need to convert e.g.
<&gpio1 5 GPIO_ACTIVE_LOW>;
to
<&gpio 37 GPIO_ACTIVE_LOW>;

8. pinctrl property rename:
Convert
+   ralink,group = "p1led_an";
+   ralink,function = "p1led_an";
to
+   groups = "p1led_an";
+   ralink,function = "p1led_an";

Sorry for not having taken care earlier, but I can review only 80 % of your PR, 
and that's just not enough to merge it.

Best

Adrian


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v6] ramips: add support for JS76x8 series DEV boards

2020-07-11 Thread Petr Štetiar
Robinson Wu  [2020-04-07 16:36:52]:

Hi,

> +&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";
> + };
> + };

this block looks weird

> +&spi0 {
> + status = "okay";
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
> +
> + flash@0 {
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + spi-max-frequency = <4000>;
> + m25p,chunked-io = <32>;
> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition@0 {
> + label = "u-boot";
> + reg = <0x0 0x3>;
> + read-only;
> + };
> +
> + partition@3 {
> + label = "u-boot-env";
> + reg = <0x3 0x1>;
> + read-only;
> + };
> +
> + factory: partition@4 {
> + label = "factory";
> + reg = <0x4 0x1>;
> + read-only;
> + };
> +
> + firmware: partition@5 {
> + compatible = "denx,uimage";

missing reg property

> + label = "firmware";
> + };
> + };
> + };
> +
> + spidev@1 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "linux,spidev";
> + reg = <1>;
> + spi-max-frequency = <4000>;
> + };

Remove this, it's going to produce kernel warning.

> --- a/target/linux/ramips/image/mt76x8.mk
> +++ b/target/linux/ramips/image/mt76x8.mk
> @@ -140,6 +140,36 @@ define Device/iptime_a604m
>  endef
>  TARGET_DEVICES += iptime_a604m
>  

whitespace issue

> +define Device/jotale_js76x8-16m
> +  MTK_SOC := mt7628an
> +  IMAGE_SIZE := 16064k
> +  DEVICE_VENDOR := Jotale
> +  DEVICE_MODEL := JS76x8
> +  DEVICE_VARIANT := 16M
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
> +endef
> +TARGET_DEVICES += jotale_js76x8-16m
> +
> +define Device/jotale_js76x8-32m
> +  MTK_SOC := mt7628an
> +  IMAGE_SIZE := 32448k
> +  DEVICE_VENDOR := Jotale
> +  DEVICE_MODEL := JS76x8
> +  DEVICE_VARIANT := 32M
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
> +endef
> +TARGET_DEVICES += jotale_js76x8-32m
> +
> +define Device/jotale_js76x8-8m
> +  MTK_SOC := mt7628an
> +  IMAGE_SIZE := 7872k
> +  DEVICE_VENDOR := Jotale
> +  DEVICE_MODEL := JS76x8
> +  DEVICE_VARIANT := 8M
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
> +endef
> +TARGET_DEVICES += jotale_js76x8-8m
> +

Be DRY, use some common Device and just change IMAGE_SIZE and DEVICE_VARIANT.

> @@ -186,6 +189,9 @@ ramips_setup_macs()
>   mercury,mac1200r-v2)
>   wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory_info 0xd)" 
> 1)
>   ;;
> + jotale,js76x8-16m|\
> + jotale,js76x8-32m|\
> + jotale,js76x8-8m|\

Wrong alphabetic sorting here

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


[OpenWrt-Devel] [PATCH v6] ramips: add support for JS76x8 series DEV boards

2020-04-07 Thread Robinson Wu
This commit adds support for the Jotale JS76x8 series development boards.
These devices have the following specifications:

- SOC: MT7628AN/NN, MT7688AN, MT7628DAN
- RAM of MT7628AN/NN and MT7688AN: 64/128/256 MB (DDR2)
- RAM of MT7628DAN: 64 MB (DDR2)
- FLASH:8/16/32 MB (SPI NOR)
- Ethernet:3x 10/100 Mbps ethernet ports (MT76x8 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 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.

Signed-off-by: Robinson Wu 
---
 .../ramips/dts/mt7628an_jotale_js76x8-16m.dts  |  12 ++
 .../ramips/dts/mt7628an_jotale_js76x8-32m.dts  |  12 ++
 .../linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts |  12 ++
 .../linux/ramips/dts/mt7628an_jotale_js76x8.dtsi   | 156 +
 target/linux/ramips/image/mt76x8.mk|  30 
 .../ramips/mt76x8/base-files/etc/board.d/01_leds   |   6 +
 .../mt76x8/base-files/etc/board.d/02_network   |   6 +
 7 files changed, 234 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi

diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts
new file mode 100644
index 000..53ed6d8
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "mt7628an_jotale_js76x8.dtsi"
+
+/ {
+   compatible = "jotale,js76x8-16m", "jotale,js76x8", 
"mediatek,mt7628an-soc";
+   model = "Jotale JS76x8 (16M)";
+};
+
+&firmware {
+   reg = <0x5 0xfb>;
+};
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
new file mode 100644
index 000..851e6db
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "mt7628an_jotale_js76x8.dtsi"
+
+/ {
+   compatible = "jotale,js76x8-32m", "jotale,js76x8", 
"mediatek,mt7628an-soc";
+   model = "Jotale JS76x8 (32M)";
+};
+
+&firmware {
+   reg = <0x5 0x1fb>;
+};
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts
new file mode 100644
index 000..8cac3fb
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "mt7628an_jotale_js76x8.dtsi"
+
+/ {
+   compatible = "jotale,js76x8-8m", "mediatek,mt7628an-soc";
+   model = "Jotale JS76x8 (8M)";
+};
+
+&firmware {
+   reg = <0x5 0x7b>;
+};
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
new file mode 100644
index 000..d9cd5d4
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
@@ -0,0 +1,156 @@
+#include "mt7628an.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "jotale,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";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_system: system {
+   label = "js76x8:green:system";
+   gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+   };
+
+