mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
scsi: Add dma direction member to command structure
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>
This commit is contained in:
parent
d48f00ed11
commit
8fbac8e23e
@ -169,6 +169,7 @@ static ulong scsi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
|
|||||||
block_dev->devnum, start, blks, (unsigned long)buffer);
|
block_dev->devnum, start, blks, (unsigned long)buffer);
|
||||||
do {
|
do {
|
||||||
pccb->pdata = (unsigned char *)buf_addr;
|
pccb->pdata = (unsigned char *)buf_addr;
|
||||||
|
pccb->dma_dir = DMA_FROM_DEVICE;
|
||||||
#ifdef CONFIG_SYS_64BIT_LBA
|
#ifdef CONFIG_SYS_64BIT_LBA
|
||||||
if (start > SCSI_LBA48_READ) {
|
if (start > SCSI_LBA48_READ) {
|
||||||
unsigned long blocks;
|
unsigned long blocks;
|
||||||
@ -237,6 +238,7 @@ static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
|
|||||||
__func__, block_dev->devnum, start, blks, (unsigned long)buffer);
|
__func__, block_dev->devnum, start, blks, (unsigned long)buffer);
|
||||||
do {
|
do {
|
||||||
pccb->pdata = (unsigned char *)buf_addr;
|
pccb->pdata = (unsigned char *)buf_addr;
|
||||||
|
pccb->dma_dir = DMA_TO_DEVICE;
|
||||||
if (blks > max_blks) {
|
if (blks > max_blks) {
|
||||||
pccb->datalen = block_dev->blksz * max_blks;
|
pccb->datalen = block_dev->blksz * max_blks;
|
||||||
smallblks = max_blks;
|
smallblks = max_blks;
|
||||||
@ -385,6 +387,7 @@ static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb,
|
|||||||
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */
|
||||||
|
|
||||||
pccb->datalen = 16;
|
pccb->datalen = 16;
|
||||||
|
pccb->dma_dir = DMA_FROM_DEVICE;
|
||||||
if (scsi_exec(dev, pccb))
|
if (scsi_exec(dev, pccb))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -487,6 +490,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
|
|||||||
pccb->lun = lun;
|
pccb->lun = lun;
|
||||||
pccb->pdata = (unsigned char *)&tempbuff;
|
pccb->pdata = (unsigned char *)&tempbuff;
|
||||||
pccb->datalen = 512;
|
pccb->datalen = 512;
|
||||||
|
pccb->dma_dir = DMA_FROM_DEVICE;
|
||||||
scsi_setup_inquiry(pccb);
|
scsi_setup_inquiry(pccb);
|
||||||
if (scsi_exec(dev, pccb)) {
|
if (scsi_exec(dev, pccb)) {
|
||||||
if (pccb->contr_stat == SCSI_SEL_TIME_OUT) {
|
if (pccb->contr_stat == SCSI_SEL_TIME_OUT) {
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#ifndef _SCSI_H
|
#ifndef _SCSI_H
|
||||||
#define _SCSI_H
|
#define _SCSI_H
|
||||||
|
|
||||||
|
#include <linux/dma-direction.h>
|
||||||
|
|
||||||
struct scsi_cmd {
|
struct scsi_cmd {
|
||||||
unsigned char cmd[16]; /* command */
|
unsigned char cmd[16]; /* command */
|
||||||
/* for request sense */
|
/* for request sense */
|
||||||
@ -26,6 +28,7 @@ struct scsi_cmd {
|
|||||||
unsigned long trans_bytes; /* tranfered bytes */
|
unsigned long trans_bytes; /* tranfered bytes */
|
||||||
|
|
||||||
unsigned int priv;
|
unsigned int priv;
|
||||||
|
enum dma_data_direction dma_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user