devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] firmware: meson_sm: populate platform devices from sm device tree data
@ 2023-03-24 14:55 Dmitry Rokosov
  2023-03-25 20:34 ` Martin Blumenstingl
  2023-03-27 10:08 ` Neil Armstrong
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Rokosov @ 2023-03-24 14:55 UTC (permalink / raw)
  To: krzysztof.kozlowski, robh, neil.armstrong, khilman, jbrunet,
	martin.blumenstingl, jianxin.pan
  Cc: kernel, linux-kernel, linux-arm-kernel, linux-amlogic,
	devicetree, rockosov, Dmitry Rokosov

In some meson boards, secure monitor device has children, for example,
power secure controller. By default, secure monitor isn't the bus in terms
of device tree subsystem, so the of_platform initialization code doesn't
populate its device tree data. As a result, secure monitor's children
aren't probed at all.

Run the 'of_platform_populate()' routine manually to resolve such issues.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
Changes v3 since v2 at [2]:
    - unmap meson sm shmem region if devm_of_platform_populate() failed
    - move pr_info() log about successfully enabled secure-monitor to
      the end of probe() routine

Changes v2 since v1 at [1]:
    - decline the device tree /firmware based solution
    - introduce devm_of_platform_populate() solution in the meson sm driver

Links:
    [1] https://lore.kernel.org/all/20230323185548.13731-1-ddrokosov@sberdevices.ru/
    [2] https://lore.kernel.org/linux-amlogic/20230324140141.6743-1-ddrokosov@sberdevices.ru/
---
 drivers/firmware/meson/meson_sm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index 77aa5c6398aa..1a99dbc274fa 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -311,11 +311,14 @@ static int __init meson_sm_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, fw);
 
-	pr_info("secure-monitor enabled\n");
+	if (devm_of_platform_populate(dev))
+		goto out_in_base;
 
 	if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group))
 		goto out_in_base;
 
+	pr_info("secure-monitor enabled\n");
+
 	return 0;
 
 out_in_base:
-- 
2.36.0


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

* Re: [PATCH v3] firmware: meson_sm: populate platform devices from sm device tree data
  2023-03-24 14:55 [PATCH v3] firmware: meson_sm: populate platform devices from sm device tree data Dmitry Rokosov
@ 2023-03-25 20:34 ` Martin Blumenstingl
  2023-03-27 10:08 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2023-03-25 20:34 UTC (permalink / raw)
  To: Dmitry Rokosov
  Cc: krzysztof.kozlowski, robh, neil.armstrong, khilman, jbrunet,
	jianxin.pan, kernel, linux-kernel, linux-arm-kernel,
	linux-amlogic, devicetree, rockosov

On Fri, Mar 24, 2023 at 3:56 PM Dmitry Rokosov <ddrokosov@sberdevices.ru> wrote:
>
> In some meson boards, secure monitor device has children, for example,
> power secure controller. By default, secure monitor isn't the bus in terms
> of device tree subsystem, so the of_platform initialization code doesn't
> populate its device tree data. As a result, secure monitor's children
> aren't probed at all.
>
> Run the 'of_platform_populate()' routine manually to resolve such issues.
>
> Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

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

* Re: [PATCH v3] firmware: meson_sm: populate platform devices from sm device tree data
  2023-03-24 14:55 [PATCH v3] firmware: meson_sm: populate platform devices from sm device tree data Dmitry Rokosov
  2023-03-25 20:34 ` Martin Blumenstingl
@ 2023-03-27 10:08 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-03-27 10:08 UTC (permalink / raw)
  To: krzysztof.kozlowski, robh, khilman, jbrunet, martin.blumenstingl,
	jianxin.pan, Dmitry Rokosov
  Cc: kernel, linux-kernel, linux-arm-kernel, linux-amlogic,
	devicetree, rockosov

Hi,

On Fri, 24 Mar 2023 17:55:57 +0300, Dmitry Rokosov wrote:
> In some meson boards, secure monitor device has children, for example,
> power secure controller. By default, secure monitor isn't the bus in terms
> of device tree subsystem, so the of_platform initialization code doesn't
> populate its device tree data. As a result, secure monitor's children
> aren't probed at all.
> 
> Run the 'of_platform_populate()' routine manually to resolve such issues.
> 
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.4/drivers)

[1/1] firmware: meson_sm: populate platform devices from sm device tree data
      https://git.kernel.org/amlogic/c/e45f243409db98d610248c843b25435e7fb0baf3

These changes has been applied on the intermediate git tree [1].

The v6.4/drivers branch will then be sent via a formal Pull Request to the Linux SoC maintainers
for inclusion in their intermediate git branches in order to be sent to Linus during
the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate
kernel and as soon they appear on the Linux master branch they will be
backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3],
people are encouraged testing these pre-release kernels and report issues on the
relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert
patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

-- 
Neil


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

end of thread, other threads:[~2023-03-27 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 14:55 [PATCH v3] firmware: meson_sm: populate platform devices from sm device tree data Dmitry Rokosov
2023-03-25 20:34 ` Martin Blumenstingl
2023-03-27 10:08 ` Neil Armstrong

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).