From f3424c554c572761f35b00988deb8ed35d1870e3 Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Wed, 15 May 2013 18:27:30 +0800 Subject: cros: exynos: add SPI support for cros_ec This patch adds SPI support for carrying out the cros_ec protocol. Signed-off-by: Hung-ying Tyan Signed-off-by: Randall Spangler Signed-off-by: Simon Glass Acked-by: Simon Glass --- drivers/spi/exynos_spi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'drivers/spi/exynos_spi.c') diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c index 01378d098e..7a25a35aa0 100644 --- a/drivers/spi/exynos_spi.c +++ b/drivers/spi/exynos_spi.c @@ -465,6 +465,28 @@ static int process_nodes(const void *blob, int node_list[], int count) } #endif +/** + * Set up a new SPI slave for an fdt node + * + * @param blob Device tree blob + * @param node SPI peripheral node to use + * @return 0 if ok, -1 on error + */ +struct spi_slave *spi_setup_slave_fdt(const void *blob, int node, + unsigned int cs, unsigned int max_hz, unsigned int mode) +{ + struct spi_bus *bus; + unsigned int i; + + for (i = 0, bus = spi_bus; i < bus_count; i++, bus++) { + if (bus->node == node) + return spi_setup_slave(i, cs, max_hz, mode); + } + + debug("%s: Failed to find bus node %d\n", __func__, node); + return NULL; +} + /* Sadly there is no error return from this function */ void spi_init(void) { -- cgit v1.2.3