Enable EEE on boot, do not reset interfaces immediately to save boot time.

This commit is contained in:
chriz
2026-02-05 17:23:50 +01:00
parent 3496d12111
commit ed37d75aba
3 changed files with 19 additions and 6 deletions
+6 -3
View File
@@ -429,28 +429,31 @@ void port_eee_enable(__xdata uint8_t port,__xdata uint8_t speed) __banked
return; return;
// Enable all speeds up to the specified speed // Enable all speeds up to the specified speed
if (speed == EEE_100) { if ((speed & (EEE_100 | EEE_1000 | EEE_2G5)) == EEE_100) {
REG_SET(RTL8373_EEE_CTRL_BASE + (port << 2), EEE_100); REG_SET(RTL8373_EEE_CTRL_BASE + (port << 2), EEE_100);
// Enable EEE advertisement for 100BASE-T via EEE Advertisement Reg // Enable EEE advertisement for 100BASE-T via EEE Advertisement Reg
phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, PHY_EEE_BIT_100M); phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, PHY_EEE_BIT_100M);
if (!(speed & EEE_NORESET))
phy_reset(port); phy_reset(port);
return; return;
} }
if (speed == EEE_1000) { if ((speed & (EEE_100 | EEE_1000 | EEE_2G5)) == EEE_1000) {
REG_SET(RTL8373_EEE_CTRL_BASE + (port << 2), EEE_100 | EEE_1000); REG_SET(RTL8373_EEE_CTRL_BASE + (port << 2), EEE_100 | EEE_1000);
// Disable EEE advertisement for 2.5GBASE-T via EEE Advertisement Reg 2 // Disable EEE advertisement for 2.5GBASE-T via EEE Advertisement Reg 2
phy_write(port, PHY_MMD_AN, PHY_EEE_ADV2, 0); phy_write(port, PHY_MMD_AN, PHY_EEE_ADV2, 0);
// Enable EEE advertisement for 100/1000BASE-T via EEE Advertisement Reg // Enable EEE advertisement for 100/1000BASE-T via EEE Advertisement Reg
phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, PHY_EEE_BIT_1G | PHY_EEE_BIT_100M); phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, PHY_EEE_BIT_1G | PHY_EEE_BIT_100M);
if (!(speed & EEE_NORESET))
phy_reset(port); phy_reset(port);
return; return;
} }
if (speed == EEE_2G5) { if ((speed & (EEE_100 | EEE_1000 | EEE_2G5)) == EEE_2G5) {
REG_SET(RTL8373_EEE_CTRL_BASE + (port << 2), EEE_100 | EEE_1000 | EEE_2G5); REG_SET(RTL8373_EEE_CTRL_BASE + (port << 2), EEE_100 | EEE_1000 | EEE_2G5);
// Enable EEE advertisement for 100/1000BASE-T via EEE Advertisement Reg // Enable EEE advertisement for 100/1000BASE-T via EEE Advertisement Reg
phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, PHY_EEE_BIT_1G | PHY_EEE_BIT_100M); phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, PHY_EEE_BIT_1G | PHY_EEE_BIT_100M);
// Enable EEE advertisement for 2.5GBASE-T via EEE Advertisement Reg 2 // Enable EEE advertisement for 2.5GBASE-T via EEE Advertisement Reg 2
phy_write(port, PHY_MMD_AN, PHY_EEE_ADV2, PHY_EEE_BIT_2G5); phy_write(port, PHY_MMD_AN, PHY_EEE_ADV2, PHY_EEE_BIT_2G5);
if (!(speed & EEE_NORESET))
phy_reset(port); phy_reset(port);
return; return;
} }
+1
View File
@@ -257,6 +257,7 @@
#define EEE_100 0x01 #define EEE_100 0x01
#define EEE_1000 0x04 #define EEE_1000 0x04
#define EEE_2G5 0x10 #define EEE_2G5 0x10
#define EEE_NORESET 0x80
/* /*
* RANDOM * RANDOM
+9
View File
@@ -1637,6 +1637,9 @@ void rtl8373_init(void)
reg_bit_set(RTL837X_REG_HW_CONF, 0); reg_bit_set(RTL837X_REG_HW_CONF, 0);
// enable EEE for all ports at 2.5G and 10G, but don't reset the PHYs
port_eee_enable_all(EEE_2G5 | EEE_NORESET);
// TODO: patch the PHYs // TODO: patch the PHYs
// Re-enable PHY after configuration // Re-enable PHY after configuration
@@ -1700,6 +1703,10 @@ void rtl8372_init(void)
reg_bit_set(RTL837X_REG_HW_CONF, 0); reg_bit_set(RTL837X_REG_HW_CONF, 0);
// enable EEE for all ports at 2.5G and 10G, but don't reset the PHYs
port_eee_enable_all(EEE_2G5 | EEE_NORESET);
// TODO: patch the PHYs // TODO: patch the PHYs
// Re-enable PHY after configuration // Re-enable PHY after configuration
@@ -1954,6 +1961,8 @@ void bootloader(void)
REG_SET(RTL837X_PIN_MUX_2, 0x0); // Disable pins for ACL REG_SET(RTL837X_PIN_MUX_2, 0x0); // Disable pins for ACL
init_smi(); init_smi();
rtl8373_revision(); rtl8373_revision();
if (machine_detected.isRTL8373) if (machine_detected.isRTL8373)
rtl8373_init(); rtl8373_init();