Message ID | 1450165922-11870-1-git-send-email-mugunthanvnm@ti.com |
---|---|
State | Superseded |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
On 15 December 2015 at 13:22, Mugunthan V N <mugunthanvnm@ti.com> 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 <mugunthanvnm@ti.com> > Reviewed-by: Simon Glass <sjg@chromium.org> > Reviewed-by: Tom Rini <trini@konsulko.com> > --- > > Changes from v3->v4 > * used op_mode_{t/r}x to hold flash tx/rx modes. > > This has been tested on am437x-sk evm logs [1] and pushed a > branch for others to test [2] > > [1] - http://pastebin.ubuntu.com/14024895/ > [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-qspi-v4 > > --- Please rebase it on master, there is some changes regarding SPI_TX_* and also please send the whole series with next version, it easy for me to quantify all at once and pick. thanks!
On Tuesday 15 December 2015 01:43 PM, Jagan Teki wrote: > On 15 December 2015 at 13:22, Mugunthan V N <mugunthanvnm@ti.com> 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 <mugunthanvnm@ti.com> >> Reviewed-by: Simon Glass <sjg@chromium.org> >> Reviewed-by: Tom Rini <trini@konsulko.com> >> --- >> >> Changes from v3->v4 >> * used op_mode_{t/r}x to hold flash tx/rx modes. >> >> This has been tested on am437x-sk evm logs [1] and pushed a >> branch for others to test [2] >> >> [1] - http://pastebin.ubuntu.com/14024895/ >> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-qspi-v4 >> >> --- > > Please rebase it on master, there is some changes regarding SPI_TX_* > and also please send the whole series with next version, it easy for > me to quantify all at once and pick. > Okay, will send v4 as a separate series. The branch which I pushed is based on u-boot/master only. Regards Mugunthan V N
On Dec 17, 2015 12:01 PM, "Mugunthan V N" <mugunthanvnm@ti.com> wrote: > > On Tuesday 15 December 2015 01:43 PM, Jagan Teki wrote: > > On 15 December 2015 at 13:22, Mugunthan V N <mugunthanvnm@ti.com> 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 <mugunthanvnm@ti.com> > >> Reviewed-by: Simon Glass <sjg@chromium.org> > >> Reviewed-by: Tom Rini <trini@konsulko.com> > >> --- > >> > >> Changes from v3->v4 > >> * used op_mode_{t/r}x to hold flash tx/rx modes. > >> > >> This has been tested on am437x-sk evm logs [1] and pushed a > >> branch for others to test [2] > >> > >> [1] - http://pastebin.ubuntu.com/14024895/ > >> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-qspi-v4 > >> > >> --- > > > > Please rebase it on master, there is some changes regarding SPI_TX_* > > and also please send the whole series with next version, it easy for > > me to quantify all at once and pick. > > > > Okay, will send v4 as a separate series. The branch which I pushed is > based on u-boot/master only. Just wait will ping you back, I have some updated patches need to push.
On 17 December 2015 at 12:19, Jagan Teki <jteki@openedev.com> wrote: > > On Dec 17, 2015 12:01 PM, "Mugunthan V N" <mugunthanvnm@ti.com> wrote: >> >> On Tuesday 15 December 2015 01:43 PM, Jagan Teki wrote: >> > On 15 December 2015 at 13:22, Mugunthan V N <mugunthanvnm@ti.com> 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 <mugunthanvnm@ti.com> >> >> Reviewed-by: Simon Glass <sjg@chromium.org> >> >> Reviewed-by: Tom Rini <trini@konsulko.com> >> >> --- >> >> >> >> Changes from v3->v4 >> >> * used op_mode_{t/r}x to hold flash tx/rx modes. >> >> >> >> This has been tested on am437x-sk evm logs [1] and pushed a >> >> branch for others to test [2] >> >> >> >> [1] - http://pastebin.ubuntu.com/14024895/ >> >> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git >> >> dm-qspi-v4 >> >> >> >> --- >> > >> > Please rebase it on master, there is some changes regarding SPI_TX_* >> > and also please send the whole series with next version, it easy for >> > me to quantify all at once and pick. >> > >> >> Okay, will send v4 as a separate series. The branch which I pushed is >> based on u-boot/master only. > > Just wait will ping you back, I have some updated patches need to push. Please use u-boot-spi/next - If possible please verify quad support I have added few changes for setting up quad bit. thanks!
On Thursday 17 December 2015 10:10 PM, Jagan Teki wrote: > On 17 December 2015 at 12:19, Jagan Teki <jteki@openedev.com> wrote: >> >> On Dec 17, 2015 12:01 PM, "Mugunthan V N" <mugunthanvnm@ti.com> wrote: >>> >>> On Tuesday 15 December 2015 01:43 PM, Jagan Teki wrote: >>>> On 15 December 2015 at 13:22, Mugunthan V N <mugunthanvnm@ti.com> 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 <mugunthanvnm@ti.com> >>>>> Reviewed-by: Simon Glass <sjg@chromium.org> >>>>> Reviewed-by: Tom Rini <trini@konsulko.com> >>>>> --- >>>>> >>>>> Changes from v3->v4 >>>>> * used op_mode_{t/r}x to hold flash tx/rx modes. >>>>> >>>>> This has been tested on am437x-sk evm logs [1] and pushed a >>>>> branch for others to test [2] >>>>> >>>>> [1] - http://pastebin.ubuntu.com/14024895/ >>>>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git >>>>> dm-qspi-v4 >>>>> >>>>> --- >>>> >>>> Please rebase it on master, there is some changes regarding SPI_TX_* >>>> and also please send the whole series with next version, it easy for >>>> me to quantify all at once and pick. >>>> >>> >>> Okay, will send v4 as a separate series. The branch which I pushed is >>> based on u-boot/master only. >> >> Just wait will ping you back, I have some updated patches need to push. > > Please use u-boot-spi/next - If possible please verify quad support > I have added few changes for setting up quad bit. > Will rebase to u-boot-spi/next and will submit my next version ASAP. Regards Mugunthan V N
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index e0f6b25..3c7ca78 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -157,6 +157,8 @@ static int spi_child_pre_probe(struct udevice *dev) slave->max_hz = plat->max_hz; slave->mode = plat->mode; + slave->op_mode_tx = plat->op_mode_tx; + slave->op_mode_rx = plat->op_mode_rx; return 0; } @@ -369,6 +371,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,8 +385,40 @@ 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; + plat->mode = mode; + /* Device DUAL/QUAD mode */ + value = fdtdec_get_uint(blob, node, "spi-tx-bus-width", 1); + switch (value) { + case 1: + break; + case 2: + plat->op_mode_tx |= SPI_OPM_TX_DUAL; + break; + case 4: + plat->op_mode_tx |= SPI_OPM_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->op_mode_rx |= SPI_OPM_RX_DUAL; + break; + case 4: + plat->op_mode_rx |= SPI_OPM_RX_QUAD; + break; + default: + error("spi-rx-bus-width %d not supported\n", value); + break; + } + return 0; } diff --git a/include/spi.h b/include/spi.h index b4d2723..090ae1f 100644 --- a/include/spi.h +++ b/include/spi.h @@ -35,6 +35,8 @@ /* SPI TX operation modes */ #define SPI_OPM_TX_QPP (1 << 0) #define SPI_OPM_TX_BP (1 << 1) +#define SPI_OPM_TX_DUAL (1 << 2) /* transmit with 2 wires */ +#define SPI_OPM_TX_QUAD (1 << 3) /* transmit with 4 wires */ /* SPI RX operation modes */ #define SPI_OPM_RX_AS (1 << 0) @@ -46,6 +48,8 @@ #define SPI_OPM_RX_EXTN (SPI_OPM_RX_AS | SPI_OPM_RX_AF | SPI_OPM_RX_DOUT | \ SPI_OPM_RX_DIO | SPI_OPM_RX_QOF | \ SPI_OPM_RX_QIOF) +#define SPI_OPM_RX_DUAL (1 << 6) /* receive with 2 wires */ +#define SPI_OPM_RX_QUAD (1 << 7) /* receive with 4 wires */ /* SPI bus connection options - see enum spi_dual_flash */ #define SPI_CONN_DUAL_SHARED (1 << 0) @@ -75,11 +79,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) + * @op_mode_rx: SPI RX operation mode. + * @op_mode_tx: SPI TX operation mode. */ struct dm_spi_slave_platdata { unsigned int cs; uint max_hz; uint mode; + u8 op_mode_rx; + u8 op_mode_tx; }; #endif /* CONFIG_DM_SPI */