Skip to content

Commit 517f14d

Browse files
brglgregkh
authored andcommitted
nvmem: add new config option
We want to add nvmem support for MTD. TI DaVinci is the first platform that will be using it, but only in non-DT mode. In order not to introduce any new interface to supporting of which we would have to commit - add a new config option that tells nvmem not to use the DT node of the parent device. This way we won't be creating nvmem devices corresponding with MTD partitions defined in device tree. By default MTD will set this new field to true. Once a set of bindings for MTD nvmem cells is agreed upon, we'll be able to remove this option. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a8b44d5 commit 517f14d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/nvmem/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
635635
nvmem->type = config->type;
636636
nvmem->reg_read = config->reg_read;
637637
nvmem->reg_write = config->reg_write;
638-
nvmem->dev.of_node = config->dev->of_node;
638+
if (!config->no_of_node)
639+
nvmem->dev.of_node = config->dev->of_node;
639640

640641
if (config->id == -1 && config->name) {
641642
dev_set_name(&nvmem->dev, "%s", config->name);

include/linux/nvmem-provider.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ enum nvmem_type {
3838
* @type: Type of the nvmem storage
3939
* @read_only: Device is read-only.
4040
* @root_only: Device is accessibly to root only.
41+
* @no_of_node: Device should not use the parent's of_node even if it's !NULL.
4142
* @reg_read: Callback to read data.
4243
* @reg_write: Callback to write data.
4344
* @size: Device size.
@@ -62,6 +63,7 @@ struct nvmem_config {
6263
enum nvmem_type type;
6364
bool read_only;
6465
bool root_only;
66+
bool no_of_node;
6567
nvmem_reg_read_t reg_read;
6668
nvmem_reg_write_t reg_write;
6769
int size;

0 commit comments

Comments
 (0)