Add support for the Edgecore ECS4100-12PH, an 8-port 802.3bt PoE Gigabit Ethernet switch with 2 combo RJ45/SFP and 2 SFP ports. Hardware: * SoC: RTL8393M * RAM: 256MiB * Flash: 32MiB SPI-NOR * Ethernet: * 8x GbE RJ45 PoE (external RTL8218B) * 2x GbE RJ45 / SFP combo (external RTL8214FC) * 2x SFP (external RTL8214FC) * Console: RJ45 RS232 port on front panel * PoE: Nuvoton M0516 + 2x Broadcom BCM59121 PSE Installation via bootloader: * open serial console (baud rate 115200) * interrupt boot process by pressing any key during boot * boot the OpenWrt initramfs: # rtk network on # tftpboot 0x8f000000 /tftpboot/openwrt-realtek-rtl839x-edgecore_ecs4100-12ph-initramfs-kernel.bin # bootm * copy openwrt-realtek-rtl839x-edgecore_ecs4100-12ph-squashfs-sysupgrade.bin to /tmp and use sysupgrade to install it: # sysupgrade /tmp/openwrt-realtek-rtl839x-edgecore_ecs4100-12ph-squashfs-sysupgrade.bin Even though U-Boot claims the switch is based on the RTL8392M SoC, my device is based on the RTL8393M SoC. I have confirmed this by removing the heatsink, and the Linux kernel agrees with this. Therefore the DTS has the rtl8393_ prefix. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
193 lines
5.3 KiB
Plaintext
193 lines
5.3 KiB
Plaintext
|
|
. /lib/functions.sh
|
|
. /lib/functions/uci-defaults.sh
|
|
. /lib/functions/system.sh
|
|
|
|
_filter_port_list_ordered() {
|
|
local ports="$1"
|
|
local excluded="$2"
|
|
local sort_opts="$3"
|
|
echo $ports $excluded | xargs -n1 basename | sort -V $sort_opts | uniq -u | xargs
|
|
}
|
|
|
|
filter_port_list() {
|
|
_filter_port_list_ordered "$1" "$2"
|
|
}
|
|
|
|
filter_port_list_reverse() {
|
|
_filter_port_list_ordered "$1" "$2" "-r"
|
|
}
|
|
|
|
realtek_setup_interfaces()
|
|
{
|
|
local board="$1"
|
|
local lan_list="$2"
|
|
|
|
ucidef_set_bridge_device switch
|
|
ucidef_set_interface_lan "$lan_list"
|
|
}
|
|
|
|
realtek_setup_macs_lan()
|
|
{
|
|
local lan_list="$1"
|
|
local lan_mac_start="$2"
|
|
local lan_mac_end="$3"
|
|
|
|
for lan in $lan_list; do
|
|
ucidef_set_network_device_mac $lan $lan_mac_start
|
|
[ -z "$lan_mac_end" ] || [ "$lan_mac_start" == "$lan_mac_end" ] && lan_mac_start=$(macaddr_setbit_la $lan_mac_start)
|
|
lan_mac_start=$(macaddr_add $lan_mac_start 1)
|
|
done
|
|
}
|
|
|
|
realtek_setup_macs()
|
|
{
|
|
local board="$1"
|
|
local lan_list="$2"
|
|
|
|
local lan_mac=""
|
|
local lan_mac_start=""
|
|
local lan_mac_end=""
|
|
local label_mac=""
|
|
|
|
case $board in
|
|
edgecore,ecs4100-12ph|\
|
|
tplink,sg2008p-v1|\
|
|
tplink,sg2210p-v3|\
|
|
tplink,sg2452p-v4|\
|
|
tplink,t1600g-28ts-v3)
|
|
label_mac=$(get_mac_label)
|
|
lan_mac="$label_mac"
|
|
;;
|
|
hpe,1920-8g|\
|
|
hpe,1920-8g-poe-65w|\
|
|
hpe,1920-8g-poe-180w|\
|
|
hpe,1920-16g|\
|
|
hpe,1920-24g|\
|
|
hpe,1920-24g-poe-180w|\
|
|
hpe,1920-24g-poe-370w|\
|
|
hpe,1920-48g|\
|
|
hpe,1920-48g-poe)
|
|
label_mac=$(mtd_get_mac_binary factory 0x68)
|
|
lan_mac=$label_mac
|
|
mac_count1=$(hexdump -v -n 4 -s 0x110 -e '4 "%d"' $(find_mtd_part factory) 2>/dev/null)
|
|
mac_count2=$(hexdump -v -n 4 -s 0x114 -e '4 "%d"' $(find_mtd_part factory) 2>/dev/null)
|
|
lan_mac_start=$(macaddr_add $lan_mac 2)
|
|
lan_mac_end=$(macaddr_add $lan_mac $((mac_count2-mac_count1)))
|
|
;;
|
|
plasmacloud,esx28|\
|
|
plasmacloud,mcx3|\
|
|
plasmacloud,psx8|\
|
|
plasmacloud,psx10|\
|
|
plasmacloud,psx28)
|
|
lan_mac_start=skip
|
|
lan_mac="$(get_mac_label)"
|
|
;;
|
|
tplink,tl-st1008f-v2|\
|
|
zyxel,xgs1010-12-a1)
|
|
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
|
[ -z "$lan_mac" ] || [ "$lan_mac" = "00:e0:4c:00:00:00" ] && lan_mac=$(macaddr_random)
|
|
;;
|
|
xikestor,sks8300-8x)
|
|
lan_mac=$(mtd_get_mac_binary board-info 0x1f1)
|
|
;;
|
|
xikestor,sks8310-8x)
|
|
lan_mac=$(mtd_get_mac_binary factory 0x80)
|
|
label_mac="$lan_mac"
|
|
;;
|
|
*)
|
|
lan_mac=$(mtd_get_mac_ascii u-boot-env2 mac_start)
|
|
lan_mac_end=$(mtd_get_mac_ascii u-boot-env2 mac_end)
|
|
label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
|
[ -z "$lan_mac" ] && lan_mac=$label_mac
|
|
;;
|
|
esac
|
|
|
|
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
|
[ -n "$lan_mac" ] && ucidef_set_bridge_mac "$lan_mac"
|
|
[ -n "$lan_mac" ] && ucidef_set_network_device_mac eth0 $lan_mac
|
|
|
|
[ -z "$lan_mac_start" -a -n "$lan_mac" ] && lan_mac_start=$lan_mac
|
|
[ "$lan_mac_start" != "skip" ] && realtek_setup_macs_lan "$lan_list" "$lan_mac_start" "$lan_mac_end"
|
|
|
|
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
|
}
|
|
|
|
realtek_setup_poe()
|
|
{
|
|
local board="$1"
|
|
local lan_list="$2"
|
|
|
|
case $board in
|
|
d-link,dgs-1210-10mp-f)
|
|
ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
d-link,dgs-1210-10p)
|
|
ucidef_set_poe 65 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
d-link,dgs-1210-28mp-f)
|
|
ucidef_set_poe 370 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23
|
|
lan22 lan21 lan20 lan19 lan18 lan17"
|
|
;;
|
|
d-link,dgs-1210-28p-f)
|
|
ucidef_set_poe 193 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23
|
|
lan22 lan21 lan20 lan19 lan18 lan17"
|
|
;;
|
|
edgecore,ecs4100-12ph|\
|
|
netgear,gs110tpp-v1)
|
|
ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
engenius,ews2910p-v1|\
|
|
engenius,ews2910p-v3)
|
|
ucidef_set_poe 60 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
hpe,1920-8g-poe-65w)
|
|
ucidef_set_poe 65 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")"
|
|
;;
|
|
hpe,1920-8g-poe-180w)
|
|
ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")"
|
|
;;
|
|
hpe,1920-24g-poe-180w)
|
|
ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")"
|
|
;;
|
|
hpe,1920-24g-poe-370w)
|
|
ucidef_set_poe 370 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")"
|
|
;;
|
|
hpe,1920-48g-poe)
|
|
ucidef_set_poe 370 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23
|
|
lan22 lan21 lan20 lan19 lan18 lan17 lan32 lan31 lan30 lan29 lan28 lan27 lan26 lan25 lan40 lan39 lan38 lan37
|
|
lan36 lan35 lan34 lan33 lan48 lan47 lan46 lan45 lan44 lan43 lan42 lan41"
|
|
;;
|
|
netgear,gs110tup-v1)
|
|
ucidef_set_poe 240 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
netgear,gs310tp-v1)
|
|
ucidef_set_poe 55 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
zyxel,gs1900-10hp-a1)
|
|
ucidef_set_poe 77 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
zyxel,gs1900-8hp-a1|\
|
|
zyxel,gs1900-8hp-b1)
|
|
ucidef_set_poe 70 "$lan_list"
|
|
;;
|
|
zyxel,gs1900-24ep-a1)
|
|
ucidef_set_poe 130 "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 lan9 lan10 lan11 lan12"
|
|
;;
|
|
zyxel,gs1900-24hp-a1|\
|
|
zyxel,gs1900-24hp-b1)
|
|
ucidef_set_poe 170 "$(filter_port_list "$lan_list" "lan25 lan26")"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
board=$(board_name)
|
|
board_config_update
|
|
lan_list=$(ls -1 -v -d /sys/class/net/lan* | xargs -n1 basename | xargs)
|
|
realtek_setup_interfaces "$board" "$lan_list"
|
|
realtek_setup_macs "$board" "$lan_list"
|
|
realtek_setup_poe "$board" "$lan_list"
|
|
board_config_flush
|
|
|
|
exit 0
|