Skip to content

Commit a5f372a

Browse files
andy-shevstorulf
authored andcommitted
mmc: mmc_spi: Don't mention DMA direction
Since driver doesn't handle any DMA requests, drop any use of DMA bits, such as DMA direction. Instead, use MMC_DATA_WRITE flag directly. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 67e90a7 commit a5f372a

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

drivers/mmc/host/mmc_spi.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/slab.h>
1616
#include <linux/module.h>
1717
#include <linux/bio.h>
18-
#include <linux/dma-direction.h>
1918
#include <linux/crc7.h>
2019
#include <linux/crc-itu-t.h>
2120
#include <linux/scatterlist.h>
@@ -510,10 +509,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
510509
* so we explicitly initialize it to all ones on RX paths.
511510
*/
512511
static void
513-
mmc_spi_setup_data_message(
514-
struct mmc_spi_host *host,
515-
bool multiple,
516-
enum dma_data_direction direction)
512+
mmc_spi_setup_data_message(struct mmc_spi_host *host, bool multiple, bool write)
517513
{
518514
struct spi_transfer *t;
519515
struct scratch *scratch = host->data;
@@ -523,7 +519,7 @@ mmc_spi_setup_data_message(
523519
/* for reads, readblock() skips 0xff bytes before finding
524520
* the token; for writes, this transfer issues that token.
525521
*/
526-
if (direction == DMA_TO_DEVICE) {
522+
if (write) {
527523
t = &host->token;
528524
memset(t, 0, sizeof(*t));
529525
t->len = 1;
@@ -547,7 +543,7 @@ mmc_spi_setup_data_message(
547543
t = &host->crc;
548544
memset(t, 0, sizeof(*t));
549545
t->len = 2;
550-
if (direction == DMA_TO_DEVICE) {
546+
if (write) {
551547
/* the actual CRC may get written later */
552548
t->tx_buf = &scratch->crc_val;
553549
} else {
@@ -570,10 +566,10 @@ mmc_spi_setup_data_message(
570566
* the next token (next data block, or STOP_TRAN). We can try to
571567
* minimize I/O ops by using a single read to collect end-of-busy.
572568
*/
573-
if (multiple || direction == DMA_TO_DEVICE) {
569+
if (multiple || write) {
574570
t = &host->early_status;
575571
memset(t, 0, sizeof(*t));
576-
t->len = (direction == DMA_TO_DEVICE) ? sizeof(scratch->status) : 1;
572+
t->len = write ? sizeof(scratch->status) : 1;
577573
t->tx_buf = host->ones;
578574
t->rx_buf = scratch->status;
579575
t->cs_change = 1;
@@ -777,15 +773,15 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
777773
{
778774
struct spi_device *spi = host->spi;
779775
struct spi_transfer *t;
780-
enum dma_data_direction direction = mmc_get_dma_dir(data);
781776
struct scatterlist *sg;
782777
unsigned n_sg;
783778
bool multiple = (data->blocks > 1);
784-
const char *write_or_read = (direction == DMA_TO_DEVICE) ? "write" : "read";
779+
bool write = (data->flags & MMC_DATA_WRITE);
780+
const char *write_or_read = write ? "write" : "read";
785781
u32 clock_rate;
786782
unsigned long timeout;
787783

788-
mmc_spi_setup_data_message(host, multiple, direction);
784+
mmc_spi_setup_data_message(host, multiple, write);
789785
t = &host->t;
790786

791787
if (t->speed_hz)
@@ -807,7 +803,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
807803

808804
/* allow pio too; we don't allow highmem */
809805
kmap_addr = kmap(sg_page(sg));
810-
if (direction == DMA_TO_DEVICE)
806+
if (write)
811807
t->tx_buf = kmap_addr + sg->offset;
812808
else
813809
t->rx_buf = kmap_addr + sg->offset;
@@ -818,7 +814,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
818814

819815
dev_dbg(&spi->dev, " %s block, %d bytes\n", write_or_read, t->len);
820816

821-
if (direction == DMA_TO_DEVICE)
817+
if (write)
822818
status = mmc_spi_writeblock(host, t, timeout);
823819
else
824820
status = mmc_spi_readblock(host, t, timeout);
@@ -833,7 +829,9 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
833829
}
834830

835831
/* discard mappings */
836-
if (direction == DMA_FROM_DEVICE)
832+
if (write)
833+
/* nothing to do */;
834+
else
837835
flush_dcache_page(sg_page(sg));
838836
kunmap(sg_page(sg));
839837

@@ -850,7 +848,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
850848
* that can affect the STOP_TRAN logic. Complete (and current)
851849
* MMC specs should sort that out before Linux starts using CMD23.
852850
*/
853-
if (direction == DMA_TO_DEVICE && multiple) {
851+
if (write && multiple) {
854852
struct scratch *scratch = host->data;
855853
int tmp;
856854
const unsigned statlen = sizeof(scratch->status);

0 commit comments

Comments
 (0)