On 25/04/2024 12:02, Peter Griffin wrote: >> I prefer to keep the syscon >> API and change the syscon driver to expose proper regmap. IOW, use >> generic API syscon_regmap_lookup_by_phandle() and the type of regmap >> returned is defined by the provider (so node pointed by phandle). >> > > @Arnd - any more thoughts on Krzysztof idea above ^^ > > @Krzysztof - I did speak to Arnd about the idea you proposed (or my > understanding of it at least), which was external drivers like > exynos-pmu or altera-sysmgr.c could create the regmap and register it > with syscon so it can be returned by > syscon_regmap_lookup_by_phandle(). Arnd's initial feedback was he > would prefer to keep the complexity out of syscon, and have the client > driver support multiple backends (so syscon-reboot for example would > support using either syscon_regmap_lookup_by_phandle() or > exynos_get_pmu_regmap_by_phandle() to obtain it's regmap). There were > also some concerns about syscon having to probe very early for some > platforms. mfd/syscon.c is postcore_initcall, so it is not that very early, although earlier than drivers. However it does not support deferred probe and sometimes syscon providers might need clocks and resets. One syscon consumer (so regular driver like phy here) might work with different providers. E.g. on earlier arm and arm64 Exynos this was simple regmap. On Google GS this is SMC. On some foo-bar it might be call to hypervisor or something needing clocks. For me therefore the syscon consumer is like regmap consumer. You do not care who provides the regmap, just want i2c or mmio regmap. Of course the specific driver, so the consumer of regmap, knows the type of regmap it uses, so it requests i2c or mmio. Here we want to hide two different interfaces - mmio and SMC - behind one regmap. We solve it by using same regmap interface for consumer, but different syscon calls returning different regmaps. Anyway, I want to sort it out and have some sort of global policy, before we start doing such changes for Google GS. I am sure soon Qualcomm will come with their need for hypervisor quirks/regmaps etc. And then TI will come with some need. Best regards, Krzysztof