All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 08/13] mmc: tmio: Silence transfer errors when tuning
Date: Thu, 1 Nov 2018 20:42:12 +0900	[thread overview]
Message-ID: <CAK7LNARHT0mD90LUs0THCbCsN-ExnjZ1Z-AHzuxNUZj6jPSTvQ@mail.gmail.com> (raw)
In-Reply-To: <20181031171606.13561-8-marek.vasut+renesas@gmail.com>

On Thu, Nov 1, 2018 at 2:22 AM Marek Vasut <marek.vasut@gmail.com> wrote:
>
> In case the controller performs card tuning, that is, sends MMC
> command 19 or 21, silence possible CRC error warning prints. The
> warnings are bound to happen, since the tuning will fail for some
> settings while searching for the optimal configuration of the bus
> and that is perfectly OK.
>
> This patch passes around the MMC command structure and adds check
> into tmio_sd_check_error() to avoid printing CRC error warning
> when the tuning happens.

Make sense, but another solution might be
to delete the message entirely, or to turn it into a debug message.


FWIW,

commit 61f2e5ee12895a2bdaeac8dd13e8d7f50ca7e375
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Sat Dec 30 02:00:12 2017 +0900

    mmc: sdhci: change data transfer failure into debug message





> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>  drivers/mmc/tmio-common.c | 45 +++++++++++++++++++++------------------
>  1 file changed, 24 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
> index 8e83584e57..8e1bcd7ed5 100644
> --- a/drivers/mmc/tmio-common.c
> +++ b/drivers/mmc/tmio-common.c
> @@ -95,7 +95,7 @@ static void __dma_unmap_single(dma_addr_t addr, size_t size,
>                 invalidate_dcache_range(addr, addr + size);
>  }
>
> -static int tmio_sd_check_error(struct udevice *dev)
> +static int tmio_sd_check_error(struct udevice *dev, struct mmc_cmd *cmd)
>  {
>         struct tmio_sd_priv *priv = dev_get_priv(dev);
>         u32 info2 = tmio_sd_readl(priv, TMIO_SD_INFO2);
> @@ -116,7 +116,9 @@ static int tmio_sd_check_error(struct udevice *dev)
>
>         if (info2 & (TMIO_SD_INFO2_ERR_END | TMIO_SD_INFO2_ERR_CRC |
>                      TMIO_SD_INFO2_ERR_IDX)) {
> -               dev_err(dev, "communication out of sync\n");
> +               if ((cmd->cmdidx != MMC_CMD_SEND_TUNING_BLOCK) &&
> +                   (cmd->cmdidx != MMC_CMD_SEND_TUNING_BLOCK_HS200))
> +                       dev_err(dev, "communication out of sync\n");
>                 return -EILSEQ;
>         }
>
> @@ -129,8 +131,8 @@ static int tmio_sd_check_error(struct udevice *dev)
>         return 0;
>  }
>
> -static int tmio_sd_wait_for_irq(struct udevice *dev, unsigned int reg,
> -                                   u32 flag)
> +static int tmio_sd_wait_for_irq(struct udevice *dev, struct mmc_cmd *cmd,
> +                               unsigned int reg, u32 flag)
>  {
>         struct tmio_sd_priv *priv = dev_get_priv(dev);
>         long wait = 1000000;
> @@ -142,7 +144,7 @@ static int tmio_sd_wait_for_irq(struct udevice *dev, unsigned int reg,
>                         return -ETIMEDOUT;
>                 }
>
> -               ret = tmio_sd_check_error(dev);
> +               ret = tmio_sd_check_error(dev, cmd);
>                 if (ret)
>                         return ret;
>
> @@ -178,15 +180,15 @@ tmio_pio_read_fifo(64, q)
>  tmio_pio_read_fifo(32, l)
>  tmio_pio_read_fifo(16, w)
>
> -static int tmio_sd_pio_read_one_block(struct udevice *dev, char *pbuf,
> -                                         uint blocksize)
> +static int tmio_sd_pio_read_one_block(struct udevice *dev, struct mmc_cmd *cmd,
> +                                     char *pbuf, uint blocksize)
>  {
>         struct tmio_sd_priv *priv = dev_get_priv(dev);
>         int ret;
>
>         /* wait until the buffer is filled with data */
> -       ret = tmio_sd_wait_for_irq(dev, TMIO_SD_INFO2,
> -                                      TMIO_SD_INFO2_BRE);
> +       ret = tmio_sd_wait_for_irq(dev, cmd, TMIO_SD_INFO2,
> +                                  TMIO_SD_INFO2_BRE);
>         if (ret)
>                 return ret;
>
> @@ -231,15 +233,15 @@ tmio_pio_write_fifo(64, q)
>  tmio_pio_write_fifo(32, l)
>  tmio_pio_write_fifo(16, w)
>
> -static int tmio_sd_pio_write_one_block(struct udevice *dev,
> +static int tmio_sd_pio_write_one_block(struct udevice *dev, struct mmc_cmd *cmd,
>                                            const char *pbuf, uint blocksize)
>  {
>         struct tmio_sd_priv *priv = dev_get_priv(dev);
>         int ret;
>
>         /* wait until the buffer becomes empty */
> -       ret = tmio_sd_wait_for_irq(dev, TMIO_SD_INFO2,
> -                                   TMIO_SD_INFO2_BWE);
> +       ret = tmio_sd_wait_for_irq(dev, cmd, TMIO_SD_INFO2,
> +                                  TMIO_SD_INFO2_BWE);
>         if (ret)
>                 return ret;
>
> @@ -255,7 +257,8 @@ static int tmio_sd_pio_write_one_block(struct udevice *dev,
>         return 0;
>  }
>
> -static int tmio_sd_pio_xfer(struct udevice *dev, struct mmc_data *data)
> +static int tmio_sd_pio_xfer(struct udevice *dev, struct mmc_cmd *cmd,
> +                           struct mmc_data *data)
>  {
>         const char *src = data->src;
>         char *dest = data->dest;
> @@ -263,10 +266,10 @@ static int tmio_sd_pio_xfer(struct udevice *dev, struct mmc_data *data)
>
>         for (i = 0; i < data->blocks; i++) {
>                 if (data->flags & MMC_DATA_READ)
> -                       ret = tmio_sd_pio_read_one_block(dev, dest,
> +                       ret = tmio_sd_pio_read_one_block(dev, cmd, dest,
>                                                              data->blocksize);
>                 else
> -                       ret = tmio_sd_pio_write_one_block(dev, src,
> +                       ret = tmio_sd_pio_write_one_block(dev, cmd, src,
>                                                               data->blocksize);
>                 if (ret)
>                         return ret;
> @@ -468,8 +471,8 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>                 cmd->cmdidx, tmp, cmd->cmdarg);
>         tmio_sd_writel(priv, tmp, TMIO_SD_CMD);
>
> -       ret = tmio_sd_wait_for_irq(dev, TMIO_SD_INFO1,
> -                                      TMIO_SD_INFO1_RSP);
> +       ret = tmio_sd_wait_for_irq(dev, cmd, TMIO_SD_INFO1,
> +                                  TMIO_SD_INFO1_RSP);
>         if (ret)
>                 return ret;
>
> @@ -497,17 +500,17 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>                     tmio_sd_addr_is_dmaable(data->src))
>                         ret = tmio_sd_dma_xfer(dev, data);
>                 else
> -                       ret = tmio_sd_pio_xfer(dev, data);
> +                       ret = tmio_sd_pio_xfer(dev, cmd, data);
>                 if (ret)
>                         return ret;
>
> -               ret = tmio_sd_wait_for_irq(dev, TMIO_SD_INFO1,
> -                                              TMIO_SD_INFO1_CMP);
> +               ret = tmio_sd_wait_for_irq(dev, cmd, TMIO_SD_INFO1,
> +                                          TMIO_SD_INFO1_CMP);
>                 if (ret)
>                         return ret;
>         }
>
> -       return tmio_sd_wait_for_irq(dev, TMIO_SD_INFO2,
> +       return tmio_sd_wait_for_irq(dev, cmd, TMIO_SD_INFO2,
>                                     TMIO_SD_INFO2_SCLKDIVEN);
>  }
>
> --
> 2.18.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



--
Best Regards
Masahiro Yamada

  reply	other threads:[~2018-11-01 11:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 17:15 [U-Boot] [PATCH 01/13] mmc: tmio: Simplify pinmux handling Marek Vasut
2018-10-31 17:15 ` [U-Boot] [PATCH 02/13] mmc: tmio: Switch to clock framework Marek Vasut
2018-11-01  9:38   ` [U-Boot] [PATCH V2 " Marek Vasut
2018-11-01 11:38     ` Masahiro Yamada
2018-11-02  2:19       ` Masahiro Yamada
2018-11-02 14:42         ` Marek Vasut
2018-11-02  2:24     ` Masahiro Yamada
2018-11-02 14:43       ` Marek Vasut
2018-10-31 17:15 ` [U-Boot] [PATCH 03/13] mmc: tmio: Do not set divider to 1 in DDR mode Marek Vasut
2018-11-01 11:39   ` Masahiro Yamada
2018-11-01 12:09     ` Marek Vasut
2018-10-31 17:15 ` [U-Boot] [PATCH 04/13] mmc: tmio: Configure clock before any other IOS Marek Vasut
2018-10-31 17:15 ` [U-Boot] [PATCH 05/13] mmc: tmio: Keep generating clock when clock are enabled Marek Vasut
2018-11-01 11:46   ` Masahiro Yamada
2018-11-01 12:10     ` Marek Vasut
2018-10-31 17:15 ` [U-Boot] [PATCH 06/13] mmc: tmio: Preinitialize regulator to 3.3V Marek Vasut
2018-10-31 17:16 ` [U-Boot] [PATCH 07/13] mmc: tmio: Improve error handling Marek Vasut
2018-11-01 11:43   ` Masahiro Yamada
2018-10-31 17:16 ` [U-Boot] [PATCH 08/13] mmc: tmio: Silence transfer errors when tuning Marek Vasut
2018-11-01 11:42   ` Masahiro Yamada [this message]
2018-11-01 12:11     ` Marek Vasut
2018-11-02  3:59       ` Masahiro Yamada
2018-11-02 14:27         ` Marek Vasut
2018-10-31 17:16 ` [U-Boot] [PATCH 09/13] mmc: tmio: sdhi: Touch SCC only when UHS capable Marek Vasut
2018-10-31 17:16 ` [U-Boot] [PATCH 10/13] mmc: tmio: sdhi: Clear HS400 settings when reseting SCC Marek Vasut
2018-10-31 17:16 ` [U-Boot] [PATCH 11/13] mmc: tmio: sdhi: Implement waiting for DAT0 line state Marek Vasut
2018-10-31 17:16 ` [U-Boot] [PATCH 12/13] mmc: tmio: sdhi: Switch CPG settings in UHS modes Marek Vasut
2018-10-31 17:16 ` [U-Boot] [PATCH 13/13] mmc: tmio: sdhi: Merge DTCNTL access into single register write Marek Vasut
2018-11-01 11:38 ` [U-Boot] [PATCH 01/13] mmc: tmio: Simplify pinmux handling Masahiro Yamada
2018-11-01 12:12   ` Marek Vasut
2018-11-02  3:58     ` Masahiro Yamada
2018-11-02 14:20       ` Marek Vasut
2018-11-02 14:35         ` Masahiro Yamada

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=CAK7LNARHT0mD90LUs0THCbCsN-ExnjZ1Z-AHzuxNUZj6jPSTvQ@mail.gmail.com \
    --to=yamada.masahiro@socionext.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.