Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29DB9C7618E for ; Sat, 18 Mar 2023 00:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229697AbjCRAYh (ORCPT ); Fri, 17 Mar 2023 20:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjCRAYf (ORCPT ); Fri, 17 Mar 2023 20:24:35 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6276E7EE1 for ; Fri, 17 Mar 2023 17:24:16 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id 6-20020a17090a190600b00237c5b6ecd7so10921721pjg.4 for ; Fri, 17 Mar 2023 17:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1679099056; h=in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:from:to:cc:subject:date:message-id:reply-to; bh=aCIvgHkvum9lOFK8nJz2kt/7YAWyk9CjGByJA1h8nvA=; b=Vw/dtAsfzHkazE4M5XxCQ22Wva9fDs5xWKdXGO3tG8rNPO9xF3Ox54WfGRDfgLwewU PbB9f8cmtcUOMDEGEPyw3IkyIhWJ1he9Vbsd3Tv0nGLcBlEbgOYL4IjvZvJMTxoQUZ70 VZUuBXTewA8xkQlIP82VSPqT0RrUr6i4O90Uo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679099056; h=in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aCIvgHkvum9lOFK8nJz2kt/7YAWyk9CjGByJA1h8nvA=; b=m96FQ4ZxOO9OYbWl5RN6MQTj75afbpSO2aoJCaqleymImsABcb5ixi0AJeTnNuDtKP gqt/2s+nt7Gjk6/uTDVXHsihOt0EGiUYI/HRvmhq4Q5zZu+Jng+QKkHqFIpHKQ23rs92 +mZ17yVB5s6FIN+TDrLJ/S6w3Q0TXbctrnNlKiEryK3zZgt5nauX73PuiZxwZvThGn5J RiB8lXZAguZh4Z6UXyNFinR+/slAHtDOkQWBL8JJAT9B5uPnXukyfQ8hwN7N0ORTcthe hig5xUoEz3Nam7aVS3ysm2MvluCCVGaK2cAWO7n5r+T+MQdv+QyNcTMwAm9I0kfwNT9R CDHA== X-Gm-Message-State: AO0yUKULz5XiZMt8dNPUkwx+MIDOKlS9dQUj5cJUUctDpHJazWdLvdJY mGFe2e8zKRHsGjD1oFrdcflDNw== X-Google-Smtp-Source: AK7set8dlsjaQzpr/5Hj9uU+qkR+aoGvfj9SZirH/xj53h2ft2+47WXR1i8jQNH2GwBbVy+ckyr/gA== X-Received: by 2002:a05:6a20:548f:b0:d5:10ca:5264 with SMTP id i15-20020a056a20548f00b000d510ca5264mr11242046pzk.59.1679099055933; Fri, 17 Mar 2023 17:24:15 -0700 (PDT) Received: from bcacpedev-irv-3.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id c25-20020aa78c19000000b00623f72df4e2sm2062157pfd.203.2023.03.17.17.24.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Mar 2023 17:24:15 -0700 (PDT) Subject: Re: Probing devices by their less-specific "compatible" bindings (here: brcmnand) To: Florian Fainelli , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , Brian Norris , Linux Kernel Mailing List , "devicetree@vger.kernel.org" , MTD Maling List References: <399d2f43-5cad-6c51-fe3a-623950e2151a@gmail.com> <0bbaa346-edbf-a1b9-3c95-5a1aacaf0c44@gmail.com> From: William Zhang Message-ID: Date: Fri, 17 Mar 2023 17:24:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <0bbaa346-edbf-a1b9-3c95-5a1aacaf0c44@gmail.com> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000ce02c505f721b68a" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000ce02c505f721b68a Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit On 03/17/2023 02:54 PM, Florian Fainelli wrote: > +William, > > On 3/17/23 03: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@1800 { >>      compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", >> "brcm,brcmnand"; >>      reg = <0x1800 0x600>, <0x2000 0x10>; >>      reg-names = "nand", "nand-int-base"; >> }: >> >> Above binding is based on the documentation: >> Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml >> >> >> ### Linux drivers >> >> Linux has separated drivers for few Broadcom's NAND controller bindings: >> >> 1. drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c for: >> brcm,nand-bcm63138 >> >> 2. drivers/mtd/nand/raw/brcmnand/brcmnand.c for: >> brcm,brcmnand-v2.1 >> brcm,brcmnand-v2.2 >> brcm,brcmnand-v4.0 >> brcm,brcmnand-v5.0 >> brcm,brcmnand-v6.0 >> brcm,brcmnand-v6.1 >> brcm,brcmnand-v6.2 >> brcm,brcmnand-v7.0 >> brcm,brcmnand-v7.1 >> brcm,brcmnand-v7.2 >> brcm,brcmnand-v7.3 >> >> 3. drivers/mtd/nand/raw/brcmnand/brcmstb_nand.c for: >> 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. > > Why does it fail? > Same question here. I just tried latest linux master code on my 4908 reference board and the Micron NAND on my board works fine. Can you post the log from the brcmnand driver? >> >> 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. > > Well, the missing piece here is that brcmnand.c is a library driver, > therefore it needs an entry point, the next one that matches is > brcmstb_nand.c. > >> >> 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? >> Or should I not claim hw to be "brcm,brcmnand" compatible if it REQUIRES >> SoC-specific handling? >> >> An extra note: that fallback probing happens even with .probe() >> returning -EPROBE_DEFER. This actually smells fishy for me on the Linux >> core part. >> I'm not an expect but I think core should wait for actual error without >> trying less-specific compatible strings & drivers. >> Are you saying the bcm63138_nand.c probe function return -EPROBE_DEFER and late on kernel call brcmstb_nand.c probe instead of bcm63138_nand's probe again? >> ______________________________________________________ >> Linux MTD discussion mailing list >> http://lists.infradead.org/mailman/listinfo/linux-mtd/ > --000000000000ce02c505f721b68a Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQcAYJKoZIhvcNAQcCoIIQYTCCEF0CAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3HMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduI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