Probing devices by their less-specific "compatible" bindings (here: brcmnand)
Krzysztof Kozlowski
krzysztof.kozlowski at linaro.org
Fri Mar 17 07:34:44 PDT 2023
On 17/03/2023 11:02, Rafał Miłecki wrote:
> Hi, I just spent few hours debugging hidden hw lockup and I need to
> consult driver core code behaviour.
>
> I have a BCM4908 SoC based board with a NAND controller on it.
>
>
> ### Hardware binding
>
> Hardware details:
> arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
>
> Relevant part:
> nand-controller at 1800 {
> compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand";
(...)
> ### Problem
>
> As first Linux probes my hardware using the "brcm,nand-bcm63138"
> compatibility string driver bcm63138_nand.c. That's good.
>
> It that fails however (.probe() returns an error) then Linux core starts
> probing using drivers for less specific bindings.
>
> In my case probing with the "brcm,brcmnand" string driver brcmstb_nand.c
> results in ignoring SoC specific bits and causes a hardware lockup. Hw
> isn't initialized properly and writel_relaxed(0x00000009, base + 0x04)
> just make it hang.
>
> That obviously isn't an acceptable behavior for me. So I'm wondering
> what's going on wrong here.
>
> Should Linux avoid probing with less-specific compatible strings?
Why? If less-specific compatible is there, it means device is compatible
with it and it should work.
> Or should I not claim hw to be "brcm,brcmnand" compatible if it REQUIRES
> SoC-specific handling?
As you pointed this compatible does not work for your device, so they
are not compatible.
Best regards,
Krzysztof
More information about the linux-mtd
mailing list