Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: flash: spi_nor: Set 4-byte addr mode via Bank Addr Reg #77845

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

talih0
Copy link
Contributor

@talih0 talih0 commented Aug 31, 2024

Some flash devices enable entering the 4-byte address mode by setting BIT(7) in the Bank Address register (0x17). The support for this method is indicated in BIT(3) of Enter 4-Byte Addressing byte in 16th DWORD of the JEDEC Basic Flash Parameter Table.

image

Infineon's S25FL512S is an example flash device with this feature.

@talih0
Copy link
Contributor Author

talih0 commented Aug 31, 2024

I can fix this compliance warning but it will make the registers misaligned :S

image

@@ -35,6 +35,7 @@
#define SPI_NOR_CMD_PP_1_1_4 0x32 /* Quad Page program (1-1-4) */
#define SPI_NOR_CMD_PP_1_4_4 0x38 /* Quad Page program (1-4-4) */
#define SPI_NOR_CMD_RDCR 0x15 /* Read control register */
#define SPI_NOR_CMD_BRWR 0x17 /* Bank address register write */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't name the command. This is Infineon specific name for the command that itself has no name in JEDEC specification, that is not SPI_NOR_CMD name, that is Infineon SPI_NOR_CMD name.
I know that we have been naming things here and there, but I think we start to have a problem here where we can start collision of naming things with identifiers provided by vendors doc.
The JEDEC spec does not name the command only gives info that 0x16 is read and 0x17 is write, and that lower 7 bits of register translate, under condition, to as 128Mbit "segment". The definition here states "Bank", which is something Infineon doc defines, not JEDEC, and may additionally collide with defs from other vendors for the same command, in naming.

return -ENOTSUP;
}

acquire_device(dev);

if ((enter_4byte_addr & 0x08) != 0) {
uint8_t sr = BIT(7);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment here on JEDEC 216F description of Enter 4-Byte Addressing and just use hardcoded 0x17 with explanation in comment.

@de-nordic de-nordic added this to the v4.0.0 milestone Sep 10, 2024
Some flash devices enable entering the 4-byte address mode
by setting BIT(7) in a special register via a write instruction 0x17.
The support for this method is indicated in BIT(3) of
Enter 4-Byte Addressing byte in 16th DWORD of the JEDEC Basic
Flash Parameter Table.

Infineon's S25FL512S is an example flash device with this feature.

Signed-off-by: Andriy Gelman <[email protected]>
@talih0
Copy link
Contributor Author

talih0 commented Oct 1, 2024

@de-nordic, I updated the comments and removed the changes in the spi_nor.h. Let me know if the updated version is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants