Message ID | 1441135938-8056-3-git-send-email-vaibhav.hiremath@linaro.org |
---|---|
State | New |
Headers | show |
On Wed, 2 Sep 2015 01:02:17 +0530 Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > Currently, the sdhci_do_start_signal_voltage_switch() function invokes > controller specific voltage switch configuration only for 1.8v usecase; > but it is required for others as well. > > For example, in case of PXA1928 SDH controller, we need to set different > configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power > control register). > > Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> > --- > Note: > Currently ->voltage_switch() callback is only supported > in f_sdh30 driver. And I am not sure on the dependency of execution > sequence for that device. I could have moved ->voltage_switch() call > at one common place (above/below), but was not quite sure about it. > So, replicated/duplicated the call for other voltages. > > drivers/mmc/host/sdhci.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 3dd295f..b59b76d 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, > /* Wait for 5ms */ > usleep_range(5000, 5500); > > + /* Some controller need to do more when switching */ > + if (host->ops->voltage_switch) > + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330); Could this be implemented by regulator API? From patch set 3/3, the pxa1928 voltage_switch hook is to operate the IO pad registers, this seems not belong to the SDHC IP core. Thanks, Jisheng > + > /* 3.3V regulator output should be stable within 5 ms */ > ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); > if (!(ctrl & SDHCI_CTRL_VDD_180)) > @@ -1803,6 +1807,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, > return -EIO; > } > } > + /* Some controller need to do more when switching */ > + if (host->ops->voltage_switch) > + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_120); > + > return 0; > default: > /* No signal voltage switch required */ -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wednesday 02 September 2015 12:34 PM, Jisheng Zhang wrote: > On Wed, 2 Sep 2015 01:02:17 +0530 > Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > >> Currently, the sdhci_do_start_signal_voltage_switch() function invokes >> controller specific voltage switch configuration only for 1.8v usecase; >> but it is required for others as well. >> >> For example, in case of PXA1928 SDH controller, we need to set different >> configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power >> control register). >> >> Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> >> --- >> Note: >> Currently ->voltage_switch() callback is only supported >> in f_sdh30 driver. And I am not sure on the dependency of execution >> sequence for that device. I could have moved ->voltage_switch() call >> at one common place (above/below), but was not quite sure about it. >> So, replicated/duplicated the call for other voltages. >> >> drivers/mmc/host/sdhci.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >> index 3dd295f..b59b76d 100644 >> --- a/drivers/mmc/host/sdhci.c >> +++ b/drivers/mmc/host/sdhci.c >> @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, >> /* Wait for 5ms */ >> usleep_range(5000, 5500); >> >> + /* Some controller need to do more when switching */ >> + if (host->ops->voltage_switch) >> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330); > > Could this be implemented by regulator API? From patch set 3/3, the pxa1928 > voltage_switch hook is to operate the IO pad registers, this seems not belong > to the SDHC IP core. > Not quite sure whether regulator would be right fit for this. Initially I was thinking of making use of pinconf framework, using PIN_CONFIG_POWER_SOURCE, but that too I am not sure is the right way of doing it. Probably, question for pinctrl maintainer. Looping Linus Walleji. Also note that, this configuration is not applicable to all pins/pads, only handpicked pads have this configuration (voltage selection on pads). And this configuration is not part of the same register map. It is part of separate register map (AIB_EXT_REG_BASE), called IO domain power control register. And that Thanks, Vaibhav -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
On Wed, 2 Sep 2015 13:49:53 +0530 Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > > > On Wednesday 02 September 2015 12:34 PM, Jisheng Zhang wrote: > > On Wed, 2 Sep 2015 01:02:17 +0530 > > Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > > > >> Currently, the sdhci_do_start_signal_voltage_switch() function invokes > >> controller specific voltage switch configuration only for 1.8v usecase; > >> but it is required for others as well. > >> > >> For example, in case of PXA1928 SDH controller, we need to set different > >> configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power > >> control register). > >> > >> Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> > >> --- > >> Note: > >> Currently ->voltage_switch() callback is only supported > >> in f_sdh30 driver. And I am not sure on the dependency of execution > >> sequence for that device. I could have moved ->voltage_switch() call > >> at one common place (above/below), but was not quite sure about it. > >> So, replicated/duplicated the call for other voltages. > >> > >> drivers/mmc/host/sdhci.c | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > >> index 3dd295f..b59b76d 100644 > >> --- a/drivers/mmc/host/sdhci.c > >> +++ b/drivers/mmc/host/sdhci.c > >> @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, > >> /* Wait for 5ms */ > >> usleep_range(5000, 5500); > >> > >> + /* Some controller need to do more when switching */ > >> + if (host->ops->voltage_switch) > >> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330); > > > > Could this be implemented by regulator API? From patch set 3/3, the pxa1928 > > voltage_switch hook is to operate the IO pad registers, this seems not belong > > to the SDHC IP core. > > > > Not quite sure whether regulator would be right fit for this. From the patche[3/3], this can be achieved by abstracting the IO PAD as regulators then, we may not need to touch the core sdhci.c. But I'm not sure whether this is the good solution or not. sdhci Maintainers and experts may have better suggestions. > > Initially I was thinking of making use of pinconf framework, using > PIN_CONFIG_POWER_SOURCE, but that too I am not sure is the right way of > doing it. > > Probably, question for pinctrl maintainer. Looping Linus Walleji. > > Also note that, this configuration is not applicable to all pins/pads, > only handpicked pads have this configuration (voltage selection on > pads). > And this configuration is not part of the same register map. > > It is part of separate register map (AIB_EXT_REG_BASE), called IO > domain power control register. > And that > > Thanks, > Vaibhav -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wednesday 02 September 2015 01:56 PM, Jisheng Zhang wrote: > On Wed, 2 Sep 2015 13:49:53 +0530 > Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > >> >> >> On Wednesday 02 September 2015 12:34 PM, Jisheng Zhang wrote: >>> On Wed, 2 Sep 2015 01:02:17 +0530 >>> Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: >>> >>>> Currently, the sdhci_do_start_signal_voltage_switch() function invokes >>>> controller specific voltage switch configuration only for 1.8v usecase; >>>> but it is required for others as well. >>>> >>>> For example, in case of PXA1928 SDH controller, we need to set different >>>> configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power >>>> control register). >>>> >>>> Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> >>>> --- >>>> Note: >>>> Currently ->voltage_switch() callback is only supported >>>> in f_sdh30 driver. And I am not sure on the dependency of execution >>>> sequence for that device. I could have moved ->voltage_switch() call >>>> at one common place (above/below), but was not quite sure about it. >>>> So, replicated/duplicated the call for other voltages. >>>> >>>> drivers/mmc/host/sdhci.c | 8 ++++++++ >>>> 1 file changed, 8 insertions(+) >>>> >>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >>>> index 3dd295f..b59b76d 100644 >>>> --- a/drivers/mmc/host/sdhci.c >>>> +++ b/drivers/mmc/host/sdhci.c >>>> @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, >>>> /* Wait for 5ms */ >>>> usleep_range(5000, 5500); >>>> >>>> + /* Some controller need to do more when switching */ >>>> + if (host->ops->voltage_switch) >>>> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330); >>> >>> Could this be implemented by regulator API? From patch set 3/3, the pxa1928 >>> voltage_switch hook is to operate the IO pad registers, this seems not belong >>> to the SDHC IP core. >>> >> >> Not quite sure whether regulator would be right fit for this. > > From the patche[3/3], this can be achieved by abstracting the IO PAD as regulators > then, we may not need to touch the core sdhci.c. But I'm not sure whether this > is the good solution or not. Exactly... > sdhci Maintainers and experts may have better > suggestions. > Thats is the reason I stamped it as a RFC :) Thanks, Vaibhav -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[...] >>>> >>>> Could this be implemented by regulator API? From patch set 3/3, the >>>> pxa1928 >>>> voltage_switch hook is to operate the IO pad registers, this seems not >>>> belong >>>> to the SDHC IP core. >>>> >>> >>> Not quite sure whether regulator would be right fit for this. >> >> >> From the patche[3/3], this can be achieved by abstracting the IO PAD as >> regulators >> then, we may not need to touch the core sdhci.c. But I'm not sure whether >> this >> is the good solution or not. > > > Exactly... > >> sdhci Maintainers and experts may have better >> suggestions. >> > > Thats is the reason I stamped it as a RFC :) > [...] From an mmc core perspective it would be preferred if you implement this as a regulator (vqmmc). Especially since we will soon have an API for how to set the I/O voltages - and the intelligence within that API is not something we would like to implement for each and every host driver. https://lkml.org/lkml/2015/8/31/367 Kind regards Uffe -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 14 September 2015 03:00 PM, Ulf Hansson wrote: > [...] > >>>>> >>>>> Could this be implemented by regulator API? From patch set 3/3, the >>>>> pxa1928 >>>>> voltage_switch hook is to operate the IO pad registers, this seems not >>>>> belong >>>>> to the SDHC IP core. >>>>> >>>> >>>> Not quite sure whether regulator would be right fit for this. >>> >>> >>> From the patche[3/3], this can be achieved by abstracting the IO PAD as >>> regulators >>> then, we may not need to touch the core sdhci.c. But I'm not sure whether >>> this >>> is the good solution or not. >> >> >> Exactly... >> >>> sdhci Maintainers and experts may have better >>> suggestions. >>> >> >> Thats is the reason I stamped it as a RFC :) >> > > [...] > > From an mmc core perspective it would be preferred if you implement > this as a regulator (vqmmc). > > Especially since we will soon have an API for how to set the I/O > voltages - and the intelligence within that API is not something we > would like to implement for each and every host driver. > https://lkml.org/lkml/2015/8/31/367 > I would still consider this as a regulator specific and may not address the IO configuration within the SoC which are module specific. The API regulator_set_voltage_triplet() will not have intelligence to differentiate whether the call is coming from MMC or somewhere else. Note that, the IO pad voltage configuration which I am referring to is MMC specific and applicable only when pad is configured in MMC mode. So technically it is not simply common pad voltage configuration. And I am still not sure regulator framework would be right fit for this. Pinctrl would have been right fit, but...since I saw f_sdh30 driver is already doing this, which is easy fit; so adopted the same. Thanks, Vaibhav -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 14 September 2015 at 11:42, Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > > > On Monday 14 September 2015 03:00 PM, Ulf Hansson wrote: >> >> [...] >> >>>>>> >>>>>> Could this be implemented by regulator API? From patch set 3/3, the >>>>>> pxa1928 >>>>>> voltage_switch hook is to operate the IO pad registers, this seems not >>>>>> belong >>>>>> to the SDHC IP core. >>>>>> >>>>> >>>>> Not quite sure whether regulator would be right fit for this. >>>> >>>> >>>> >>>> From the patche[3/3], this can be achieved by abstracting the IO PAD >>>> as >>>> regulators >>>> then, we may not need to touch the core sdhci.c. But I'm not sure >>>> whether >>>> this >>>> is the good solution or not. >>> >>> >>> >>> Exactly... >>> >>>> sdhci Maintainers and experts may have better >>>> suggestions. >>>> >>> >>> Thats is the reason I stamped it as a RFC :) >>> >> >> [...] >> >> From an mmc core perspective it would be preferred if you implement >> this as a regulator (vqmmc). >> >> Especially since we will soon have an API for how to set the I/O >> voltages - and the intelligence within that API is not something we >> would like to implement for each and every host driver. >> https://lkml.org/lkml/2015/8/31/367 >> > > > I would still consider this as a regulator specific and may not address > the IO configuration within the SoC which are module specific. > The API regulator_set_voltage_triplet() will not have intelligence to > differentiate whether the call is coming from MMC or somewhere else. > > Note that, the IO pad voltage configuration which I am referring to is > MMC specific and applicable only when pad is configured in MMC mode. So > technically it is not simply common pad voltage configuration. > > > And I am still not sure regulator framework would be right fit for > this. Pinctrl would have been right fit, but...since I saw f_sdh30 > driver is already doing this, which is easy fit; so adopted the same. Pinctrl would work as well, or perhaps a combination of both pinctrl and a regulator. What I don't like is the solution you have suggested in patch3. Kind regards Uffe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
On Monday 14 September 2015 04:04 PM, Ulf Hansson wrote: > On 14 September 2015 at 11:42, Vaibhav Hiremath > <vaibhav.hiremath@linaro.org> wrote: >> >> >> On Monday 14 September 2015 03:00 PM, Ulf Hansson wrote: >>> >>> [...] >>> >>>>>>> >>>>>>> Could this be implemented by regulator API? From patch set 3/3, the >>>>>>> pxa1928 >>>>>>> voltage_switch hook is to operate the IO pad registers, this seems not >>>>>>> belong >>>>>>> to the SDHC IP core. >>>>>>> >>>>>> >>>>>> Not quite sure whether regulator would be right fit for this. >>>>> >>>>> >>>>> >>>>> From the patche[3/3], this can be achieved by abstracting the IO PAD >>>>> as >>>>> regulators >>>>> then, we may not need to touch the core sdhci.c. But I'm not sure >>>>> whether >>>>> this >>>>> is the good solution or not. >>>> >>>> >>>> >>>> Exactly... >>>> >>>>> sdhci Maintainers and experts may have better >>>>> suggestions. >>>>> >>>> >>>> Thats is the reason I stamped it as a RFC :) >>>> >>> >>> [...] >>> >>> From an mmc core perspective it would be preferred if you implement >>> this as a regulator (vqmmc). >>> >>> Especially since we will soon have an API for how to set the I/O >>> voltages - and the intelligence within that API is not something we >>> would like to implement for each and every host driver. >>> https://lkml.org/lkml/2015/8/31/367 >>> >> >> >> I would still consider this as a regulator specific and may not address >> the IO configuration within the SoC which are module specific. >> The API regulator_set_voltage_triplet() will not have intelligence to >> differentiate whether the call is coming from MMC or somewhere else. >> >> Note that, the IO pad voltage configuration which I am referring to is >> MMC specific and applicable only when pad is configured in MMC mode. So >> technically it is not simply common pad voltage configuration. >> >> >> And I am still not sure regulator framework would be right fit for >> this. Pinctrl would have been right fit, but...since I saw f_sdh30 >> driver is already doing this, which is easy fit; so adopted the same. > > Pinctrl would work as well, or perhaps a combination of both pinctrl > and a regulator. Not sure, how I can propagate "call coming from MMC/SD" to both regulator and pinctrl. Probably pinctrl would already know, but then it doesn't know the voltage settings. Let me spend some time, but atleast at this point I am not sure. > > What I don't like is the solution you have suggested in patch3. > As I said, that was easy fit into existing implementation. :) f_sdh30 already does something similar. Thanks, Vaibhav -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 14 September 2015 06:11 PM, Vaibhav Hiremath wrote: > > > On Monday 14 September 2015 04:04 PM, Ulf Hansson wrote: >> On 14 September 2015 at 11:42, Vaibhav Hiremath >> <vaibhav.hiremath@linaro.org> wrote: >>> >>> >>> On Monday 14 September 2015 03:00 PM, Ulf Hansson wrote: >>>> >>>> [...] >>>> >>>>>>>> >>>>>>>> Could this be implemented by regulator API? From patch set 3/3, the >>>>>>>> pxa1928 >>>>>>>> voltage_switch hook is to operate the IO pad registers, this >>>>>>>> seems not >>>>>>>> belong >>>>>>>> to the SDHC IP core. >>>>>>>> >>>>>>> >>>>>>> Not quite sure whether regulator would be right fit for this. >>>>>> >>>>>> >>>>>> >>>>>> From the patche[3/3], this can be achieved by abstracting the >>>>>> IO PAD >>>>>> as >>>>>> regulators >>>>>> then, we may not need to touch the core sdhci.c. But I'm not sure >>>>>> whether >>>>>> this >>>>>> is the good solution or not. >>>>> >>>>> >>>>> >>>>> Exactly... >>>>> >>>>>> sdhci Maintainers and experts may have better >>>>>> suggestions. >>>>>> >>>>> >>>>> Thats is the reason I stamped it as a RFC :) >>>>> >>>> >>>> [...] >>>> >>>> From an mmc core perspective it would be preferred if you implement >>>> this as a regulator (vqmmc). >>>> >>>> Especially since we will soon have an API for how to set the I/O >>>> voltages - and the intelligence within that API is not something we >>>> would like to implement for each and every host driver. >>>> https://lkml.org/lkml/2015/8/31/367 >>>> >>> >>> >>> I would still consider this as a regulator specific and may not address >>> the IO configuration within the SoC which are module specific. >>> The API regulator_set_voltage_triplet() will not have intelligence to >>> differentiate whether the call is coming from MMC or somewhere else. >>> >>> Note that, the IO pad voltage configuration which I am referring to is >>> MMC specific and applicable only when pad is configured in MMC mode. So >>> technically it is not simply common pad voltage configuration. >>> >>> >>> And I am still not sure regulator framework would be right fit for >>> this. Pinctrl would have been right fit, but...since I saw f_sdh30 >>> driver is already doing this, which is easy fit; so adopted the same. >> >> Pinctrl would work as well, or perhaps a combination of both pinctrl >> and a regulator. > > > Not sure, how I can propagate "call coming from MMC/SD" to both > regulator and pinctrl. > Probably pinctrl would already know, but then it doesn't know the > voltage settings. > > Let me spend some time, but atleast at this point I am not sure. > >> On the side note, Lets park this patch aside, till I get back with better option. It would be nice if you could review other patches, let them notget blocked due to this. Thanks, Vaibhav -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Sep 2, 2015 at 1:19 AM, Vaibhav Hiremath <vaibhav.hiremath@linaro.org> wrote: > Not quite sure whether regulator would be right fit for this. > > Initially I was thinking of making use of pinconf framework, using > PIN_CONFIG_POWER_SOURCE, but that too I am not sure is the right way of > doing it. > > Probably, question for pinctrl maintainer. Looping Linus Walleji. We have another pinctrl driver exposing the occasional fixed regulator for exactly this purpose, see: sh-pfc/pfc-sh73a0.c So use the same mechanism for this driver. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 3dd295f..b59b76d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, /* Wait for 5ms */ usleep_range(5000, 5500); + /* Some controller need to do more when switching */ + if (host->ops->voltage_switch) + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330); + /* 3.3V regulator output should be stable within 5 ms */ ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); if (!(ctrl & SDHCI_CTRL_VDD_180)) @@ -1803,6 +1807,10 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, return -EIO; } } + /* Some controller need to do more when switching */ + if (host->ops->voltage_switch) + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_120); + return 0; default: /* No signal voltage switch required */
Currently, the sdhci_do_start_signal_voltage_switch() function invokes controller specific voltage switch configuration only for 1.8v usecase; but it is required for others as well. For example, in case of PXA1928 SDH controller, we need to set different configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power control register). Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> --- Note: Currently ->voltage_switch() callback is only supported in f_sdh30 driver. And I am not sure on the dependency of execution sequence for that device. I could have moved ->voltage_switch() call at one common place (above/below), but was not quite sure about it. So, replicated/duplicated the call for other voltages. drivers/mmc/host/sdhci.c | 8 ++++++++ 1 file changed, 8 insertions(+)