summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorMaximilian Brune <maximilian.brune@9elements.com>2023-08-28 13:57:20 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-12-18 20:27:52 +0000
commit7bcf4ae4d26d5c904c95d896dedeeb23d44d979f (patch)
treed2fd5cbe69aa1397d9972415c1d48db5ca964f51 /src/drivers
parentb24eadb973cdaffabdb03452338aaaca868ca380 (diff)
downloadcoreboot-7bcf4ae4d26d5c904c95d896dedeeb23d44d979f.tar.gz
coreboot-7bcf4ae4d26d5c904c95d896dedeeb23d44d979f.tar.bz2
coreboot-7bcf4ae4d26d5c904c95d896dedeeb23d44d979f.zip
drivers/spi: Add ISSI IS25WP256D flash
datasheet: IS25WP256D Rev A13 (2023-08-03) tested: boot SiFive Hifive Unmatched board Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: I655776258cbcf464becf38cbb5045cda5bca711c Reviewed-on: https://review.coreboot.org/c/coreboot/+/79369 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/spi/Kconfig7
-rw-r--r--src/drivers/spi/Makefile.inc1
-rw-r--r--src/drivers/spi/issi.c29
-rw-r--r--src/drivers/spi/spi_flash.c3
-rw-r--r--src/drivers/spi/spi_flash_internal.h1
5 files changed, 41 insertions, 0 deletions
diff --git a/src/drivers/spi/Kconfig b/src/drivers/spi/Kconfig
index 8c251d7fbcd6..6d161f400595 100644
--- a/src/drivers/spi/Kconfig
+++ b/src/drivers/spi/Kconfig
@@ -155,6 +155,13 @@ config SPI_FLASH_WINBOND
Select this option if your chipset driver needs to store certain
data in the SPI flash and your SPI flash is made by Winbond.
+config SPI_FLASH_ISSI
+ bool
+ default y if SPI_FLASH_INCLUDE_ALL_DRIVERS
+ help
+ Select this option if your chipset driver needs to store certain
+ data in the SPI flash and your SPI flash is made by ISSI.
+
config SPI_FLASH_HAS_VOLATILE_GROUP
bool
default n
diff --git a/src/drivers/spi/Makefile.inc b/src/drivers/spi/Makefile.inc
index 954eef277272..97c3d63d4912 100644
--- a/src/drivers/spi/Makefile.inc
+++ b/src/drivers/spi/Makefile.inc
@@ -30,6 +30,7 @@ $(1)-$(CONFIG_SPI_FLASH_SPANSION) += spansion.c
$(1)-$(CONFIG_SPI_FLASH_SST) += sst.c
$(1)-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.c
$(1)-$(CONFIG_SPI_FLASH_WINBOND) += winbond.c
+$(1)-$(CONFIG_SPI_FLASH_ISSI) += issi.c
endef
$(eval $(call add_spi_stage,bootblock,_EARLY))
diff --git a/src/drivers/spi/issi.c b/src/drivers/spi/issi.c
new file mode 100644
index 000000000000..45fe5a130de9
--- /dev/null
+++ b/src/drivers/spi/issi.c
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <console/console.h>
+#include <commonlib/helpers.h>
+#include <spi_flash.h>
+#include <spi-generic.h>
+#include <delay.h>
+#include <lib.h>
+
+#include "spi_flash_internal.h"
+
+static const struct spi_flash_part_id flash_table[] = {
+ {
+ /* IS25WP256D */
+ .id[0] = 0x7019,
+ .nr_sectors_shift = 13,
+ },
+};
+
+const struct spi_flash_vendor_info spi_flash_issi_vi = {
+ .id = VENDOR_ID_ISSI,
+ .page_size_shift = 8, // 256 byte page size
+ .sector_size_kib_shift = 2, // 4 Kbyte sector size
+ .match_id_mask[0] = 0xffff,
+ .ids = flash_table,
+ .nr_part_ids = ARRAY_SIZE(flash_table),
+ .desc = &spi_flash_pp_0x20_sector_desc,
+ .prot_ops = NULL,
+};
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index 7619f643649a..42952df53178 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -397,6 +397,9 @@ static const struct spi_flash_vendor_info *spi_flash_vendors[] = {
#if CONFIG(SPI_FLASH_WINBOND)
&spi_flash_winbond_vi,
#endif
+#if CONFIG(SPI_FLASH_ISSI)
+ &spi_flash_issi_vi,
+#endif
};
#define IDCODE_LEN 5
diff --git a/src/drivers/spi/spi_flash_internal.h b/src/drivers/spi/spi_flash_internal.h
index 61113742cb13..3aea9140e452 100644
--- a/src/drivers/spi/spi_flash_internal.h
+++ b/src/drivers/spi/spi_flash_internal.h
@@ -123,6 +123,7 @@ extern const struct spi_flash_vendor_info spi_flash_stmicro2_vi;
extern const struct spi_flash_vendor_info spi_flash_stmicro3_vi;
extern const struct spi_flash_vendor_info spi_flash_stmicro4_vi;
extern const struct spi_flash_vendor_info spi_flash_winbond_vi;
+extern const struct spi_flash_vendor_info spi_flash_issi_vi;
/* Page Programming Command Set with 0x20 Sector Erase command. */
extern const struct spi_flash_ops_descriptor spi_flash_pp_0x20_sector_desc;