Message ID | 20240920181231.20542-4-erezgeva@nwtime.org |
---|---|
State | Superseded |
Delegated to: | Ambarus Tudor |
Headers | show |
Series | Add support for SPI-NOR Macronix OTP | expand |
On Fri, Sep 20, 2024 at 08:12:29PM +0200, Erez Geva wrote: > From: Erez Geva <ErezGeva2@gmail.com> > > Some flash devices need OTP parameters in device tree. > As we can not deduce the parameters based on JEDEC ID or SFDP. > > Signed-off-by: Erez Geva <ErezGeva2@gmail.com> > --- > .../bindings/mtd/jedec,spi-nor.yaml | 39 +++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > index 6e3afb42926e..4f7bb3f41cb1 100644 > --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > @@ -90,6 +90,43 @@ properties: > the SRWD bit while writing the status register. WP# signal hard strapped to GND > can be a valid use case. > > + otp-n-regions: > + $ref: /schemas/types.yaml#/definitions/uint32 > + 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. OTP regions where? In DTS? On flash itself? > + The value must be larger or equal to 1 and mandatory for OTP. Don't repeat constraints in free form text. Add proper minimum and default, although it is confusing - property is not required but it is mandatory for OTP? > + > + otp-len: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + Some flash devices need OTP parameters in the device tree. > + As we can not deduce the parameters based on JEDEC ID or SFDP. Don't repeat the same. > + This parameter indicates the size (length) in bytes of an OTP region. What if each region has different length? Is it possible? > + Currently the driver supports symmetric OTP, > + which means all regions must use the same size. Drop unneeded space in front. > + The value must be positive and mandatory for OTP. Same comments as before. > + > + otp-offset: > + $ref: /schemas/types.yaml#/definitions/uint32 > + 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: > + $ref: /schemas/types.yaml#/definitions/uint32 > + 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. so default: 0? I am not sure, but all this looks like duplicated description of nvmem cells or some sort of partitions. Considering that this is first time the binding mentions OTP, I really do not get what you are doing it. If the properties are to stay, please describe better the problem (and hardware!) in commit msg. Best regards, Krzysztof
On Sun, 22 Sept 2024 at 22:40, Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On Fri, Sep 20, 2024 at 08:12:29PM +0200, Erez Geva wrote: > > From: Erez Geva <ErezGeva2@gmail.com> > > > > Some flash devices need OTP parameters in device tree. > > As we can not deduce the parameters based on JEDEC ID or SFDP. > > > > Signed-off-by: Erez Geva <ErezGeva2@gmail.com> > > --- > > .../bindings/mtd/jedec,spi-nor.yaml | 39 +++++++++++++++++++ > > 1 file changed, 39 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > > index 6e3afb42926e..4f7bb3f41cb1 100644 > > --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > > +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > > @@ -90,6 +90,43 @@ properties: > > the SRWD bit while writing the status register. WP# signal hard strapped to GND > > can be a valid use case. > > > > + otp-n-regions: > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + 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. > > OTP regions where? In DTS? On flash itself? Where can OTP regions be? Can you please be serious? If you have any suggestions, I am happy to hear. I did ask before. > > > + The value must be larger or equal to 1 and mandatory for OTP. > > Don't repeat constraints in free form text. Add proper minimum and Sure, I will add a minimum. > default, although it is confusing - property is not required but it is > mandatory for OTP? You are welcome to suggest a better rephrase. Using OTP settings is optional. If you set OTP then the number of regions and region length are mandatory. While offset and base are optional for OTP settings. > > > > > + > > + otp-len: > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + description: > > + Some flash devices need OTP parameters in the device tree. > > + As we can not deduce the parameters based on JEDEC ID or SFDP. > > Don't repeat the same. Is there a grouping description? > > > + This parameter indicates the size (length) in bytes of an OTP region. > > What if each region has different length? Is it possible? Yes, there are. Old Mactronix have chips with the first region bigger than the second region. As these are old chips, we may skip the support of them. > > > + Currently the driver supports symmetric OTP, > > + which means all regions must use the same size. > > Drop unneeded space in front. OK > > > + The value must be positive and mandatory for OTP. > > Same comments as before. > > > + > > + otp-offset: > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + 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: > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + 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. > > so default: 0? Sure. > > I am not sure, but all this looks like duplicated description of nvmem > cells or some sort of partitions. > > Considering that this is first time the binding mentions OTP, I really > do not get what you are doing it. If the properties are to stay, please > describe better the problem (and hardware!) in commit msg. OK, good point. Thanks for the feedback. > > Best regards, > Krzysztof >
On 23/09/2024 11:21, Erez wrote: > On Sun, 22 Sept 2024 at 22:40, Krzysztof Kozlowski <krzk@kernel.org> wrote: >> >> On Fri, Sep 20, 2024 at 08:12:29PM +0200, Erez Geva wrote: >>> From: Erez Geva <ErezGeva2@gmail.com> >>> >>> Some flash devices need OTP parameters in device tree. >>> As we can not deduce the parameters based on JEDEC ID or SFDP. >>> >>> Signed-off-by: Erez Geva <ErezGeva2@gmail.com> >>> --- >>> .../bindings/mtd/jedec,spi-nor.yaml | 39 +++++++++++++++++++ >>> 1 file changed, 39 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml >>> index 6e3afb42926e..4f7bb3f41cb1 100644 >>> --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml >>> +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml >>> @@ -90,6 +90,43 @@ properties: >>> the SRWD bit while writing the status register. WP# signal hard strapped to GND >>> can be a valid use case. >>> >>> + otp-n-regions: >>> + $ref: /schemas/types.yaml#/definitions/uint32 >>> + 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. >> >> OTP regions where? In DTS? On flash itself? > > Where can OTP regions be? > Can you please be serious? > If you have any suggestions, I am happy to hear. > I did ask before. Yes, I am serious, imagine that we do not know what you wanted to say. At first this just sounded like you mix nvmem-cells here. Out of blue this binding starts mentioning OTP and you add bunch of generic properties not really matching anything so far. Instead of being sarcastic about reviewers confusion, rather improve your description. Otherwise, good luck. > >> >>> + The value must be larger or equal to 1 and mandatory for OTP. >> >> Don't repeat constraints in free form text. Add proper minimum and > > Sure, I will add a minimum. > >> default, although it is confusing - property is not required but it is >> mandatory for OTP? > > You are welcome to suggest a better rephrase. > Using OTP settings is optional. > If you set OTP then the number of regions and region length are mandatory. > While offset and base are optional for OTP settings. So properties should be required? > > >> >> >> >>> + >>> + otp-len: >>> + $ref: /schemas/types.yaml#/definitions/uint32 >>> + description: >>> + Some flash devices need OTP parameters in the device tree. >>> + As we can not deduce the parameters based on JEDEC ID or SFDP. >> >> Don't repeat the same. > > Is there a grouping description? > >> >>> + This parameter indicates the size (length) in bytes of an OTP region. >> >> What if each region has different length? Is it possible? > > Yes, there are. Old Mactronix have chips with the first region bigger > than the second region. > As these are old chips, we may skip the support of them. Other devices can come later re-introducing this approach. Best regards, Krzysztof
On Mon, 23 Sept 2024 at 17:42, Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 23/09/2024 11:21, Erez wrote: > > On Sun, 22 Sept 2024 at 22:40, Krzysztof Kozlowski <krzk@kernel.org> wrote: > >> > >> On Fri, Sep 20, 2024 at 08:12:29PM +0200, Erez Geva wrote: > >>> From: Erez Geva <ErezGeva2@gmail.com> > >>> > >>> Some flash devices need OTP parameters in device tree. > >>> As we can not deduce the parameters based on JEDEC ID or SFDP. > >>> > >>> Signed-off-by: Erez Geva <ErezGeva2@gmail.com> > >>> --- > >>> .../bindings/mtd/jedec,spi-nor.yaml | 39 +++++++++++++++++++ > >>> 1 file changed, 39 insertions(+) > >>> > >>> diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > >>> index 6e3afb42926e..4f7bb3f41cb1 100644 > >>> --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > >>> +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml > >>> @@ -90,6 +90,43 @@ properties: > >>> the SRWD bit while writing the status register. WP# signal hard strapped to GND > >>> can be a valid use case. > >>> > >>> + otp-n-regions: > >>> + $ref: /schemas/types.yaml#/definitions/uint32 > >>> + 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. > >> > >> OTP regions where? In DTS? On flash itself? > > > > Where can OTP regions be? > > Can you please be serious? > > If you have any suggestions, I am happy to hear. > > I did ask before. > > Yes, I am serious, imagine that we do not know what you wanted to say. > At first this just sounded like you mix nvmem-cells here. > > Out of blue this binding starts mentioning OTP and you add bunch of > generic properties not really matching anything so far. Instead of being > sarcastic about reviewers confusion, rather improve your description Sorry, no disrespect. I just prefer to be explicit, same as you ask me to be. The patch seria is under review in the MTD-SPI-NOR. This patch is under hold at the moment. Thanks for the feedback and your time Erez . > > Otherwise, good luck. > > > > > > >> > >>> + The value must be larger or equal to 1 and mandatory for OTP. > >> > >> Don't repeat constraints in free form text. Add proper minimum and > > > > Sure, I will add a minimum. > > > >> default, although it is confusing - property is not required but it is > >> mandatory for OTP? > > > > You are welcome to suggest a better rephrase. > > Using OTP settings is optional. > > If you set OTP then the number of regions and region length are mandatory. > > While offset and base are optional for OTP settings. > > So properties should be required? > > > > > > >> > >> > >> > >>> + > >>> + otp-len: > >>> + $ref: /schemas/types.yaml#/definitions/uint32 > >>> + description: > >>> + Some flash devices need OTP parameters in the device tree. > >>> + As we can not deduce the parameters based on JEDEC ID or SFDP. > >> > >> Don't repeat the same. > > > > Is there a grouping description? > > > >> > >>> + This parameter indicates the size (length) in bytes of an OTP region. > >> > >> What if each region has different length? Is it possible? > > > > Yes, there are. Old Mactronix have chips with the first region bigger > > than the second region. > > As these are old chips, we may skip the support of them. > > Other devices can come later re-introducing this approach. > > > > Best regards, > Krzysztof >
diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml index 6e3afb42926e..4f7bb3f41cb1 100644 --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml @@ -90,6 +90,43 @@ properties: the SRWD bit while writing the status register. WP# signal hard strapped to GND can be a valid use case. + otp-n-regions: + $ref: /schemas/types.yaml#/definitions/uint32 + 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 or equal to 1 and mandatory for OTP. + + otp-len: + $ref: /schemas/types.yaml#/definitions/uint32 + 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: + $ref: /schemas/types.yaml#/definitions/uint32 + 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: + $ref: /schemas/types.yaml#/definitions/uint32 + 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. @@ -118,6 +155,8 @@ examples: spi-max-frequency = <40000000>; m25p,fast-read; reset-gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + otp-len = <512>; + otp-n-regions = <1>; }; }; ...