u8 dev_id;
};
-static u32 stmmac_get_id(struct stmmac_priv *priv, u32 id_reg)
+static u32 stmmac_get_id(struct stmmac_priv *priv, u32 reg)
{
- u32 reg = readl(priv->ioaddr + id_reg);
-
- if (!reg) {
- dev_info(priv->device, "Version ID not available\n");
- return 0x0;
- }
-
dev_info(priv->device, "User ID: 0x%x, Synopsys ID: 0x%x\n",
(unsigned int)(reg & GENMASK(15, 8)) >> 8,
(unsigned int)(reg & GENMASK(7, 0)));
return reg & GENMASK(7, 0);
}
-static u32 stmmac_get_dev_id(struct stmmac_priv *priv, u32 id_reg)
+static u32 stmmac_get_dev_id(struct stmmac_priv *priv, u32 reg)
{
- u32 reg = readl(priv->ioaddr + id_reg);
-
- if (!reg) {
- dev_info(priv->device, "Version ID not available\n");
- return 0x0;
- }
-
return (reg & GENMASK(15, 8)) >> 8;
}
{
enum dwmac_core_type core_type = priv->plat->core_type;
unsigned int version_offset;
+ u32 version;
ver->snpsver = 0;
ver->dev_id = 0;
else
version_offset = GMAC4_VERSION;
- ver->snpsver = stmmac_get_id(priv, version_offset);
+ version = readl(priv->ioaddr + version_offset);
+ if (version == 0) {
+ dev_info(priv->device, "Version ID not available\n");
+ return;
+ }
+
+ ver->snpsver = stmmac_get_id(priv, version);
if (core_type == DWMAC_CORE_XGMAC)
- ver->dev_id = stmmac_get_dev_id(priv, version_offset);
+ ver->dev_id = stmmac_get_dev_id(priv, version);
}
static void stmmac_dwmac_mode_quirk(struct stmmac_priv *priv)