Actually, it isn't sufficient to set the FORCE_RX_FC_PU
and FORCE_TX_FC_PU
bits, because they are only used when the FORCE_MODE_PU
bit is set to 1. And setting this to 1 doesn't only force the FC settings, but also the other FORCE options. This has lead me to the following new version (again, this needs clean-up by defining the bitmasks once and reusing them, and a nice for-loop, but that's not the point for now):
/* reset the switch */
mt7530_mdio_w32(gsw, 0x7000, 0x3);
usleep_range(10, 20);
/* Disable Flow Control Globally */
val = mt7530_mdio_r32(gsw, 0x1FE0);
val &= ~BIT(31);
mt7530_mdio_w32(gsw, 0x1FE0, val);
/* (GE1, Force 1000M/FD, FC OFF, MAX_RX_LENGTH 1536) */
mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
/* Disable Flow Control on MAC 0 */
val = mt7530_mdio_r32(gsw, 0x3000);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3000, val);
/* Disable Flow Control on MAC 1 */
val = mt7530_mdio_r32(gsw, 0x3100);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3100, val);
/* Disable Flow Control on MAC 2 */
val = mt7530_mdio_r32(gsw, 0x3200);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3200, val);
/* Disable Flow Control on MAC 3 */
val = mt7530_mdio_r32(gsw, 0x3300);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3300, val);
/* Disable Flow Control on MAC 4 */
val = mt7530_mdio_r32(gsw, 0x3400);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3400, val);
/* Disable Flow Control on MAC 5 */
val = mt7530_mdio_r32(gsw, 0x3500);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3500, val);
/* Disable Flow Control on MAC 6 */
val = mt7530_mdio_r32(gsw, 0x3600);
val |= BIT(0);
val |= BIT(1);
val &= ~BIT(2);
val |= BIT(3);
val &= ~BIT(4);
val &= ~BIT(5);
val &= ~BIT(6);
val &= ~BIT(7);
val |= BIT(15);
mt7530_mdio_w32(gsw, 0x3600, val);
Unfortunately, this didn't bring me to my goal of disabling flow control either. Running ethtool on my desktop connected to the router still brings me the following:
Link partner advertised pause frame use: Symmetric
I am assuming using mt7530_mdio_w32
isn't enough, and I actually have to use mtk_switch_w32
as well to set these registers properly. But I have absolutely no clue on where to start. Any ideas?