Lines Matching +full:nvmem +full:- +full:layout

1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/nvmem-consumer.h>
6 #include <linux/nvmem-provider.h>
29 return -EINVAL; in sl28vpd_mac_address_pp()
32 return -EINVAL; in sl28vpd_mac_address_pp()
35 return -EINVAL; in sl28vpd_mac_address_pp()
44 .name = "serial-number",
49 .name = "base-mac-address",
56 static int sl28vpd_v1_check_crc(struct device *dev, struct nvmem_device *nvmem) in sl28vpd_v1_check_crc() argument
65 ret = nvmem_device_read(nvmem, 0, sizeof(data_v1), &data_v1); in sl28vpd_v1_check_crc()
69 return -EIO; in sl28vpd_v1_check_crc()
71 crc = crc8(table, (void *)&data_v1, sizeof(data_v1) - 1, 0); in sl28vpd_v1_check_crc()
77 return -EINVAL; in sl28vpd_v1_check_crc()
83 static int sl28vpd_add_cells(struct nvmem_layout *layout) in sl28vpd_add_cells() argument
85 struct nvmem_device *nvmem = layout->nvmem; in sl28vpd_add_cells() local
86 struct device *dev = &layout->dev; in sl28vpd_add_cells()
94 ret = nvmem_device_read(nvmem, 0, sizeof(hdr), &hdr); in sl28vpd_add_cells()
98 return -EIO; in sl28vpd_add_cells()
102 return -EINVAL; in sl28vpd_add_cells()
107 return -EINVAL; in sl28vpd_add_cells()
110 ret = sl28vpd_v1_check_crc(dev, nvmem); in sl28vpd_add_cells()
114 layout_np = of_nvmem_layout_get_container(nvmem); in sl28vpd_add_cells()
116 return -ENOENT; in sl28vpd_add_cells()
121 info.name = pinfo->name; in sl28vpd_add_cells()
122 info.offset = pinfo->offset; in sl28vpd_add_cells()
123 info.bytes = pinfo->bytes; in sl28vpd_add_cells()
124 info.read_post_process = pinfo->read_post_process; in sl28vpd_add_cells()
125 info.np = of_get_child_by_name(layout_np, pinfo->name); in sl28vpd_add_cells()
127 ret = nvmem_add_one_cell(nvmem, &info); in sl28vpd_add_cells()
139 static int sl28vpd_probe(struct nvmem_layout *layout) in sl28vpd_probe() argument
141 layout->add_cells = sl28vpd_add_cells; in sl28vpd_probe()
143 return nvmem_layout_register(layout); in sl28vpd_probe()
146 static void sl28vpd_remove(struct nvmem_layout *layout) in sl28vpd_remove() argument
148 nvmem_layout_unregister(layout); in sl28vpd_remove()
152 { .compatible = "kontron,sl28-vpd" },
159 .name = "kontron-sl28vpd-layout",
169 MODULE_DESCRIPTION("NVMEM layout driver for the VPD of Kontron sl28 boards");