Tegra SDHCI rerun pad calibration periodically
Subsystems (3)
cover Tegra SDHCI rerun pad calibration periodically
Hi all,
This series implements pad drive strength recalibration. The calibration is rerun to compensate possible changes in temperature. The calibration procedure is rerun as part of mmc_host_ops.request before sdhci_request() is run. The calibration is executed only if the 100 ms recalibration interval has passed.
This series depends on the "Tegra SDHCI add support for HS200 and UHS signaling" series.
Aapo Vienamo (2):
mmc: sdhci: Export sdhci_request()
mmc: tegra: Implement periodic pad calibration
drivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH 1/2 mmc: sdhci: Export sdhci_request()
Allow SDHCI drivers to hook code before and after sdhci_request() by making it externally visible.
--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
@@ -1636,7 +1636,7 @@ EXPORT_SYMBOL_GPL(sdhci_set_power);* * \*****************************************************************************/ -static void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) +void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) {struct sdhci_host *host;int present;
@@ -1675,6 +1675,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)mmiowb ();spin_unlock_irqrestore (&host->lock, flags); } +EXPORT_SYMBOL_GPL (sdhci_request);void sdhci_set_bus_width (struct sdhci_host *host,int width) {
drivers/mmc/host/sdhci.h +1 -0
@@ -729,6 +729,7 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode, unsigned short vdd);void sdhci_set_power_noreg (struct sdhci_host *host,unsigned char mode,unsigned short vdd); +void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq);void sdhci_set_bus_width (struct sdhci_host *host,int width);void sdhci_reset (struct sdhci_host *host,u8 mask);void sdhci_set_uhs_signaling (struct sdhci_host *host,unsigned timing);
Signature · 1 line
2.7.4
Re: [PATCH 1/2] mmc: sdhci: Export sdhci_request()
Quoted 4 lines · Aapo Vienamo
Allow SDHCI drivers to hook code before and after
sdhci_request()by making it externally visible.Signed-off-by Aapo Vienamo <[email protected]>
Quoted 39 lines
--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +2
-1@@ -1636,7 +1636,7 @@ EXPORT_SYMBOL_GPL(sdhci_set_power);* * \*****************************************************************************/ -static void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) +void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) {struct sdhci_host *host;int present;@@ -1675,6 +1675,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)mmiowb ();spin_unlock_irqrestore (&host->lock, flags); } +EXPORT_SYMBOL_GPL (sdhci_request);void sdhci_set_bus_width (struct sdhci_host *host,int width) {drivers/mmc/host/sdhci.h +1
-0@@ -729,6 +729,7 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode, unsigned short vdd);void sdhci_set_power_noreg (struct sdhci_host *host,unsigned char mode,unsigned short vdd); +void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq);void sdhci_set_bus_width (struct sdhci_host *host,int width);void sdhci_reset (struct sdhci_host *host,u8 mask);void sdhci_set_uhs_signaling (struct sdhci_host *host,unsigned timing);
Re: [PATCH 1/2] mmc: sdhci: Export sdhci_request()
In reply to Aapo VienamoQuoted 4 lines · Aapo Vienamo
Allow SDHCI drivers to hook code before and after
sdhci_request()by making it externally visible.Signed-off-by Aapo Vienamo <[email protected]>
This one happens to be useful for other variants but Tegras, hence I have applied this one for next. Thanks!
Thierry, you may thus drop this one from your PR. Also, you should probably base your pull request on top of my next branch, as I have already started to queue up some changes for sdhci.
Kind regards
Uffe
Quoted 41 lines
--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +2
-1@@ -1636,7 +1636,7 @@ EXPORT_SYMBOL_GPL(sdhci_set_power);* * \*****************************************************************************/ -static void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) +void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) {struct sdhci_host *host;int present;@@ -1675,6 +1675,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)mmiowb ();spin_unlock_irqrestore (&host->lock, flags); } +EXPORT_SYMBOL_GPL (sdhci_request);void sdhci_set_bus_width (struct sdhci_host *host,int width) {drivers/mmc/host/sdhci.h +1
-1@@ -729,6 +729,7 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode, unsigned short vdd);void sdhci_set_power_noreg (struct sdhci_host *host,unsigned char mode,unsigned short vdd); +void sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq);void sdhci_set_bus_width (struct sdhci_host *host,int width);void sdhci_reset (struct sdhci_host *host,u8 mask);void sdhci_set_uhs_signaling (struct sdhci_host *host,unsigned timing); --2.7.4
Re: [PATCH 1/2] mmc: sdhci: Export sdhci_request()
Quoted 4 lines · Ulf Hansson
Quoted 3 lines · Aapo Vienamo
Allow SDHCI drivers to hook code before and after
sdhci_request()by making it externally visible.
Quoted 8 lines
Quoted 1 line
Signed-off-by Aapo Vienamo <[email protected]>This one happens to be useful for other variants but Tegras, hence I have applied this one for next. Thanks!
Thierry, you may thus drop this one from your PR. Also, you should probably base your pull request on top of my next branch, as I have already started to queue up some changes for sdhci.
Will do that, thanks.
Thierry
PATCH 2/2 mmc: tegra: Implement periodic pad calibration
In reply to Aapo VienamoRerun the pad calibration procedure before sdhci_request() if the 100 ms recalibration interval has been exceeded.
--- drivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/mmc/host/sdhci-tegra.c +22 -0
@@ -30,6 +30,7 @@#include <linux/mmc/mmc.h> #include <linux/mmc/slot-gpio.h> #include <linux/gpio/consumer.h> +#include <linux/ktime.h> #include "sdhci-pltfm.h"
@@ -122,6 +123,7 @@ struct sdhci_tegra {struct pinctrl_state *pinctrl_state_1v8;struct sdhci_tegra_autocal_offsets autocal_offsets; +ktime_t last_calib;u32 default_tap;u32 default_trim;
@@ -533,6 +535,22 @@ static void tegra_sdhci_parse_pad_autocal_dt(struct sdhci_host *host) autocal->pull_down_hs400 = autocal->pull_down_1v8; } +static void tegra_sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) +{ +struct sdhci_host *host =mmc_priv (mmc); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_tegra *tegra_host =sdhci_pltfm_priv (pltfm_host); +ktime_t since_calib =ktime_sub (ktime_get (), tegra_host->last_calib); + +/* 100 ms calibration interval is specified in the TRM */ +if (ktime_to_ms (since_calib) >100 ) { +tegra_sdhci_pad_autocalib (host); + tegra_host->last_calib =ktime_get (); + } + +sdhci_request (mmc, mrq); +} +static void tegra_sdhci_parse_tap_and_trim (struct sdhci_host *host) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);
@@ -1014,6 +1032,10 @@ static int sdhci_tegra_probe(struct platform_device *pdev) sdhci_tegra_start_signal_voltage_switch; } +/* Hook to periodically rerun pad calibration */ +if (soc_data->nvquirks &NVQUIRK_HAS_PADCALIB ) + host->mmc_host_ops.request = tegra_sdhci_request; + host->mmc_host_ops.hs400_enhanced_strobe = tegra_sdhci_hs400_enhanced_strobe;
Signature · 1 line
2.7.4
Re: [PATCH 2/2] mmc: tegra: Implement periodic pad calibration
Quoted 4 lines · Aapo Vienamo
Rerun the pad calibration procedure before
sdhci_request()if the 100 ms recalibration interval has been exceeded.Signed-off-by Aapo Vienamo <[email protected]>
Quoted 59 lines
--- drivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/mmc/host/sdhci-tegra.c +22
-0@@ -30,6 +30,7 @@#include <linux/mmc/mmc.h> #include <linux/mmc/slot-gpio.h> #include <linux/gpio/consumer.h> +#include <linux/ktime.h> #include "sdhci-pltfm.h" @@ -122,6 +123,7 @@ struct sdhci_tegra {struct pinctrl_state *pinctrl_state_1v8;struct sdhci_tegra_autocal_offsets autocal_offsets; +ktime_t last_calib;u32 default_tap;u32 default_trim;@@ -533,6 +535,22 @@ static void tegra_sdhci_parse_pad_autocal_dt(struct sdhci_host *host) autocal->pull_down_hs400 = autocal->pull_down_1v8; } +static void tegra_sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) +{ +struct sdhci_host *host =mmc_priv (mmc); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_tegra *tegra_host =sdhci_pltfm_priv (pltfm_host); +ktime_t since_calib =ktime_sub (ktime_get (), tegra_host->last_calib); + +/* 100 ms calibration interval is specified in the TRM */ +if (ktime_to_ms (since_calib) >100 ) { +tegra_sdhci_pad_autocalib (host); + tegra_host->last_calib =ktime_get (); + } + +sdhci_request (mmc, mrq); +} +static void tegra_sdhci_parse_tap_and_trim (struct sdhci_host *host) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);@@ -1014,6 +1032,10 @@ static int sdhci_tegra_probe(struct platform_device *pdev) sdhci_tegra_start_signal_voltage_switch; } +/* Hook to periodically rerun pad calibration */ +if (soc_data->nvquirks &NVQUIRK_HAS_PADCALIB ) + host->mmc_host_ops.request = tegra_sdhci_request; + host->mmc_host_ops.hs400_enhanced_strobe = tegra_sdhci_hs400_enhanced_strobe;
Re: [PATCH 2/2] mmc: tegra: Implement periodic pad calibration
In reply to Aapo VienamoQuoted 7 lines · Aapo Vienamo
Rerun the pad calibration procedure before
sdhci_request()if the 100 ms recalibration interval has been exceeded.Signed-off-by Aapo Vienamo <[email protected]>--- drivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
Re: [PATCH 2/2] mmc: tegra: Implement periodic pad calibration
In reply to Aapo VienamoQuoted 4 lines · Aapo Vienamo
Rerun the pad calibration procedure before
sdhci_request()if the 100 ms recalibration interval has been exceeded.Signed-off-by Aapo Vienamo <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 61 lines
--- drivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/mmc/host/sdhci-tegra.c +22
-1@@ -30,6 +30,7 @@#include <linux/mmc/mmc.h> #include <linux/mmc/slot-gpio.h> #include <linux/gpio/consumer.h> +#include <linux/ktime.h> #include "sdhci-pltfm.h" @@ -122,6 +123,7 @@ struct sdhci_tegra {struct pinctrl_state *pinctrl_state_1v8;struct sdhci_tegra_autocal_offsets autocal_offsets; +ktime_t last_calib;u32 default_tap;u32 default_trim;@@ -533,6 +535,22 @@ static void tegra_sdhci_parse_pad_autocal_dt(struct sdhci_host *host) autocal->pull_down_hs400 = autocal->pull_down_1v8; } +static void tegra_sdhci_request (struct mmc_host *mmc,struct mmc_request *mrq) +{ +struct sdhci_host *host =mmc_priv (mmc); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_tegra *tegra_host =sdhci_pltfm_priv (pltfm_host); +ktime_t since_calib =ktime_sub (ktime_get (), tegra_host->last_calib); + +/* 100 ms calibration interval is specified in the TRM */ +if (ktime_to_ms (since_calib) >100 ) { +tegra_sdhci_pad_autocalib (host); + tegra_host->last_calib =ktime_get (); + } + +sdhci_request (mmc, mrq); +} +static void tegra_sdhci_parse_tap_and_trim (struct sdhci_host *host) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);@@ -1014,6 +1032,10 @@ static int sdhci_tegra_probe(struct platform_device *pdev) sdhci_tegra_start_signal_voltage_switch; } +/* Hook to periodically rerun pad calibration */ +if (soc_data->nvquirks &NVQUIRK_HAS_PADCALIB ) + host->mmc_host_ops.request = tegra_sdhci_request; + host->mmc_host_ops.hs400_enhanced_strobe = tegra_sdhci_hs400_enhanced_strobe; --2.7.4
Quoted 11 lines · Aapo Vienamo
Hi all,
This series implements pad drive strength recalibration. The calibration is rerun to compensate possible changes in temperature. The calibration procedure is rerun as part of mmc_host_ops.request before
sdhci_request()is run. The calibration is executed only if the 100 ms recalibration interval has passed.This series depends on the "Tegra SDHCI add support for HS200 and UHS signaling" series.
Quoted 8 lines
Aapo Vienamo (2):
mmc: sdhci: Exportsdhci_request()
mmc: tegra: Implement periodic pad calibrationdrivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-)
Adrian, Ulf,
Since this depends on the earlier, fairly large series, I could throw these on top of the branch I already have. That way you don't have to worry about the dependency yourself. Of course it's also fine if you want to apply this yourselves, in which case the series is:
Thanks,
Thierry
Quoted 28 lines · Thierry Reding
Quoted 11 lines · Aapo Vienamo
Hi all,
This series implements pad drive strength recalibration. The calibration is rerun to compensate possible changes in temperature. The calibration procedure is rerun as part of mmc_host_ops.request before
sdhci_request()is run. The calibration is executed only if the 100 ms recalibration interval has passed.This series depends on the "Tegra SDHCI add support for HS200 and UHS signaling" series.
Quoted 8 lines
Aapo Vienamo (2):
mmc: sdhci: Exportsdhci_request()
mmc: tegra: Implement periodic pad calibrationdrivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-)Adrian, Ulf,
Since this depends on the earlier, fairly large series, I could throw these on top of the branch I already have. That way you don't have to worry about the dependency yourself. Of course it's also fine if you want to apply this yourselves, in which case the series is:
Quoted 4 lines
Acked-by Thierry Reding <[email protected]>Thanks,
Thierry
Feel free to put in top in your branch and send a PR. BTW, Adrian has already acked these changes.
Kind regards
Uffe