All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v7] spi: Add support for dual and quad mode
@ 2015-12-28 17:38 Jagan Teki
  2015-12-29  6:44 ` Jagan Teki
  2015-12-30  5:58 ` Mugunthan V N
  0 siblings, 2 replies; 3+ messages in thread
From: Jagan Teki @ 2015-12-28 17:38 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

spi bus can support dual and quad wire data transfers for tx and
rx. So defining dual and quad modes for both tx and rx. Also add
support to parse bus width used for spi tx and rx transfers.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
---
Changes for v7:
- Fixed SPI_TX_DUAL
- Removed mode_tx from spi_slave{}

 drivers/spi/spi-uclass.c | 38 +++++++++++++++++++++++++++++++++++++-
 include/spi.h            |  2 ++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index e0f6b25..f1ff5f4 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -157,6 +157,7 @@ static int spi_child_pre_probe(struct udevice *dev)
 
 	slave->max_hz = plat->max_hz;
 	slave->mode = plat->mode;
+	slave->mode_rx = plat->mode_rx;
 
 	return 0;
 }
@@ -368,7 +369,8 @@ void spi_free_slave(struct spi_slave *slave)
 int spi_slave_ofdata_to_platdata(const void *blob, int node,
 				 struct dm_spi_slave_platdata *plat)
 {
-	int mode = 0;
+	int mode = 0, mode_rx = 0;
+	int value;
 
 	plat->cs = fdtdec_get_int(blob, node, "reg", -1);
 	plat->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", 0);
@@ -382,8 +384,42 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node,
 		mode |= SPI_3WIRE;
 	if (fdtdec_get_bool(blob, node, "spi-half-duplex"))
 		mode |= SPI_PREAMBLE;
+
+	/* Device DUAL/QUAD mode */
+	value = fdtdec_get_uint(blob, node, "spi-tx-bus-width", 1);
+	switch (value) {
+	case 1:
+		break;
+	case 2:
+		mode |= SPI_TX_DUAL;
+		break;
+	case 4:
+		mode |= SPI_TX_QUAD;
+		break;
+	default:
+		error("spi-tx-bus-width %d not supported\n", value);
+		break;
+	}
+
 	plat->mode = mode;
 
+	value = fdtdec_get_uint(blob, node, "spi-rx-bus-width", 1);
+	switch (value) {
+	case 1:
+		break;
+	case 2:
+		plat->mode_rx |= SPI_RX_DUAL;
+		break;
+	case 4:
+		plat->mode_rx |= SPI_RX_QUAD;
+		break;
+	default:
+		error("spi-rx-bus-width %d not supported\n", value);
+		break;
+	}
+
+	plat->mode_rx = mode_rx;
+
 	return 0;
 }
 
diff --git a/include/spi.h b/include/spi.h
index 25470e4..4b88d39 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -61,11 +61,13 @@ struct dm_spi_bus {
  * @cs:		Chip select number (0..n-1)
  * @max_hz:	Maximum bus speed that this slave can tolerate
  * @mode:	SPI mode to use for this device (see SPI mode flags)
+ * @mode_rx:	SPI RX mode to use for this slave (see SPI mode_rx flags)
  */
 struct dm_spi_slave_platdata {
 	unsigned int cs;
 	uint max_hz;
 	uint mode;
+	u8 mode_rx;
 };
 
 #endif /* CONFIG_DM_SPI */
-- 
1.9.1

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

* [U-Boot] [PATCH v7] spi: Add support for dual and quad mode
  2015-12-28 17:38 [U-Boot] [PATCH v7] spi: Add support for dual and quad mode Jagan Teki
@ 2015-12-29  6:44 ` Jagan Teki
  2015-12-30  5:58 ` Mugunthan V N
  1 sibling, 0 replies; 3+ messages in thread
From: Jagan Teki @ 2015-12-29  6:44 UTC (permalink / raw)
  To: u-boot

On 28 December 2015 at 23:08, Jagan Teki <jteki@openedev.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> spi bus can support dual and quad wire data transfers for tx and
> rx. So defining dual and quad modes for both tx and rx. Also add
> support to parse bus width used for spi tx and rx transfers.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Reviewed-by: Jagan Teki <jteki@openedev.com>
> ---

Applied to u-boot-spi/master

thanks!
-- 
Jagan.

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

* [U-Boot] [PATCH v7] spi: Add support for dual and quad mode
  2015-12-28 17:38 [U-Boot] [PATCH v7] spi: Add support for dual and quad mode Jagan Teki
  2015-12-29  6:44 ` Jagan Teki
@ 2015-12-30  5:58 ` Mugunthan V N
  1 sibling, 0 replies; 3+ messages in thread
From: Mugunthan V N @ 2015-12-30  5:58 UTC (permalink / raw)
  To: u-boot

On Monday 28 December 2015 11:08 PM, Jagan Teki wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
> 
> spi bus can support dual and quad wire data transfers for tx and
> rx. So defining dual and quad modes for both tx and rx. Also add
> support to parse bus width used for spi tx and rx transfers.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Reviewed-by: Jagan Teki <jteki@openedev.com>

Thanks for the v7 patch.

Regards
Mugunthan V N

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

end of thread, other threads:[~2015-12-30  5:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-28 17:38 [U-Boot] [PATCH v7] spi: Add support for dual and quad mode Jagan Teki
2015-12-29  6:44 ` Jagan Teki
2015-12-30  5:58 ` Mugunthan V N

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.