]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: stmmac: imx: convert to use phy_interface
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 17 Sep 2025 15:12:11 +0000 (16:12 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 20 Sep 2025 00:19:44 +0000 (17:19 -0700)
Checking the IMX8MP documentation, there is no requirement for a
separate mac_interface mode definition. As mac_interface and
phy_interface will be the same, use phy_interface internally rather
than mac_interface.

Also convert the error prints to use phy_modes() so that we get a
meaningful string rather than a number for the interface mode.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1uytpL-00000006H2F-1o6b@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

index 80200a6aa0cb5d559b976ab53513fa79fc7a3026..4268b99872372839846da59d803622db51ef61c4 100644 (file)
@@ -72,7 +72,7 @@ static int imx8mp_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
        struct imx_priv_data *dwmac = plat_dat->bsp_priv;
        int val;
 
-       switch (plat_dat->mac_interface) {
+       switch (plat_dat->phy_interface) {
        case PHY_INTERFACE_MODE_MII:
                val = GPR_ENET_QOS_INTF_SEL_MII;
                break;
@@ -88,8 +88,8 @@ static int imx8mp_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
                      GPR_ENET_QOS_RGMII_EN;
                break;
        default:
-               pr_debug("imx dwmac doesn't support %d interface\n",
-                        plat_dat->mac_interface);
+               pr_debug("imx dwmac doesn't support %s interface\n",
+                        phy_modes(plat_dat->phy_interface));
                return -EINVAL;
        }
 
@@ -112,7 +112,7 @@ static int imx93_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
        struct imx_priv_data *dwmac = plat_dat->bsp_priv;
        int val, ret;
 
-       switch (plat_dat->mac_interface) {
+       switch (plat_dat->phy_interface) {
        case PHY_INTERFACE_MODE_MII:
                val = MX93_GPR_ENET_QOS_INTF_SEL_MII;
                break;
@@ -134,8 +134,8 @@ static int imx93_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
                val = MX93_GPR_ENET_QOS_INTF_SEL_RGMII;
                break;
        default:
-               dev_dbg(dwmac->dev, "imx dwmac doesn't support %d interface\n",
-                        plat_dat->mac_interface);
+               dev_dbg(dwmac->dev, "imx dwmac doesn't support %s interface\n",
+                       phy_modes(plat_dat->phy_interface));
                return -EINVAL;
        }
 
@@ -197,7 +197,7 @@ static int imx_dwmac_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
 {
        struct imx_priv_data *dwmac = bsp_priv;
 
-       interface = dwmac->plat_dat->mac_interface;
+       interface = dwmac->plat_dat->phy_interface;
        if (interface == PHY_INTERFACE_MODE_RMII ||
            interface == PHY_INTERFACE_MODE_MII)
                return 0;
@@ -215,8 +215,8 @@ static void imx_dwmac_fix_speed(void *priv, int speed, unsigned int mode)
        plat_dat = dwmac->plat_dat;
 
        if (dwmac->ops->mac_rgmii_txclk_auto_adj ||
-           (plat_dat->mac_interface == PHY_INTERFACE_MODE_RMII) ||
-           (plat_dat->mac_interface == PHY_INTERFACE_MODE_MII))
+           (plat_dat->phy_interface == PHY_INTERFACE_MODE_RMII) ||
+           (plat_dat->phy_interface == PHY_INTERFACE_MODE_MII))
                return;
 
        rate = rgmii_clock(speed);
@@ -274,7 +274,7 @@ static int imx_dwmac_mx93_reset(struct stmmac_priv *priv, void __iomem *ioaddr)
        value |= DMA_BUS_MODE_SFT_RESET;
        writel(value, ioaddr + DMA_BUS_MODE);
 
-       if (plat_dat->mac_interface == PHY_INTERFACE_MODE_RMII) {
+       if (plat_dat->phy_interface == PHY_INTERFACE_MODE_RMII) {
                usleep_range(100, 200);
                writel(RMII_RESET_SPEED, ioaddr + MAC_CTRL_REG);
        }