[coreboot-gerrit] Change in coreboot[master]: soc/rockchip: Move spi driver to use spi_bus_map

Furquan Shaikh (Code Review) gerrit at coreboot.org
Fri May 19 01:03:29 CEST 2017


Furquan Shaikh has uploaded a new change for review. ( https://review.coreboot.org/19771 )

Change subject: soc/rockchip: Move spi driver to use spi_bus_map
......................................................................

soc/rockchip: Move spi driver to use spi_bus_map

This is in preparation to get rid of the strong spi_setup_slave
implemented by different platforms.

BUG=b:38430839

Change-Id: I66b1b9635ece2381f62f2a9d6f5744d639d59163
Signed-off-by: Furquan Shaikh <furquan at chromium.org>
---
M src/soc/rockchip/common/spi.c
1 file changed, 15 insertions(+), 9 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/71/19771/1

diff --git a/src/soc/rockchip/common/spi.c b/src/soc/rockchip/common/spi.c
index 0e73769..4f8f41b 100644
--- a/src/soc/rockchip/common/spi.c
+++ b/src/soc/rockchip/common/spi.c
@@ -323,20 +323,26 @@
 	return ret < 0 ? ret : 0;
 }
 
+static int spi_ctrlr_setup(const struct spi_slave *slave)
+{
+	assert(slave->bus < ARRAY_SIZE(rockchip_spi_slaves));
+	return 0;
+}
+
 static const struct spi_ctrlr spi_ctrlr = {
+	.setup = spi_ctrlr_setup,
 	.claim_bus = spi_ctrlr_claim_bus,
 	.release_bus = spi_ctrlr_release_bus,
 	.xfer = spi_ctrlr_xfer,
 	.max_xfer_size = 65535,
 };
 
-int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
-{
-	assert(bus < ARRAY_SIZE(rockchip_spi_slaves));
+const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {
+	{
+		.ctrlr = &spi_ctrlr,
+		.bus_start = 0,
+		.bus_end = ARRAY_SIZE(rockchip_spi_slaves) - 1,
+	},
+};
 
-	slave->bus = bus;
-	slave->cs = cs;
-	slave->ctrlr = &spi_ctrlr;
-
-	return 0;
-}
+const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map);

-- 
To view, visit https://review.coreboot.org/19771
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66b1b9635ece2381f62f2a9d6f5744d639d59163
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Furquan Shaikh <furquan at google.com>



More information about the coreboot-gerrit mailing list