From: Paul Burton Date: Mon, 1 Aug 2016 11:10:06 +0100 Subject: [U-Boot] [PATCH v2 08/10] dm: syscon: Provide a generic syscon driver In-Reply-To: References: <20160727142651.10570-1-paul.burton@imgtec.com> <20160727142651.10570-9-paul.burton@imgtec.com> Message-ID: <6997666b-1ea4-370d-532a-ac32b69e75b7@imgtec.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 01/08/16 03:20, Simon Glass wrote: > Hi Paul, > > On 27 July 2016 at 08:26, Paul Burton wrote: >> Provide a trivial syscon driver matching the generic "syscon" compatible >> string, allowing for simple system controllers to be used without a >> custom driver just as in Linux. >> >> Signed-off-by: Paul Burton >> >> --- >> >> Changes in v2: >> - New patch >> >> drivers/core/syscon-uclass.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c >> index 01bd968..2148469 100644 >> --- a/drivers/core/syscon-uclass.c >> +++ b/drivers/core/syscon-uclass.c >> @@ -95,3 +95,14 @@ UCLASS_DRIVER(syscon) = { >> .per_device_auto_alloc_size = sizeof(struct syscon_uc_info), >> .pre_probe = syscon_pre_probe, >> }; >> + >> +static const struct udevice_id generic_syscon_ids[] = { >> + { .compatible = "syscon" }, >> + { } >> +}; >> + >> +U_BOOT_DRIVER(generic_syscon) = { >> + .name = "syscon", >> + .id = UCLASS_SYSCON, >> + .of_match = generic_syscon_ids, >> +}; >> -- >> 2.9.0 >> > > This would work if driver model checked compatible strings in priority > order. But it does not. > > lists_bind_fdt() checks every driver to see if it is compatible. So > your driver may be picked in preference to a more specific one. > > I've been aware of this limitation but it hasn't come up until now. > > I suppose the solution is to flip things around so that we: > > 1. Pick a node > 2. Look at each compatible string in turn, starting from the first > (most specific) > 3. Search for a driver for that string > > Do you want to take a look? > > Regards, > Simon > Hi Simon, Ah - I wasn't aware of that discrepancy vs the device tree spec. I've just submitted v4 of my series which introduces a new patch 8 "dm: core: Match compatible strings in order of priority" which should fix that. Thanks, Paul