All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: moxart: read scr register without changing byte order
@ 2023-06-27 12:05 Sergei Antonov
  2023-06-27 12:11 ` Sergei Antonov
  2023-07-13 11:05 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Sergei Antonov @ 2023-06-27 12:05 UTC (permalink / raw)
  To: linux-mmc; +Cc: Sergei Antonov, Jonas Jensen, stable

Conversion from big-endian to native is done in a common function
mmc_app_send_scr(). Converting in moxart_transfer_pio() is extra.
Double conversion on a LE system returns an incorrect SCR value,
leads to errors:

mmc0: unrecognised SCR structure version 8

Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Cc: Jonas Jensen <jonas.jensen@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/mmc/host/moxart-mmc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index 2d002c81dcf3..d0d6ffcf78d4 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -338,13 +338,7 @@ static void moxart_transfer_pio(struct moxart_host *host)
 				return;
 			}
 			for (len = 0; len < remain && len < host->fifo_width;) {
-				/* SCR data must be read in big endian. */
-				if (data->mrq->cmd->opcode == SD_APP_SEND_SCR)
-					*sgp = ioread32be(host->base +
-							  REG_DATA_WINDOW);
-				else
-					*sgp = ioread32(host->base +
-							REG_DATA_WINDOW);
+				*sgp = ioread32(host->base + REG_DATA_WINDOW);
 				sgp++;
 				len += 4;
 			}
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: moxart: read scr register without changing byte order
  2023-06-27 12:05 [PATCH] mmc: moxart: read scr register without changing byte order Sergei Antonov
@ 2023-06-27 12:11 ` Sergei Antonov
  2023-06-27 12:27   ` Greg KH
  2023-07-13 11:05 ` Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Antonov @ 2023-06-27 12:11 UTC (permalink / raw)
  To: linux-mmc, ulf.hansson; +Cc: Jonas Jensen, stable

+ulf.hansson@linaro.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: moxart: read scr register without changing byte order
  2023-06-27 12:11 ` Sergei Antonov
@ 2023-06-27 12:27   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2023-06-27 12:27 UTC (permalink / raw)
  To: Sergei Antonov; +Cc: linux-mmc, ulf.hansson, Jonas Jensen, stable

On Tue, Jun 27, 2023 at 03:11:17PM +0300, Sergei Antonov wrote:
> +ulf.hansson@linaro.org

That doesn't do anything given that there is no content here, sorry :(

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: moxart: read scr register without changing byte order
  2023-06-27 12:05 [PATCH] mmc: moxart: read scr register without changing byte order Sergei Antonov
  2023-06-27 12:11 ` Sergei Antonov
@ 2023-07-13 11:05 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2023-07-13 11:05 UTC (permalink / raw)
  To: Sergei Antonov; +Cc: linux-mmc, Jonas Jensen, stable

On Tue, 27 Jun 2023 at 14:06, Sergei Antonov <saproj@gmail.com> wrote:
>
> Conversion from big-endian to native is done in a common function
> mmc_app_send_scr(). Converting in moxart_transfer_pio() is extra.
> Double conversion on a LE system returns an incorrect SCR value,
> leads to errors:
>
> mmc0: unrecognised SCR structure version 8
>
> Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
> Signed-off-by: Sergei Antonov <saproj@gmail.com>
> Cc: Jonas Jensen <jonas.jensen@gmail.com>
> Cc: stable@vger.kernel.org

Applied for fixes, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/moxart-mmc.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
> index 2d002c81dcf3..d0d6ffcf78d4 100644
> --- a/drivers/mmc/host/moxart-mmc.c
> +++ b/drivers/mmc/host/moxart-mmc.c
> @@ -338,13 +338,7 @@ static void moxart_transfer_pio(struct moxart_host *host)
>                                 return;
>                         }
>                         for (len = 0; len < remain && len < host->fifo_width;) {
> -                               /* SCR data must be read in big endian. */
> -                               if (data->mrq->cmd->opcode == SD_APP_SEND_SCR)
> -                                       *sgp = ioread32be(host->base +
> -                                                         REG_DATA_WINDOW);
> -                               else
> -                                       *sgp = ioread32(host->base +
> -                                                       REG_DATA_WINDOW);
> +                               *sgp = ioread32(host->base + REG_DATA_WINDOW);
>                                 sgp++;
>                                 len += 4;
>                         }
> --
> 2.37.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-13 11:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-27 12:05 [PATCH] mmc: moxart: read scr register without changing byte order Sergei Antonov
2023-06-27 12:11 ` Sergei Antonov
2023-06-27 12:27   ` Greg KH
2023-07-13 11:05 ` Ulf Hansson

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.