[PATCH 2/2] soc: nxp: Add a simple NXP LPC32xx socinfo driver
Arnd Bergmann
arnd at arndb.de
Fri Jan 2 01:34:33 PST 2026
On Fri, Jan 2, 2026, at 00:56, Vladimir Zapolskiy wrote:
> Add NXP LPC32xx specific driver to get unique SoC ID from System Control
> Block registers and export it to userspace.
>
> Signed-off-by: Vladimir Zapolskiy <vz at mleia.com>
This looks fine to me overall
> +static int lpc32xx_soc_probe(struct platform_device *pdev)
> +{
> + struct soc_device_attribute *soc_dev_attr;
> + struct device *dev = &pdev->dev;
> + struct soc_device *soc_dev;
> + struct regmap *scb;
> + u32 serial_id[4];
> + int ret;
> +
> + soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL);
> + if (!soc_dev_attr)
> + return -ENOMEM;
> +
> + soc_dev_attr->family = "NXP LPC32xx";
> +
> + ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
> + if (ret)
> + return ret;
> +
> + scb = syscon_regmap_lookup_by_compatible("nxp,lpc3220-scb");
It seems a bit odd to register a fake platform_device and then
get the registers from another device.
I think with the current iteration of syscon since 26769582bf35
("mfd: syscon: Remove the platform driver support"), you should be
able to just register the driver as a module_platform_driver
for the "nxp,lpc3220-scb" compatible value. Have you tried that?
If for some reason that doesn't work, I would drop the custom
platform_device here and just merge the probe function into
the module init.
Arnd
More information about the linux-arm-kernel
mailing list