xref: /openbmc/u-boot/drivers/spi/Kconfig (revision 892cac72e44d54add772f81fee01ab64b006b88b)
1da333ae7SMasahiro Yamadaconfig DM_SPI
2da333ae7SMasahiro Yamada	bool "Enable Driver Model for SPI drivers"
3da333ae7SMasahiro Yamada	depends on DM
4da333ae7SMasahiro Yamada	help
5f94a1bedSSimon Glass	  Enable driver model for SPI. The SPI slave interface
6f94a1bedSSimon Glass	  (spi_setup_slave(), spi_xfer(), etc.) is then implemented by
7f94a1bedSSimon Glass	  the SPI uclass. Drivers provide methods to access the SPI
8f94a1bedSSimon Glass	  buses that they control. The uclass interface is defined in
9f94a1bedSSimon Glass	  include/spi.h. The existing spi_slave structure is attached
10f94a1bedSSimon Glass	  as 'parent data' to every slave on each bus. Slaves
11f94a1bedSSimon Glass	  typically use driver-private data instead of extending the
12f94a1bedSSimon Glass	  spi_slave structure.
13*892cac72SSimon Glass
14*892cac72SSimon Glassconfig SANDBOX_SPI
15*892cac72SSimon Glass	bool "Sandbox SPI driver"
16*892cac72SSimon Glass	depends on SANDBOX && DM
17*892cac72SSimon Glass	help
18*892cac72SSimon Glass	  Enable SPI support for sandbox. This is an emulation of a real SPI
19*892cac72SSimon Glass	  bus. Devices can be attached to the bus using the device tree
20*892cac72SSimon Glass	  which specifies the driver to use. As an example, see this device
21*892cac72SSimon Glass	  tree fragment from sandbox.dts. It shows that the SPI bus has a
22*892cac72SSimon Glass	  single flash device on chip select 0 which is emulated by the driver
23*892cac72SSimon Glass	  for "sandbox,spi-flash", which is in drivers/mtd/spi/sandbox.c.
24*892cac72SSimon Glass
25*892cac72SSimon Glass	  spi@0 {
26*892cac72SSimon Glass		#address-cells = <1>;
27*892cac72SSimon Glass		#size-cells = <0>;
28*892cac72SSimon Glass		reg = <0>;
29*892cac72SSimon Glass		compatible = "sandbox,spi";
30*892cac72SSimon Glass		cs-gpios = <0>, <&gpio_a 0>;
31*892cac72SSimon Glass		flash@0 {
32*892cac72SSimon Glass			reg = <0>;
33*892cac72SSimon Glass			compatible = "spansion,m25p16", "sandbox,spi-flash";
34*892cac72SSimon Glass			spi-max-frequency = <40000000>;
35*892cac72SSimon Glass			sandbox,filename = "spi.bin";
36*892cac72SSimon Glass		};
37*892cac72SSimon Glass	};
38