All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SPI: Set SPI bits per words in an OF DeviceTree SPI node
@ 2013-08-07 15:44 ` Christophe Leroy
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe Leroy @ 2013-08-07 15:44 UTC (permalink / raw)
  To: Grant Likely, Rob Herring
  Cc: spi-devel-general, linux-kernel, devicetree-discuss, stigge

This patch allows to set up the bits per word together with all other SPI
parameters in the SPI Node of the OF device tree

In the node, you then have to include the 'spi-bits' property.

Exemple:
	fpga-loader@7 {
		compatible = "cs,fpga-loader";
		spi-max-frequency = <10000000>;
		reg = <7>;
		spi-cs-high;
		spi-bits = <16>;
	};

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

--- linux-3.8.13/drivers/spi/spi.c	2013-05-11 22:57:46.000000000 +0200
+++ linux/drivers/spi/spi.c	2013-08-06 18:19:30.000000000 +0200
@@ -870,6 +870,11 @@
 		if (of_find_property(nc, "spi-3wire", NULL))
 			spi->mode |= SPI_3WIRE;
 
+		/* Bits per word */
+		prop = of_get_property(nc, "spi-bits", &len);
+		if (prop && len >= sizeof(*prop))
+			spi->bits_per_word = prop[0];
+
 		/* Device speed */
 		prop = of_get_property(nc, "spi-max-frequency", &len);
 		if (!prop || len < sizeof(*prop)) {

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-14 16:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 15:44 [PATCH] SPI: Set SPI bits per words in an OF DeviceTree SPI node Christophe Leroy
2013-08-07 15:44 ` Christophe Leroy
2013-08-07 15:54 ` Fwd: " leroy christophe
2013-08-07 16:27   ` Kumar Gala
2013-08-07 16:30   ` Fwd: " Stephen Warren
2013-08-14 13:21     ` leroy christophe
2013-08-14 16:19       ` Stephen Warren
2013-08-14 16:29         ` leroy christophe
2013-08-14 16:31           ` Stephen Warren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.