dm: core: Scan "/firmware" node by default
cover dm: core: Scan "/firmware" node by default
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch series scans "/firmware" node by default like "/clocks". To avoid duplication of code, first patch moves, node scan code into separate function.
Rajan Vaja (2):
dm: core: Move "/clock" node scan into function
dm: core: Scan "/firmware" node by default
drivers/core/root.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
Signature · 6 lines
BRANCH: zynq3/master-next-test Changes since RFC: * Rebase on top on zynq3 branch. -- 2.7.4
PATCH 1/2 dm: core: Move "/clock" node scan into function
Create separate function for scanning node by path and move "/clock" node scan code into that function.
This will be usable if scanning of more node is required.
--- drivers/core/root.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/core/root.c +18 -15
@@ -330,10 +330,25 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob, }#endif +static int dm_scan_fdt_ofnode_path (const char *path,bool pre_reloc_only) +{ +ofnode node; + + node =ofnode_path (path); +if (!ofnode_valid (node)) +return 0 ; + +#if CONFIG_IS_ENABLED (OF_LIVE ) +if (of_live_active ()) +return dm_scan_fdt_live (gd->dm_root, node.np, pre_reloc_only); +#endif +return dm_scan_fdt_node (gd->dm_root, gd->fdt_blob, node.of_offset, + pre_reloc_only); +} +int dm_extended_scan_fdt (const void *blob,bool pre_reloc_only) {int ret; -ofnode node; ret =dm_scan_fdt (gd->fdt_blob, pre_reloc_only);if (ret) {
@@ -341,21 +356,9 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)return ret; } -/* bind fixed-clock */ - node =ofnode_path ("/clocks" ); -/* if no DT "clocks" node, no need to go further */ -if (!ofnode_valid (node)) -return ret; - -#if CONFIG_IS_ENABLED (OF_LIVE ) -if (of_live_active ()) - ret =dm_scan_fdt_live (gd->dm_root, node.np, pre_reloc_only); - else -#endif - ret =dm_scan_fdt_node (gd->dm_root, gd->fdt_blob, node.of_offset, - pre_reloc_only); + ret =dm_scan_fdt_ofnode_path ("/clocks" , pre_reloc_only);if (ret) -debug ("dm_scan_fdt_node() failed: %d\n" , ret); +debug ("scan for /clocks failed: %d\n" , ret);return ret; }
Signature · 1 line
2.7.4
PATCH 1/2 dm: core: Move "/clock" node scan into function
Quoted 10 lines · Rajan Vaja
Create separate function for scanning node by path and move "/clock" node scan code into that function.
This will be usable if scanning of more node is required.
Signed-off-by Rajan Vaja <[email protected]>--- drivers/core/root.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
PATCH 2/2 dm: core: Scan "/firmware" node by default
In reply to Rajan VajaAll Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch scans "/firmware" node by default like "/clocks".
--- drivers/core/root.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/core/root.c +7 -1
@@ -357,8 +357,14 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) } ret =dm_scan_fdt_ofnode_path ("/clocks" , pre_reloc_only); -if (ret) +if (ret) {debug ("scan for /clocks failed: %d\n" , ret); +return ret; + } + + ret =dm_scan_fdt_ofnode_path ("/firmware" , pre_reloc_only); +if (ret) +debug ("scan for /firmware failed: %d\n" , ret);return ret; }
Signature · 1 line
2.7.4
PATCH 2/2 dm: core: Scan "/firmware" node by default
Quoted 7 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
Quoted 6 lines
This patch scans "/firmware" node by default like "/clocks".
Signed-off-by Rajan Vaja <[email protected]>--- drivers/core/root.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
We should add a firmware device for sandbox.
PATCH 2/2 dm: core: Scan "/firmware" node by default
Quoted 10 lines · Simon Glass
Quoted 9 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch scans "/firmware" node by default like "/clocks".
Quoted 9 lines
Quoted 4 lines
Signed-off-by Rajan Vaja <[email protected]>--- drivers/core/root.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)Reviewed-by Simon Glass <[email protected]>We should add a firmware device for sandbox.
what to add there?
M
PATCH 2/2 dm: core: Scan "/firmware" node by default
Hi Michael,
Quoted 16 lines · Michal Simek
Quoted 15 lines · Simon Glass
Quoted 13 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch scans "/firmware" node by default like "/clocks".
Signed-off-by Rajan Vaja <[email protected]>--- drivers/core/root.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 4 lines
Reviewed-by Simon Glass <[email protected]>We should add a firmware device for sandbox.
what to add there?
It can be any device, but I suggest something simple like a demo-shape? Then you can check that it is accessible in a test in test/dm/core.c, perhaps.
Regards,
Simon
PATCH 2/2 dm: core: Scan "/firmware" node by default
Quoted 21 lines · Simon Glass
Hi Michael,
Quoted 18 lines · Michal Simek
Quoted 17 lines · Simon Glass
Quoted 7 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
Quoted 6 lines
This patch scans "/firmware" node by default like "/clocks".
Signed-off-by Rajan Vaja <[email protected]>--- drivers/core/root.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)Reviewed-by Simon Glass <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
We should add a firmware device for sandbox.
what to add there?
It can be any device, but I suggest something simple like a demo-shape? Then you can check that it is accessible in a test in
test/dm/core.c, perhaps.
Rajan: please take a look at it.
Thanks,
Michal
cover dm: core: Scan "/firmware" node by default
In reply to Rajan VajaHi Simon,
Quoted 11 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch series scans "/firmware" node by default like "/clocks". To avoid duplication of code, first patch moves, node scan code into separate function.
Quoted 7 lines
Rajan Vaja (2):
dm: core: Move "/clock" node scan into function
dm: core: Scan "/firmware" node by defaultdrivers/core/root.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
This patch is done based on acked binding
https://lkml.org/lkml/2018/8/3/683
and
https://lkml.org/lkml/2018/8/3/684
where clock driver is child of firmware node.
Can you please look at these 2 patches?
Thanks,
Michal
v2 cover dm: core: Scan "/firmware" node by default
In reply to Rajan VajaAll Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch series scans "/firmware" node by default like "/clocks". To avoid duplication of code, first patch moves, node scan code into separate function.
This series also test to make sure "/firmware" nodes are scanned properly.
Rajan Vaja (4):
firmware: Add FIRMWARE config prompt string
dm: core: Move "/clock" node scan into function
dm: core: Scan "/firmware" node by default
dm: test: Add "/firmware" node scan test
arch/sandbox/dts/test.dts | 7 +++++++ drivers/core/root.c | 35 ++++++++++++++++++++++------------- drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 1 + drivers/firmware/firmware-sandbox.c | 20 ++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/firmware.c | 22 ++++++++++++++++++++++ 7 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 drivers/firmware/firmware-sandbox.c create mode 100644 test/dm/firmware.c
Signature · 5 lines
Changes in v2: * Add firmware device for sanbox and its test * Fix Kconfig to enable FIRMWARE config -- 2.7.4
PATCH v2 1/4 firmware: Add FIRMWARE config prompt string
There is no prompt string for FIRMWARE config. Without this, FIRMWARE config cannot be enabled through menuconfing or config file. Fix this by adding prompt summary.
---
Changes in v2:
* New patch
--- drivers/firmware/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/Kconfig +1 -1
@@ -1,5 +1,5 @@ config FIRMWARE - bool + bool "Enable Firmware driver support" config ARM_PSCI_FW bool
Signature · 1 line
2.7.4
PATCH v2 1/4 firmware: Add FIRMWARE config prompt string
Quoted 11 lines · Rajan Vaja
There is no prompt string for FIRMWARE config. Without this, FIRMWARE config cannot be enabled through menuconfing or config file. Fix this by adding prompt summary.
Signed-off-by Rajan Vaja <[email protected]>---
Changes in v2:
* New patch--- drivers/firmware/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v2 1/4 firmware: Add FIRMWARE config prompt string
Quoted 13 lines · Simon Glass
Quoted 11 lines · Rajan Vaja
There is no prompt string for FIRMWARE config. Without this, FIRMWARE config cannot be enabled through menuconfing or config file. Fix this by adding prompt summary.
Signed-off-by Rajan Vaja <[email protected]>---
Changes in v2:
* New patch--- drivers/firmware/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>
Applied to u-boot-dm, and now in mainline, thanks!
PATCH v2 2/4 dm: core: Move "/clock" node scan into function
In reply to Rajan VajaCreate separate function for scanning node by path and move "/clock" node scan code into that function.
This will be usable if scanning of more node is required.
---
Changes in v2:
* None
--- drivers/core/root.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/core/root.c +18 -15
@@ -330,10 +330,25 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob, }#endif +static int dm_scan_fdt_ofnode_path (const char *path,bool pre_reloc_only) +{ +ofnode node; + + node =ofnode_path (path); +if (!ofnode_valid (node)) +return 0 ; + +#if CONFIG_IS_ENABLED (OF_LIVE ) +if (of_live_active ()) +return dm_scan_fdt_live (gd->dm_root, node.np, pre_reloc_only); +#endif +return dm_scan_fdt_node (gd->dm_root, gd->fdt_blob, node.of_offset, + pre_reloc_only); +} +int dm_extended_scan_fdt (const void *blob,bool pre_reloc_only) {int ret; -ofnode node; ret =dm_scan_fdt (gd->fdt_blob, pre_reloc_only);if (ret) {
@@ -341,21 +356,9 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)return ret; } -/* bind fixed-clock */ - node =ofnode_path ("/clocks" ); -/* if no DT "clocks" node, no need to go further */ -if (!ofnode_valid (node)) -return ret; - -#if CONFIG_IS_ENABLED (OF_LIVE ) -if (of_live_active ()) - ret =dm_scan_fdt_live (gd->dm_root, node.np, pre_reloc_only); - else -#endif - ret =dm_scan_fdt_node (gd->dm_root, gd->fdt_blob, node.of_offset, - pre_reloc_only); + ret =dm_scan_fdt_ofnode_path ("/clocks" , pre_reloc_only);if (ret) -debug ("dm_scan_fdt_node() failed: %d\n" , ret); +debug ("scan for /clocks failed: %d\n" , ret);return ret; }
Signature · 1 line
2.7.4
PATCH v2 2/4 dm: core: Move "/clock" node scan into function
Quoted 5 lines · Rajan Vaja
Create separate function for scanning node by path and move "/clock" node scan code into that function.
This will be usable if scanning of more node is required.
Quoted 8 lines
Signed-off-by Rajan Vaja <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Changes in v2:
* None--- drivers/core/root.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
Applied to u-boot-dm, and now in mainline, thanks!
PATCH v2 3/4 dm: core: Scan "/firmware" node by default
In reply to Rajan VajaAll Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch scans "/firmware" node by default like "/clocks".
---
Changes in v2:
* None
--- drivers/core/root.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/core/root.c +7 -1
@@ -357,8 +357,14 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) } ret =dm_scan_fdt_ofnode_path ("/clocks" , pre_reloc_only); -if (ret) +if (ret) {debug ("scan for /clocks failed: %d\n" , ret); +return ret; + } + + ret =dm_scan_fdt_ofnode_path ("/firmware" , pre_reloc_only); +if (ret) +debug ("scan for /firmware failed: %d\n" , ret);return ret; }
Signature · 1 line
2.7.4
PATCH v2 4/4 dm: test: Add "/firmware" node scan test
In reply to Rajan VajaAdd a test which verifies that all subnodes under "/firmware" nodes are scanned.
---
Changes in v2:
* New patch
--- arch/sandbox/dts/test.dts | 7 +++++++ drivers/firmware/Makefile | 1 + drivers/firmware/firmware-sandbox.c | 20 ++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/firmware.c | 22 ++++++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 drivers/firmware/firmware-sandbox.c create mode 100644 test/dm/firmware.c
arch/sandbox/dts/test.dts +7 -0
@@ -630,6 +630,13 @@ }; }; }; + + firmware { + sandbox_firmware: sandbox-firmware { + compatible = "sandbox,firmware"; + }; + }; + }; #include "sandbox_pmic.dtsi"
drivers/firmware/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_FIRMWARE) += firmware-uclass.o obj-$(CONFIG_ARM_PSCI_FW) += psci.o obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o +obj-$(CONFIG_SANDBOX) += firmware-sandbox.o
drivers/firmware/firmware-sandbox.c new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* sandbox firmware driver +* +* Copyright (C) 2018 Xilinx, Inc. +*/ + +#include <common.h> +#include <dm.h> + +static const struct udevice_id generic_sandbox_firmware_ids[] = { + { .compatible ="sandbox,firmware" }, + { } +}; + +U_BOOT_DRIVER (sandbox_firmware) = { + .name ="sandbox_firmware" , + .id =UCLASS_FIRMWARE , + .of_match = generic_sandbox_firmware_ids, +};
test/dm/Makefile +1 -0
@@ -47,4 +47,5 @@ obj-$(CONFIG_WDT) += wdt.o obj-$(CONFIG_AXI) += axi.o obj-$(CONFIG_MISC) += misc.o obj-$(CONFIG_DM_SERIAL) += serial.o +obj-$(CONFIG_FIRMWARE) += firmware.o endif
test/dm/firmware.c new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018 Xilinx, Inc. +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/test.h> +#include <dm/test.h> +#include <test/ut.h> + +/* Base test of firmware probe */ +static int dm_test_firmware_probe (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (uclass_get_device_by_name (UCLASS_FIRMWARE , +"sandbox-firmware" , &dev)); +return 0 ; +} +DM_TEST (dm_test_firmware_probe,DM_TESTF_SCAN_FDT );
Signature · 1 line
2.7.4
PATCH v2 4/4 dm: test: Add "/firmware" node scan test
Quoted 7 lines · Rajan Vaja
Add a test which verifies that all subnodes under "/firmware" nodes are scanned.
Signed-off-by Rajan Vaja <[email protected]>---
Changes in v2:
* New patch
Quoted 9 lines
--- arch/sandbox/dts/test.dts | 7 +++++++ drivers/firmware/Makefile | 1 + drivers/firmware/firmware-sandbox.c | 20 ++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/firmware.c | 22 ++++++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 drivers/firmware/firmware-sandbox.c create mode 100644 test/dm/firmware.c
PATCH v2 4/4 dm: test: Add "/firmware" node scan test
Quoted 18 lines · Simon Glass
Quoted 7 lines · Rajan Vaja
Add a test which verifies that all subnodes under "/firmware" nodes are scanned.
Signed-off-by Rajan Vaja <[email protected]>---
Changes in v2:
* New patchQuoted 9 lines
--- arch/sandbox/dts/test.dts | 7 +++++++ drivers/firmware/Makefile | 1 + drivers/firmware/firmware-sandbox.c | 20 ++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/firmware.c | 22 ++++++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 drivers/firmware/firmware-sandbox.c create mode 100644 test/dm/firmware.c
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>
Applied to u-boot-dm, and now in mainline, thanks!
v2 cover dm: core: Scan "/firmware" node by default
In reply to Rajan VajaHi Simon,
Quoted 20 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch series scans "/firmware" node by default like "/clocks". To avoid duplication of code, first patch moves, node scan code into separate function.
This series also test to make sure "/firmware" nodes are scanned properly.
Rajan Vaja (4):
firmware: Add FIRMWARE config prompt string
dm: core: Move "/clock" node scan into function
dm: core: Scan "/firmware" node by default
dm: test: Add "/firmware" node scan test
Quoted 11 lines
arch/sandbox/dts/test.dts | 7 +++++++ drivers/core/root.c | 35 ++++++++++++++++++++++------------- drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 1 + drivers/firmware/firmware-sandbox.c | 20 ++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/firmware.c | 22 ++++++++++++++++++++++ 7 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 drivers/firmware/firmware-sandbox.c create mode 100644 test/dm/firmware.c
Can you please take it via your tree?
Thanks,
Michal
v2 cover dm: core: Scan "/firmware" node by default
Quoted 35 lines · Michal Simek
Hi Simon,
Quoted 20 lines · Rajan Vaja
All Linux firmware drivers are put under "/firmware" node and it has support to populate "/firmware" node by default.
u-boot and Linux can share same DTB. In this case, driver probe for devices under "/firmware" will not be invoked as "/firmware" does not have its own "compatible" property.
This patch series scans "/firmware" node by default like "/clocks". To avoid duplication of code, first patch moves, node scan code into separate function.
This series also test to make sure "/firmware" nodes are scanned properly.
Rajan Vaja (4):
firmware: Add FIRMWARE config prompt string
dm: core: Move "/clock" node scan into function
dm: core: Scan "/firmware" node by default
dm: test: Add "/firmware" node scan testQuoted 11 lines
arch/sandbox/dts/test.dts | 7 +++++++ drivers/core/root.c | 35 ++++++++++++++++++++++------------- drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 1 + drivers/firmware/firmware-sandbox.c | 20 ++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/firmware.c | 22 ++++++++++++++++++++++ 7 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 drivers/firmware/firmware-sandbox.c create mode 100644 test/dm/firmware.c
Quoted 4 lines
Can you please take it via your tree?
Thanks,
Michal
Applied to u-boot-dm, and now in mainline, thanks!