diff mbox series

[U-Boot,v5,1/4] mmc: mmc_spi: Use SPI_XFER_BEGIN and SPI_XFER_END flags

Message ID 20190717035006.16634-2-anup.patel@wdc.com
State Superseded
Delegated to: Peng Fan
Headers show
Series SiFive SPI MMC Support | expand

Commit Message

Anup Patel July 17, 2019, 3:50 a.m. UTC
Most DM based SPI host controller drivers use SPI_XFER_BEGIN and
SPI_XFER_END flags to enable/disable slave chip select.

This patch extends MMC SPI driver to pass SPI_XFER_BEGIN flag when
MMC command is send at start and pass SPI_XFER_END flag using a
dummy transfer (of bitlen = 0) at the end of MMC command.

Suggested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 drivers/mmc/mmc_spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jagan Teki July 17, 2019, 4:04 a.m. UTC | #1
On Wed, Jul 17, 2019 at 9:20 AM Anup Patel <Anup.Patel@wdc.com> wrote:
>
> Most DM based SPI host controller drivers use SPI_XFER_BEGIN and
> SPI_XFER_END flags to enable/disable slave chip select.
>
> This patch extends MMC SPI driver to pass SPI_XFER_BEGIN flag when
> MMC command is send at start and pass SPI_XFER_END flag using a
> dummy transfer (of bitlen = 0) at the end of MMC command.
>
> Suggested-by: Jagan Teki <jagan@amarulasolutions.com>
> Signed-off-by: Anup Patel <anup.patel@wdc.com>

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Jagan Teki July 17, 2019, 4:10 a.m. UTC | #2
Hi Peng,

On Wed, Jul 17, 2019 at 9:34 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Wed, Jul 17, 2019 at 9:20 AM Anup Patel <Anup.Patel@wdc.com> wrote:
> >
> > Most DM based SPI host controller drivers use SPI_XFER_BEGIN and
> > SPI_XFER_END flags to enable/disable slave chip select.
> >
> > This patch extends MMC SPI driver to pass SPI_XFER_BEGIN flag when
> > MMC command is send at start and pass SPI_XFER_END flag using a
> > dummy transfer (of bitlen = 0) at the end of MMC command.
> >
> > Suggested-by: Jagan Teki <jagan@amarulasolutions.com>
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
>
> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>

Would like to pick this via spi tree, let me know if it fine for you?
Jagan Teki July 17, 2019, 5:15 a.m. UTC | #3
On Wed, Jul 17, 2019 at 9:40 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Hi Peng,
>
> On Wed, Jul 17, 2019 at 9:34 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > On Wed, Jul 17, 2019 at 9:20 AM Anup Patel <Anup.Patel@wdc.com> wrote:
> > >
> > > Most DM based SPI host controller drivers use SPI_XFER_BEGIN and
> > > SPI_XFER_END flags to enable/disable slave chip select.
> > >
> > > This patch extends MMC SPI driver to pass SPI_XFER_BEGIN flag when
> > > MMC command is send at start and pass SPI_XFER_END flag using a
> > > dummy transfer (of bitlen = 0) at the end of MMC command.
> > >
> > > Suggested-by: Jagan Teki <jagan@amarulasolutions.com>
> > > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> >
> > Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
>
> Would like to pick this via spi tree, let me know if it fine for you?

Look like it has dependency on your tree,  please take this from mmc.
Jagan Teki July 18, 2019, 10:16 a.m. UTC | #4
On Wed, Jul 17, 2019 at 10:45 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Wed, Jul 17, 2019 at 9:40 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > Hi Peng,
> >
> > On Wed, Jul 17, 2019 at 9:34 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> > >
> > > On Wed, Jul 17, 2019 at 9:20 AM Anup Patel <Anup.Patel@wdc.com> wrote:
> > > >
> > > > Most DM based SPI host controller drivers use SPI_XFER_BEGIN and
> > > > SPI_XFER_END flags to enable/disable slave chip select.
> > > >
> > > > This patch extends MMC SPI driver to pass SPI_XFER_BEGIN flag when
> > > > MMC command is send at start and pass SPI_XFER_END flag using a
> > > > dummy transfer (of bitlen = 0) at the end of MMC command.
> > > >
> > > > Suggested-by: Jagan Teki <jagan@amarulasolutions.com>
> > > > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > >
> > > Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
> >
> > Would like to pick this via spi tree, let me know if it fine for you?
>
> Look like it has dependency on your tree,  please take this from mmc.

Sorry for the noise, the dependent patch is already in master. So

Applied to u-boot-spi/master
Anup Patel July 18, 2019, 10:17 a.m. UTC | #5
On Thu, Jul 18, 2019 at 3:46 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Wed, Jul 17, 2019 at 10:45 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > On Wed, Jul 17, 2019 at 9:40 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> > >
> > > Hi Peng,
> > >
> > > On Wed, Jul 17, 2019 at 9:34 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> > > >
> > > > On Wed, Jul 17, 2019 at 9:20 AM Anup Patel <Anup.Patel@wdc.com> wrote:
> > > > >
> > > > > Most DM based SPI host controller drivers use SPI_XFER_BEGIN and
> > > > > SPI_XFER_END flags to enable/disable slave chip select.
> > > > >
> > > > > This patch extends MMC SPI driver to pass SPI_XFER_BEGIN flag when
> > > > > MMC command is send at start and pass SPI_XFER_END flag using a
> > > > > dummy transfer (of bitlen = 0) at the end of MMC command.
> > > > >
> > > > > Suggested-by: Jagan Teki <jagan@amarulasolutions.com>
> > > > > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > > >
> > > > Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
> > >
> > > Would like to pick this via spi tree, let me know if it fine for you?
> >
> > Look like it has dependency on your tree,  please take this from mmc.
>
> Sorry for the noise, the dependent patch is already in master. So
>
> Applied to u-boot-spi/master

Cool, thanks.

Regards,
Anup
diff mbox series

Patch

diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index f3d687ae80..350812a04b 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -84,7 +84,7 @@  static int mmc_spi_sendcmd(struct udevice *dev,
 	cmdo[4] = cmdarg >> 8;
 	cmdo[5] = cmdarg;
 	cmdo[6] = (crc7(0, &cmdo[1], 5) << 1) | 0x01;
-	ret = dm_spi_xfer(dev, sizeof(cmdo) * 8, cmdo, NULL, 0);
+	ret = dm_spi_xfer(dev, sizeof(cmdo) * 8, cmdo, NULL, SPI_XFER_BEGIN);
 	if (ret)
 		return ret;
 
@@ -360,6 +360,8 @@  static int dm_mmc_spi_request(struct udevice *dev, struct mmc_cmd *cmd,
 	}
 
 done:
+	dm_spi_xfer(dev, 0, NULL, NULL, SPI_XFER_END);
+
 	dm_spi_release_bus(dev);
 
 	return ret;