ath79: add eth0 mac and initvals for Engenius EPG5000
authorMichael Pratt <mcpratt@pm.me>
Tue, 31 Jan 2023 18:58:38 +0000 (13:58 -0500)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 12 Feb 2023 17:07:31 +0000 (18:07 +0100)
Although VLANs are used, the "eth0" device by itself
does not have a valid MAC, so fix that with preinit script.

More initvals added by editing the driver to print switch registers,
after the bootloader sets them but before openwrt changes them.

The register bits needed for the QCA8337 switch
can be read from interrupted boot (tftpboot, bootm)
by adding print lines in the switch driver ar8327.c
before 'qca,ar8327-initvals' is parsed from DTS and written
for example:

  pr_info("0x04 %08x\n", ar8xxx_read(priv, AR8327_REG_PAD0_MODE));

Signed-off-by: Michael Pratt <mcpratt@pm.me>
target/linux/ath79/dts/qca9558_engenius_epg5000.dts
target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh

index ee0b36d6deeeaeb7c6611b717da43f9e43e89f71..36aba0714e4e13cee0b5291a38a794818298721c 100644 (file)
 };
 
 &phy0 {
+       qca,mib-poll-interval = <500>;
+
        qca,ar8327-initvals = <
-               0x04 0x87600000 /* PORT0 PAD MODE CTRL */
+               0x04 0x87680000 /* PORT0 PAD MODE CTRL */
+               0x10 0x40000000 /* POWER_ON_STRAP */
+               0x50 0xcf35cf35 /* LED_CTRL0 */
+               0x54 0xcf35cf35 /* LED_CTRL1 */
+               0x58 0xcf35cf35 /* LED_CTRL2 */
+               0x5c 0x03ffff00 /* LED_CTRL3 */
                0x7c 0x0000007e /* PORT0_STATUS */
        >;
 };
index def4417fbcfd395895a780fb097f59acd5b7af83..5fa23e8eb68c3ebcad0fe528e4bdc031b824dc7d 100644 (file)
@@ -12,6 +12,7 @@ preinit_set_mac_address() {
                ip link set dev eth0 address $(mtd_get_mac_ascii bdcfg "lanmac")
                ip link set dev eth1 address $(mtd_get_mac_ascii bdcfg "wanmac")
                ;;
+       engenius,epg5000|\
        engenius,esr1200|\
        engenius,esr1750|\
        engenius,esr900)