soc: fsl: guts: add a central fsl_guts_read() function

Add a central fsl_guts_read() function which will take into account the
endianness that was already determined. No point is duplicating the
if-else statement each time we need to read a DCFG register.

Signed-off-by: Ioana Ciornei <[email protected]>
Signed-off-by: Vladimir Oltean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christophe Leroy (CS GROUP) <[email protected]>
This commit is contained in:
Ioana Ciornei authored and Christophe Leroy (CS GROUP) committed 2026-08-07 06:54:23 +02:00
1 parent c559ba052a
commit 35faff569f
1 file changed
+9 -4
+9 -4
View File
@@ -111,6 +111,14 @@ static struct fsl_soc_guts {
bool little_endian;
} soc;
static unsigned int fsl_guts_read(const void __iomem *reg)
{
if (soc.little_endian)
return ioread32(reg);
return ioread32be(reg);
}
static const struct fsl_soc_die_attr *fsl_soc_die_match(
u32 svr, const struct fsl_soc_die_attr *matches)
{
@@ -209,10 +217,7 @@ static int __init fsl_guts_init(void)
}
soc.little_endian = of_property_read_bool(np, "little-endian");
if (soc.little_endian)
svr = ioread32(&soc.dcfg_ccsr->svr);
else
svr = ioread32be(&soc.dcfg_ccsr->svr);
svr = fsl_guts_read(&soc.dcfg_ccsr->svr);
of_node_put(np);
/* Register soc device */