Hi, Looking in Documentation/devicetree/bindings/mtd/mtd.yaml I see you are defining OTP in a different way, as partitions. Each partition is an OTP region which can be user or factory mode (since many chips do not define or enforce it). While I try to define the OTP parameters. I wonder what you think? Should the parameter be in the partitions? Do we wish to support asymmetric OTP? I only found asymmetric OTP (OTP with different region sizes) with old chips. But perhaps I missed it. Erez diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml index 6e3afb42926e..5fde51309b93 100644 --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml @@ -90,6 +90,47 @@ properties: the SRWD bit while writing the status register. WP# signal hard strapped to GND can be a valid use case. + opt_n_regions: + type: u32 + description: + Some flash devices need OTP parameters in the device tree. + As we can not deduce the parameters based on JEDEC ID, + or SFDP. + This parameter indicates the number of OTP regions. + The value must be larger than 1 and mandatory for OTP. + + otp_len: + type: u32 + description: + Some flash devices need OTP parameters in the device tree. + As we can not deduce the parameters based on JEDEC ID, + or SFDP. + This parameter indicates the size (length) in bytes of an OTP region. + Currently the driver supports symmetric OTP, + which means all regions must use the same size. + The value must be positive and mandatory for OTP. + + otp_offset: + type: u32 + description: + Some flash devices need OTP parameters in the device tree. + As we can not deduce the parameters based on JEDEC ID, + or SFDP. + This parameter indicates the offset in bytes of + an OTP region relative to its previous. + User can omit it if the offset equals the length. + Or in case we have a single OTP region. + + otp_base: + type: u32 + description: + Some flash devices need OTP parameters in the device tree. + As we can not deduce the parameters based on JEDEC ID, + or SFDP. + This parameter indicates the base in bytes of the first OTP region. + User can omit it if the base is zero. + I.e. the address of the first OTP region starts from 0. + reset-gpios: description: A GPIO line connected to the RESET (active low) signal of the device. On Sat, 17 Aug 2024 at 14:42, Erez Geva <erezgeva@xxxxxxxxxx> wrote: > > From: Erez Geva <ErezGeva2@xxxxxxxxx> > > Add support for SPI-NOR Macronix OTP. > And add MX25L12833F with OTP. > > TODO: > - Test OTP with 'flash_otp_write' and 'flash_otp_lock' > - Question: Do we need documentation on new DT OTP parameters? > > v2: > Improve description of mx25l12833f. > Add note about mx25l12833f using the same JEDEC ID as mx25l12805d. > > v3: > Improve description. > Rename _nor_send_cmd() to spi_nor_send_cmd_internal() > Remove MX25L12833F specific changes. > Add reading SFDP to all Macronix chips. > Add support of reading OTP parameters from device tree. > Reorgenize patches to 2 SPI-NOR patches and 2 Macronix patches > Testing with MX25L3233F using BeagleBone Black. > Test results are in "mtd: spi-nor: macronix: add manufacturer flags" patch > > Erez Geva (4): > mtd: spi-nor: core: add manufacturer flags > mtd: spi-nor: core: add generic functions > mtd: spi-nor: macronix: add support for OTP > mtd: spi-nor: macronix: add manufacturer flags > > drivers/mtd/spi-nor/core.c | 166 ++++++++++++++++++++++------- > drivers/mtd/spi-nor/core.h | 34 ++---- > drivers/mtd/spi-nor/macronix.c | 186 +++++++++++++++++++++++++++++++++ > drivers/mtd/spi-nor/otp.c | 6 +- > drivers/mtd/spi-nor/winbond.c | 2 +- > include/linux/mtd/spi-nor.h | 10 ++ > 6 files changed, 336 insertions(+), 68 deletions(-) > > -- > 2.39.2 >