openwrt/target/linux/ramips/mt7620/base-files/etc/board.d/02_network

342 lines
7.8 KiB
Plaintext
Raw Normal View History

#!/bin/sh
. /lib/functions.sh
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
ramips_setup_interfaces()
{
local board="$1"
case $board in
aigale,ai-br100|\
alfa-network,ac1200rm|\
asus,rt-n12p|\
dlink,dir-810l|\
dlink,dwr-116-a1|\
dlink,dwr-921-c1|\
dlink,dwr-922-e2|\
ohyeah,oy-0001|\
phicomm,psg1208|\
phicomm,psg1218a|\
planex,db-wrt01|\
planex,mzk-750dhp|\
sanlinking,d240|\
youku,yk1|\
zbtlink,zbt-ape522ii|\
zbtlink,zbt-we826-16m|\
zbtlink,zbt-we826-32m|\
zbtlink,zbt-we826-e|\
zbtlink,zbt-wr8305rt|\
zyxel,keenetic-omni)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;;
ramips: add support for ALFA Network R36M-E4G ALFA Network R36M-E4G is a dual-SIM, N300 Wi-Fi, compact size platform based on MediaTek MT7620A WiSoC. This product is designed for operation with 4G modem (can be bought in bundle with Quectel EC25, EG25 or EP06) but supports also Wi-Fi modules (miniPCIe slot has USB and PCIe buses). Specification: - MT7620A (580 MHz) - 64/128/256 MB of RAM (DDR2) - 16/32+ MB of FLASH (SPI NOR) - 2x 10/100 Mbps Ethernet, with passive PoE support (24 V) - 2T2R 2.4 GHz (MT7620A), with ext. LNA (RFFM4227) - 1x miniPCIe slot (with PCIe and USB 2.0 buses and optional 5 V) - 2x SIM slot (mini, micro) with detect and switch driven by GPIO - 2x u.fl antenna connectors (for Wi-Fi) - 8x LED (7 driven by GPIO) - 2x button (reset, wifi) - 2x UART (4-pin/2.54 mm pitch, 10-pin/1.27 mm pitch) headers on PCB - 1x I2C (4-pin, 1.27 mm pitch) header on PCB - 1x LED (8-pin, 1.27 mm pitch) header on PCB - 1x DC jack with lock (12 V) Other: - there is a dedicated, 4-pin connector for optional RTC module (Holtek HT138x) with 'enable' input, not available at the time of preparing support for this board - miniPCIe slot supports additional 5 V supply on pins 47 and 49 but a jumper resistor (R174) is not installed by default - U-Boot selects default SIM slot, based on value of 'default_sim' env variable: '1' or unset -> SIM1 (mini), '2' -> SIM2 (micro). This will work only if both slots are occupied, otherwise U-Boot will always select slot with SIM card inside (user can override it later, in user-space) - U-Boot resets the modem, using PERSTn signal, before starting kernel - this board supports 'dual image' feature (controlled by 'dual_image' U-Boot environment variable) Flash instruction: You can use the 'sysupgrade' image directly in vendor firmware which is based on OpenWrt (make sure to not preserve settings - use 'sysupgrade -n -F ...' command). Alternatively, use web recovery mode in U-Boot: 1. Power the device with reset button pressed, the modem LED will start blinking slowly and after ~3 seconds, when it starts blinking faster, you can release the button. 2. Setup static IP 192.168.1.2/24 on your PC. 3. Go to 192.168.1.1 in browser and upload 'sysupgrade' image. Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2019-10-30 00:10:40 +01:00
alfa-network,r36m-e4g|\
zbtlink,zbt-we1026-h-32m)
ucidef_add_switch "switch0" \
"3:lan" "4:wan" "6@eth0"
;;
alfa-network,tube-e4g|\
buffalo,wmr-300|\
dlink,dch-m225|\
elecom,wrh-300cr|\
kimax,u25awf-h1|\
netgear,ex2700|\
netgear,ex3700|\
netgear,ex6130|\
netgear,wn3000rp-v3|\
planex,cs-qr10|\
planex,mzk-ex300np|\
planex,mzk-ex750np|\
ravpower,wd03|\
sercomm,na930)
ucidef_set_interface_lan "eth0"
;;
asus,rp-n53)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;;
asus,rt-ac51u)
ucidef_add_switch "switch0" \
"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;;
asus,rt-n14u|\
bdcom,wap2100-sk|\
glinet,gl-mt300a|\
glinet,gl-mt300n|\
glinet,gl-mt750|\
hiwifi,hc5661|\
tplink,archer-c20i|\
wrtnode,wrtnode|\
zbtlink,zbt-wa05)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
buffalo,whr-300hp2|\
buffalo,whr-600d)
ucidef_add_switch "switch0" \
"0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan:5" "6@eth0"
;;
buffalo,whr-1166d)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
;;
comfast,cf-wr800n|\
hnet,c108)
ucidef_add_switch "switch0" \
"4:lan" "6@eth0"
;;
dlink,dir-510l)
ucidef_add_switch "switch0" \
"0:lan" "6@eth0"
;;
dlink,dwr-118-a1)
ucidef_add_switch "switch0" \
"1:lan:2" "2:lan:3" "3:lan:1" "4:lan:0" "5:wan" "6@eth0"
;;
dlink,dwr-118-a2)
ucidef_add_switch "switch0" \
"1:lan:2" "2:lan:1" "3:lan:3" "4:lan" "0:wan" "6@eth0"
;;
edimax,br-6478ac-v2|\
tplink,archer-c2-v1)
ucidef_add_switch "switch1" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
edimax,ew-7476rpc|\
edimax,ew-7478ac|\
kimax,u35wf|\
microduino,microwrt|\
yukai,bocco|\
zbtlink,zbt-cpe102|\
zte,q7)
ucidef_add_switch "switch0"
ucidef_add_switch_attr "switch0" "enable" "false"
ucidef_set_interface_lan "eth0"
;;
engenius,esr600)
ucidef_add_switch "switch0" \
"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "0@eth0"
;;
fon,fon2601)
ucidef_add_switch "switch0" \
"0:lan" "4:wan" "6@eth0"
;;
head-weblink,hdrm200)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
;;
hiwifi,hc5761)
ucidef_add_switch "switch0" \
"1:lan" "4:lan" "0:wan" "6@eth0"
;;
hiwifi,hc5861)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "5:wan" "6@eth0"
;;
iodata,wn-ac1167gr|\
iodata,wn-ac733gr3)
ucidef_add_switch "switch1" \
"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
;;
kingston,mlw221)
ucidef_set_interface_lan "eth0.2"
;;
kingston,mlwg2)
ucidef_set_interface_lan "eth0.1"
;;
lava,lr-25g001)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
;;
lenovo,newifi-y1|\
xiaomi,miwifi-mini)
ucidef_add_switch "switch0" \
"0:lan:2" "1:lan:1" "4:wan" "6@eth0"
;;
lenovo,newifi-y1s)
ucidef_add_switch "switch0" \
"1:lan:4" "2:lan:3" "4:lan:2" "5:lan:1" "0:wan" "6@eth0"
;;
linksys,e1700|\
ralink,mt7620a-mt7530-evb)
ucidef_add_switch "switch1" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;;
nexx,wt3020-4m|\
nexx,wt3020-8m)
ucidef_add_switch "switch0" \
"4:lan" "0:wan" "6@eth0"
;;
phicomm,k2g)
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5:wan" "6@eth0"
;;
phicomm,psg1218b)
ucidef_add_switch "switch0" \
"0:lan:3" "1:lan:2" "2:lan:1" "3:wan" "6@eth0"
;;
tplink,archer-c20-v1|\
tplink,archer-c50-v1)
ucidef_add_switch "switch0" \
"1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0"
;;
tplink,archer-mr200)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0"
ucidef_set_interface_wan "usb0"
;;
vonets,var11n-300)
ucidef_add_switch "switch0" \
"0:lan" "4:wan" "6@eth0"
;;
zbtlink,zbt-we1026-5g-16m)
ucidef_add_switch "switch0" \
"0:lan" "6t@eth0"
;;
zbtlink,zbt-we2026)
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
;;
zyxel,keenetic-omni-ii)
ucidef_add_switch "switch0" \
"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
;;
zyxel,keenetic-viva)
ucidef_add_switch "switch1" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t@eth0"
;;
*)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
esac
}
ramips_setup_macs()
{
local board="$1"
local lan_mac=""
local wan_mac=""
local label_mac=""
case $board in
ramips: remove default case for MAC address assignment So far, MAC address assignment in ramips has contained a default case, which defined wan_mac = eth0 + 1 for _every_ device not having an explicit case there. This is not desirable, as many device supporters will just not care or know about this definition, so another MAC address will be introduced by accident. In some cases the wan_mac is assigned although it is not needed, in other cases even addresses not dedicated to the device will be used (e.g. wan_mac actually is eth0 - 1, but during support nobody cared, so eth0 + 1 is used now, which might actually belong to another device ...). Thus, in this PR the former default case is converted to an explicit case. This one comprises all devices not being accounted for by other cases, reduced by those not having wan at all. The big number of entries for this node might be another indication that many of them wouldn't actually be there if there hadn't been default wan_mac setup. In exchange, the current "do nothing" case can be removed, as it will be the new default case. The devices being put in the newly created explicit case were determined as follows: 1. Create a list of all devices based on the DTS files. 2. Remove all devices already having an explicit entry setting their address. 3. Remove all devices that only have lan set up in the first part of 02_network: mt7620: - alfa-network,tube-e4g - asus,rp-n53 - buffalo,wmr-300 - comfast,cf-wr800n - edimax,ew-7476rpc - edimax,ew-7478ac - elecom,wrh-300cr - hnet,c108 - kimax,u25awf-h1 - kimax,u35wf - kingston,mlw221 - kingston,mlwg2 - microduino,microwrt - netgear,ex2700 - netgear,ex3700 - netgear,wn3000rp-v3 - planex,cs-qr10 - planex,mzk-ex300np - planex,mzk-ex750np - ravpower,wd03 - sercomm,na930 - yukai,bocco - zbtlink,zbt-cpe102 - zte,q7 mt7621: - gnubee,gb-pc1 - gnubee,gb-pc2 - linksys,re6500 - mikrotik,rbm11g - netgear,ex6150 - thunder,timecloud - tplink,re350-v1 - tplink,re650-v1 mt76x8: - alfa-network,awusfree1 - d-team,pbr-d1 - glinet,vixmini - vocore,vocore2-lite - tama,w06 - tplink,tl-mr3020-v3 - tplink,tl-wa801nd-v5 - tplink,tl-wr802n-v4 - tplink,tl-wr902ac-v3 - vocore,vocore2 - widora,neo-16m - widora,neo-32m rt288x: - buffalo,wli-tx4-ag300n - dlink,dap-1522-a1 rt305x: - allnet,all0256n-4m - allnet,all0256n-8m - allnet,all5002 - allnet,all5003 - alphanetworks,asl26555-16m - alphanetworks,asl26555-8m - asus,wl-330n - aximcom,mr-102n - dlink,dcs-930 - easyacc,wizard-8800 - hame,mpr-a2 - hootoo,ht-tm02 - huawei,d105 - intenso,memory2move - planex,mzk-dp150n - rt305x dlink,dcs-930l-b1 - sparklan,wcr-150gn - tenda,3g150b - tenda,3g300m - tenda,w150m - trendnet,tew-638apb-v2 - unbranded,a5-v11 - vocore,vocore-16m - vocore,vocore-8m - wansview,ncs601w - zorlik,zl5900v2 rt3883: - loewe,wmdr-143n - omnima,hpm 4. Put the remaining devices in the new case. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-22 19:04:27 +02:00
aigale,ai-br100|\
alfa-network,ac1200rm|\
asus,rt-ac51u|\
asus,rt-n12p|\
asus,rt-n14u|\
bdcom,wap2100-sk|\
dlink,dir-810l|\
edimax,ew-7478apc|\
fon,fon2601|\
head-weblink,hdrm200|\
nexx,wt3020-4m|\
nexx,wt3020-8m|\
phicomm,psg1208|\
phicomm,psg1218a|\
phicomm,psg1218b|\
planex,db-wrt01|\
planex,mzk-750dhp|\
ralink,mt7620a-evb|\
ralink,mt7620a-mt7530-evb|\
ralink,mt7620a-mt7610e-evb|\
ralink,mt7620a-v22sg-evb|\
sanlinking,d240|\
tplink,archer-c2-v1|\
tplink,archer-c20-v1|\
tplink,archer-c20i|\
tplink,archer-c50-v1|\
tplink,archer-mr200|\
vonets,var11n-300|\
wrtnode,wrtnode|\
youku,yk1|\
zbtlink,zbt-ape522ii|\
zbtlink,zbt-wa05|\
zbtlink,zbt-we2026|\
zbtlink,zbt-we826-16m|\
zbtlink,zbt-we826-32m|\
zbtlink,zbt-we826-e|\
zbtlink,zbt-wr8305rt)
wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
;;
ramips: add support for ALFA Network R36M-E4G ALFA Network R36M-E4G is a dual-SIM, N300 Wi-Fi, compact size platform based on MediaTek MT7620A WiSoC. This product is designed for operation with 4G modem (can be bought in bundle with Quectel EC25, EG25 or EP06) but supports also Wi-Fi modules (miniPCIe slot has USB and PCIe buses). Specification: - MT7620A (580 MHz) - 64/128/256 MB of RAM (DDR2) - 16/32+ MB of FLASH (SPI NOR) - 2x 10/100 Mbps Ethernet, with passive PoE support (24 V) - 2T2R 2.4 GHz (MT7620A), with ext. LNA (RFFM4227) - 1x miniPCIe slot (with PCIe and USB 2.0 buses and optional 5 V) - 2x SIM slot (mini, micro) with detect and switch driven by GPIO - 2x u.fl antenna connectors (for Wi-Fi) - 8x LED (7 driven by GPIO) - 2x button (reset, wifi) - 2x UART (4-pin/2.54 mm pitch, 10-pin/1.27 mm pitch) headers on PCB - 1x I2C (4-pin, 1.27 mm pitch) header on PCB - 1x LED (8-pin, 1.27 mm pitch) header on PCB - 1x DC jack with lock (12 V) Other: - there is a dedicated, 4-pin connector for optional RTC module (Holtek HT138x) with 'enable' input, not available at the time of preparing support for this board - miniPCIe slot supports additional 5 V supply on pins 47 and 49 but a jumper resistor (R174) is not installed by default - U-Boot selects default SIM slot, based on value of 'default_sim' env variable: '1' or unset -> SIM1 (mini), '2' -> SIM2 (micro). This will work only if both slots are occupied, otherwise U-Boot will always select slot with SIM card inside (user can override it later, in user-space) - U-Boot resets the modem, using PERSTn signal, before starting kernel - this board supports 'dual image' feature (controlled by 'dual_image' U-Boot environment variable) Flash instruction: You can use the 'sysupgrade' image directly in vendor firmware which is based on OpenWrt (make sure to not preserve settings - use 'sysupgrade -n -F ...' command). Alternatively, use web recovery mode in U-Boot: 1. Power the device with reset button pressed, the modem LED will start blinking slowly and after ~3 seconds, when it starts blinking faster, you can release the button. 2. Setup static IP 192.168.1.2/24 on your PC. 3. Go to 192.168.1.1 in browser and upload 'sysupgrade' image. Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2019-10-30 00:10:40 +01:00
alfa-network,r36m-e4g|\
zbtlink,zbt-we1026-h-32m)
wan_mac=$(mtd_get_mac_binary factory 0x2e)
label_mac=$(mtd_get_mac_binary factory 0x4)
;;
dlink,dch-m225)
lan_mac=$(mtd_get_mac_ascii factory lanmac)
;;
dlink,dir-510l|\
dlink,dwr-116-a1|\
dlink,dwr-118-a1|\
dlink,dwr-118-a2|\
dlink,dwr-921-c1|\
dlink,dwr-922-e2|\
lava,lr-25g001)
wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
lan_mac=$(macaddr_add "$wan_mac" 1)
label_mac=$wan_mac
;;
dovado,tiny-ac)
lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
;;
edimax,br-6478ac-v2)
wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
;;
engenius,esr600)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
;;
glinet,gl-mt300a|\
glinet,gl-mt300n|\
glinet,gl-mt750)
wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
label_mac=$(mtd_get_mac_binary factory 0x4)
;;
hiwifi,hc5661|\
hiwifi,hc5761|\
hiwifi,hc5861)
lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
label_mac=$lan_mac
[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(macaddr_add "$lan_mac" 1)
;;
iodata,wn-ac1167gr|\
iodata,wn-ac733gr3)
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
;;
lenovo,newifi-y1|\
lenovo,newifi-y1s|\
ohyeah,oy-0001|\
phicomm,k2g)
wan_mac=$(mtd_get_mac_binary factory 0x2e)
;;
linksys,e1700)
wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
;;
zbtlink,zbt-we1026-5g-16m)
label_mac=$(mtd_get_mac_binary factory 0x4)
;;
zyxel,keenetic-omni|\
zyxel,keenetic-omni-ii|\
zyxel,keenetic-viva)
wan_mac=$(mtd_get_mac_binary factory 0x28)
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
}
board_config_update
board=$(board_name)
ramips_setup_interfaces $board
ramips_setup_macs $board
board_config_flush
exit 0