Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3523851rdh; Thu, 28 Sep 2023 14:29:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo5Lw560U9qEQwvNJQLY/TaqvgrdV8OvkNnKs06kvYfLXMDW1zAeZlFCZtB7jt5/XgpAbH X-Received: by 2002:a9d:6ad3:0:b0:6bd:bba9:2d63 with SMTP id m19-20020a9d6ad3000000b006bdbba92d63mr2437981otq.9.1695936559037; Thu, 28 Sep 2023 14:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695936558; cv=none; d=google.com; s=arc-20160816; b=Q933Hk5eZ328vRtOWJH8tEFduZD8u74wUn/hdcvjvmDXnwqAm1f9rC1arQxbkKX6RE DVHOXd2Jll4Hizt3qy96FCor6jOhX/vCO/iBk38zoR5vo/XvDyLxtSVlLJs8DTHLtnb+ 1+pqtKE+zZwgOnFcsg7a0yEJxrFKMJsnNRs81VuNnwwzCmXfRCRryD4WnINOD+g1096V SeCtYq3p1Qk+Y0DZPTtJbhLEBwmci7BNwrRmobGpSEkbr7rxM6OMYRMCbTrmwS90n0h4 U2lpLnU+NDWx/QjYYayvFOUnnh8ialoeEbFWvwYMdT1gk4TcqnxuotvoXr7f2L3O8rqA SZJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version; bh=/TB0pcDOsJvcufWBvC6xQGRYpauVAoHbM8GmAI5EJfA=; fh=2EMv6Ee5TLaeiEAL/RdHZsJEKmO8ue9udvR2Ea6pQ5U=; b=ls+aTMFfZUbRzArgY9dx5o7AOUlaK2AvyW0wB1nIMNsUt/PJKZdpQv9K+sn8ELASWu 4fL8mM0AFsLkF0Rr8U87jW7r4vmDzXQ1SsX7ovsqWY2+C8jaT8Odm0TQceZY1vN6/xBx 4jyAYdqKgvSgNDcSYbBWNKGdMU2DAtS5VDQJMgNNky1J/0eWDYhw2Ae8cxYRR4vzIkEu 349ig6Lp6u23jsDRZCGGcsjxkdkMdulkraZGvzS4YMwJBhZtX87OpE2xPQM2uDl27hKF oIQWo6nI1alTgItkt4Khe+OyXpq2EVuKzX09IAdRMN3wDEe4NQuq3KQCu7g7BSm4PwkI aqhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id w14-20020a63474e000000b00578da80ac3dsi19440061pgk.80.2023.09.28.14.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 14:29:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7ED298373198; Thu, 28 Sep 2023 13:41:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbjI1Uk5 (ORCPT + 99 others); Thu, 28 Sep 2023 16:40:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbjI1Uk4 (ORCPT ); Thu, 28 Sep 2023 16:40:56 -0400 X-Greylist: delayed 1005 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 28 Sep 2023 13:40:52 PDT Received: from 10.mo575.mail-out.ovh.net (10.mo575.mail-out.ovh.net [46.105.79.203]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E364519D for ; Thu, 28 Sep 2023 13:40:52 -0700 (PDT) Received: from director8.ghost.mail-out.ovh.net (unknown [10.109.146.175]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 3DEFA2766C for ; Thu, 28 Sep 2023 20:24:06 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-tq497 (unknown [10.110.208.152]) by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C499A1FDBA; Thu, 28 Sep 2023 20:24:04 +0000 (UTC) Received: from RCM-web4.webmail.mail.ovh.net ([176.31.235.81]) by ghost-submission-6684bf9d7b-tq497 with ESMTPSA id vKH/K+TgFWX2QwYA45+jXQ (envelope-from ); Thu, 28 Sep 2023 20:24:04 +0000 MIME-Version: 1.0 Date: Thu, 28 Sep 2023 22:24:04 +0200 From: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= To: Miquel Raynal Cc: Srinivas Kandagatla , Greg Kroah-Hartman , Michael Walle , Thomas Petazzoni , Robert Marko , Luka Perkov , linux-kernel@vger.kernel.org, Randy Dunlap , Chen-Yu Tsai , Daniel Golle Subject: Re: [PATCH v10 1/3] nvmem: core: Rework layouts to become platform devices In-Reply-To: <20230922174854.611975-2-miquel.raynal@bootlin.com> References: <20230922174854.611975-1-miquel.raynal@bootlin.com> <20230922174854.611975-2-miquel.raynal@bootlin.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <1982d29ccb4e8c82cddfe0d86edc6072@milecki.pl> X-Sender: rafal@milecki.pl X-Originating-IP: 31.11.218.106 X-Webmail-UserID: rafal@milecki.pl Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 16205640309849697181 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrtddtgdduudekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepggffhffvvefujghffgfkgihitgfgsehtkehjtddtreejnecuhfhrohhmpeftrghfrghlucfoihhlvggtkhhiuceorhgrfhgrlhesmhhilhgvtghkihdrphhlqeenucggtffrrghtthgvrhhnpeejvdelgfeutdfhfeelheegfedtleduleeuvdfgfeefvefhvedtheetjeetfeehgeenucfkphepuddvjedrtddrtddruddpfedurdduuddrvddukedruddtiedpudejiedrfedurddvfeehrdekudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehrrghfrghlsehmihhlvggtkhhirdhplheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 13:41:00 -0700 (PDT) On 2023-09-22 19:48, Miquel Raynal wrote: > Current layout support was initially written without modules support in > mind. When the requirement for module support rose, the existing base > was improved to adopt modularization support, but kind of a design flaw > was introduced. With the existing implementation, when a storage device > registers into NVMEM, the core tries to hook a layout (if any) and > populates its cells immediately. This means, if the hardware > description > expects a layout to be hooked up, but no driver was provided for that, > the storage medium will fail to probe and try later from > scratch. Technically, the layouts are more like a "plus" and, even we > consider that the hardware description shall be correct, we could still > probe the storage device (especially if it contains the rootfs). > > One way to overcome this situation is to consider the layouts as > devices, and leverage the existing notifier mechanism. When a new NVMEM > device is registered, we can: > - populate its nvmem-layout child, if any > - try to modprobe the relevant driver, if relevant > - try to hook the NVMEM device with a layout in the notifier > And when a new layout is registered: > - try to hook all the existing NVMEM devices which are not yet hooked > to > a layout with the new layout > This way, there is no strong order to enforce, any NVMEM device > creation > or NVMEM layout driver insertion will be observed as a new event which > may lead to the creation of additional cells, without disturbing the > probes with costly (and sometimes endless) deferrals. > > Signed-off-by: Miquel Raynal I rebased & tested my patch converting U-Boot NVMEM device to NVMEM layout on top of this. It worked! Tested-by: Rafał Miłecki For reference what I used: partitions { partition-loader { compatible = "brcm,u-boot"; partition-u-boot-env { compatible = "nvmem-cells"; nvmem-layout { compatible = "brcm,env"; base_mac_addr: ethaddr { #nvmem-cell-cells = <1>; }; }; }; }; }; -- Rafał Miłecki