On Thu, Aug 09, 2018 at 03:52:39PM +0300, Aapo Vienamo wrote: > On Thu, 9 Aug 2018 14:43:46 +0200 > Thierry Reding wrote: > > > On Wed, Aug 01, 2018 at 07:32:02PM +0300, Aapo Vienamo wrote: > > > Parse the pinctrl state and nvidia,only-1-8-v properties from the device > > > tree. Validate the pinctrl and regulator configuration before unmasking > > > UHS modes. Implement pad voltage state reconfiguration in the mmc > > > start_signal_voltage_switch() callback. Add NVQUIRK_NEEDS_PAD_CONTROL > > > and add set it for Tegra210 and Tegra186. > > > > > > The pad configuration is done in the mmc callback because the order of > > > pad reconfiguration and sdhci voltage switch depend on the voltage to > > > which the transition occurs. > > > > > > Signed-off-by: Aapo Vienamo > > > --- > > > drivers/mmc/host/sdhci-tegra.c | 138 ++++++++++++++++++++++++++++++++++++++--- > > > 1 file changed, 131 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c > > > index ddf00166..7d98455 100644 > > > --- a/drivers/mmc/host/sdhci-tegra.c > > > +++ b/drivers/mmc/host/sdhci-tegra.c > > > @@ -21,6 +21,8 @@ > > > #include > > > #include > > > #include > > > +#include > > > +#include > > > #include > > > #include > > > #include > > > @@ -55,6 +57,7 @@ > > > #define NVQUIRK_ENABLE_SDR104 BIT(4) > > > #define NVQUIRK_ENABLE_DDR50 BIT(5) > > > #define NVQUIRK_HAS_PADCALIB BIT(6) > > > +#define NVQUIRK_NEEDS_PAD_CONTROL BIT(7) > > > > > > struct sdhci_tegra_soc_data { > > > const struct sdhci_pltfm_data *pdata; > > > @@ -66,8 +69,12 @@ struct sdhci_tegra { > > > struct gpio_desc *power_gpio; > > > bool ddr_signaling; > > > bool pad_calib_required; > > > + bool pad_control_available; > > > > > > struct reset_control *rst; > > > + struct pinctrl *pinctrl_sdmmc; > > > + struct pinctrl_state *pinctrl_state_3v3; > > > + struct pinctrl_state *pinctrl_state_1v8; > > > }; > > > > > > static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) > > > @@ -138,12 +145,46 @@ static unsigned int tegra_sdhci_get_ro(struct sdhci_host *host) > > > return mmc_gpio_get_ro(host->mmc); > > > } > > > > > > +static bool tegra_sdhci_is_pad_and_regulator_valid(struct sdhci_host *host) > > > +{ > > > + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > > + struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host); > > > + int has_1v8, has_3v3; > > > > Can these be boolean? > > In some cases regulator_is_supported_voltage() can return a negative > error code. Okay, that's fine then. Thierry