Add imx-scu-ocotp driver to support i.MX8QM/QXP.
The usage, add an entry in ocotp node, such as the test_1 entry:
ocotp: ocotp {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,imx8qm-ocotp", "syscon";
test_1: test_1@40 {
reg = <0x41 0x8>;
bits = <4 40>;
};
};
Then in your device node, add this:
node: node {
.....
nvmem-cells = <&test_1>;
nvmem-cell-names = "test_1";
};
Then in your driver, using the following piece code:
+#include <linux/nvmem-consumer.h>
struct nvmem_cell *cell;
u8 *val;
size_t len;
int i;
cell = devm_nvmem_cell_get(&pdev->dev, "test_1");
if (IS_ERR(cell)) {
if (PTR_ERR(cell) == -EPROBE_DEFER)
return -EPROBE_DEFER;
}
val = nvmem_cell_read(cell, &len);
The val points the contents that you need.
After shutdown or driver remove, use this:
devm_nvmem_cell_put(&pdev->dev, cell);
Note: we not reuse the imx-ocotp driver, because mix scu api with
legacy code will cost many maintenance efforts. When we have common
api support, we could merge the two.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
36 lines
1.3 KiB
Makefile
36 lines
1.3 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Makefile for nvmem drivers.
|
|
#
|
|
|
|
obj-$(CONFIG_NVMEM) += nvmem_core.o
|
|
nvmem_core-y := core.o
|
|
|
|
# Devices
|
|
obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o
|
|
nvmem-bcm-ocotp-y := bcm-ocotp.o
|
|
obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o
|
|
nvmem-imx-iim-y := imx-iim.o
|
|
obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o
|
|
nvmem-imx-ocotp-y := imx-ocotp.o
|
|
obj-$(CONFIG_NVMEM_IMX_SCU_OCOTP) += nvmem-imx-scu-ocotp.o
|
|
nvmem-imx-scu-ocotp-y := imx-scu-ocotp.o
|
|
obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o
|
|
nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o
|
|
obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o
|
|
nvmem_lpc18xx_otp-y := lpc18xx_otp.o
|
|
obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o
|
|
nvmem-mxs-ocotp-y := mxs-ocotp.o
|
|
obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o
|
|
nvmem_mtk-efuse-y := mtk-efuse.o
|
|
obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o
|
|
nvmem_qfprom-y := qfprom.o
|
|
obj-$(CONFIG_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o
|
|
nvmem_rockchip_efuse-y := rockchip-efuse.o
|
|
obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o
|
|
nvmem_sunxi_sid-y := sunxi_sid.o
|
|
obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o
|
|
nvmem-vf610-ocotp-y := vf610-ocotp.o
|
|
obj-$(CONFIG_MESON_EFUSE) += nvmem_meson_efuse.o
|
|
nvmem_meson_efuse-y := meson-efuse.o
|