mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
net: lan743x: add support for RMII interface
Enable RMII interface in the lan743x driver for PHY and MAC configuration. - Select RMII interface in lan743x_phy_interface_select(). - Update phylink supported_interfaces and MAC capabilities. - Enable RMII via RMII_CTL in lan743x_hardware_init(). - Define RMII_CTL register and enable bit in lan743x_main.h. EEE is not supported with RMII on PCI11x1x: the hardware does not implement LPI signaling over RMII. Clear RMII from lpi_interfaces to prevent phylink from enabling EEE on this interface. Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com> Link: https://patch.msgid.link/20260723050827.694832-3-Thangaraj.S@microchip.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
fc2b13acef
commit
c2e2921d7a
|
|
@ -1402,6 +1402,8 @@ static void lan743x_phy_interface_select(struct lan743x_adapter *adapter)
|
|||
|
||||
if (adapter->is_pci11x1x && adapter->is_sgmii_en)
|
||||
adapter->phy_interface = PHY_INTERFACE_MODE_SGMII;
|
||||
else if (adapter->is_pci11x1x && adapter->is_rmii_en)
|
||||
adapter->phy_interface = PHY_INTERFACE_MODE_RMII;
|
||||
else if (id_rev == ID_REV_ID_LAN7430_)
|
||||
adapter->phy_interface = PHY_INTERFACE_MODE_GMII;
|
||||
else if ((id_rev == ID_REV_ID_LAN7431_) && (data & MAC_CR_MII_EN_))
|
||||
|
|
@ -3190,6 +3192,12 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
|
|||
__set_bit(PHY_INTERFACE_MODE_MII,
|
||||
adapter->phylink_config.supported_interfaces);
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_RMII:
|
||||
__set_bit(PHY_INTERFACE_MODE_RMII,
|
||||
adapter->phylink_config.supported_interfaces);
|
||||
adapter->phylink_config.lpi_capabilities = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
phy_interface_set_rgmii(adapter->phylink_config.supported_interfaces);
|
||||
}
|
||||
|
|
@ -3197,6 +3205,9 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
|
|||
memcpy(adapter->phylink_config.lpi_interfaces,
|
||||
adapter->phylink_config.supported_interfaces,
|
||||
sizeof(adapter->phylink_config.lpi_interfaces));
|
||||
if (adapter->phy_interface == PHY_INTERFACE_MODE_RMII)
|
||||
__clear_bit(PHY_INTERFACE_MODE_RMII,
|
||||
adapter->phylink_config.lpi_interfaces);
|
||||
|
||||
pl = phylink_create(&adapter->phylink_config, NULL,
|
||||
adapter->phy_interface, &lan743x_phylink_mac_ops);
|
||||
|
|
@ -3541,6 +3552,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
|
|||
{
|
||||
struct lan743x_tx *tx;
|
||||
u32 sgmii_ctl;
|
||||
u32 rmii_ctl;
|
||||
int index;
|
||||
int ret;
|
||||
|
||||
|
|
@ -3562,6 +3574,12 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
|
|||
sgmii_ctl |= SGMII_CTL_SGMII_POWER_DN_;
|
||||
}
|
||||
lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl);
|
||||
rmii_ctl = lan743x_csr_read(adapter, RMII_CTL);
|
||||
if (adapter->is_rmii_en)
|
||||
rmii_ctl |= RMII_CTL_RMII_ENABLE_;
|
||||
else
|
||||
rmii_ctl &= ~RMII_CTL_RMII_ENABLE_;
|
||||
lan743x_csr_write(adapter, RMII_CTL, rmii_ctl);
|
||||
} else {
|
||||
adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS;
|
||||
adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS;
|
||||
|
|
@ -3628,8 +3646,9 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
|
|||
adapter->mdiobus->name = "lan743x-mdiobus-c45";
|
||||
dev_dbg(&adapter->pdev->dev, "lan743x-mdiobus-c45\n");
|
||||
} else {
|
||||
dev_dbg(&adapter->pdev->dev, "RGMII operation\n");
|
||||
// Only C22 support when RGMII I/F
|
||||
dev_dbg(&adapter->pdev->dev, "%s operation\n",
|
||||
adapter->is_rmii_en ? "RMII" : "RGMII");
|
||||
// Only C22 support when RGMII/RMII I/F
|
||||
adapter->mdiobus->read = lan743x_mdiobus_read_c22;
|
||||
adapter->mdiobus->write = lan743x_mdiobus_write_c22;
|
||||
adapter->mdiobus->name = "lan743x-mdiobus";
|
||||
|
|
|
|||
|
|
@ -325,6 +325,9 @@
|
|||
#define MAC_WUCSR2_IPV6_TCPSYN_RCD_ BIT(5)
|
||||
#define MAC_WUCSR2_IPV4_TCPSYN_RCD_ BIT(4)
|
||||
|
||||
#define RMII_CTL (0x710)
|
||||
#define RMII_CTL_RMII_ENABLE_ BIT(0)
|
||||
|
||||
#define SGMII_ACC (0x720)
|
||||
#define SGMII_ACC_SGMII_BZY_ BIT(31)
|
||||
#define SGMII_ACC_SGMII_WR_ BIT(30)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user