From 7606c377f56ab68421aa482b1ded6840d426e197 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sat, 11 Feb 2017 10:57:23 -0800 Subject: device: Add a new "SPI" device type Add support for a new "SPI" device type in the devicetree to bind a device on the SPI bus. Allow device to provide chip select number for the device as a parameter. Add spi_bus_operations with operation dev_to_bus which allows SoCs to define a translation method for converting "struct device" into a unique SPI bus number. BUG=chrome-os-partner:59832 BRANCH=None TEST=Compiles successfully. Change-Id: I86f09516d3cddd619fef23a4659c9e4eadbcf3fa Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/18340 Reviewed-by: Duncan Laurie Tested-by: build bot (Jenkins) --- src/include/device/spi.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/include/device/spi.h (limited to 'src/include/device/spi.h') diff --git a/src/include/device/spi.h b/src/include/device/spi.h new file mode 100644 index 0000000000..4315ebce14 --- /dev/null +++ b/src/include/device/spi.h @@ -0,0 +1,30 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2017 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __DEVICE_SPI_H__ +#define __DEVICE_SPI_H__ + +struct device; +struct spi_bus_operations { + /* + * This is a SoC-specific method that can be provided to translate the + * 'struct device' for a SPI controller into a unique SPI bus + * number. Returns -1 if the bus number for this bus cannot be + * determined. + */ + int (*dev_to_bus)(struct device *dev); +}; + +#endif /* __DEVICE_SPI_H__ */ -- cgit v1.2.3