net: stmmac: use FIELD_GET() for version register

Provide field definitions in common.h, and use these with FIELD_GET()
to extract the fields from the version register.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vDtf1-0000000CCCF-0uUV@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Russell King (Oracle) 2025-10-29 00:03:31 +00:00 committed by Jakub Kicinski
parent 7b2e41fff7
commit b2fe9e29b5
2 changed files with 7 additions and 4 deletions

View File

@ -26,6 +26,9 @@
#include "hwif.h"
#include "mmc.h"
#define DWMAC_SNPSVER GENMASK_U32(7, 0)
#define DWMAC_USERVER GENMASK_U32(15, 8)
/* Synopsys Core versions */
#define DWMAC_CORE_3_40 0x34
#define DWMAC_CORE_3_50 0x35

View File

@ -43,12 +43,12 @@ static void stmmac_get_version(struct stmmac_priv *priv,
}
dev_info(priv->device, "User ID: 0x%x, Synopsys ID: 0x%x\n",
(unsigned int)(version & GENMASK(15, 8)) >> 8,
(unsigned int)(version & GENMASK(7, 0)));
FIELD_GET(DWMAC_USERVER, version),
FIELD_GET(DWMAC_SNPSVER, version));
ver->snpsver = version & GENMASK(7, 0);
ver->snpsver = FIELD_GET(DWMAC_SNPSVER, version);
if (core_type == DWMAC_CORE_XGMAC)
ver->dev_id = (version & GENMASK(15, 8)) >> 8;
ver->dev_id = FIELD_GET(DWMAC_USERVER, version);
}
static void stmmac_dwmac_mode_quirk(struct stmmac_priv *priv)