Linux-mmc Archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] mmc: mmc_spi: Don't mention DMA direction
Date: Tue, 5 Mar 2024 13:14:40 +0100	[thread overview]
Message-ID: <CAPDyKFoToK_BUeMyDMB-HDJPKYWdi1TiQVwE6mNSQshUFQDLKw@mail.gmail.com> (raw)
In-Reply-To: <20240304184830.1319526-1-andriy.shevchenko@linux.intel.com>

On Mon, 4 Mar 2024 at 19:48, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> 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 <andriy.shevchenko@linux.intel.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/mmc_spi.c | 30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index b8dda8160c4e..922275de0593 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -15,7 +15,6 @@
>  #include <linux/slab.h>
>  #include <linux/module.h>
>  #include <linux/bio.h>
> -#include <linux/dma-direction.h>
>  #include <linux/crc7.h>
>  #include <linux/crc-itu-t.h>
>  #include <linux/scatterlist.h>
> @@ -510,10 +509,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
>   * so we explicitly initialize it to all ones on RX paths.
>   */
>  static void
> -mmc_spi_setup_data_message(
> -       struct mmc_spi_host     *host,
> -       bool                    multiple,
> -       enum dma_data_direction direction)
> +mmc_spi_setup_data_message(struct mmc_spi_host *host, bool multiple, bool write)
>  {
>         struct spi_transfer     *t;
>         struct scratch          *scratch = host->data;
> @@ -523,7 +519,7 @@ mmc_spi_setup_data_message(
>         /* for reads, readblock() skips 0xff bytes before finding
>          * the token; for writes, this transfer issues that token.
>          */
> -       if (direction == DMA_TO_DEVICE) {
> +       if (write) {
>                 t = &host->token;
>                 memset(t, 0, sizeof(*t));
>                 t->len = 1;
> @@ -547,7 +543,7 @@ mmc_spi_setup_data_message(
>         t = &host->crc;
>         memset(t, 0, sizeof(*t));
>         t->len = 2;
> -       if (direction == DMA_TO_DEVICE) {
> +       if (write) {
>                 /* the actual CRC may get written later */
>                 t->tx_buf = &scratch->crc_val;
>         } else {
> @@ -570,10 +566,10 @@ mmc_spi_setup_data_message(
>          * the next token (next data block, or STOP_TRAN).  We can try to
>          * minimize I/O ops by using a single read to collect end-of-busy.
>          */
> -       if (multiple || direction == DMA_TO_DEVICE) {
> +       if (multiple || write) {
>                 t = &host->early_status;
>                 memset(t, 0, sizeof(*t));
> -               t->len = (direction == DMA_TO_DEVICE) ? sizeof(scratch->status) : 1;
> +               t->len = write ? sizeof(scratch->status) : 1;
>                 t->tx_buf = host->ones;
>                 t->rx_buf = scratch->status;
>                 t->cs_change = 1;
> @@ -777,15 +773,15 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>  {
>         struct spi_device       *spi = host->spi;
>         struct spi_transfer     *t;
> -       enum dma_data_direction direction = mmc_get_dma_dir(data);
>         struct scatterlist      *sg;
>         unsigned                n_sg;
>         bool                    multiple = (data->blocks > 1);
> -       const char              *write_or_read = (direction == DMA_TO_DEVICE) ? "write" : "read";
> +       bool                    write = (data->flags & MMC_DATA_WRITE);
> +       const char              *write_or_read = write ? "write" : "read";
>         u32                     clock_rate;
>         unsigned long           timeout;
>
> -       mmc_spi_setup_data_message(host, multiple, direction);
> +       mmc_spi_setup_data_message(host, multiple, write);
>         t = &host->t;
>
>         if (t->speed_hz)
> @@ -807,7 +803,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>
>                 /* allow pio too; we don't allow highmem */
>                 kmap_addr = kmap(sg_page(sg));
> -               if (direction == DMA_TO_DEVICE)
> +               if (write)
>                         t->tx_buf = kmap_addr + sg->offset;
>                 else
>                         t->rx_buf = kmap_addr + sg->offset;
> @@ -818,7 +814,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>
>                         dev_dbg(&spi->dev, "    %s block, %d bytes\n", write_or_read, t->len);
>
> -                       if (direction == DMA_TO_DEVICE)
> +                       if (write)
>                                 status = mmc_spi_writeblock(host, t, timeout);
>                         else
>                                 status = mmc_spi_readblock(host, t, timeout);
> @@ -833,7 +829,9 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>                 }
>
>                 /* discard mappings */
> -               if (direction == DMA_FROM_DEVICE)
> +               if (write)
> +                       /* nothing to do */;
> +               else
>                         flush_dcache_page(sg_page(sg));
>                 kunmap(sg_page(sg));
>
> @@ -850,7 +848,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
>          * that can affect the STOP_TRAN logic.   Complete (and current)
>          * MMC specs should sort that out before Linux starts using CMD23.
>          */
> -       if (direction == DMA_TO_DEVICE && multiple) {
> +       if (write && multiple) {
>                 struct scratch  *scratch = host->data;
>                 int             tmp;
>                 const unsigned  statlen = sizeof(scratch->status);
> --
> 2.43.0.rc1.1.gbec44491f096
>

      reply	other threads:[~2024-03-05 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 18:48 [PATCH v1 1/1] mmc: mmc_spi: Don't mention DMA direction Andy Shevchenko
2024-03-05 12:14 ` Ulf Hansson [this message]

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=CAPDyKFoToK_BUeMyDMB-HDJPKYWdi1TiQVwE6mNSQshUFQDLKw@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).