[PATCH v4 2/2] realtek: add support for Panasonic Switch-M8eG PN28080K

2022-03-09 Thread INAGAKI Hiroshi
Panasonic Switch-M8eG PN28080K is a 8 + 1 port gigabit switch, based on
RTL8380M.

Specification:

- SoC   : Realtek RTL8380M
- RAM   : DDR3 128 MiB (Winbond W631GG8KB-15)
- Flash : SPI-NOR 32 MiB (Macronix MX25L25635FMI-10G)
- Ethernet  : 10/100/1000 Mbps x8 + 1
  - port 1-8: TP, RTL8218B (SoC)
  - port 9  : SFP, RTL8380M (SoC)
- LEDs/Keys : 7x / 1x
- UART  : RS-232 port on the front panel (connector: RJ-45)
  - 3:TX, 4:GND, 5:GND, 6:RX (pin number: RJ-45)
  - 9600n8
- Power : 100-240 VAC, 50/60 Hz, 0.5 A
  - Plug: IEC 60320-C13
- Stock OS  : VxWorks based

Flash instruction using initramfs image:

1.  Prepare the TFTP server with the IP address 192.168.1.111
2.  Rename the OpenWrt initramfs image to "0101A8C0.img" and place it to
the TFTP directory
3.  Download the official upgrading firmware (ex: pn28080k_v3.rom)
and place it to the TFTP directory
4.  Boot M8eG and interrupt the U-Boot with Ctrl + C keys
5.  Execute the following commands and boot with the OpenWrt initramfs
image

rtk network on
tftpboot 0x8100
bootm

6.  Backup mtdblock files to the computer by scp or anything and reboot
7.  Interrupt the U-Boot and execute the following commands to re-create
filesystem in the flash

ffsmount c:/
ffsfmt c:/

this step takes a long time, about ~ 4 mins

8.  Execute the following commands to put the official images to the
filesystem

updatert 

example:

  updatert pn28080k_v3.rom

this step takes about ~ 40 secs

9.  Set the environment variables of the U-Boot by the following commands

setenv loadaddr 0xb4e0
setenv bootcmd bootm
saveenv

10: Download the OpenWrt initramfs image and boot with it

tftpboot 0x8100 0101A8C0.img
bootm

11: On the initramfs image, download the sysupgrade image and perform
sysupgrade with it

sysupgrade 

12: Wait ~ 120 seconds to complete flashing

Note:

- "Switch-M8eG" is a model name, and "PN28080K" is a model number.
  Switch-M8eG has an another (old) model number ("PN28080"), it's not a
  Realtek based hardware.

- Switch-M8eG has a "POWER" LED (Green), but it's not connected to any
  GPIO pin.

- The U-Boot checks the runtime images in the flash when booting and
  fails to execute anything in "bootcmd" variable if the images are not
  exsisting.

- A filesystem is formed in the flash (0x10-0x1DF) on the stock
  firmware and it includes the stock images, configuration files and
  checksum files. It's unknown format, can't be managed on the OpenWrt.
  To get the enough space for OpenWrt, move the filesystem to the head
  of "fs_reserved" partition by execution of "ffsfmt" and "updatert".

- On the other devices in the same series of Switch-M8eG PN28080K, the
  INT pin on the PCA9555 is not connected to anywhere.

Back to the stock firmware:

1. Delete "loadaddr" variable and set "bootcmd" to the original value

   on U-Boot:

 setenv loadaddr
 setenv bootcmd 'bootm 0x8100'

   on OpenWrt:

 fw_setenv loadaddr
 fw_setenv bootcmd 'bootm 0x8100'

2. Perform reset or reboot

  on U-Boot:

reset

  on OpenWrt:

reboot

Signed-off-by: INAGAKI Hiroshi 
---
v1 -> v2:

- drop changes for kernel 5.4
- add interrupt-related properties to the nodes of PCA9539 and PCA9555
  - use "gpio-keys" instead of "gpio-keys-polled"
- update/remove comments in mtd partitions
- use "led-*" scheme and add color/function properties for each node of
  LEDs
- drop unnecessary default values from gpio-restart node

v2 -> v3:

- move interrupt related properties in PCA9539 to device dts
- move child i2c bus definitions in PCA9545 to device dts
- use actual SoC name "rtl8380" in second compatible of root

