summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-01-08 13:32:30 -0800
committerFurquan Shaikh <furquan@google.com>2017-02-16 08:40:47 +0100
commit3e01b633d6e18ae72e71e198671890d6accbda25 (patch)
treed1d14798d4db16a5f17fb70d7f2d21ebb361e943 /src/drivers
parentc76e9982b231023ccf91b79ec7526e50f595ffc1 (diff)
spi: Add function callback to get configuration of SPI bus
Add a new callback to spi_ctrlr structure - get_config - to obtain configuration of SPI bus from the controller driver. Also, move common config definitions from acpi_device.h to spi-generic.h BUG=chrome-os-partner:59832 BRANCH=None TEST=Compiles successfully Change-Id: I412c8c70167d18058a32041c2310bc1c884043ce Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/18337 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/spi/spi-generic.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/drivers/spi/spi-generic.c b/src/drivers/spi/spi-generic.c
index 805e17af5a..3ef437c4a7 100644
--- a/src/drivers/spi/spi-generic.c
+++ b/src/drivers/spi/spi-generic.c
@@ -88,6 +88,16 @@ int spi_xfer(const struct spi_slave *slave, const void *dout, size_t bytesout,
return -1;
}
+int spi_get_config(const struct spi_slave *slave, struct spi_cfg *cfg)
+{
+ const struct spi_ctrlr *ctrlr = slave->ctrlr;
+
+ if (ctrlr && ctrlr->get_config)
+ return ctrlr->get_config(slave, cfg);
+
+ return -1;
+}
+
void __attribute__((weak)) spi_init(void)
{
/* Default weak implementation - do nothing. */