The TP-Link TL-ST1008F is an 8-port multi-gig switch with 8x SFP+ ports which support 1G/2.5G/10G speeds. Out of the box it is an unmanaged switch but with RTL9303 and sufficient RAM + Flash it easily can run as a managed Linux switch. Hardware: - Realtek RTL9303 Switch SoC - Winbond 25Q256JVFQ (32MB flash) - Samsung K4B4G1646E-BYMA (512MB DDR3 SDRAM) - TCA9534 GPIO extender to control the port LEDs - 8x SFP+ 1/2.5/10G slot - Serial: 3V3 logic, 115200 8N1 - 5-pin JTAG - physical tri-state switch (used by stock firmware for port speed config) - 24-LED port speed matrix - robust full-metal case Power is supplied via a 12V 2A standard barrel connector. There are THT holes on the PCB for serial console next to the flash chip and JTAG pads. Serial uses 3V3 logic and standard 115200-8N1 config. Pinout is labeled on the PCB. All ports/connectors and LEDs are on the back, only Power LED is on the front. Hints before flashing ---------------------- * It is recommended to backup the stock flash contents before proceeding. Backup can be done from U-Boot (with memory display), from OpenWrt initramfs or probably with SPI flash programmer. There is no stock recovery functionality. * Use a small image for RAM boot or first flash. Since you need to use ymodem, this is really slow and takes time. * This does not keep the dual-partition layout for firmware to have more space available for a single OpenWrt installation. Initial flashing ---------------------- The stock U-boot has broken networking thus no TFTP available. Serial transfer only. 1. Open device and connect serial as per layout and settings (recommended to use picocom, ymodem not working with minicom) 2. Connect power to device and press Esc when prompted to enter the U-Boot console. 3. Boot initramfs * in the U-Boot console: loady 0x82000000 (load OpenWrt image via ymodem) CTRL-A CTRL-S <initramfs.bin> (specify initramfs image for picocom to upload) bootm 0x82000000 (boot initramfs from RAM) (Just to be on the safe side, backup your flash now while RAM-booted) 4. Connect network to your device 5. Upload the sysupgrade image (e.g. with scp) 6. Do sysupgrade There's no need to adjust the bootcmd in U-Boot. Networking is running fine once the realtek driver initialized everything in OpenWrt. No functional difference with running 'rtk network on' within U-Boot before. Running this even fails and returns with an error. Return to stock ------------------ This only works if you did a backup of the flash before flashing OpenWrt. Stock dump then can be flashed from within U-Boot or OpenWrt. There is no vendor firmware image because this is an unmanaged switch! CAUTION: Make sure to not overwrite the U-Boot partition(s). If you do not have a flash programmer, you may not be able to debrick your device then. Co-authored-by: Balázs Triszka <balika011@gmail.com> Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
146 lines
4.3 KiB
Text
146 lines
4.3 KiB
Text
|
|
. /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"
|
|
}
|
|
|
|
board=$(board_name)
|
|
board_config_update
|
|
|
|
lan_list=$(ls -1 -v -d /sys/class/net/lan* | xargs -n1 basename | xargs)
|
|
|
|
ucidef_set_bridge_device switch
|
|
ucidef_set_interface_lan "$lan_list"
|
|
|
|
lan_mac=""
|
|
lan_mac_start=""
|
|
lan_mac_end=""
|
|
label_mac=""
|
|
case $board in
|
|
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)))
|
|
;;
|
|
tplink,sg2008p-v1|\
|
|
tplink,sg2210p-v3|\
|
|
tplink,sg2452p-v4|\
|
|
tplink,t1600g-28ts-v3)
|
|
label_mac=$(get_mac_label)
|
|
lan_mac="$label_mac"
|
|
;;
|
|
tplink,tl-st1008f,v2)
|
|
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)
|
|
;;
|
|
*)
|
|
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
|
|
|
|
ucidef_set_interface_macaddr "lan" $lan_mac
|
|
ucidef_set_bridge_mac "$lan_mac"
|
|
ucidef_set_network_device_mac eth0 $lan_mac
|
|
[ -z "$lan_mac_start" ] && lan_mac_start=$lan_mac
|
|
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
|
|
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
|
|
|
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"
|
|
;;
|
|
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,gs110tpp-v1)
|
|
ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
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)
|
|
ucidef_set_poe 77 "$(filter_port_list "$lan_list" "lan9 lan10")"
|
|
;;
|
|
zyxel,gs1900-8hp-v1|\
|
|
zyxel,gs1900-8hp-v2)
|
|
ucidef_set_poe 70 "$lan_list"
|
|
;;
|
|
zyxel,gs1900-24ep)
|
|
ucidef_set_poe 130 "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 lan9 lan10 lan11 lan12"
|
|
;;
|
|
zyxel,gs1900-24hp-v1|\
|
|
zyxel,gs1900-24hp-v2)
|
|
ucidef_set_poe 170 "$(filter_port_list "$lan_list" "lan25 lan26")"
|
|
;;
|
|
esac
|
|
|
|
board_config_flush
|
|
|
|
exit 0
|