v3 -> v4:

- drop unnecessary "/delete-node/" of rtl8231 from dtsi

 .../rtl8380_panasonic_m8eg-pn28080k.dts   | 133 
 .../rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 195 ++
 target/linux/realtek/image/rtl838x.mk |  10 +
 3 files changed, 338 insertions(+)
 create mode 100644 
target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
 create mode 100644 
target/linux/realtek/dts-5.10/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi

diff --git a/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts 
b/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
new file mode 100644
index 00..f9d58f5b66
--- /dev/null
+++ b/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "rtl838x.dtsi"
+#include "rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi"
+
+#include 
+
+/ {
+   compatible = "panasonic,m8eg-pn28080k", "realtek,rtl8380-soc";
+   model = "Panasonic Switch-M8eG PN28080K";
+
+   aliases {
+   led-boot = &led_status_eco_green;
+   led-failsafe = &led_status_eco_amber;
+   led-running = &led_sta

[PATCH v4 1/2] realtek: enable pca953x driver for rtl838x subtarget

2022-03-09 Thread INAGAKI Hiroshi
The system status LED on Panasonic Switch-M8eG PN28080K is connected to
a PCA9539PW. To use the LED as a status LED of OpenWrt while booting,
enable the pca953x driver and built-in to the kernel.
Also enable CONFIG_GPIO_PCA953X_IRQ to use interrupt via RTL83xx GPIO.

Signed-off-by: INAGAKI Hiroshi 
---
v1 -> v2:

- drop changes in config-5.4
- enable CONFIG_GPIO_PCA953X_IRQ to use interrupt

v2 -> v3:

(no changes)

v3 -> v4:

- update the title of this commit

 target/linux/realtek/rtl838x/config-5.10 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/linux/realtek/rtl838x/config-5.10 
b/target/linux/realtek/rtl838x/config-5.10
index 1252aab11e..8e27af95ba 100644
--- a/target/linux/realtek/rtl838x/config-5.10
+++ b/target/linux/realtek/rtl838x/config-5.10
@@ -69,6 +69,8 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIOLIB_IRQCHIP=y
 CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_PCA953X=y
+CONFIG_GPIO_PCA953X_IRQ=y
 CONFIG_GPIO_REALTEK_OTTO=y
 CONFIG_GPIO_RTL8231=y
 CONFIG_GRO_CELLS=y
@@ -166,6 +168,7 @@ CONFIG_REALTEK_OTTO_WDT=y
 CONFIG_REALTEK_PHY=y
 CONFIG_REALTEK_SOC_PHY=y
 CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
 CONFIG_REGMAP_MMIO=y
 CONFIG_RESET_CONTROLLER=y
 CONFIG_RTL83XX=y
-- 
2.34.1.windows.1


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


[PATCH v4 0/2] realtek: add support for Panasonic Switch-M8eG PN28080K

2022-03-09 Thread INAGAKI Hiroshi
This is a continuation of the PR in GitHub[1] and v1 patch series.

This patch series adds support for Panasonic Switch-M8eG PN28080K.

Panasonic Switch-M*eG PN28xx0K series has the following models:

- Switch-M8eG PN28080K (RTL8380M, 8 + 1 SFP)
  -  1-9 : RTL8380M (SoC)
- Switch-M16eG PN28160K (RTL8382M?, 14 + 2 combo)
  - ?
- Switch-M24eG PN28240K (RTL8382M, 22 + 2 combo)
  -  1-8 : RTL8218B
  -  9-16: RTL8382M (SoC)
  - 17-24: RTL8218FB
- Switch-M48eG PN28480K (RTL8393M, 44 + 4 combo)
  -  1-40: RTL8218B
  - 41-48: RTL8218FB

(Note: I don't have a Switch-M16eG PN28160K and the hardware specification
 is unknown)

These models have the many common parts, so 2nd commit creates a dtsi for
This series.

Note:

- "Switch-M*eG" is a model name and "PN28xx0K" is a model number.
  Each model has two model number, "PN28xx0" and "PN28xx0K". But the
  first one (PN28xx0) is a Broadcom SoC based hardware.

- This series uses the VxWorks-based kernel in stock firmware.

[1]: https://github.com/openwrt/openwrt/pull/4209

v1 -> v2:

- drop 5.4 changes
- add interrupt-related properties to the nodes of PCA9539 and PCA9555
  - use "gpio-keys" instead of "gpio-keys-polled"
- update/remove comments in mtd partitions
- use "led-*" scheme and add color/function properties for each node of
  LEDs
- drop unnecessary default values from gpio-restart node

v2 -> v3:

- move interrupt related properties in PCA9539 to device dts
- move child i2c bus definitions in PCA9545 to device dts
- use actual SoC name "rtl8380" in second compatible of root

v3 -> v4:

- update the title of the first commit
- drop unnecessary "/delete-node/" of rtl8231 from dtsi

INAGAKI Hiroshi (2):
  realtek: enable pca953x driver for rtl838x subtarget
  realtek: add support for Panasonic Switch-M8eG PN28080K

 .../rtl8380_panasonic_m8eg-pn28080k.dts   | 133 
 .../rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 195 ++
 target/linux/realtek/image/rtl838x.mk |  10 +
 target/linux/realtek/rtl838x/config-5.10  |   3 +
 4 files changed, 341 insertions(+)
 create mode 100644 
target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
 create mode 100644 
target/linux/realtek/dts-5.10/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi

-- 
2.34.1.windows.1


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


Re: [PATCH v3 1/2] realtek: enable pca953x driver for target

2022-03-09 Thread INAGAKI Hiroshi

Oops, I forgot to update the title of this commit...

I'll fix and re-send, please ignore this series. Sorry for noise...

Regards,
Hiroshi

On 2022/03/09 21:52, INAGAKI Hiroshi wrote:

The system status LED on Panasonic Switch-M8eG PN28080K is connected to
a PCA9539PW. To use the LED as a status LED of OpenWrt while booting,
enable the pca953x driver and built-in to the kernel.
Also enable CONFIG_GPIO_PCA953X_IRQ to use interrupt via RTL83xx GPIO.

Signed-off-by: INAGAKI Hiroshi 
---
v1 -> v2:

- drop changes in config-5.4
- enable CONFIG_GPIO_PCA953X_IRQ to use interrupt

v2 -> v3:

(no changes)

  target/linux/realtek/rtl838x/config-5.10 | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/target/linux/realtek/rtl838x/config-5.10 
b/target/linux/realtek/rtl838x/config-5.10
index 1252aab11e..8e27af95ba 100644
--- a/target/linux/realtek/rtl838x/config-5.10
+++ b/target/linux/realtek/rtl838x/config-5.10
@@ -69,6 +69,8 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
  CONFIG_GPIOLIB=y
  CONFIG_GPIOLIB_IRQCHIP=y
  CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_PCA953X=y
+CONFIG_GPIO_PCA953X_IRQ=y
  CONFIG_GPIO_REALTEK_OTTO=y
  CONFIG_GPIO_RTL8231=y
  CONFIG_GRO_CELLS=y
@@ -166,6 +168,7 @@ CONFIG_REALTEK_OTTO_WDT=y
  CONFIG_REALTEK_PHY=y
  CONFIG_REALTEK_SOC_PHY=y
  CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
  CONFIG_REGMAP_MMIO=y
  CONFIG_RESET_CONTROLLER=y
  CONFIG_RTL83XX=y


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


[PATCH v3 2/2] realtek: add support for Panasonic Switch-M8eG PN28080K

2022-03-09 Thread INAGAKI Hiroshi
Panasonic Switch-M8eG PN28080K is a 8 + 1 port gigabit switch, based on
RTL8380M.

Specification:

- SoC   : Realtek RTL8380M
- RAM   : DDR3 128 MiB (Winbond W631GG8KB-15)
- Flash : SPI-NOR 32 MiB (Macronix MX25L25635FMI-10G)
- Ethernet  : 10/100/1000 Mbps x8 + 1
  - port 1-8: TP, RTL8218B (SoC)
  - port 9  : SFP, RTL8380M (SoC)
- LEDs/Keys : 7x / 1x
- UART  : RS-232 port on the front panel (connector: RJ-45)
  - 3:TX, 4:GND, 5:GND, 6:RX (pin number: RJ-45)
  - 9600n8
- Power : 100-240 VAC, 50/60 Hz, 0.5 A
  - Plug: IEC 60320-C13
- Stock OS  : VxWorks based

Flash instruction using initramfs image:

1.  Prepare the TFTP server with the IP address 192.168.1.111
2.  Rename the OpenWrt initramfs image to "0101A8C0.img" and place it to
the TFTP directory
3.  Download the official upgrading firmware (ex: pn28080k_v3.rom)
and place it to the TFTP directory
4.  Boot M8eG and interrupt the U-Boot with Ctrl + C keys
5.  Execute the following commands and boot with the OpenWrt initramfs
image

rtk network on
tftpboot 0x8100
bootm

6.  Backup mtdblock files to the computer by scp or anything and reboot
7.  Interrupt the U-Boot and execute the following commands to re-create
filesystem in the flash

ffsmount c:/
ffsfmt c:/

this step takes a long time, about ~ 4 mins

8.  Execute the following commands to put the official images to the
filesystem

updatert 

example:

  updatert pn28080k_v3.rom

this step takes about ~ 40 secs

9.  Set the environment variables of the U-Boot by the following commands

setenv loadaddr 0xb4e0
setenv bootcmd bootm
saveenv

10: Download the OpenWrt initramfs image and boot with it

tftpboot 0x8100 0101A8C0.img
bootm

11: On the initramfs image, download the sysupgrade image and perform
sysupgrade with it

sysupgrade 

12: Wait ~ 120 seconds to complete flashing

Note:

- "Switch-M8eG" is a model name, and "PN28080K" is a model number.
  Switch-M8eG has an another (old) model number ("PN28080"), it's not a
  Realtek based hardware.

- Switch-M8eG has a "POWER" LED (Green), but it's not connected to any
  GPIO pin.

- The U-Boot checks the runtime images in the flash when booting and
  fails to execute anything in "bootcmd" variable if the images are not
  exsisting.

- A filesystem is formed in the flash (0x10-0x1DF) on the stock
  firmware and it includes the stock images, configuration files and
  checksum files. It's unknown format, can't be managed on the OpenWrt.
  To get the enough space for OpenWrt, move the filesystem to the head
  of "fs_reserved" partition by execution of "ffsfmt" and "updatert".

- On the other devices in the same series of Switch-M8eG PN28080K, the
  INT pin on the PCA9555 is not connected to anywhere.

Back to the stock firmware:

1. Delete "loadaddr" variable and set "bootcmd" to the original value

   on U-Boot:

 setenv loadaddr
 setenv bootcmd 'bootm 0x8100'

   on OpenWrt:

 fw_setenv loadaddr
 fw_setenv bootcmd 'bootm 0x8100'

2. Perform reset or reboot

  on U-Boot:

reset

  on OpenWrt:

reboot

Signed-off-by: INAGAKI Hiroshi 
---
v1 -> v2:

- drop changes for kernel 5.4
- add interrupt-related properties to the nodes of PCA9539 and PCA9555
  - use "gpio-keys" instead of "gpio-keys-polled"
- update/remove comments in mtd partitions
- use "led-*" scheme and add color/function properties for each node of
  LEDs
- drop unnecessary default values from gpio-restart node

v2 -> v3:

- move interrupt related properties in PCA9539 to device dts
- move child i2c bus definitions in PCA9545 to device dts
- use actual SoC name "rtl8380" in second compatible of root

 .../rtl8380_panasonic_m8eg-pn28080k.dts   | 133 
 .../rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 198 ++
 target/linux/realtek/image/rtl838x.mk |  10 +
 3 files changed, 341 insertions(+)
 create mode 100644 
target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
 create mode 100644 
target/linux/realtek/dts-5.10/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi

diff --git a/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts 
b/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
new file mode 100644
index 00..f9d58f5b66
--- /dev/null
+++ b/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "rtl838x.dtsi"
+#include "rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi"
+
+#include 
+
+/ {
+   compatible = "panasonic,m8eg-pn28080k", "realtek,rtl8380-soc";
+   model = "Panasonic Switch-M8eG PN28080K";
+
+   aliases {
+   led-boot = &led_status_eco_green;
+   led-failsafe = &led_status_eco_amber;
+   led-running = &led_status_eco_green;
+   led-upgrade = &led_status_eco_green;

[PATCH v3 1/2] realtek: enable pca953x driver for target

2022-03-09 Thread INAGAKI Hiroshi
The system status LED on Panasonic Switch-M8eG PN28080K is connected to
a PCA9539PW. To use the LED as a status LED of OpenWrt while booting,
enable the pca953x driver and built-in to the kernel.
Also enable CONFIG_GPIO_PCA953X_IRQ to use interrupt via RTL83xx GPIO.

Signed-off-by: INAGAKI Hiroshi 
---
v1 -> v2:

- drop changes in config-5.4
- enable CONFIG_GPIO_PCA953X_IRQ to use interrupt

v2 -> v3:

(no changes)

 target/linux/realtek/rtl838x/config-5.10 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/linux/realtek/rtl838x/config-5.10 
b/target/linux/realtek/rtl838x/config-5.10
index 1252aab11e..8e27af95ba 100644
--- a/target/linux/realtek/rtl838x/config-5.10
+++ b/target/linux/realtek/rtl838x/config-5.10
@@ -69,6 +69,8 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIOLIB_IRQCHIP=y
 CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_PCA953X=y
+CONFIG_GPIO_PCA953X_IRQ=y
 CONFIG_GPIO_REALTEK_OTTO=y
 CONFIG_GPIO_RTL8231=y
 CONFIG_GRO_CELLS=y
@@ -166,6 +168,7 @@ CONFIG_REALTEK_OTTO_WDT=y
 CONFIG_REALTEK_PHY=y
 CONFIG_REALTEK_SOC_PHY=y
 CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
 CONFIG_REGMAP_MMIO=y
 CONFIG_RESET_CONTROLLER=y
 CONFIG_RTL83XX=y
-- 
2.34.1.windows.1


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


[PATCH v3 0/2] realtek: add support for Panasonic Switch-M8eG PN28080K

2022-03-09 Thread INAGAKI Hiroshi
This is a continuation of the PR in GitHub[1] and v1 patch series.

This patch series adds support for Panasonic Switch-M8eG PN28080K.

Panasonic Switch-M*eG PN28xx0K series has the following models:

- Switch-M8eG PN28080K (RTL8380M, 8 + 1 SFP)
  -  1-9 : RTL8380M (SoC)
- Switch-M16eG PN28160K (RTL8382M?, 14 + 2 combo)
  - ?
- Switch-M24eG PN28240K (RTL8382M, 22 + 2 combo)
  -  1-8 : RTL8218B
  -  9-16: RTL8382M (SoC)
  - 17-24: RTL8218FB
- Switch-M48eG PN28480K (RTL8393M, 44 + 4 combo)
  -  1-40: RTL8218B
  - 41-48: RTL8218FB

(Note: I don't have a Switch-M16eG PN28160K and the hardware specification
 is unknown)

These models have the many common parts, so 2nd commit creates a dtsi for
This series.

Note:

- "Switch-M*eG" is a model name and "PN28xx0K" is a model number.
  Each model has two model number, "PN28xx0" and "PN28xx0K". But the
  first one (PN28xx0) is a Broadcom SoC based hardware.

- This series uses the VxWorks-based kernel in stock firmware.

[1]: https://github.com/openwrt/openwrt/pull/4209

v1 -> v2:

- drop 5.4 changes
- add interrupt-related properties to the nodes of PCA9539 and PCA9555
  - use "gpio-keys" instead of "gpio-keys-polled"
- update/remove comments in mtd partitions
- use "led-*" scheme and add color/function properties for each node of
  LEDs
- drop unnecessary default values from gpio-restart node

v2 -> v3:

- move interrupt related properties in PCA9539 to device dts
- move child i2c bus definitions in PCA9545 to device dts
- use actual SoC name "rtl8380" in second compatible of root

INAGAKI Hiroshi (2):
  realtek: enable pca953x driver for target
  realtek: add support for Panasonic Switch-M8eG PN28080K

 .../rtl8380_panasonic_m8eg-pn28080k.dts   | 133 
 .../rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 198 ++
 target/linux/realtek/image/rtl838x.mk |  10 +
 target/linux/realtek/rtl838x/config-5.10  |   3 +
 4 files changed, 344 insertions(+)
 create mode 100644 
target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts
 create mode 100644 
target/linux/realtek/dts-5.10/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi

-- 
2.34.1.windows.1


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