From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FDFBC433ED for ; Tue, 20 Apr 2021 00:42:17 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CAE46135F for ; Tue, 20 Apr 2021 00:42:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CAE46135F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=atmark-techno.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FPPyt53FHz3027 for ; Tue, 20 Apr 2021 10:42:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=atmark-techno.com (client-ip=13.115.124.170; helo=gw.atmark-techno.com; envelope-from=dominique.martinet@atmark-techno.com; receiver=) Received: from gw.atmark-techno.com (gw.atmark-techno.com [13.115.124.170]) by lists.ozlabs.org (Postfix) with ESMTP id 4FPNfn5gs5z2xZt for ; Tue, 20 Apr 2021 09:43:11 +1000 (AEST) Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by gw.atmark-techno.com (Postfix) with ESMTPS id BC2CB804CA for ; Tue, 20 Apr 2021 08:43:09 +0900 (JST) Received: by mail-oi1-f198.google.com with SMTP id s9-20020acadb090000b0290101bacefaa4so12259265oig.2 for ; Mon, 19 Apr 2021 16:43:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YfTDNxUjME1kzwn4ONpBlmaWp5uEs0PGjlewRbiJ8O0=; b=NpLdI0/B3EJg0dK0LMy5hUyT+HlDRboSqM6F0ZKUHp9sLTE6QpiqZ7toe5QKJNy+6q DwbZLB/Tk3guTkTizqN/lBpBo8pYT5u5+xxGUrkrP0LWqwMJKt6IXZp8G6yzAOl2POoh vV5HBmnNEbQ4Nm+j4Yo/y5ZI/9s6KOwxwevTmt+vH+eA9raauJDdO/9nH98U41xbvyMX R0Vy2rVSnh4RSGDbXsd/THH0yt/J7TLUxUCkSxOIURQcRmyUYiahCB6Bat3z7o7W4CuU kFZ2wlFGq35m+J/CnD38Rk2Bvg94z+gY9J+ImL6nutHH0OUwD3BUuKzRvsxho00yaTli 8mKA== X-Gm-Message-State: AOAM531gjUbc03GjGINppqo/NDUQO4lhfW2Z2Q5aIJIZAO9SreifCEKA bOxvGuWlNEhI9vvFIpRjtMZ2CI9qHT1FAP6PiKFcJEL4OQ8RRJkZY9NvxiR9WaTabLWcpeYBiH/ D2S3iG36UPWX78PW3BTr8lFsS7kzh8A== X-Received: by 2002:a17:90a:1c1:: with SMTP id 1mr1708187pjd.190.1618875776933; Mon, 19 Apr 2021 16:42:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRGNIqy2AO5m9iOwuC4N09BxordE8LmUXYTIIeyniOtbCQKfA0MKaQl391n1ZLV3YIJOra8w== X-Received: by 2002:a17:90a:1c1:: with SMTP id 1mr1708139pjd.190.1618875776711; Mon, 19 Apr 2021 16:42:56 -0700 (PDT) Received: from pc-0115 (76.125.194.35.bc.googleusercontent.com. [35.194.125.76]) by smtp.gmail.com with ESMTPSA id r3sm8384971pgn.82.2021.04.19.16.42.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Apr 2021 16:42:55 -0700 (PDT) Received: from martinet by pc-0115 with local (Exim 4.94) (envelope-from ) id 1lYdXa-002mPj-58; Tue, 20 Apr 2021 08:42:54 +0900 Date: Tue, 20 Apr 2021 08:42:44 +0900 From: Dominique MARTINET To: Arnd Bergmann Subject: Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match Message-ID: References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-4-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Tue, 20 Apr 2021 10:41:52 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , aymen.sghaier@nxp.com, Geert Uytterhoeven , Rafael Wysocki , David Airlie , Michael Turquette , dri-devel , Linux Kernel Mailing List , Andrzej Hajda , Networking , linux-phy@lists.infradead.org, peter.ujfalusi@gmail.com, linux-clk , Linux-Renesas , Wim Van Sebroeck , Herbert Xu , Horia =?utf-8?Q?Geant=C4=83?= , Kevin Hilman , Joerg Roedel , Neil Armstrong , linux-staging@lists.linux.dev, "open list:IOMMU DRIVERS" , Kishon , Tony Lindgren , linux-omap , Geert Uytterhoeven , Jakub Kicinski , Linus Walleij , Guenter Roeck , Linux Media Mailing List , LINUXWATCHDOG , Will Deacon , Linux PM list , linuxppc-dev , Eduardo Valentin , "open list:GPIO SUBSYSTEM" , "moderated list:ARM/Mediatek SoC..." , Santosh Shilimkar , Matthias Brugger , "open list:ARM/Amlogic Meson SoC support" , Mauro Carvalho Chehab , Linux ARM , "Alice Guo \(OSS\)" , Felipe Balbi , tomba@kernel.org, Stephen Boyd , gregkh , Alan Stern , USB list , linux-mmc , Adrian Hunter , Robert Foss , Leo Li , Tony Prisk , Vinod Koul , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Daniel Vetter , Keerthy , dmaengine@vger.kernel.org, Roy Pledge , jyri.sarha@iki.fi, David Miller Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Arnd Bergmann wrote on Mon, Apr 19, 2021 at 02:16:36PM +0200: > In some cases, you can use the device_link infrastructure to deal > with dependencies between devices. Not sure if this would help > in your case, but have a look at device_link_add() etc in drivers/base/core.c I'll need to actually try to convince myself but if creating the link forces driver registration then it should be workable. > > In this particular case the problem is that since 7d981405d0fd ("soc: > > imx8m: change to use platform driver") the soc probe tries to use the > > nvmem driver for ocotp fuses for imx8m devices, which isn't ready yet. > > So soc loading gets pushed back to the end of the list because it gets > > defered and other drivers relying on soc_device_match get confused > > because they wrongly think a device doesn't match a quirk when it > > actually does. > > > > If there is a way to ensure the nvmem driver gets loaded before the soc, > > that would also solve the problem nicely, and avoid the need to mess > > with all the ~50 drivers which use it. > > > > Is there a way to control in what order drivers get loaded? Something in > > the dtb perhaps? > > For built-in drivers, load order depends on the initcall level and > link order (how things are lined listed in the Makefile hierarchy). > > For loadable modules, this is up to user space in the end. > > Which of the drivers in this scenario are loadable modules? All the drivers involved in my case are built-in (nvmem, soc and final soc_device_match consumer e.g. caam_jr that crashes the kernel if soc is not identified properly). I frankly don't like the idea of moving nvmem/ above soc/ in drivers/Makefile as a "solution" to this (especially as there is one that seems to care about what soc they run on...), so I'll have a look at links first, hopefully that will work out. Thanks, -- Dominique