spi: Remove non_volatile flag from block protection interface

Only Winbond parts seem to support making status register writes
volatile. So this flag should not be exposed in the generic interface.

Change-Id: Idadb65ffaff0dd7809b18c53086a466122b37c12
Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41746
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Daniel Gröber
2020-05-26 22:12:14 +02:00
committed by Philipp Deppenwiese
parent bcb4a77fb1
commit 0d0b2f45f6
5 changed files with 4 additions and 10 deletions

View File

@@ -97,7 +97,7 @@ int boot_device_wp_region(const struct region_device *rd,
if (spi_flash_is_write_protected(boot_dev, if (spi_flash_is_write_protected(boot_dev,
region_device_region(rd)) != 1) { region_device_region(rd)) != 1) {
return spi_flash_set_write_protected(boot_dev, return spi_flash_set_write_protected(boot_dev,
region_device_region(rd), true, region_device_region(rd),
SPI_WRITE_PROTECTION_REBOOT); SPI_WRITE_PROTECTION_REBOOT);
} }

View File

@@ -555,7 +555,6 @@ int spi_flash_is_write_protected(const struct spi_flash *flash,
int spi_flash_set_write_protected(const struct spi_flash *flash, int spi_flash_set_write_protected(const struct spi_flash *flash,
const struct region *region, const struct region *region,
const bool non_volatile,
const enum spi_flash_status_reg_lockdown mode) const enum spi_flash_status_reg_lockdown mode)
{ {
struct region flash_region = { 0 }; struct region flash_region = { 0 };
@@ -575,7 +574,7 @@ int spi_flash_set_write_protected(const struct spi_flash *flash,
return -1; return -1;
} }
ret = flash->prot_ops->set_write(flash, region, non_volatile, mode); ret = flash->prot_ops->set_write(flash, region, mode);
if (ret == 0 && mode != SPI_WRITE_PROTECTION_PRESERVE) { if (ret == 0 && mode != SPI_WRITE_PROTECTION_PRESERVE) {
printk(BIOS_INFO, "SPI: SREG lock-down was set to "); printk(BIOS_INFO, "SPI: SREG lock-down was set to ");

View File

@@ -422,7 +422,6 @@ static int winbond_flash_cmd_status(const struct spi_flash *flash,
* *
* @param flash: The flash to operate on * @param flash: The flash to operate on
* @param region: The region to write protect * @param region: The region to write protect
* @param non_volatile: Make setting permanent
* @param mode: Optional status register lock-down mode * @param mode: Optional status register lock-down mode
* *
* @return 0 on success * @return 0 on success
@@ -430,7 +429,6 @@ static int winbond_flash_cmd_status(const struct spi_flash *flash,
static int static int
winbond_set_write_protection(const struct spi_flash *flash, winbond_set_write_protection(const struct spi_flash *flash,
const struct region *region, const struct region *region,
const bool non_volatile,
const enum spi_flash_status_reg_lockdown mode) const enum spi_flash_status_reg_lockdown mode)
{ {
const struct spi_flash_part_id *params; const struct spi_flash_part_id *params;
@@ -527,7 +525,7 @@ winbond_set_write_protection(const struct spi_flash *flash,
mask.reg2.srp1 = 1; mask.reg2.srp1 = 1;
} }
ret = winbond_flash_cmd_status(flash, mask.u, val.u, non_volatile); ret = winbond_flash_cmd_status(flash, mask.u, val.u, true);
if (ret) if (ret)
return ret; return ret;

View File

@@ -74,7 +74,6 @@ struct spi_flash_protection_ops {
int int
(*set_write)(const struct spi_flash *flash, (*set_write)(const struct spi_flash *flash,
const struct region *region, const struct region *region,
const bool non_volatile,
const enum spi_flash_status_reg_lockdown mode); const enum spi_flash_status_reg_lockdown mode);
}; };
@@ -170,7 +169,6 @@ int spi_flash_is_write_protected(const struct spi_flash *flash,
* *
* @param flash : A SPI flash device * @param flash : A SPI flash device
* @param region: A subregion of the device's region * @param region: A subregion of the device's region
* @param non_volatile: Write status register non-volatile
* @param mode: Optional lock-down of status register * @param mode: Optional lock-down of status register
* @return 0 on success * @return 0 on success
@@ -178,7 +176,6 @@ int spi_flash_is_write_protected(const struct spi_flash *flash,
int int
spi_flash_set_write_protected(const struct spi_flash *flash, spi_flash_set_write_protected(const struct spi_flash *flash,
const struct region *region, const struct region *region,
const bool non_volatile,
const enum spi_flash_status_reg_lockdown mode); const enum spi_flash_status_reg_lockdown mode);
/* /*

View File

@@ -71,7 +71,7 @@ static void protect_ro_rgn_spi_flash(void)
* WP_RO read only and use /WP pin * WP_RO read only and use /WP pin
* non-volatile programming * non-volatile programming
*/ */
if (spi_flash_set_write_protected(flash, &ro_rgn, 1, if (spi_flash_set_write_protected(flash, &ro_rgn,
SPI_WRITE_PROTECTION_PIN) != 0) SPI_WRITE_PROTECTION_PIN) != 0)
die("Failed to write-protect WP_RO region!"); die("Failed to write-protect WP_RO region!");
} }