Jonas Karlman 2348dd8e41 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>
2025-01-26 11:39:00 -06:00
..
2024-12-09 16:29:47 -06:00
2024-10-17 03:12:47 +02:00
2025-01-22 15:58:03 -06:00
2023-08-08 10:22:03 -04:00
2024-07-29 15:01:04 -06:00
2023-12-21 08:54:37 -05:00
2024-10-24 11:20:58 -06:00
2024-07-29 15:01:04 -06:00
2024-08-26 14:05:38 -06:00
2024-02-13 15:38:49 -05:00
2024-07-29 15:01:04 -06:00
2024-11-20 17:57:58 +01:00
2024-07-29 15:01:04 -06:00
2025-01-05 02:30:49 +01:00
2024-06-14 12:59:07 -06:00
2024-08-26 14:05:38 -06:00
2024-07-29 15:01:04 -06:00
2024-09-24 13:41:20 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2023-11-07 14:50:51 -05:00
2024-07-29 15:01:04 -06:00
2024-08-13 06:23:15 +02:00
2023-12-21 11:59:49 -05:00
2024-10-10 16:02:20 -06:00
2024-12-31 10:58:30 -06:00
2025-01-26 11:06:56 +01:00
2024-07-29 15:01:04 -06:00
2023-12-21 08:54:37 -05:00
2024-11-04 16:41:38 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2024-10-24 11:21:48 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2023-12-21 08:54:37 -05:00
2024-11-25 23:07:37 -03:00
2024-09-30 17:48:12 -06:00
2024-11-20 17:57:58 +01:00
2024-09-12 17:35:37 +02:00
2023-12-21 08:54:37 -05:00
2024-07-29 15:01:04 -06:00
2025-01-14 14:29:29 -06:00
2024-07-29 15:01:04 -06:00
2025-01-22 09:47:50 -06:00
2023-10-09 15:24:31 -04:00
2024-07-29 15:01:04 -06:00
2025-01-07 15:45:51 +02:00
2025-01-01 10:40:33 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2024-11-13 08:14:23 -06:00
2024-07-29 15:01:04 -06:00