diff mbox

[U-Boot] mmc: uniphier-sd: Fix long response processing

Message ID 20170721211159.23317-1-marek.vasut+renesas@gmail.com
State Accepted
Commit ac5efc358bd6257c2553580d122ae85ffdb0391b
Delegated to: Jaehoon Chung
Headers show

Commit Message

Marek Vasut July 21, 2017, 9:11 p.m. UTC
The long response entry 0..3 LSByte comes from the next response
register MSByte, not from the next response register LSByte. Fix
this to make the driver report correct values in response 136 .

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/uniphier-sd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Masahiro Yamada Aug. 3, 2017, 12:34 p.m. UTC | #1
2017-07-22 6:11 GMT+09:00 Marek Vasut <marek.vasut@gmail.com>:
> The long response entry 0..3 LSByte comes from the next response
> register MSByte, not from the next response register LSByte. Fix
> this to make the driver report correct values in response 136 .
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> ---

Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>


Thanks!
Jaehoon Chung Aug. 17, 2017, 5:36 a.m. UTC | #2
On 07/22/2017 06:11 AM, Marek Vasut wrote:
> The long response entry 0..3 LSByte comes from the next response
> register MSByte, not from the next response register LSByte. Fix
> this to make the driver report correct values in response 136 .
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied to u-boot-mmc. Sorry for late!

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/uniphier-sd.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
> index 3c462bd583..e272b14153 100644
> --- a/drivers/mmc/uniphier-sd.c
> +++ b/drivers/mmc/uniphier-sd.c
> @@ -470,13 +470,13 @@ static int uniphier_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>  		u32 rsp_71_40 = readl(priv->regbase + UNIPHIER_SD_RSP32);
>  		u32 rsp_39_8 = readl(priv->regbase + UNIPHIER_SD_RSP10);
>  
> -		cmd->response[0] = (rsp_127_104 & 0xffffff) << 8 |
> -							(rsp_103_72 & 0xff);
> -		cmd->response[1] = (rsp_103_72  & 0xffffff) << 8 |
> -							(rsp_71_40 & 0xff);
> -		cmd->response[2] = (rsp_71_40   & 0xffffff) << 8 |
> -							(rsp_39_8 & 0xff);
> -		cmd->response[3] = (rsp_39_8    & 0xffffff) << 8;
> +		cmd->response[0] = ((rsp_127_104 & 0x00ffffff) << 8) |
> +				   ((rsp_103_72  & 0xff000000) >> 24);
> +		cmd->response[1] = ((rsp_103_72  & 0x00ffffff) << 8) |
> +				   ((rsp_71_40   & 0xff000000) >> 24);
> +		cmd->response[2] = ((rsp_71_40   & 0x00ffffff) << 8) |
> +				   ((rsp_39_8    & 0xff000000) >> 24);
> +		cmd->response[3] = (rsp_39_8     & 0xffffff)   << 8;
>  	} else {
>  		/* bit 39-8 */
>  		cmd->response[0] = readl(priv->regbase + UNIPHIER_SD_RSP10);
>
diff mbox

Patch

diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index 3c462bd583..e272b14153 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -470,13 +470,13 @@  static int uniphier_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 		u32 rsp_71_40 = readl(priv->regbase + UNIPHIER_SD_RSP32);
 		u32 rsp_39_8 = readl(priv->regbase + UNIPHIER_SD_RSP10);
 
-		cmd->response[0] = (rsp_127_104 & 0xffffff) << 8 |
-							(rsp_103_72 & 0xff);
-		cmd->response[1] = (rsp_103_72  & 0xffffff) << 8 |
-							(rsp_71_40 & 0xff);
-		cmd->response[2] = (rsp_71_40   & 0xffffff) << 8 |
-							(rsp_39_8 & 0xff);
-		cmd->response[3] = (rsp_39_8    & 0xffffff) << 8;
+		cmd->response[0] = ((rsp_127_104 & 0x00ffffff) << 8) |
+				   ((rsp_103_72  & 0xff000000) >> 24);
+		cmd->response[1] = ((rsp_103_72  & 0x00ffffff) << 8) |
+				   ((rsp_71_40   & 0xff000000) >> 24);
+		cmd->response[2] = ((rsp_71_40   & 0x00ffffff) << 8) |
+				   ((rsp_39_8    & 0xff000000) >> 24);
+		cmd->response[3] = (rsp_39_8     & 0xffffff)   << 8;
 	} else {
 		/* bit 39-8 */
 		cmd->response[0] = readl(priv->regbase + UNIPHIER_SD_RSP10);