Thread (92 messages) 92 messages, 11 authors, 2018-10-04

Re: [PATCH v2 06/29] mtd: Add support for reading MTD devices via the nvmem API

From: Boris Brezillon <hidden>
Date: 2018-08-21 13:57:42
Also in: linux-arm-kernel, linux-i2c, linux-omap, lkml, netdev

On Tue, 21 Aug 2018 14:37:37 +0100
Srinivas Kandagatla [off-list ref] wrote:
On 21/08/18 14:34, Srinivas Kandagatla wrote:
quoted

On 21/08/18 12:31, Boris Brezillon wrote:  
quoted
quoted
    * struct nvmem_config - NVMEM device configuration
@@ -58,6 +62,7 @@ struct nvmem_config {
          bool                    root_only;
          nvmem_reg_read_t        reg_read;
          nvmem_reg_write_t       reg_write;
+       nvmem_match_t           match;
          int     size;
          int     word_size;
          int     stride;
 
That might work if nvmem cells are defined directly under the mtdnode.  
Layout should not matter! which is the purpose of this callback.

The only purpose of this callback is to tell nvmem core that the 
node(nvmem cell) belongs to that provider or not, if it is then we 
successfully found the provider. Its up to the provider on which layout 
it describes nvmem cells. Additionally the provider can add additional 
sanity checks in this match function to ensure that cell is correctly 
represented.

  
quoted
If we go for this approach, I'd recommend replacing this ->match() hook
by ->is_nvmem_cell() and pass it the cell node instead of the nvmem
node, because what we're really after here is knowing which subnode is
an nvmem cell and which subnode is not.  
I agree on passing cell node instead of its parent. Regarding basic 
validating if its nvmem cell or not, we can check compatible string in 
nvmem core if we decide to use "nvmem-cell" compatible.

Also just in case if you missed this, nvmem would not iterate the  
Sorry !! i hit send button too quickly I guess.

What I meant to say here, is that nvmem core would not iterate the 
provider node in any case.

Only time it looks at the cell node is when a consumer requests for the 
cell.
I did miss that, indeed. Thanks for the heads up.

So, the "old partitions being considered as nvmem cells" is not really
a problem, because those parts shouldn't be referenced.
This leaves us with the config->force_compat_check topic, which I'd
like to have to ensure that nvmem cells under MTD nodes actually have
compatible = "nvmem-cell" and prevent people from inadvertently
omitting this prop.

And of course, we need Rob's approval on this new binding :-).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help