From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mugunthan V N Date: Wed, 30 Dec 2015 11:25:18 +0530 Subject: [U-Boot] [PATCH re-send v6 05/17] spi: Add support for dual and quad mode In-Reply-To: References: <1450883389-32149-1-git-send-email-mugunthanvnm@ti.com> <1450883389-32149-6-git-send-email-mugunthanvnm@ti.com> Message-ID: <568371C6.8030605@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday 28 December 2015 08:19 PM, Jagan Teki wrote: > On 23 December 2015 at 20:39, Mugunthan V N wrote: >> 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 >> --- >> drivers/spi/spi-uclass.c | 31 +++++++++++++++++++++++++++++++ >> include/spi.h | 4 ++++ >> 2 files changed, 35 insertions(+) >> >> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c >> index e0f6b25..e5df2c2 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; >> } >> @@ -369,6 +370,7 @@ int spi_slave_ofdata_to_platdata(const void *blob, int node, >> struct dm_spi_slave_platdata *plat) >> { >> int mode = 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,6 +384,35 @@ 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; > > I think it missed case 2 for dual I tried searching spi devices using dual mode for tx in kernel dt files, but I found only single and quad mode, so I dropped dual mode parsing. It can be added when there is a controller which supports max dual mode. > >> + case 4: >> + mode |= SPI_TX_QUAD; >> + break; >> + default: >> + error("spi-tx-bus-width %d not supported\n", value); >> + break; >> + } >> + >> + 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 = mode; >> >> return 0; >> diff --git a/include/spi.h b/include/spi.h >> index 803fb40..94d8a32 100644 >> --- a/include/spi.h >> +++ b/include/spi.h >> @@ -38,11 +38,15 @@ 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 operation mode. >> + * @mode_tx: SPI TX operation mode. >> */ >> struct dm_spi_slave_platdata { >> unsigned int cs; >> uint max_hz; >> uint mode; >> + u8 mode_rx; >> + u8 mode_tx; > > mode_tx not required and you defined but not used. Oops, missed removing this unused. Do you want me to post this patch only as a followup patch or the entire series as v7? Regards Mugunthan V N > >> }; >> >> #endif /* CONFIG_DM_SPI */ >> -- >> 2.7.0.rc1.5.gf3adf45 > > thanks! >