All of lore.kernel.org
 help / color / mirror / Atom feed
From: Faiz Abbas <faiz_abbas@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/10] scsi: Add dma direction member to command structure
Date: Mon, 9 Sep 2019 13:49:53 +0530	[thread overview]
Message-ID: <20190909081959.16173-5-faiz_abbas@ti.com> (raw)
In-Reply-To: <20190909081959.16173-1-faiz_abbas@ti.com>

Some SCSI devices like UFS use DMA for executing scsi commands and hence
need to know the direction of transfer of the dma. Add a dma_dir element
to the command structure to facilitate this.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/scsi/scsi.c | 4 ++++
 include/scsi.h      | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 7b7d388557..719e0fbfe6 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -167,6 +167,7 @@ static ulong scsi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
 	      block_dev->devnum, start, blks, (unsigned long)buffer);
 	do {
 		pccb->pdata = (unsigned char *)buf_addr;
+		pccb->dma_dir = DMA_FROM_DEVICE;
 #ifdef CONFIG_SYS_64BIT_LBA
 		if (start > SCSI_LBA48_READ) {
 			unsigned long blocks;
@@ -235,6 +236,7 @@ static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
 	      __func__, block_dev->devnum, start, blks, (unsigned long)buffer);
 	do {
 		pccb->pdata = (unsigned char *)buf_addr;
+		pccb->dma_dir = DMA_TO_DEVICE;
 		if (blks > SCSI_MAX_BLK) {
 			pccb->datalen = block_dev->blksz * max_blks;
 			smallblks = max_blks;
@@ -382,6 +384,7 @@ static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb,
 	pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
 
 	pccb->datalen = 16;
+	pccb->dma_dir = DMA_FROM_DEVICE;
 	if (scsi_exec(dev, pccb))
 		return 1;
 
@@ -484,6 +487,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
 	pccb->lun = lun;
 	pccb->pdata = (unsigned char *)&tempbuff;
 	pccb->datalen = 512;
+	pccb->dma_dir = DMA_FROM_DEVICE;
 	scsi_setup_inquiry(pccb);
 	if (scsi_exec(dev, pccb)) {
 		if (pccb->contr_stat == SCSI_SEL_TIME_OUT) {
diff --git a/include/scsi.h b/include/scsi.h
index 076bdbc6a0..7bb2d3ac0f 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -6,6 +6,8 @@
  #ifndef _SCSI_H
  #define _SCSI_H
 
+#include <linux/dma-direction.h>
+
 struct scsi_cmd {
 	unsigned char		cmd[16];					/* command				   */
 	/* for request sense */
@@ -26,6 +28,7 @@ struct scsi_cmd {
 	unsigned long		trans_bytes;			/* tranfered bytes		*/
 
 	unsigned int		priv;
+	enum dma_data_direction	dma_dir;
 };
 
 /*-----------------------------------------------------------
-- 
2.19.2

  parent reply	other threads:[~2019-09-09  8:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09  8:19 [U-Boot] [PATCH 00/10] Add Support for UFS subsystem for TI's J721e Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 01/10] scsi: Simplify scsi_read()/_write() Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 02/10] scsi: Add max_bytes to scsi_platdata Faiz Abbas
2019-09-10  3:46   ` Vignesh Raghavendra
2019-09-11  7:55     ` Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 03/10] scsi: Retry inquiry 3 times to overcome Unit Attention condition Faiz Abbas
2019-09-09  8:19 ` Faiz Abbas [this message]
2019-09-09  8:19 ` [U-Boot] [PATCH 05/10] ufs: Add Initial Support for UFS subsystem Faiz Abbas
2019-09-10  3:48   ` Vignesh Raghavendra
2019-09-11  8:06     ` Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 06/10] ufs: Add Support for Cadence platform UFS driver Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 07/10] ufs: Add glue layer driver for TI J721E devices Faiz Abbas
2019-09-10  3:48   ` Vignesh Raghavendra
2019-09-11 13:45     ` Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 08/10] arm: dts: k3-j721e-main: Add UFS nodes Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 09/10] cmd: Add Support for UFS commands Faiz Abbas
2019-09-09  8:19 ` [U-Boot] [PATCH 10/10] configs: j721e_evm_a72: Enable configs for UFS Faiz Abbas
2019-09-09 14:52 ` [U-Boot] [PATCH 00/10] Add Support for UFS subsystem for TI's J721e Tom Rini
2019-09-09 14:57   ` Faiz Abbas
2019-09-09 15:01     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190909081959.16173-5-faiz_abbas@ti.com \
    --to=faiz_abbas@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.