Commit 645a575aeb384c7bf4ffb1204a93d140c0984fee

Authored by Marek Vasut
Committed by Marek Vasut
1 parent e5cb6bd9a2

mmc: tmio: Simplify pinmux handling

The SD UHS SDR12, SDR25, SDR50, SDR104, DDR50 and MMC HS200, HS400
modes all use 1.8V signaling, while all the legacy modes use 3.3V
signaling. While there are extra modes which use 1.2V signaling,
the existing hardware does not support those.

Simplify the pinmux such that 3.3V signaling implies legacy mode
pinmux and the rest implies UHS mode pinmux. This prevents the
massive case statement from growing further. Moreover, it fixes
an edge case where during SD 1.8V switch, the bus mode is still
set to default while the signaling is already set to 1.8V, which
results in an attempt to communicate with a 1.8V card using pins
in 3.3V mode and thus communication failure.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>

Showing 1 changed file with 3 additions and 19 deletions Side-by-side Diff

drivers/mmc/tmio-common.c
... ... @@ -622,26 +622,10 @@
622 622 #endif
623 623  
624 624 #ifdef CONFIG_PINCTRL
625   - switch (mmc->selected_mode) {
626   - case MMC_LEGACY:
627   - case SD_LEGACY:
628   - case MMC_HS:
629   - case SD_HS:
630   - case MMC_HS_52:
631   - case MMC_DDR_52:
632   - pinctrl_select_state(dev, "default");
633   - break;
634   - case UHS_SDR12:
635   - case UHS_SDR25:
636   - case UHS_SDR50:
637   - case UHS_DDR50:
638   - case UHS_SDR104:
639   - case MMC_HS_200:
  625 + if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
640 626 pinctrl_select_state(dev, "state_uhs");
641   - break;
642   - default:
643   - break;
644   - }
  627 + else
  628 + pinctrl_select_state(dev, "default");
645 629 #endif
646 630 }
647 631