mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
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 <ioana.ciornei@nxp.com> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://lore.kernel.org/r/20260721231603.67865-5-vladimir.oltean@nxp.com Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
This commit is contained in:
parent
c559ba052a
commit
35faff569f
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user