[PATCH 16/31] staging: mt7621-mmc: Remove flags from msdc_dma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The flags of msdc_dma are set to a constant value, so block and dword
padding are disabled and checksum is enabled. By removing the field
the code is easier to read and the difference to the mtk-sd driver is
smaller.

Signed-off-by: Christian Lütke-Stetzkamp <christian@xxxxxxxx>
---
 drivers/staging/mt7621-mmc/mt6575_sd.h |  6 ------
 drivers/staging/mt7621-mmc/sd.c        | 16 +++++-----------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h
index 323b039a1fd2..ee796990e7c5 100644
--- a/drivers/staging/mt7621-mmc/mt6575_sd.h
+++ b/drivers/staging/mt7621-mmc/mt6575_sd.h
@@ -889,13 +889,7 @@ struct msdc_regs {
 	struct msdc_eco_ver_reg    eco_ver;       /* base+0x104h */
 };
 
-#define DMA_FLAG_NONE       (0x00000000)
-#define DMA_FLAG_EN_CHKSUM  (0x00000001)
-#define DMA_FLAG_PAD_BLOCK  (0x00000002)
-#define DMA_FLAG_PAD_DWORD  (0x00000004)
-
 struct msdc_dma {
-	u32 flags;                   /* flags */
 	u32 xfersz;                  /* xfer size in bytes */
 	u32 sglen;                   /* size of scatter list */
 	struct scatterlist *sg;      /* I/O scatter list */
diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index bda072cd2b3d..445d8c0e3cf2 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1253,7 +1253,6 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma)
 	u32 base = host->base;
 	//u32 i, j, num, bdlen, arg, xfersz;
 	u32 j, num;
-	u8  blkpad, dwpad, chksum;
 	struct scatterlist *sg = dma->sg;
 	struct gpd *gpd;
 	struct bd *bd;
@@ -1276,9 +1275,6 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma)
 		sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 0);
 		break;
 	case MSDC_MODE_DMA_DESC:
-		blkpad = (dma->flags & DMA_FLAG_PAD_BLOCK) ? 1 : 0;
-		dwpad  = (dma->flags & DMA_FLAG_PAD_DWORD) ? 1 : 0;
-		chksum = (dma->flags & DMA_FLAG_EN_CHKSUM) ? 1 : 0;
 
 		/* calculate the required number of gpd */
 		num = (dma->sglen + MAX_BD_PER_GPD - 1) / MAX_BD_PER_GPD;
@@ -1292,12 +1288,12 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma)
 		gpd->hwo = 1;  /* hw will clear it */
 		gpd->bdp = 1;
 		gpd->chksum = 0;  /* need to clear first. */
-		gpd->chksum = (chksum ? msdc_dma_calcs((u8 *)gpd, 16) : 0);
+		gpd->chksum = msdc_dma_calcs((u8 *)gpd, 16);
 
 		/* modify bd*/
 		for_each_sg(dma->sg, sg, dma->sglen, j) {
-			bd[j].blkpad = blkpad;
-			bd[j].dwpad = dwpad;
+			bd[j].blkpad = 0;
+			bd[j].dwpad = 0;
 			bd[j].ptr = (void *)sg_dma_address(sg);
 			bd[j].buflen = sg_dma_len(sg);
 
@@ -1307,10 +1303,10 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma)
 				bd[j].eol = 0;
 
 			bd[j].chksum = 0; /* checksume need to clear first */
-			bd[j].chksum = (chksum ? msdc_dma_calcs((u8 *)(&bd[j]), 16) : 0);
+			bd[j].chksum = msdc_dma_calcs((u8 *)(&bd[j]), 16);
 		}
 
-		sdr_set_field(MSDC_DMA_CFG, MSDC_DMA_CFG_DECSEN, chksum);
+		sdr_set_field(MSDC_DMA_CFG, MSDC_DMA_CFG_DECSEN, 1);
 		sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ,
 			      MSDC_BRUST_64B);
 		sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 1);
@@ -1335,8 +1331,6 @@ static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma,
 	BUG_ON(sglen > MAX_BD_NUM); /* not support currently */
 
 	dma->sg = sg;
-	dma->flags = DMA_FLAG_EN_CHKSUM;
-	//dma->flags = DMA_FLAG_NONE; /* CHECKME */
 	dma->sglen = sglen;
 	dma->xfersz = host->xfer_size;
 
-- 
2.16.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux