All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: Fix decoding of SCR & function switch data on little-endian machines
@ 2009-05-06 21:43 Yauhen Kharuzhy
  2009-05-07 22:07 ` Andy Fleming
  2009-06-02 22:21 ` Andy Fleming
  0 siblings, 2 replies; 3+ messages in thread
From: Yauhen Kharuzhy @ 2009-05-06 21:43 UTC (permalink / raw)
  To: u-boot

SCR & switch data are read from card as big-endian words and should be
converted to CPU byte order.

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
 drivers/mmc/mmc.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b4814d2..596e052 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -487,8 +487,8 @@ retry_scr:
 		return err;
 	}
 
-	mmc->scr[0] = scr[0];
-	mmc->scr[1] = scr[1];
+	mmc->scr[0] = __be32_to_cpu(scr[0]);
+	mmc->scr[1] = __be32_to_cpu(scr[1]);
 
 	switch ((mmc->scr[0] >> 24) & 0xf) {
 		case 0:
@@ -518,7 +518,7 @@ retry_scr:
 			return err;
 
 		/* The high-speed function is busy.  Try again */
-		if (!switch_status[7] & SD_HIGHSPEED_BUSY)
+		if (!(__be32_to_cpu(switch_status[7]) & SD_HIGHSPEED_BUSY))
 			break;
 	}
 
@@ -526,7 +526,7 @@ retry_scr:
 		mmc->card_caps |= MMC_MODE_4BIT;
 
 	/* If high-speed isn't supported, we return */
-	if (!(switch_status[3] & SD_HIGHSPEED_SUPPORTED))
+	if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
 		return 0;
 
 	err = sd_switch(mmc, SD_SWITCH_SWITCH, 0, 1, (u8 *)&switch_status);
@@ -534,8 +534,10 @@ retry_scr:
 	if (err)
 		return err;
 
-	if ((switch_status[4] & 0x0f000000) == 0x01000000)
+	if ((__be32_to_cpu(switch_status[4]) & 0x0f000000) == 0x01000000) {
 		mmc->card_caps |= MMC_MODE_HS;
+		printf("Switched to HS mode\n");
+	}
 
 	return 0;
 }
-- 
1.6.2.3

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

* [U-Boot] [PATCH] mmc: Fix decoding of SCR & function switch data on little-endian machines
  2009-05-06 21:43 [U-Boot] [PATCH] mmc: Fix decoding of SCR & function switch data on little-endian machines Yauhen Kharuzhy
@ 2009-05-07 22:07 ` Andy Fleming
  2009-06-02 22:21 ` Andy Fleming
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Fleming @ 2009-05-07 22:07 UTC (permalink / raw)
  To: u-boot


On May 6, 2009, at 4:43 PM, Yauhen Kharuzhy wrote:

> SCR & switch data are read from card as big-endian words and should be
> converted to CPU byte order.
>
> Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
> ---
>
> -	if ((switch_status[4] & 0x0f000000) == 0x01000000)
> +	if ((__be32_to_cpu(switch_status[4]) & 0x0f000000) == 0x01000000) {
> 		mmc->card_caps |= MMC_MODE_HS;
> +		printf("Switched to HS mode\n");
> +	}


You left some debug output there.

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

* [U-Boot] [PATCH] mmc: Fix decoding of SCR & function switch data on little-endian machines
  2009-05-06 21:43 [U-Boot] [PATCH] mmc: Fix decoding of SCR & function switch data on little-endian machines Yauhen Kharuzhy
  2009-05-07 22:07 ` Andy Fleming
@ 2009-06-02 22:21 ` Andy Fleming
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Fleming @ 2009-06-02 22:21 UTC (permalink / raw)
  To: u-boot

On Wed, May 6, 2009 at 4:43 PM, Yauhen Kharuzhy <jekhor@gmail.com> wrote:

> SCR & switch data are read from card as big-endian words and should be
> converted to CPU byte order.
>
> Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>


Applied to HEAD, first removing the debug output you left in.

Andy

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

end of thread, other threads:[~2009-06-02 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-06 21:43 [U-Boot] [PATCH] mmc: Fix decoding of SCR & function switch data on little-endian machines Yauhen Kharuzhy
2009-05-07 22:07 ` Andy Fleming
2009-06-02 22:21 ` Andy Fleming

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.