mmc: dw_mmc: fix 32bit little-endian access of des1 field
authorBen Dooks <ben.dooks@codethink.co.uk>
Tue, 7 Jun 2016 13:37:19 +0000 (14:37 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 25 Jul 2016 08:34:27 +0000 (10:34 +0200)
The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
not check if the value being passed is big or little endian
desptire the des1 field being marked as __le32.

Fix the issue by ensuring the values are changed from the
cpu endian to the descriptor endian by using cpu_to_le32.

Spotted whilst doing big endian conversion work on Exynos,
and stops the mmc worker thread from stalling.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c

index 5a0e2ca56fd6b8e952c920c3023123d823811bdc..b7c7a76b80d52460b6b16bd7bafc66db4d984528 100644 (file)
@@ -92,7 +92,7 @@ struct idmac_desc {
 
        __le32          des1;   /* Buffer sizes */
 #define IDMAC_SET_BUFFER1_SIZE(d, s) \
-       ((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
+       ((d)->des1 = ((d)->des1 & cpu_to_le32(0x03ffe000)) | (cpu_to_le32((s) & 0x1fff)))
 
        __le32          des2;   /* buffer 1 physical address */