linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] bus: imx-aipstz: fix probe-related issues
@ 2025-07-07 23:46 Laurentiu Mihalcea
  2025-07-07 23:46 ` [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses Laurentiu Mihalcea
  2025-07-07 23:46 ` [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver Laurentiu Mihalcea
  0 siblings, 2 replies; 9+ messages in thread
From: Laurentiu Mihalcea @ 2025-07-07 23:46 UTC (permalink / raw)
  To: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer,
	Alexander Stein, Mark Brown, Fabio Estevam
  Cc: Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx

From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>

Since the introduction of the i.MX AIPSTZ bridge driver via commit
796cba2dd4d9 ("bus: add driver for IMX AIPSTZ bridge"), a couple of
problems have been reported by Mark Brown and Alexander Stein. Namely:

	1) The driver doesn't get compiled when using the ARM64
	defconfig [1].
	2) The children of the SPBA bus do not get probed [2].

These issues are addressed here by:

	1) Enabling the driver config option in the ARM64 defconfig.
	2) Replacing devm_of_platform_populate() with
	of_platform_populate() and passing a reference to the bus OF
	match table to it.

[1]: https://lore.kernel.org/lkml/ac1daf6b-ee06-4076-b86f-b436ca0acd6d@sirena.org.uk/
[2]: https://lore.kernel.org/lkml/5029548.31r3eYUQgx@steina-w/#t

Laurentiu Mihalcea (2):
  bus: imx-aipstz: allow creating pdevs for child buses
  arm64: defconfig: enable i.MX AIPSTZ driver

 arch/arm64/configs/defconfig |  1 +
 drivers/bus/imx-aipstz.c     | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses
  2025-07-07 23:46 [PATCH 0/2] bus: imx-aipstz: fix probe-related issues Laurentiu Mihalcea
@ 2025-07-07 23:46 ` Laurentiu Mihalcea
  2025-07-08  5:42   ` Alexander Stein
  2025-07-11  8:32   ` Shawn Guo
  2025-07-07 23:46 ` [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver Laurentiu Mihalcea
  1 sibling, 2 replies; 9+ messages in thread
From: Laurentiu Mihalcea @ 2025-07-07 23:46 UTC (permalink / raw)
  To: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer,
	Alexander Stein, Mark Brown, Fabio Estevam
  Cc: Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx

From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>

devm_of_platform_populate() passes a NULL as the bus OF match table
to the underlying of_platform_populate(), meaning child bus devices
of the AIPSTZ bridge will not have its children devices created. Since
some SoCs (e.g. i.MX8MP) use this particular setup (e.g. SPBA bus, which
is a child of AIPSTZ5 and has multiple child nodes), the driver needs to
support it.

Therefore, replace devm_of_platform_populate() with of_platform_populate()
and pass a reference to the bus OF match table to it. For now, the only
possible child buses are simple buses.

Since the usage of devres is dropped, the complementary operation of
of_platform_populate() needs to be called during the driver's removal.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Fixes: 796cba2dd4d9 ("bus: add driver for IMX AIPSTZ bridge")
Reported-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Closes: https://lore.kernel.org/lkml/5029548.31r3eYUQgx@steina-w/#t
---
 drivers/bus/imx-aipstz.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
index 6610251f41c7..5fdf377f5d06 100644
--- a/drivers/bus/imx-aipstz.c
+++ b/drivers/bus/imx-aipstz.c
@@ -26,6 +26,11 @@ static void imx_aipstz_apply_default(struct imx_aipstz_data *data)
 	writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0);
 }
 
+static const struct of_device_id imx_aipstz_match_table[] = {
+	{ .compatible = "simple-bus", },
+	{ }
+};
+
 static int imx_aipstz_probe(struct platform_device *pdev)
 {
 	struct imx_aipstz_data *data;
@@ -49,7 +54,13 @@ static int imx_aipstz_probe(struct platform_device *pdev)
 	pm_runtime_set_active(&pdev->dev);
 	devm_pm_runtime_enable(&pdev->dev);
 
-	return devm_of_platform_populate(&pdev->dev);
+	return of_platform_populate(pdev->dev.of_node, imx_aipstz_match_table,
+				    NULL, &pdev->dev);
+}
+
+static void imx_aipstz_remove(struct platform_device *pdev)
+{
+	of_platform_depopulate(&pdev->dev);
 }
 
 static int imx_aipstz_runtime_resume(struct device *dev)
