drivers/spi/spi_flash: organize spi flash by sector topology

By grouping the spi flash parts by their {vendor, sector topology}
tuple one can use a common probe function for looking up the part
instead of having per-vendor probe functions. Additionally, by
grouping by the command set one can save more space as well. SST
is the exception that requires after_probe() function to unlock the
parts.

2KiB of savings in each of verstage, romstage, and ramstage
on Aleena Chrome OS Build.

Change-Id: I9cc20ca0f3d0a1b97154b000c95ff2e7e87f3375
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38379
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Aaron Durbin
2020-01-12 15:12:18 -07:00
parent a6c73c8987
commit 5abeb06a73
13 changed files with 346 additions and 700 deletions

View File

@@ -91,6 +91,8 @@ struct spi_flash_protection_ops {
};
struct spi_flash_part_id;
struct spi_flash {
struct spi_slave spi;
u8 vendor;
@@ -113,6 +115,7 @@ struct spi_flash {
const struct spi_flash_ops *ops;
/* If !NULL all protection callbacks exist. */
const struct spi_flash_protection_ops *prot_ops;
const struct spi_flash_part_id *part;
};
void lb_spi_flash(struct lb_header *header);