aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi/exynos_spi.c
diff options
context:
space:
mode:
authorHung-ying Tyan2013-05-15 18:27:30 +0800
committerTom Rini2013-06-26 10:13:24 -0400
commitf3424c554c572761f35b00988deb8ed35d1870e3 (patch)
treebd4d66a127bb045d1c4968fde86d3c25e1f0ddb1 /drivers/spi/exynos_spi.c
parent78764a4e11dd40005ba2b36848de407070ccc1a7 (diff)
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 <tyanh@chromium.org> Signed-off-by: Randall Spangler <rspangler@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/spi/exynos_spi.c')
-rw-r--r--drivers/spi/exynos_spi.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index 01378d098e5..7a25a35aa0f 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)
{