@@ -83,6 +94,7 @@ MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids);
 
 static struct platform_driver imx_aipstz_of_driver = {
 	.probe = imx_aipstz_probe,
+	.remove = imx_aipstz_remove,
 	.driver = {
 		.name = "imx-aipstz",
 		.of_match_table = imx_aipstz_of_ids,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver
  2025-07-07 23:46 [PATCH 0/2] bus: imx-aipstz: fix probe-related issues Laurentiu Mihalcea
  2025-07-07 23:46 ` [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses Laurentiu Mihalcea
@ 2025-07-07 23:46 ` Laurentiu Mihalcea
  2025-07-08  1:39   ` Fabio Estevam
  2025-07-08  5:42   ` Alexander Stein
  1 sibling, 2 replies; 9+ messages in thread
From: Laurentiu Mihalcea @ 2025-07-07 23:46 UTC (permalink / raw)
  To: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer,
	Alexander Stein, Mark Brown, Fabio Estevam
  Cc: Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx

From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>

Enable the config (CONFIG_IMX_AIPSTZ) for the i.MX AIPSTZ driver, which
is required for platforms using the AIPSTZ bridge (e.g. i.MX8MP).

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 739b19302865..4d7a60444bf5 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -262,6 +262,7 @@ CONFIG_GOOGLE_FIRMWARE=y
 CONFIG_GOOGLE_CBMEM=m
 CONFIG_GOOGLE_COREBOOT_TABLE=m
 CONFIG_EFI_CAPSULE_LOADER=y
+CONFIG_IMX_AIPSTZ=y
 CONFIG_IMX_SCU=y
 CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=y
 CONFIG_QCOM_QSEECOM=y
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver
  2025-07-07 23:46 ` [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver Laurentiu Mihalcea
@ 2025-07-08  1:39   ` Fabio Estevam
  2025-08-01 12:18     ` Laurentiu Mihalcea
  2025-07-08  5:42   ` Alexander Stein
  1 sibling, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2025-07-08  1:39 UTC (permalink / raw)
  To: Laurentiu Mihalcea
  Cc: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer,
	Alexander Stein, Mark Brown, Pengutronix Kernel Team,
	linux-arm-kernel, linux-kernel, imx

On Mon, Jul 7, 2025 at 8:46 PM Laurentiu Mihalcea
<laurentiumihalcea111@gmail.com> wrote:
>
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> Enable the config (CONFIG_IMX_AIPSTZ) for the i.MX AIPSTZ driver, which
> is required for platforms using the AIPSTZ bridge (e.g. i.MX8MP).

Shouldn't this be enabled via a select in Kconfig instead?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses
  2025-07-07 23:46 ` [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses Laurentiu Mihalcea
@ 2025-07-08  5:42   ` Alexander Stein
  2025-07-11  8:32   ` Shawn Guo
  1 sibling, 0 replies; 9+ messages in thread
From: Alexander Stein @ 2025-07-08  5:42 UTC (permalink / raw)
  To: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer, Mark Brown,
	Fabio Estevam, Laurentiu Mihalcea
  Cc: Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx

Hi,

Am Dienstag, 8. Juli 2025, 01:46:27 CEST schrieb Laurentiu Mihalcea:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> 
> devm_of_platform_populate() passes a NULL as the bus OF match table
> to the underlying of_platform_populate(), meaning child bus devices
> of the AIPSTZ bridge will not have its children devices created. Since
> some SoCs (e.g. i.MX8MP) use this particular setup (e.g. SPBA bus, which
> is a child of AIPSTZ5 and has multiple child nodes), the driver needs to
> support it.
> 
> Therefore, replace devm_of_platform_populate() with of_platform_populate()
> and pass a reference to the bus OF match table to it. For now, the only
> possible child buses are simple buses.
> 
> Since the usage of devres is dropped, the complementary operation of
> of_platform_populate() needs to be called during the driver's removal.
> 
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> Fixes: 796cba2dd4d9 ("bus: add driver for IMX AIPSTZ bridge")
> Reported-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Closes: https://lore.kernel.org/lkml/5029548.31r3eYUQgx@steina-w/#t

Thanks, with this SAI devices are probed again.

Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>

> ---
>  drivers/bus/imx-aipstz.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
> index 6610251f41c7..5fdf377f5d06 100644
> --- a/drivers/bus/imx-aipstz.c
> +++ b/drivers/bus/imx-aipstz.c
> @@ -26,6 +26,11 @@ static void imx_aipstz_apply_default(struct imx_aipstz_data *data)
>  	writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0);
>  }
>  
> +static const struct of_device_id imx_aipstz_match_table[] = {
> +	{ .compatible = "simple-bus", },
> +	{ }
> +};
> +
>  static int imx_aipstz_probe(struct platform_device *pdev)
>  {
>  	struct imx_aipstz_data *data;
> @@ -49,7 +54,13 @@ static int imx_aipstz_probe(struct platform_device *pdev)
>  	pm_runtime_set_active(&pdev->dev);
>  	devm_pm_runtime_enable(&pdev->dev);
>  
> -	return devm_of_platform_populate(&pdev->dev);
> +	return of_platform_populate(pdev->dev.of_node, imx_aipstz_match_table,
> +				    NULL, &pdev->dev);
> +}
> +
> +static void imx_aipstz_remove(struct platform_device *pdev)
> +{
> +	of_platform_depopulate(&pdev->dev);
>  }
>  
>  static int imx_aipstz_runtime_resume(struct device *dev)
> @@ -83,6 +94,7 @@ MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids);
>  
>  static struct platform_driver imx_aipstz_of_driver = {
>  	.probe = imx_aipstz_probe,
> +	.remove = imx_aipstz_remove,
>  	.driver = {
>  		.name = "imx-aipstz",
>  		.of_match_table = imx_aipstz_of_ids,
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver
  2025-07-07 23:46 ` [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver Laurentiu Mihalcea
  2025-07-08  1:39   ` Fabio Estevam
@ 2025-07-08  5:42   ` Alexander Stein
  2025-08-01 12:11     ` Laurentiu Mihalcea
  1 sibling, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2025-07-08  5:42 UTC (permalink / raw)
  To: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer, Mark Brown,
	Fabio Estevam, Laurentiu Mihalcea
  Cc: Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx

Hi,

Am Dienstag, 8. Juli 2025, 01:46:28 CEST schrieb Laurentiu Mihalcea:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> 
> Enable the config (CONFIG_IMX_AIPSTZ) for the i.MX AIPSTZ driver, which
> is required for platforms using the AIPSTZ bridge (e.g. i.MX8MP).
> 
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> ---
>  arch/arm64/configs/defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index 739b19302865..4d7a60444bf5 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -262,6 +262,7 @@ CONFIG_GOOGLE_FIRMWARE=y
>  CONFIG_GOOGLE_CBMEM=m
>  CONFIG_GOOGLE_COREBOOT_TABLE=m
>  CONFIG_EFI_CAPSULE_LOADER=y
> +CONFIG_IMX_AIPSTZ=y

Why not =m?

Best regards
Alexander

>  CONFIG_IMX_SCU=y
>  CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=y
>  CONFIG_QCOM_QSEECOM=y
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses
  2025-07-07 23:46 ` [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses Laurentiu Mihalcea
  2025-07-08  5:42   ` Alexander Stein
@ 2025-07-11  8:32   ` Shawn Guo
  1 sibling, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2025-07-11  8:32 UTC (permalink / raw)
  To: Laurentiu Mihalcea
  Cc: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer,
	Alexander Stein, Mark Brown, Fabio Estevam,
	Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx

On Mon, Jul 07, 2025 at 07:46:27PM -0400, Laurentiu Mihalcea wrote:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> 
> devm_of_platform_populate() passes a NULL as the bus OF match table
> to the underlying of_platform_populate(), meaning child bus devices
> of the AIPSTZ bridge will not have its children devices created. Since
> some SoCs (e.g. i.MX8MP) use this particular setup (e.g. SPBA bus, which
> is a child of AIPSTZ5 and has multiple child nodes), the driver needs to
> support it.
> 
> Therefore, replace devm_of_platform_populate() with of_platform_populate()
> and pass a reference to the bus OF match table to it. For now, the only
> possible child buses are simple buses.
> 
> Since the usage of devres is dropped, the complementary operation of
> of_platform_populate() needs to be called during the driver's removal.
> 
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> Fixes: 796cba2dd4d9 ("bus: add driver for IMX AIPSTZ bridge")
> Reported-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Closes: https://lore.kernel.org/lkml/5029548.31r3eYUQgx@steina-w/#t

Applied this one, thanks!


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver
  2025-07-08  5:42   ` Alexander Stein
@ 2025-08-01 12:11     ` Laurentiu Mihalcea
  0 siblings, 0 replies; 9+ messages in thread
From: Laurentiu Mihalcea @ 2025-08-01 12:11 UTC (permalink / raw)
  To: Alexander Stein, Shawn Guo, Catalin Marinas, Will Deacon,
	Sascha Hauer, Mark Brown, Fabio Estevam
  Cc: Pengutronix Kernel Team, linux-arm-kernel, linux-kernel, imx



On 7/8/2025 8:42 AM, Alexander Stein wrote:
> Hi,
>
> Am Dienstag, 8. Juli 2025, 01:46:28 CEST schrieb Laurentiu Mihalcea:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>>
>> Enable the config (CONFIG_IMX_AIPSTZ) for the i.MX AIPSTZ driver, which
>> is required for platforms using the AIPSTZ bridge (e.g. i.MX8MP).
>>
>> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>> ---
>>  arch/arm64/configs/defconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
>> index 739b19302865..4d7a60444bf5 100644
>> --- a/arch/arm64/configs/defconfig
>> +++ b/arch/arm64/configs/defconfig
>> @@ -262,6 +262,7 @@ CONFIG_GOOGLE_FIRMWARE=y
>>  CONFIG_GOOGLE_CBMEM=m
>>  CONFIG_GOOGLE_COREBOOT_TABLE=m
>>  CONFIG_EFI_CAPSULE_LOADER=y
>> +CONFIG_IMX_AIPSTZ=y
> Why not =m?

well, the thought process here was that since the audio block control driver (i.e.: clk-imx8mp-audiomix.c)
is compiled as built-in (CONFIG_CLK_IMX8MP=y) we'd want to have the bridge as built-in too so as to not
defer the probe of the clock provider and its consumers (in case there's any compiled as built-in).

however, the bridge driver could have just as well been compiled as a module so any of the two approaches
is fine with me.

>
> Best regards
> Alexander
>
>>  CONFIG_IMX_SCU=y
>>  CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=y
>>  CONFIG_QCOM_QSEECOM=y
>>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver
  2025-07-08  1:39   ` Fabio Estevam
@ 2025-08-01 12:18     ` Laurentiu Mihalcea
  0 siblings, 0 replies; 9+ messages in thread
From: Laurentiu Mihalcea @ 2025-08-01 12:18 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Shawn Guo, Catalin Marinas, Will Deacon, Sascha Hauer,
	Alexander Stein, Mark Brown, Pengutronix Kernel Team,
	linux-arm-kernel, linux-kernel, imx



On 7/8/2025 4:39 AM, Fabio Estevam wrote:
> On Mon, Jul 7, 2025 at 8:46 PM Laurentiu Mihalcea
> <laurentiumihalcea111@gmail.com> wrote:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>>
>> Enable the config (CONFIG_IMX_AIPSTZ) for the i.MX AIPSTZ driver, which
>> is required for platforms using the AIPSTZ bridge (e.g. i.MX8MP).
> Shouldn't this be enabled via a select in Kconfig instead?

would've been nice but I'm not sure we have an i.MX8MP SoC-specific config option for that?
or do you have anything particular in your mind?

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-08-01 12:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07 23:46 [PATCH 0/2] bus: imx-aipstz: fix probe-related issues Laurentiu Mihalcea
2025-07-07 23:46 ` [PATCH 1/2] bus: imx-aipstz: allow creating pdevs for child buses Laurentiu Mihalcea
2025-07-08  5:42   ` Alexander Stein
2025-07-11  8:32   ` Shawn Guo
2025-07-07 23:46 ` [PATCH 2/2] arm64: defconfig: enable i.MX AIPSTZ driver Laurentiu Mihalcea
2025-07-08  1:39   ` Fabio Estevam
2025-08-01 12:18     ` Laurentiu Mihalcea
2025-07-08  5:42   ` Alexander Stein
2025-08-01 12:11     ` Laurentiu Mihalcea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).