|
PebbleOS v4.44.0-46-gef116268a
|
Flash driver for a JEDEC NOR part on a SPI memory controller. More...
Data Structures | |
| struct | pbl_flash_spi_nor |
| NOR flash on a SPI memory controller. More... | |
Macros | |
| #define | PBL_FLASH_SPI_NOR_DEFINE(sym, _name, _bus, _part, _base, _otp_layout) |
| Define a NOR flash on a SPI memory controller. | |
Flash driver for a JEDEC NOR part on a SPI memory controller.
The part is described by its SFDP tables (JESD216): size, page size, erase types and times, read modes and 4-byte address opcodes. The part description fills in what SFDP does not cover (OTP organization, status register layout and latencies) and stands in for SFDP on parts without it. The widest read and program modes both the part and the controller support are used. Parts over 16 MiB are driven with 4-byte address opcodes when both support them, which leaves the part in its power-on 3-byte address mode; otherwise the part is put in 4-byte address mode, and taken out of it by pbl_flash_stop().
Reads go through the controller's memory-mapped window when it has one, and through operations beyond it. On a PBL_SPI_MEM_XIP controller the part is not reset, the state the boot code left is adopted, and programs and erases return once the part is readable again. Addresses start at the base the board gives, e.g. where the controller maps the part.
The user OTP area is made of the part's security registers. The board lays out its cells:
| struct pbl_flash_spi_nor |
NOR flash on a SPI memory controller.
| Data Fields | ||
|---|---|---|
| const struct pbl_spi_mem * | bus | Controller. |
| struct pbl_flash_spi_nor_data * | data | Driver state. |
| struct pbl_flash | flash | Flash. |
| const struct pbl_flash_nor_part * | part | Part. |
| #define PBL_FLASH_SPI_NOR_DEFINE | ( | sym, | |
| _name, | |||
| _bus, | |||
| _part, | |||
| _base, | |||
| _otp_layout | |||
| ) |
Define a NOR flash on a SPI memory controller.
| sym | Symbol of the flash. |
| _name | Name. |
| _bus | Controller, a struct pbl_spi_mem. |
| _part | Part, a struct pbl_flash_nor_part. |
| _base | Address of the first byte. |
| _otp_layout | OTP cells, a struct pbl_flash_otp_layout, or NULL. |