From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40FAFA92D; Tue, 21 Feb 2023 22:29:54 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id f41so7626469lfv.13; Tue, 21 Feb 2023 14:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=rRskwuzUoTseJ7UhE/XiQ/ajutHbx9Jd0AO9KzeF2SA=; b=aKFAgFAHiqsL++CU0NQXI3ge3qCJTJWe9hhri5lPXhyFoAESWMM21NLBBPU5G6cNJY 35lsLXaqrC6Mb6smUaE+WcAfzrsm9gqxGTNY/iMY66IU87+YokTiPTcPT4MAg1ufPqqN fQ16flQ0OJ/1LjzFEPXttIEaZA+BGgA59wa2q62W00rcvD7z7rqT3ayvBS5tl0ppMcJn IkWVdlg7bPBPCodv4v7h8EVO01zPwNKlvuZ5IwuJgkB8t2e6se9vm3VG4j3pdft/mnmu U8Eefz5MvvrPId0lV3ihpW8DC9KN/oUDLeqrl8gAIQSSSvZLw+145WXRdzkKwlM3xuel UKeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rRskwuzUoTseJ7UhE/XiQ/ajutHbx9Jd0AO9KzeF2SA=; b=FhCrcmFBx6OzUtqLpgUVpbOCgHL3sBFE9Q9Ut977VgF7fgl4X4A5if2hz6W2VvJ32h q541AywMo+WbiM9oj3uazNVx4Qi7MLrNHVC4k42i5VK/LnWpnUoEZ9lPaRqiMcAGod5k tmp3DzisqBvhNRWJl6kbxDUNnQ3M/7pkQ/9NJrLdcXEIDnywvtLCIEBPjFA0i/FrkWnr d69JLpSOyDh+nPgfOvILHRyUXMj0y3WlrrLqaRUL8IqhLfB2aVuQEH8YmVTLMu+cTA3c aclabe7Co5ZNbLTUr5o4hx0RsR4VvrQeYpNixt1RO476Wm1Wm+6cBivtrmrm+QPneO10 S3gg== X-Gm-Message-State: AO0yUKWAAKsCsXtVRGwk3WNQTgEb4f57qA6+G+xYqZoEQgDA2YaeI07x sxw5flaspAnOsNkyUwdIrSY= X-Google-Smtp-Source: AK7set+yBQHNb9hSkW8dFReCGvYH5kUaeuCwO556jqZU4gWvC3OnNb7bh1PGOn5AYoyDdgoJfAwP7w== X-Received: by 2002:a05:6512:14b:b0:4db:5122:2099 with SMTP id m11-20020a056512014b00b004db51222099mr1807349lfo.32.1677018591920; Tue, 21 Feb 2023 14:29:51 -0800 (PST) Received: from [192.168.26.149] (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.googlemail.com with ESMTPSA id x25-20020ac259d9000000b004caf992bba9sm1957069lfn.268.2023.02.21.14.29.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 14:29:51 -0800 (PST) Message-ID: <101a5bdf-870a-a1bb-954d-1d675ecad5a7@gmail.com> Date: Tue, 21 Feb 2023 23:29:48 +0100 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Thunderbird/96.0 Subject: Re: [PATCH] nvmem: add explicit config option to read OF fixed cells To: Martin Blumenstingl Cc: Srinivas Kandagatla , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Hector Martin , Sven Peter , Alyssa Rosenzweig , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Neil Armstrong , Kevin Hilman , Jerome Brunet , Claudiu Beznea , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , Vincent Shih , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Kunihiko Hayashi , Masami Hiramatsu , Michal Simek , Alessandro Zummo , Alexandre Belloni , Evgeniy Polyakov , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-sunxi@lists.linux.dev, linux-rtc@vger.kernel.org, =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= References: <20230221145021.31993-1-zajec5@gmail.com> From: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 21.02.2023 22:38, Martin Blumenstingl wrote: > On Tue, Feb 21, 2023 at 3:50 PM Rafał Miłecki wrote: >> >> From: Rafał Miłecki >> >> NVMEM subsystem looks for fixed NVMEM cells (specified in DT) by >> default. This behaviour made sense in early days before adding support >> for dynamic cells. >> >> With every new supported NVMEM device with dynamic cells current >> behaviour becomes non-optimal. It results in unneeded iterating over DT >> nodes and may result in false discovery of cells (depending on used DT >> properties). > I am not familiar with the recent changes around dynamic cells. > Is there any discussion/summary that I can read to get up to speed? Some NVMEM devices don't store specific data at hardcoded offsets. For such devices we have drivers (to become: layouts) that parse their magic content. They discover cells and register them and provide matching with proper DT nodes. For bindings see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=084973e944bec21804f8afb0515b25434438699a https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a607a850ba1fa966cbb035544c1588e24a6307df For example driver see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6e977eaa8280e957b87904b536661550f2a6b3e8 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=207775f7e17b8fd0426a2ac4a5b81e4e1d71849e For usage see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8442f0fb09ca3d842b9b23d1d0650f649fd10f8 > My main thought is: if there are many "fixed OF cells" implementations > and only a few "dynamic" ones - does it make sense to flip the logic > and introduce a new "use_dynamic_of_cells" flag instead? The problem is that there are more cases than just two. We can have: 1. No cells at all 2. Fixed cells in DT 3. Dynamic cells with references in DT 4. Driver specified cells (specified within config) 5. Cells defined in a global table So we need to reference DT cells explicitly (we can't just confirm / deny *dynamic* cells). Another solution would be to have "no_fixed_of_cells" but: 1. Personally I think negation is less clear / easy to follow 2. There may be actually more drivers with no fixed cells. I think I modified 18 drivers. It seems devm_nvmem_register() is referenced in 44 places. Few of them may be not actual users but it still seems to be about equal.