* [PATCH 0/3] eeprom: at25: support Cypress FRAMs without device ID @ 2025-08-14 11:15 Markus Heidelberg 2025-08-14 11:15 ` [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for " Markus Heidelberg ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Markus Heidelberg @ 2025-08-14 11:15 UTC (permalink / raw) To: Arnd Bergmann, Greg Kroah-Hartman, devicetree Cc: Markus Heidelberg, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Alexander Sverdlin, Jiri Prchal, linux-kernel Hello, currently supported FRAMs use compatible="cypress,fm25","atmel,at25" in Devicetree, the memory size is read from its device ID. For FRAMs without device ID this is not possible, so with these patches the "size" property can be set manually as it is done for EEPROMs. In that case the device ID is not read anymore. This patch series is basically the same as the one marked as RFC four months ago: https://lore.kernel.org/all/20250401133148.38330-1-m.heidelberg@cab.de/ Based on v6.17-rc1 now and extended by a comment to the at25 binding. Markus Heidelberg (3): dt-bindings: eeprom: at25: use "size" for FRAMs without device ID eeprom: at25: support Cypress FRAMs without device ID eeprom: at25: make FRAM device ID error message more precise .../devicetree/bindings/eeprom/at25.yaml | 1 + drivers/misc/eeprom/at25.c | 67 ++++++++++--------- 2 files changed, 37 insertions(+), 31 deletions(-) base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585 -- 2.43.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for FRAMs without device ID 2025-08-14 11:15 [PATCH 0/3] eeprom: at25: support Cypress FRAMs without device ID Markus Heidelberg @ 2025-08-14 11:15 ` Markus Heidelberg 2025-08-14 20:47 ` Conor Dooley 2025-08-14 11:15 ` [PATCH 2/3] eeprom: at25: support Cypress " Markus Heidelberg 2025-08-14 11:15 ` [PATCH 3/3] eeprom: at25: make FRAM device ID error message more precise Markus Heidelberg 2 siblings, 1 reply; 7+ messages in thread From: Markus Heidelberg @ 2025-08-14 11:15 UTC (permalink / raw) To: Arnd Bergmann, Greg Kroah-Hartman, devicetree Cc: Markus Heidelberg, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Alexander Sverdlin, Jiri Prchal, linux-kernel Link: https://lore.kernel.org/all/20250401133148.38330-1-m.heidelberg@cab.de/ Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de> --- Documentation/devicetree/bindings/eeprom/at25.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/eeprom/at25.yaml b/Documentation/devicetree/bindings/eeprom/at25.yaml index c31e5e719525..d6fe84091ad4 100644 --- a/Documentation/devicetree/bindings/eeprom/at25.yaml +++ b/Documentation/devicetree/bindings/eeprom/at25.yaml @@ -56,6 +56,7 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 description: Total eeprom size in bytes. + Also used for FRAMs without device ID where the size cannot be detected. address-width: $ref: /schemas/types.yaml#/definitions/uint32 -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for FRAMs without device ID 2025-08-14 11:15 ` [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for " Markus Heidelberg @ 2025-08-14 20:47 ` Conor Dooley 0 siblings, 0 replies; 7+ messages in thread From: Conor Dooley @ 2025-08-14 20:47 UTC (permalink / raw) To: Markus Heidelberg Cc: Arnd Bergmann, Greg Kroah-Hartman, devicetree, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Alexander Sverdlin, Jiri Prchal, linux-kernel [-- Attachment #1: Type: text/plain, Size: 998 bytes --] On Thu, Aug 14, 2025 at 01:15:30PM +0200, Markus Heidelberg wrote: > Link: https://lore.kernel.org/all/20250401133148.38330-1-m.heidelberg@cab.de/ > Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de> Missing commit message body explaining why this change is needed. > --- > Documentation/devicetree/bindings/eeprom/at25.yaml | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/eeprom/at25.yaml b/Documentation/devicetree/bindings/eeprom/at25.yaml > index c31e5e719525..d6fe84091ad4 100644 > --- a/Documentation/devicetree/bindings/eeprom/at25.yaml > +++ b/Documentation/devicetree/bindings/eeprom/at25.yaml > @@ -56,6 +56,7 @@ properties: > $ref: /schemas/types.yaml#/definitions/uint32 > description: > Total eeprom size in bytes. > + Also used for FRAMs without device ID where the size cannot be detected. > > address-width: > $ref: /schemas/types.yaml#/definitions/uint32 > -- > 2.43.0 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] eeprom: at25: support Cypress FRAMs without device ID 2025-08-14 11:15 [PATCH 0/3] eeprom: at25: support Cypress FRAMs without device ID Markus Heidelberg 2025-08-14 11:15 ` [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for " Markus Heidelberg @ 2025-08-14 11:15 ` Markus Heidelberg 2025-08-14 12:24 ` Alexander Sverdlin 2025-08-14 11:15 ` [PATCH 3/3] eeprom: at25: make FRAM device ID error message more precise Markus Heidelberg 2 siblings, 1 reply; 7+ messages in thread From: Markus Heidelberg @ 2025-08-14 11:15 UTC (permalink / raw) To: Arnd Bergmann, Greg Kroah-Hartman, devicetree Cc: Markus Heidelberg, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Alexander Sverdlin, Jiri Prchal, linux-kernel Not all FRAM chips have a device ID and implement the corresponding read command. For such chips this led to the following error on module loading: at25 spi2.0: Error: no Cypress FRAM (id 00) The device ID contains the memory size, so devices without this ID are supported now by setting the size manually in Devicetree using the "size" property. Tested with FM25L16B and "size = <2048>;": at25 spi2.0: 2 KByte fm25 fram, pagesize 4096 According to Infineon/Cypress datasheets, these FRAMs have a device ID: FM25V01A FM25V02A FM25V05 FM25V10 FM25V20A FM25VN10 but these do not: FM25040B FM25640B FM25C160B FM25CL64B FM25L04B FM25L16B FM25W256 So all "FM25V*" FRAMs and only these have a device ID. The letter after "FM25" (V/C/L/W) only describes the voltage range, though. Link: https://lore.kernel.org/all/20250401133148.38330-1-m.heidelberg@cab.de/ Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de> --- drivers/misc/eeprom/at25.c | 67 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 2d0492867054..c90150f72836 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -379,37 +379,49 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) struct at25_data *at25 = container_of(chip, struct at25_data, chip); u8 sernum[FM25_SN_LEN]; u8 id[FM25_ID_LEN]; + u32 val; int i; strscpy(chip->name, "fm25", sizeof(chip->name)); - /* Get ID of chip */ - fm25_aux_read(at25, id, FM25_RDID, FM25_ID_LEN); - /* There are inside-out FRAM variations, detect them and reverse the ID bytes */ - if (id[6] == 0x7f && id[2] == 0xc2) - for (i = 0; i < ARRAY_SIZE(id) / 2; i++) { - u8 tmp = id[i]; - int j = ARRAY_SIZE(id) - i - 1; + if (!device_property_read_u32(dev, "size", &val)) { + chip->byte_len = val; + } else { + /* Get ID of chip */ + fm25_aux_read(at25, id, FM25_RDID, FM25_ID_LEN); + /* There are inside-out FRAM variations, detect them and reverse the ID bytes */ + if (id[6] == 0x7f && id[2] == 0xc2) + for (i = 0; i < ARRAY_SIZE(id) / 2; i++) { + u8 tmp = id[i]; + int j = ARRAY_SIZE(id) - i - 1; + + id[i] = id[j]; + id[j] = tmp; + } + if (id[6] != 0xc2) { + dev_err(dev, "Error: no Cypress FRAM (id %02x)\n", id[6]); + return -ENODEV; + } - id[i] = id[j]; - id[j] = tmp; + switch (id[7]) { + case 0x21 ... 0x26: + chip->byte_len = BIT(id[7] - 0x21 + 4) * 1024; + break; + case 0x2a ... 0x30: + /* CY15B116QN ... CY15B116QN */ + chip->byte_len = BIT(((id[7] >> 1) & 0xf) + 13); + break; + default: + dev_err(dev, "Error: unsupported size (id %02x)\n", id[7]); + return -ENODEV; } - if (id[6] != 0xc2) { - dev_err(dev, "Error: no Cypress FRAM (id %02x)\n", id[6]); - return -ENODEV; - } - switch (id[7]) { - case 0x21 ... 0x26: - chip->byte_len = BIT(id[7] - 0x21 + 4) * 1024; - break; - case 0x2a ... 0x30: - /* CY15B116QN ... CY15B116QN */ - chip->byte_len = BIT(((id[7] >> 1) & 0xf) + 13); - break; - default: - dev_err(dev, "Error: unsupported size (id %02x)\n", id[7]); - return -ENODEV; + if (id[8]) { + fm25_aux_read(at25, sernum, FM25_RDSN, FM25_SN_LEN); + /* Swap byte order */ + for (i = 0; i < FM25_SN_LEN; i++) + at25->sernum[i] = sernum[FM25_SN_LEN - 1 - i]; + } } if (chip->byte_len > 64 * 1024) @@ -417,13 +429,6 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) else chip->flags |= EE_ADDR2; - if (id[8]) { - fm25_aux_read(at25, sernum, FM25_RDSN, FM25_SN_LEN); - /* Swap byte order */ - for (i = 0; i < FM25_SN_LEN; i++) - at25->sernum[i] = sernum[FM25_SN_LEN - 1 - i]; - } - chip->page_size = PAGE_SIZE; return 0; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] eeprom: at25: support Cypress FRAMs without device ID 2025-08-14 11:15 ` [PATCH 2/3] eeprom: at25: support Cypress " Markus Heidelberg @ 2025-08-14 12:24 ` Alexander Sverdlin 0 siblings, 0 replies; 7+ messages in thread From: Alexander Sverdlin @ 2025-08-14 12:24 UTC (permalink / raw) To: Markus Heidelberg, Arnd Bergmann, Greg Kroah-Hartman, devicetree Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Jiri Prchal, linux-kernel On Thu, 2025-08-14 at 13:15 +0200, Markus Heidelberg wrote: > Not all FRAM chips have a device ID and implement the corresponding read > command. For such chips this led to the following error on module > loading: > > at25 spi2.0: Error: no Cypress FRAM (id 00) > > The device ID contains the memory size, so devices without this ID are > supported now by setting the size manually in Devicetree using the > "size" property. > > Tested with FM25L16B and "size = <2048>;": > > at25 spi2.0: 2 KByte fm25 fram, pagesize 4096 > > According to Infineon/Cypress datasheets, these FRAMs have a device ID: > > FM25V01A > FM25V02A > FM25V05 > FM25V10 > FM25V20A > FM25VN10 > > but these do not: > > FM25040B > FM25640B > FM25C160B > FM25CL64B > FM25L04B > FM25L16B > FM25W256 > > So all "FM25V*" FRAMs and only these have a device ID. The letter after > "FM25" (V/C/L/W) only describes the voltage range, though. > > Link: https://lore.kernel.org/all/20250401133148.38330-1-m.heidelberg@cab.de/ > Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> > --- > drivers/misc/eeprom/at25.c | 67 ++++++++++++++++++++------------------ > 1 file changed, 36 insertions(+), 31 deletions(-) > > diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c > index 2d0492867054..c90150f72836 100644 > --- a/drivers/misc/eeprom/at25.c > +++ b/drivers/misc/eeprom/at25.c > @@ -379,37 +379,49 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) > struct at25_data *at25 = container_of(chip, struct at25_data, chip); > u8 sernum[FM25_SN_LEN]; > u8 id[FM25_ID_LEN]; > + u32 val; > int i; > > strscpy(chip->name, "fm25", sizeof(chip->name)); > > - /* Get ID of chip */ > - fm25_aux_read(at25, id, FM25_RDID, FM25_ID_LEN); > - /* There are inside-out FRAM variations, detect them and reverse the ID bytes */ > - if (id[6] == 0x7f && id[2] == 0xc2) > - for (i = 0; i < ARRAY_SIZE(id) / 2; i++) { > - u8 tmp = id[i]; > - int j = ARRAY_SIZE(id) - i - 1; > + if (!device_property_read_u32(dev, "size", &val)) { > + chip->byte_len = val; > + } else { > + /* Get ID of chip */ > + fm25_aux_read(at25, id, FM25_RDID, FM25_ID_LEN); > + /* There are inside-out FRAM variations, detect them and reverse the ID bytes */ > + if (id[6] == 0x7f && id[2] == 0xc2) > + for (i = 0; i < ARRAY_SIZE(id) / 2; i++) { > + u8 tmp = id[i]; > + int j = ARRAY_SIZE(id) - i - 1; > + > + id[i] = id[j]; > + id[j] = tmp; > + } > + if (id[6] != 0xc2) { > + dev_err(dev, "Error: no Cypress FRAM (id %02x)\n", id[6]); > + return -ENODEV; > + } > > - id[i] = id[j]; > - id[j] = tmp; > + switch (id[7]) { > + case 0x21 ... 0x26: > + chip->byte_len = BIT(id[7] - 0x21 + 4) * 1024; > + break; > + case 0x2a ... 0x30: > + /* CY15B116QN ... CY15B116QN */ > + chip->byte_len = BIT(((id[7] >> 1) & 0xf) + 13); > + break; > + default: > + dev_err(dev, "Error: unsupported size (id %02x)\n", id[7]); > + return -ENODEV; > } > - if (id[6] != 0xc2) { > - dev_err(dev, "Error: no Cypress FRAM (id %02x)\n", id[6]); > - return -ENODEV; > - } > > - switch (id[7]) { > - case 0x21 ... 0x26: > - chip->byte_len = BIT(id[7] - 0x21 + 4) * 1024; > - break; > - case 0x2a ... 0x30: > - /* CY15B116QN ... CY15B116QN */ > - chip->byte_len = BIT(((id[7] >> 1) & 0xf) + 13); > - break; > - default: > - dev_err(dev, "Error: unsupported size (id %02x)\n", id[7]); > - return -ENODEV; > + if (id[8]) { > + fm25_aux_read(at25, sernum, FM25_RDSN, FM25_SN_LEN); > + /* Swap byte order */ > + for (i = 0; i < FM25_SN_LEN; i++) > + at25->sernum[i] = sernum[FM25_SN_LEN - 1 - i]; > + } > } > > if (chip->byte_len > 64 * 1024) > @@ -417,13 +429,6 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) > else > chip->flags |= EE_ADDR2; > > - if (id[8]) { > - fm25_aux_read(at25, sernum, FM25_RDSN, FM25_SN_LEN); > - /* Swap byte order */ > - for (i = 0; i < FM25_SN_LEN; i++) > - at25->sernum[i] = sernum[FM25_SN_LEN - 1 - i]; > - } > - > chip->page_size = PAGE_SIZE; > return 0; > } > -- > 2.43.0 -- Alexander Sverdlin. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] eeprom: at25: make FRAM device ID error message more precise 2025-08-14 11:15 [PATCH 0/3] eeprom: at25: support Cypress FRAMs without device ID Markus Heidelberg 2025-08-14 11:15 ` [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for " Markus Heidelberg 2025-08-14 11:15 ` [PATCH 2/3] eeprom: at25: support Cypress " Markus Heidelberg @ 2025-08-14 11:15 ` Markus Heidelberg 2025-08-14 12:25 ` Alexander Sverdlin 2 siblings, 1 reply; 7+ messages in thread From: Markus Heidelberg @ 2025-08-14 11:15 UTC (permalink / raw) To: Arnd Bergmann, Greg Kroah-Hartman, devicetree Cc: Markus Heidelberg, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Alexander Sverdlin, Jiri Prchal, linux-kernel The error description would be wrong in case the "size" Devicetree property is missing for an FRAM without device ID. Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de> --- drivers/misc/eeprom/at25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index c90150f72836..e2868f7bdb03 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -399,7 +399,7 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) id[j] = tmp; } if (id[6] != 0xc2) { - dev_err(dev, "Error: no Cypress FRAM (id %02x)\n", id[6]); + dev_err(dev, "Error: no Cypress FRAM with device ID (manufacturer ID bank 7: %02x)\n", id[6]); return -ENODEV; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] eeprom: at25: make FRAM device ID error message more precise 2025-08-14 11:15 ` [PATCH 3/3] eeprom: at25: make FRAM device ID error message more precise Markus Heidelberg @ 2025-08-14 12:25 ` Alexander Sverdlin 0 siblings, 0 replies; 7+ messages in thread From: Alexander Sverdlin @ 2025-08-14 12:25 UTC (permalink / raw) To: Markus Heidelberg, Arnd Bergmann, Greg Kroah-Hartman, devicetree Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Christian Eggers, Jiri Prchal, linux-kernel On Thu, 2025-08-14 at 13:15 +0200, Markus Heidelberg wrote: > The error description would be wrong in case the "size" Devicetree > property is missing for an FRAM without device ID. > > Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> > --- > drivers/misc/eeprom/at25.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c > index c90150f72836..e2868f7bdb03 100644 > --- a/drivers/misc/eeprom/at25.c > +++ b/drivers/misc/eeprom/at25.c > @@ -399,7 +399,7 @@ static int at25_fram_to_chip(struct device *dev, struct spi_eeprom *chip) > id[j] = tmp; > } > if (id[6] != 0xc2) { > - dev_err(dev, "Error: no Cypress FRAM (id %02x)\n", id[6]); > + dev_err(dev, "Error: no Cypress FRAM with device ID (manufacturer ID bank 7: %02x)\n", id[6]); > return -ENODEV; > } -- Alexander Sverdlin. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-14 20:47 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-14 11:15 [PATCH 0/3] eeprom: at25: support Cypress FRAMs without device ID Markus Heidelberg 2025-08-14 11:15 ` [PATCH 1/3] dt-bindings: eeprom: at25: use "size" for " Markus Heidelberg 2025-08-14 20:47 ` Conor Dooley 2025-08-14 11:15 ` [PATCH 2/3] eeprom: at25: support Cypress " Markus Heidelberg 2025-08-14 12:24 ` Alexander Sverdlin 2025-08-14 11:15 ` [PATCH 3/3] eeprom: at25: make FRAM device ID error message more precise Markus Heidelberg 2025-08-14 12:25 ` Alexander Sverdlin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).