blob: 635d448b3dd2564fbf0b2ae46d2ca760e2ffa03f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2026 Bootlin
*
* Authors: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
*/
#include <linux/nvmem-provider.h>
#include <linux/of.h>
#include "../internals.h"
static int fixed_layout_add_cells(struct nvmem_layout *layout)
{
struct device_node *np;
int ret;
np = of_nvmem_layout_get_container(layout->nvmem);
if (!np)
return -ENOENT;
ret = nvmem_add_cells_from_dt(layout->nvmem, np);
of_node_put(np);
return ret;
}
static int fixed_layout_probe(struct nvmem_layout *layout)
{
layout->add_cells = fixed_layout_add_cells;
return nvmem_layout_register(layout);
}
static void fixed_layout_remove(struct nvmem_layout *layout)
{
nvmem_layout_unregister(layout);
}
static const struct of_device_id fixed_layout_of_match_table[] = {
{ .compatible = "fixed-layout", },
{},
};
static struct nvmem_layout_driver fixed_layout_layout = {
.driver = {
.name = "fixed-layout",
.of_match_table = fixed_layout_of_match_table,
},
.probe = fixed_layout_probe,
.remove = fixed_layout_remove,
};
module_nvmem_layout_driver(fixed_layout_layout);
MODULE_AUTHOR("Mathieu Dubois-Briand");
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(of, fixed_layout_of_match_table);
MODULE_DESCRIPTION("NVMEM fixed-layout driver");
|