Demagic PHY_MMD31, 0xa400 to PHY_MMD31, PHY_MMD31_FEDCR

This commit is contained in:
René van Dorst
2026-01-26 22:37:16 +01:00
parent 3d7ef55ced
commit d9185b3505
2 changed files with 6 additions and 5 deletions
+1
View File
@@ -34,6 +34,7 @@
/* /*
* MMD 31 Registers * MMD 31 Registers
*/ */
#define PHY_MMD31_FEDCR 0xa400
#define PHY_MMD31_GBCR 0xa412 #define PHY_MMD31_GBCR 0xa412
+5 -5
View File
@@ -132,10 +132,10 @@ void phy_config(uint8_t phy) __banked
// p031f.a400:1040 P000008.1f00a400:5040, then: p031f.a400:5040 P000008.1f00a400:1040 // p031f.a400:1040 P000008.1f00a400:5040, then: p031f.a400:5040 P000008.1f00a400:1040
// FEDCR (Fast Ethernet Duplex Control Register, MMD 31.0xA400) // FEDCR (Fast Ethernet Duplex Control Register, MMD 31.0xA400)
// Set bit 14, sleep, then clear again, according to the datasheet these bits are reserved // Set bit 14, sleep, then clear again, according to the datasheet these bits are reserved
phy_modify(phy, PHY_MMD31, 0xa400, 0x0000, 0x4000); phy_modify(phy, PHY_MMD31, PHY_MMD31_FEDCR, 0x0000, 0x4000);
delay(20); delay(20);
phy_modify(phy, PHY_MMD31, 0xa400, 0x4000, 0x0000); phy_modify(phy, PHY_MMD31, PHY_MMD31_FEDCR, 0x4000, 0x0000);
delay(20); delay(20);
print_string("\r\n phy config done\r\n"); print_string("\r\n phy config done\r\n");
@@ -259,13 +259,13 @@ void phy_set_duplex(uint8_t port, uint8_t fullduplex) __banked
phy_read(port, PHY_MMD_AN, 0x00); phy_read(port, PHY_MMD_AN, 0x00);
v = SFR_DATA_U16; v = SFR_DATA_U16;
if (!(v & 0x1000)) { // AN disabled, we are in forced mode if (!(v & 0x1000)) { // AN disabled, we are in forced mode
phy_read(port, PHY_MMD31, 0xa400); phy_read(port, PHY_MMD31, PHY_MMD31_FEDCR);
v = SFR_DATA_U16; v = SFR_DATA_U16;
if (fullduplex) if (fullduplex)
v |= 0x0100; v |= 0x0100;
else else
v &= 0xfeff; v &= 0xfeff;
phy_write(port, PHY_MMD31, 0xa400, v); phy_write(port, PHY_MMD31, PHY_MMD31_FEDCR, v);
return; return;
} }
// Disable AN // Disable AN
@@ -363,7 +363,7 @@ void phy_show(uint8_t port) __banked
default: default:
print_string("Unknown\n"); print_string("Unknown\n");
} }
phy_read(port, PHY_MMD31, 0xa400); phy_read(port, PHY_MMD31, PHY_MMD31_FEDCR);
v = SFR_DATA_U16; v = SFR_DATA_U16;
print_string("Duplex: "); print_short(v); print_string(" enabled: "); print_string("Duplex: "); print_short(v); print_string(" enabled: ");
if (v & 0x100) if (v & 0x100)