mtd: core: add OTP nvmem provider support

Flash OTP regions can already be read via user space. Some boards have
their serial number or MAC addresses stored in the OTP regions. Add
support for them being a (read-only) nvmem provider.

The API to read the OTP data is already in place. It distinguishes
between factory and user OTP, thus there are up to two different
providers.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-6-michael@walle.cc
This commit is contained in:
Michael Walle
2021-04-24 13:06:08 +02:00
committed by Miquel Raynal
parent 96d3af22f8
commit 4b361cfa86
2 changed files with 150 additions and 0 deletions

View File

@@ -380,6 +380,8 @@ struct mtd_info {
int usecount;
struct mtd_debug_info dbg;
struct nvmem_device *nvmem;
struct nvmem_device *otp_user_nvmem;
struct nvmem_device *otp_factory_nvmem;
/*
* Parent device from the MTD partition point of view.