[coreboot-gerrit] Patch set updated for coreboot: ebf8af8 SPI: Add API for programmer-specific flashing.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Sun Jan 19 20:03:13 CET 2014


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4712

-gerrit

commit ebf8af84caf9f188562a87a68263e0d455b9efa4
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Sat Jan 18 17:45:32 2014 +0100

    SPI: Add API for programmer-specific flashing.
    
    Change-Id: I7a2f5b9ae74458b5ed6271b1c27842c61546dcd2
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/drivers/spi/spi_flash.c | 15 +++++++++++++++
 src/include/spi-generic.h   |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index d1a9504..ada4f3a 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -267,6 +267,13 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		goto err_claim_bus;
 	}
 
+	if (spi->force_programmer_specific && spi->programmer_specific_probe) {
+		flash = spi->programmer_specific_probe (spi);
+		if (!flash)
+			goto err_read_id;
+		goto flash_detected;
+	}
+
 	/* Read the ID codes */
 	ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
 	if (ret)
@@ -295,11 +302,19 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 				break;
 		}
 
+	if (!flash && spi->programmer_specific_probe) {
+#if CONFIG_SMM_TSEG && defined(__SMM__)
+		/* Need to relocate this function */
+		tseg_relocate((void **)&spi->programmer_specific_probe);
+#endif
+		flash = spi->programmer_specific_probe (spi);
+	}
 	if (!flash) {
 		printk(BIOS_WARNING, "SF: Unsupported manufacturer %02x\n", *idp);
 		goto err_manufacturer_probe;
 	}
 
+flash_detected:
 #if CONFIG_SMM_TSEG && defined(__SMM__)
 	/* Ensure flash handlers are valid for TSEG */
 	tseg_relocate((void **)&flash->read);
diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h
index d252c32..6cdb87a 100644
--- a/src/include/spi-generic.h
+++ b/src/include/spi-generic.h
@@ -64,6 +64,8 @@ struct spi_slave {
 	unsigned int	bus;
 	unsigned int	cs;
 	unsigned int	rw;
+	int force_programmer_specific;
+	struct spi_flash * (*programmer_specific_probe) (struct spi_slave *spi);
 };
 
 /*-----------------------------------------------------------------------



More information about the coreboot-gerrit mailing list