[PATCH v2] soc: imx8m: Probe the SoC driver as platform driver
Arnd Bergmann
arnd at arndb.de
Wed Sep 25 23:28:17 PDT 2024
On Wed, Sep 25, 2024, at 22:04, Marek Vasut wrote:
> With driver_async_probe=* on kernel command line, the following trace is
> produced because on i.MX8M Plus hardware because the soc-imx8m.c driver
> calls of_clk_get_by_name() which returns -EPROBE_DEFER because the clock
> driver is not yet probed. This was not detected during regular testing
> without driver_async_probe.
>
> Convert the SoC code to platform driver and instantiate a platform device
> in its current device_initcall() to probe the platform driver. Rework
> .soc_revision callback to always return valid error code and return SoC
> revision via parameter. This way, if anything in the .soc_revision callback
> return -EPROBE_DEFER, it gets propagated to .probe and the .probe will get
> retried later.
Thanks for the new version, that was quick!
> +static struct platform_driver imx8m_soc_driver = {
> + .probe = imx8m_soc_probe,
> + .driver = {
> + .name = "imx8m-soc",
> + },
> +};
> +module_platform_driver(imx8m_soc_driver);
> +
> +static int __init imx8_soc_init(void)
> +{
> + struct platform_device *pdev;
> +
> + pdev = platform_device_register_simple("imx8m-soc", -1, NULL, 0);
> +
> + return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
> +}
> device_initcall(imx8_soc_init);
Did you run into problems with the method I suggested first?
I don't like the way that this version still registers both the
device and driver regardless of the hardware it runs on, I'd
prefer to leave the platform check in the initcall and
only register them if we are actually on an imx8 machine.
Having two initcalls also makes it impossible to build this
as a loadable module, which is why I suggested
platform_create_bundle(). I think you can keep the
of_device_id lookup and pass the imx8_soc_data pointer
as the platform_data to platform_create_bundle.
Arnd
More information about the linux-arm-kernel
mailing list