I added this to keep parsed cells particulary for this nvmem in casediff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.cThis should be renamed to nvmem_cell_info_parser or something on those lines
index bca671ff4e54..648373ced6d4 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -39,6 +39,7 @@ struct nvmem_device {
nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write;
struct gpio_desc *wp_gpio;
+ struct nvmem_parser_data *parser_data;
to avoid any misunderstanding on what exactly this parser is about.
May be can totally avoid this by using parser name only during register.
same parser is used for several nvmem's and mostly because of using also
cell lookup info. I will try to also answer your below question why do I need
lookups ?
I use of_get_mac_address() func to fetch mac-address from nvmem cell.
Eventually this func calls of_get_mac_addr_nvmem() which (as I understand it
correctly) can find cells via DT by parsing "nvmem-cell-names" or via cell lookup
info of platform_device. I use the 2nd option with the following sample
solution:
## DT ##
eeprom_at24: at24@56 {
compatible = "atmel,24c32";
nvmem-cell-parser-name = "onie-tlv-cells";
reg = <0x56>;
};
onie_tlv_parser: onie-tlv-cells {
compatible = "nvmem-cell-parser";
status = "okay";
---> add ability here to map cell con_id to cell_name ?
};
some_dev_node {
compatible = "xxx";
base-mac-provider = <&onie_tlv_parser>;
status = "okay";
};
########
== CODE ==
base_mac_np = of_parse_phandle(np, "base-mac-provider", 0);
ret = of_get_mac_address(base_mac_np, base_mac);
==========
And it works with this implementation because onie-tlv-cells is
registered as platform_device which name is the same as parser's name.
So the really tricky part for me is to make this cells lookup work.
Of course would be great if you can point a way/idea to get rid the need of
lookups.