Skip to contentSkip to conversation

nvmem: Add mockup nvmem driver

PATCH New Ludvig Pärsson 1 participant 1 message Oct 25, 2021 NVMEM framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: Add mockup nvmem driver

This driver provides an easy way to test other drivers that use nvmem.

E.g. Testing that an nvmem-driver that reads from OTP memory works as intended for all possible values without having to actually write all the values to OTP. Swapping the nvmem-driver reading the OTP memory for this dummy driver makes it easy to manipulate the values to test.

---
 drivers/nvmem/Kconfig  |  5 +++
 drivers/nvmem/Makefile |  2 ++
 drivers/nvmem/mockup.c | 80 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 drivers/nvmem/mockup.c
drivers/nvmem/Kconfig +5 -0
index da414617a54d..b0caad053823 100644
@@ -300,4 +300,9 @@ config NVMEM_BRCM_NVRAM
 	  This driver provides support for Broadcom's NVRAM that can be accessed
 	  using I/O mapping.
 
+config NVMEM_MOCKUP
+	tristate "Mockup nvmem support"
+	help
+	  This driver can be used to test other drivers that use nvmem.
+
 endif
drivers/nvmem/Makefile +2 -0
index dcbbde35b6a8..1b8353f54ca2 100644
@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) 	+= nvmem-rmem.o
 nvmem-rmem-y			:= rmem.o
 obj-$(CONFIG_NVMEM_BRCM_NVRAM)	+= nvmem_brcm_nvram.o
 nvmem_brcm_nvram-y		:= brcm_nvram.o
+obj-$(CONFIG_NVMEM_MOCKUP)	+= nvmem-mockup.o
+nvmem-mockup-y			:= mockup.o
drivers/nvmem/mockup.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.20.1