Skip to content
Snippets Groups Projects
Commit 6cba6fdf authored by Jagan Teki's avatar Jagan Teki
Browse files

sf: ops: Add configuration register writing support


This patch provides support to program a flash config register.

Configuration register contains the control bits used to configure
the different configurations and security features of a device.

Signed-off-by: default avatarJagannadha Sutradharudu Teki <jaganna@xilinx.com>
parent 3163aaa6
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,30 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr) ...@@ -38,6 +38,30 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr)
return 0; return 0;
} }
static int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr)
{
u8 data[2];
u8 cmd;
int ret;
cmd = CMD_READ_STATUS;
ret = spi_flash_read_common(flash, &cmd, 1, &data[0], 1);
if (ret < 0) {
debug("SF: fail to read status register\n");
return ret;
}
cmd = CMD_WRITE_STATUS;
data[1] = cr;
ret = spi_flash_write_common(flash, &cmd, 1, &data, 2);
if (ret) {
debug("SF: fail to write config register\n");
return ret;
}
return 0;
}
#ifdef CONFIG_SPI_FLASH_BAR #ifdef CONFIG_SPI_FLASH_BAR
static int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel) static int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment