openwrt-6.x/target/linux/realtek/base-files/lib/upgrade/platform.sh
Harshal Gohel f84371ddb5 realtek: rtl930x: Add support for Plasma Cloud MCX3 Media Converter
The Plasma Cloud MCX3 Media Converter is a 3 port multi-GBit switch with
2x 10/100/1000/2500BaseT Ethernet ports and 1x SFP+ module slot.

Hardware:

- RTL9302C SoC
- Macronix MX25L25645G (32MB flash)
- Winbond W632GU6rB-11 (256MB DDR3 SDRAM)
- RTL8224 4x 10m/100m/1/2.5 Gigabit PHY
- IC+ IP802AR POE+ PSE controller

The media converter is powered by 54 Volts 1.2A barrel connector. The
internal TTL serial connector can be used to access the terminal. Pins from
1: TX RX (unused) GND. Serial connection is via 115200 baud, 8N1.

A reset button is accessible through a hole next to the SFP+ module slot.

Installation
------------

* The device can be flashed by using sysupgrade command. Either from the
  original vendor firmware or using an initramfs (see "Debug")
* Connect serial as per the layout above. Connection parameters: 115200 8N1
* The image must be copied using scp to /tmp of the device

      scp openwrt-realtek-rtl930x-plasmacloud_mcx3-squashfs-sysupgrade.bin root@[IP address of the device]:/tmp/

* start sysupgrade without saving the original vendor configuration

      sysupgrade -n /tmp/openwrt-realtek-rtl930x-plasmacloud_mcx3-squashfs-sysupgrade.bin

Installation via u-boot
-----------------------

If you have an TFTP server connected to the switch, it is possible to
directly install the device using the factory image from u-boot

    # setup networking and IP of TFP server
    rtk network on
    setenv ipaddr 10.100.100.99
    setenv serverip 10.100.100.20

    # get factory image
    tftp 0x84000000 factory.bin

    # erase firmware partitions
    sf probe 0
    sf erase 0x100000 0x01f00000

    # write firmware to both partitions
    sf write ${fileaddr} 0x100000 ${filesize}
    sf write ${fileaddr} 0x1080000 ${filesize}

    # adjust the boot commands
    setenv bootargs "mtdparts=spi0.0:896k(u-boot),64k(u-boot-env),64k(u-boot-env2),15872k(inactive),15872k(firmware2)"
    setenv bootcmd "rtk init; bootm 0xb5080000"

    # restart
    reset

Debug
-----

* Connect serial as per the layout above. Connection parameters: 115200 8N1.
* A tftp server is required, tftpd-hpa works well.
* Power the device, at U-Boot start rapidly hit Esc key to stop autoboot
* Enable network:

      rtk network on

* Change ip address of device:

      setenv ipaddr 192.168.1.6

* Download initramfs from TFTP server:

      tftpboot 0x84000000 192.168.1.111:openwrt-realtek-rtl930x-plasmacloud_mcx3-initramfs-kernel.bin

* Boot loaded file:

      bootm 0x84000000

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sven Eckelmann <se@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20625
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-11-07 21:12:58 +01:00

52 lines
1.1 KiB
Bash

PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
# The TP-Link bootloader gets its flash layout from "bootargs".
# Use this to our advantage, and:
# 1. Disable the second rootfs (usrimg2)
# 2. Extend the first rootfs (usrimg1) to include more space
# 3. Increase the baudrate to the expected 115200
tplink_sg2xxx_fix_mtdparts() {
local args
args="bootargs mtdparts=spi_flash:896K(boot),128K(env),6144K(sys)"
args="$args,20480K(usrimg1@main),0K(usrimg2)"
args="$args,4096K(usrappfs),1024K(para)\n"
args="$args baudrate 115200"
echo -e "$args" | fw_setenv --script -
}
platform_check_image() {
return 0
}
platform_do_upgrade() {
local board=$(board_name)
case "$board" in
plasmacloud,esx28|\
plasmacloud,mcx3|\
plasmacloud,psx8|\
plasmacloud,psx10|\
plasmacloud,psx28)
PART_NAME="inactive"
platform_do_upgrade_dualboot_plasmacloud "$1"
;;
tplink,sg2008p-v1|\
tplink,sg2210p-v3)
tplink_sg2xxx_fix_mtdparts
default_do_upgrade "$1"
;;
linksys,lgs328c|\
linksys,lgs352c)
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}