Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: stmmac: ingenic: convert to use phy_interface

dwmac-ingenic uses only MII, RMII, GMII or RGMII interface modes, none
of which require any kind of conversion between the MAC and external
world. Thus, mac_interface and phy_interface will be the same.

Convert dwmac-ingenic to use phy_interface when determining the
interface mode that the dwmac core should be configured to at reset,
rather than mac_interface.

Also convert the error prints to use phy_modes() and terminate with a
newline so that we get a human readable 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/E1uytpQ-00000006H2L-2Jzb@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
9ff682b4 db1948da

+15 -10
+15 -10
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
··· 90 90 struct ingenic_mac *mac = plat_dat->bsp_priv; 91 91 unsigned int val; 92 92 93 - switch (plat_dat->mac_interface) { 93 + switch (plat_dat->phy_interface) { 94 94 case PHY_INTERFACE_MODE_MII: 95 95 val = FIELD_PREP(MACPHYC_TXCLK_SEL_MASK, MACPHYC_TXCLK_SEL_INPUT) | 96 96 FIELD_PREP(MACPHYC_PHY_INFT_MASK, MACPHYC_PHY_INFT_MII); ··· 119 119 break; 120 120 121 121 default: 122 - dev_err(mac->dev, "Unsupported interface %d", plat_dat->mac_interface); 122 + dev_err(mac->dev, "Unsupported interface %s\n", 123 + phy_modes(plat_dat->phy_interface)); 123 124 return -EINVAL; 124 125 } 125 126 ··· 132 131 { 133 132 struct ingenic_mac *mac = plat_dat->bsp_priv; 134 133 135 - switch (plat_dat->mac_interface) { 134 + switch (plat_dat->phy_interface) { 136 135 case PHY_INTERFACE_MODE_RMII: 137 136 dev_dbg(mac->dev, "MAC PHY Control Register: PHY_INTERFACE_MODE_RMII\n"); 138 137 break; 139 138 140 139 default: 141 - dev_err(mac->dev, "Unsupported interface %d", plat_dat->mac_interface); 140 + dev_err(mac->dev, "Unsupported interface %s\n", 141 + phy_modes(plat_dat->phy_interface)); 142 142 return -EINVAL; 143 143 } 144 144 ··· 152 150 struct ingenic_mac *mac = plat_dat->bsp_priv; 153 151 unsigned int val; 154 152 155 - switch (plat_dat->mac_interface) { 153 + switch (plat_dat->phy_interface) { 156 154 case PHY_INTERFACE_MODE_RMII: 157 155 val = FIELD_PREP(MACPHYC_PHY_INFT_MASK, MACPHYC_PHY_INFT_RMII); 158 156 dev_dbg(mac->dev, "MAC PHY Control Register: PHY_INTERFACE_MODE_RMII\n"); 159 157 break; 160 158 161 159 default: 162 - dev_err(mac->dev, "Unsupported interface %d", plat_dat->mac_interface); 160 + dev_err(mac->dev, "Unsupported interface %s\n", 161 + phy_modes(plat_dat->phy_interface)); 163 162 return -EINVAL; 164 163 } 165 164 ··· 173 170 struct ingenic_mac *mac = plat_dat->bsp_priv; 174 171 unsigned int val; 175 172 176 - switch (plat_dat->mac_interface) { 173 + switch (plat_dat->phy_interface) { 177 174 case PHY_INTERFACE_MODE_RMII: 178 175 val = FIELD_PREP(MACPHYC_MODE_SEL_MASK, MACPHYC_MODE_SEL_RMII) | 179 176 FIELD_PREP(MACPHYC_PHY_INFT_MASK, MACPHYC_PHY_INFT_RMII); ··· 181 178 break; 182 179 183 180 default: 184 - dev_err(mac->dev, "Unsupported interface %d", plat_dat->mac_interface); 181 + dev_err(mac->dev, "Unsupported interface %s\n", 182 + phy_modes(plat_dat->phy_interface)); 185 183 return -EINVAL; 186 184 } 187 185 ··· 195 191 struct ingenic_mac *mac = plat_dat->bsp_priv; 196 192 unsigned int val; 197 193 198 - switch (plat_dat->mac_interface) { 194 + switch (plat_dat->phy_interface) { 199 195 case PHY_INTERFACE_MODE_RMII: 200 196 val = FIELD_PREP(MACPHYC_TX_SEL_MASK, MACPHYC_TX_SEL_ORIGIN) | 201 197 FIELD_PREP(MACPHYC_RX_SEL_MASK, MACPHYC_RX_SEL_ORIGIN) | ··· 225 221 break; 226 222 227 223 default: 228 - dev_err(mac->dev, "Unsupported interface %d", plat_dat->mac_interface); 224 + dev_err(mac->dev, "Unsupported interface %s\n", 225 + phy_modes(plat_dat->phy_interface)); 229 226 return -EINVAL; 230 227 } 231 228