aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Karlman <jonas@kwiboo.se>2024-01-27 16:29:21 +0000
committerTom Rini <trini@konsulko.com>2025-01-26 11:39:00 -0600
commit2348dd8e41ea7912f2ecf35684bbe6386281fb57 (patch)
tree7aab85cd844e9ac85591c28268f3aeea953ae799
parentf55fa90a959e4644b89c56e692930810c5c462b4 (diff)
downloadu-boot-2348dd8e41ea7912f2ecf35684bbe6386281fb57.tar.gz
mmc: Remove alignment hole for cmdidx in struct mmc_cmd
The alignment hole caused by cmdidx in struct mmc_cmd cause strange issues together with the peephole2 optimization on Amlogic SoCs. Following was observed while working on SPL support for Amlogic SoCs. sd_get_capabilities() normally issue a CMD55 followed by a CMD51. However, on at least Amlogic S905 (Cortex-A53) and S905X3 (Cortex-A55), CMD55 was instead followed by CMD8 (and a few reties) in SPL. Code from the call site: cmd.cmdidx = SD_CMD_APP_SEND_SCR; // 51 ... data.blocksize = 8; ... err = mmc_send_cmd_retry(mmc, &cmd, &data, 3); Running the code with MMC_TRACE enabled shows: CMD_SEND:55 ARG 0x50480000 MMC_RSP_R1,5,6,7 0x00000920 CMD_SEND:8 ARG 0x00000000 RET -110 Removing the alignment hole by changing cmdidx from ushort to uint or building with -fno-peephole2 flag seem to resolve this issue. CMD_SEND:55 ARG 0x50480000 MMC_RSP_R1,5,6,7 0x00000920 CMD_SEND:51 ARG 0x00000000 MMC_RSP_R1,5,6,7 0x00000920 Same issue was observed building U-Boot with gcc 8 - 13. Remove this alignment hole by changing cmdidx from ushort to uint. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--include/mmc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/mmc.h b/include/mmc.h
index e4b960b7294..81bccb4cf12 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -431,7 +431,7 @@ struct mmc_cid {
};
struct mmc_cmd {
- ushort cmdidx;
+ uint cmdidx;
uint resp_type;
uint cmdarg;
uint response[4];