
Change the function syscon_regmap_lookup_by_phandle() introduced by commit 6c3af1f24e4b ("syscon: dm: Add a new method to get a regmap from DTS") to have Linux-compatible syscon API and add test for this case: phandle to node with generic "syscon" compatible not bound as syscon UCLASS by default.
Without the patch the added test failed.
And I also update sysreset-syscon driver to use this function and simplify the code, tested on my stm32mp1 board with:
rcc_reboot: rcc-reboot@50000000 { compatible = "syscon-reboot"; regmap = <&rcc>; offset = <0x404>; mask = <0x1>; };
rcc: rcc@50000000 { compatible = "st,stm32mp1-rcc", "syscon"; reg = <0x50000000 0x1000>; #clock-cells = <1>; #reset-cells = <1>; };
PS: compatible st,stm32mp1-rcc is bound to driver drivers/misc/stm32_rcc.c
Patrick Delaunay (2): syscon: update syscon_regmap_lookup_by_phandle sysreset: use syscon_regmap_lookup_by_phandle
arch/sandbox/dts/test.dts | 3 +- drivers/core/syscon-uclass.c | 83 +++++++++++++++++++++++++++----------- drivers/sysreset/sysreset_syscon.c | 15 +------ test/dm/syscon.c | 7 ++++ 4 files changed, 70 insertions(+), 38 deletions(-)