sdhci patches
Subsystems (13)
Adrian Hunter
maintainercover sdhci patches
Hi
Here are some sdhci patches that include preparation for CQE and some general improvements. Patches such as:
mmc: sdhci: Let drivers decide whether to use mmc_retune_needed() with pm
mmc: sdhci: Do not use spin lock in set_ios paths
affect several drivers specifically, like:
drivers/mmc/host/sdhci-brcmstb.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-of-arasan.c
drivers/mmc/host/sdhci-of-at91.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pxav3.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sirf.c
drivers/mmc/host/sdhci-spear.c
drivers/mmc/host/sdhci-st.c
Adrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts in sdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to use mmc_retune_needed() with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock in set_ios paths
mmc: sdhci: Reduce spin lock usage in sdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Use sdhci_readl() not readl() in sdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Export sdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Add sdhci_cleanup_host
mmc: sdhci: Factor out sdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declaration
drivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 + drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)
Regards
Adrian
Adrian Hunter
maintainerPATCH 1/25 mmc: sdhci: Do not disable interrupts while waiting for clock
Disabling interrupts for even a millisecond can cause problems for some devices. That can happen when sdhci changes clock frequency because it waits for the clock to become stable under a spin lock.
The spin lock is not necessary here. Anything that is racing with changes to the I/O state is already broken. The mmc core already provides synchronization via "claiming" the host.
Although the spin lock probably should be removed from the code paths that lead to this point, such a patch would touch too much code to be suitable for stable trees. Consequently, for this patch, just drop the spin lock while waiting.
--- drivers/mmc/host/sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +3 -1
@@ -1362,7 +1362,9 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk)return ; } timeout--; -mdelay (1 ); +spin_unlock_irq (&host->lock); +usleep_range (900 ,1100 ); +spin_lock_irq (&host->lock); } clk |=SDHCI_CLOCK_CARD_EN ;
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 2/25 mmc: sdhci-pci: Do not disable interrupts in sdhci_intel_set_power
In reply to Adrian HunterDisabling interrupts for even a millisecond can cause problems for some devices. That can happen when Intel host controllers wait for the present state to propagate.
The spin lock is not necessary here. Anything that is racing with changes to the I/O state is already broken. The mmc core already provides synchronization via "claiming" the host.
Although the spin lock probably should be removed from the code paths that lead to this point, such a patch would touch too much code to be suitable for stable trees. Consequently, for this patch, just drop the spin lock while waiting.
--- drivers/mmc/host/sdhci-pci-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +4 -0
@@ -451,6 +451,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,if (mode ==MMC_POWER_OFF )return ; +spin_unlock_irq (&host->lock); +/* * Bus power might not enable after D3 -> D0 transition due to the * present state not yet having propagated. Retry for up to 2ms.
@@ -463,6 +465,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, reg |=SDHCI_POWER_ON ;sdhci_writeb (host, reg,SDHCI_POWER_CONTROL ); } + +spin_lock_irq (&host->lock); }static const struct sdhci_ops sdhci_intel_byt_ops = {
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 3/25 mmc: sdhci: Optimize delay loops
In reply to Adrian HunterThe delay loops for reset and clock enable always take at least 1 ms because they use mdelay(1). However they can take a lot less time e.g. less than 50us. Use ktime and reduce the delay to 10 microseconds per loop.
--- drivers/mmc/host/sdhci.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/mmc/host/sdhci.c +9 -10
@@ -14,6 +14,7 @@*/ #include <linux/delay.h> +#include <linux/ktime.h> #include <linux/highmem.h> #include <linux/io.h> #include <linux/module.h>
@@ -165,7 +166,7 @@ static void sdhci_runtime_pm_bus_off(struct sdhci_host *host)void sdhci_reset (struct sdhci_host *host,u8 mask) { -unsigned long timeout; +ktime_t timeout;sdhci_writeb (host, mask,SDHCI_SOFTWARE_RESET );
@@ -177,18 +178,17 @@ void sdhci_reset(struct sdhci_host *host, u8 mask) }/* Wait max 100 ms */ - timeout =100 ; + timeout =ktime_add_ms (ktime_get (),100 );/* hw clears the bit when it's done */ while (sdhci_readb (host,SDHCI_SOFTWARE_RESET ) & mask) { -if (timeout ==0 ) { +if (ktime_after (ktime_get (), timeout)) {pr_err ("%s: Reset 0x%x never completed.\n" ,mmc_hostname (host->mmc), (int )mask);sdhci_dumpregs (host);return ; } - timeout--; -mdelay (1 ); +udelay (10 ); } }EXPORT_SYMBOL_GPL (sdhci_reset);
@@ -1346,24 +1346,23 @@ u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock,void sdhci_enable_clk (struct sdhci_host *host,u16 clk) { -unsigned long timeout; +ktime_t timeout; clk |=SDHCI_CLOCK_INT_EN ;sdhci_writew (host, clk,SDHCI_CLOCK_CONTROL );/* Wait max 20 ms */ - timeout =20 ; + timeout =ktime_add_ms (ktime_get (),20 );while (!((clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL )) &SDHCI_CLOCK_INT_STABLE )) { -if (timeout ==0 ) { +if (ktime_after (ktime_get (), timeout)) {pr_err ("%s: Internal clock never stabilised.\n" ,mmc_hostname (host->mmc));sdhci_dumpregs (host);return ; } - timeout--;spin_unlock_irq (&host->lock); -usleep_range (900 ,1100 ); +udelay (10 );spin_lock_irq (&host->lock); }
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 4/25 mmc: sdhci: Let drivers decide whether to use mmc_retune_needed() with pm
In reply to Adrian HunterDevices might save and restore tuning values so that re-tuning might not be needed after a pm transition. Let drivers decide by pushing the mmc_retune_needed() logic down to them.
--- drivers/mmc/host/sdhci-acpi.c | 12 ++++++++++-- drivers/mmc/host/sdhci-brcmstb.c | 3 +++ drivers/mmc/host/sdhci-esdhc-imx.c | 6 ++++++ drivers/mmc/host/sdhci-of-arasan.c | 3 +++ drivers/mmc/host/sdhci-of-at91.c | 3 +++ drivers/mmc/host/sdhci-of-esdhc.c | 3 +++ drivers/mmc/host/sdhci-pci-core.c | 22 ++++++++++++++++++---- drivers/mmc/host/sdhci-pci.h | 2 ++ drivers/mmc/host/sdhci-pltfm.c | 3 +++ drivers/mmc/host/sdhci-pxav3.c | 5 +++++ drivers/mmc/host/sdhci-s3c.c | 6 ++++++ drivers/mmc/host/sdhci-sirf.c | 3 +++ drivers/mmc/host/sdhci-spear.c | 3 +++ drivers/mmc/host/sdhci-st.c | 6 +++++- drivers/mmc/host/sdhci.c | 4 ---- 15 files changed, 73 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci-acpi.c +10 -2
@@ -524,8 +524,12 @@ static int sdhci_acpi_remove(struct platform_device *pdev)static int sdhci_acpi_suspend (struct device *dev) {struct sdhci_acpi_host *c =dev_get_drvdata (dev); +struct sdhci_host *host = c->host; -return sdhci_suspend_host (c->host); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + +return sdhci_suspend_host (host); }static int sdhci_acpi_resume (struct device *dev)
@@ -544,8 +548,12 @@ static int sdhci_acpi_resume(struct device *dev)static int sdhci_acpi_runtime_suspend (struct device *dev) {struct sdhci_acpi_host *c =dev_get_drvdata (dev); +struct sdhci_host *host = c->host; + +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); -return sdhci_runtime_suspend_host (c->host); +return sdhci_runtime_suspend_host (host); }static int sdhci_acpi_runtime_resume (struct device *dev)
drivers/mmc/host/sdhci-brcmstb.c +3 -0
@@ -29,6 +29,9 @@ static int sdhci_brcmstb_suspend(struct device *dev)struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);int res; +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + res =sdhci_suspend_host (host);if (res)return res;
drivers/mmc/host/sdhci-esdhc-imx.c +6 -0
@@ -1322,6 +1322,9 @@ static int sdhci_esdhc_suspend(struct device *dev) {struct sdhci_host *host =dev_get_drvdata (dev); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +return sdhci_suspend_host (host); }
@@ -1346,6 +1349,9 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev) ret =sdhci_runtime_suspend_host (host); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +if (!sdhci_sdio_irq_enabled (host)) {clk_disable_unprepare (imx_data->clk_per);clk_disable_unprepare (imx_data->clk_ipg);
drivers/mmc/host/sdhci-of-arasan.c +3 -0
@@ -315,6 +315,9 @@ static int sdhci_arasan_suspend(struct device *dev)struct sdhci_arasan_data *sdhci_arasan =sdhci_pltfm_priv (pltfm_host);int ret; +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + ret =sdhci_suspend_host (host);if (ret)return ret;
drivers/mmc/host/sdhci-of-at91.c +3 -0
@@ -131,6 +131,9 @@ static int sdhci_at91_runtime_suspend(struct device *dev) ret =sdhci_runtime_suspend_host (host); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +clk_disable_unprepare (priv->gck);clk_disable_unprepare (priv->hclock);clk_disable_unprepare (priv->mainck);
drivers/mmc/host/sdhci-of-esdhc.c +3 -0
@@ -528,6 +528,9 @@ static int esdhc_of_suspend(struct device *dev) esdhc_proctl =sdhci_readl (host,SDHCI_HOST_CONTROL ); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +return sdhci_suspend_host (host); }
drivers/mmc/host/sdhci-pci-core.c +18 -4
@@ -1653,6 +1653,7 @@ static int sdhci_pci_suspend(struct device *dev)struct pci_dev *pdev =to_pci_dev (dev);struct sdhci_pci_chip *chip;struct sdhci_pci_slot *slot; +struct sdhci_host *host;mmc_pm_flag_t slot_pm_flags;mmc_pm_flag_t pm_flags =0 ;int i, ret;
@@ -1666,14 +1667,19 @@ static int sdhci_pci_suspend(struct device *dev)if (!slot)continue ; - ret =sdhci_suspend_host (slot->host); + host = slot->host; + +if (chip->pm_retune && host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + + ret =sdhci_suspend_host (host);if (ret) goto err_pci_suspend; - slot_pm_flags = slot->host->mmc->pm_flags; + slot_pm_flags = host->mmc->pm_flags;if (slot_pm_flags &MMC_PM_WAKE_SDIO_IRQ ) -sdhci_enable_irq_wakeups (slot->host); +sdhci_enable_irq_wakeups (host); pm_flags |= slot_pm_flags; }
@@ -1737,6 +1743,7 @@ static int sdhci_pci_runtime_suspend(struct device *dev)struct pci_dev *pdev =to_pci_dev (dev);struct sdhci_pci_chip *chip;struct sdhci_pci_slot *slot; +struct sdhci_host *host;int i, ret; chip =pci_get_drvdata (pdev);
@@ -1748,10 +1755,15 @@ static int sdhci_pci_runtime_suspend(struct device *dev)if (!slot)continue ; - ret =sdhci_runtime_suspend_host (slot->host); + host = slot->host; + ret =sdhci_runtime_suspend_host (host);if (ret) goto err_pci_runtime_suspend; + +if (chip->rpm_retune && + host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); }if (chip->fixes && chip->fixes->suspend) {
@@ -2042,6 +2054,8 @@ static int sdhci_pci_probe(struct pci_dev *pdev, chip->allow_runtime_pm = chip->fixes->allow_runtime_pm; } chip->num_slots = slots; + chip->pm_retune = true; + chip->rpm_retune = true;pci_set_drvdata (pdev, chip);
drivers/mmc/host/sdhci-pci.h +2 -0
@@ -97,6 +97,8 @@ struct sdhci_pci_chip {unsigned int quirks;unsigned int quirks2;bool allow_runtime_pm; +bool pm_retune; +bool rpm_retune;const struct sdhci_pci_fixes *fixes;int num_slots;/* Slots on controller */
drivers/mmc/host/sdhci-pltfm.c +3 -0
@@ -213,6 +213,9 @@ static int sdhci_pltfm_suspend(struct device *dev) {struct sdhci_host *host =dev_get_drvdata (dev); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +return sdhci_suspend_host (host); }
drivers/mmc/host/sdhci-pxav3.c +5 -0
@@ -527,6 +527,8 @@ static int sdhci_pxav3_suspend(struct device *dev)struct sdhci_host *host =dev_get_drvdata (dev);pm_runtime_get_sync (dev); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); ret =sdhci_suspend_host (host);pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev);
@@ -560,6 +562,9 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)if (ret)return ret; +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +clk_disable_unprepare (pxa->clk_io);if (!IS_ERR (pxa->clk_core))clk_disable_unprepare (pxa->clk_core);
drivers/mmc/host/sdhci-s3c.c +6 -0
@@ -743,6 +743,9 @@ static int sdhci_s3c_suspend(struct device *dev) {struct sdhci_host *host =dev_get_drvdata (dev); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +return sdhci_suspend_host (host); }
@@ -764,6 +767,9 @@ static int sdhci_s3c_runtime_suspend(struct device *dev) ret =sdhci_runtime_suspend_host (host); +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); +if (ourhost->cur_clk >=0 )clk_disable_unprepare (ourhost->clk_bus[ourhost->cur_clk]);clk_disable_unprepare (busclk);
drivers/mmc/host/sdhci-sirf.c +3 -0
@@ -237,6 +237,9 @@ static int sdhci_sirf_suspend(struct device *dev)struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);int ret; +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + ret =sdhci_suspend_host (host);if (ret)return ret;
drivers/mmc/host/sdhci-spear.c +3 -0
@@ -165,6 +165,9 @@ static int sdhci_suspend(struct device *dev)struct spear_sdhci *sdhci =sdhci_priv (host);int ret; +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + ret =sdhci_suspend_host (host);if (!ret)clk_disable (sdhci->clk);
drivers/mmc/host/sdhci-st.c +5 -1
@@ -460,8 +460,12 @@ static int sdhci_st_suspend(struct device *dev)struct sdhci_host *host =dev_get_drvdata (dev);struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct st_mmc_platform_data *pdata =sdhci_pltfm_priv (pltfm_host); -int ret =sdhci_suspend_host (host); +int ret; + +if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + ret =sdhci_suspend_host (host);if (ret) goto out;
drivers/mmc/host/sdhci.c +0 -4
@@ -2851,8 +2851,6 @@ int sdhci_suspend_host(struct sdhci_host *host)sdhci_disable_card_detection (host);mmc_retune_timer_stop (host->mmc); -if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) -mmc_retune_needed (host->mmc);if (!device_may_wakeup (mmc_dev (host->mmc))) { host->ier =0 ;
@@ -2913,8 +2911,6 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host)unsigned long flags;mmc_retune_timer_stop (host->mmc); -if (host->tuning_mode !=SDHCI_TUNING_MODE_3 ) -mmc_retune_needed (host->mmc);spin_lock_irqsave (&host->lock, flags); host->ier &=SDHCI_INT_CARD_INT ;
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 5/25 mmc: sdhci-pci: Let devices define their own private data
In reply to Adrian HunterLet devices define their own private data to facilitate device-specific operations. The size of the private structure is specified in the sdhci_pci_fixes structure, then sdhci_pci_probe_slot() will allocate extra space for it, and sdhci_pci_priv() can be used to get a reference to it.
--- drivers/mmc/host/sdhci-pci-core.c | 3 ++- drivers/mmc/host/sdhci-pci.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +2 -1
@@ -1830,6 +1830,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(struct sdhci_pci_slot *slot;struct sdhci_host *host;int ret, bar = first_bar + slotno; +size_t priv_size = chip->fixes ? chip->fixes->priv_size :0 ;if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) {dev_err (&pdev->dev,"BAR %d is not iomem. Aborting.\n" , bar);
@@ -1851,7 +1852,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(return ERR_PTR (-ENODEV ); } - host =sdhci_alloc_host (&pdev->dev,sizeof (struct sdhci_pci_slot )); + host =sdhci_alloc_host (&pdev->dev,sizeof (*slot) + priv_size);if (IS_ERR (host)) {dev_err (&pdev->dev,"cannot allocate host\n" );return ERR_CAST (host);
drivers/mmc/host/sdhci-pci.h +7 -0
@@ -70,6 +70,7 @@ struct sdhci_pci_fixes {int (*resume) (struct sdhci_pci_chip *);const struct sdhci_ops *ops; +size_t priv_size; };struct sdhci_pci_slot {
@@ -89,6 +90,7 @@ struct sdhci_pci_slot {struct mmc_card *card, unsigned int max_dtr, int host_drv, int card_drv, int *drv_type); +unsigned long private[0 ]____cacheline_aligned ; };struct sdhci_pci_chip {
@@ -105,4 +107,9 @@ struct sdhci_pci_chip { struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */ }; +static inline void *sdhci_pci_priv (struct sdhci_pci_slot *slot) +{ +return (void *)slot->private; +} +#endif /* __SDHCI_PCI_H */
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 6/25 mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
In reply to Adrian HunterMake use of an Intel ACPI _DSM that indicates if re-tuning is needed after D3.
--- drivers/mmc/host/sdhci-pci-core.c | 90 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +90 -0
@@ -259,6 +259,77 @@ static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot) .probe_slot = pch_hc_probe_slot, }; +enum { +INTEL_DSM_FNS =0 , +INTEL_DSM_D3_RETUNE =10 , +}; + +struct intel_host { +u32 dsm_fns; +bool d3_retune; +}; + +const u8 intel_dsm_uuid[] = { +0xA5 ,0x3E ,0xC1 ,0xF6 ,0xCD ,0x65 ,0x1F ,0x46 , +0xAB ,0x7A ,0x29 ,0xF7 ,0xE8 ,0xD5 ,0xBD ,0x61 , +}; + +static int __intel_dsm (struct intel_host *intel_host,struct device *dev, +unsigned int fn,u32 *result) +{ +union acpi_object *obj; +int err =0 ; + + obj =acpi_evaluate_dsm (ACPI_HANDLE (dev), intel_dsm_uuid,0 , fn,NULL ); +if (!obj) +return -EOPNOTSUPP ; + +if (obj->type !=ACPI_TYPE_BUFFER || obj->buffer.length <1 ) { + err = -EINVAL ; + goto out; + } + +if (obj->buffer.length >=4 ) + *result = *(u32 *)obj->buffer.pointer; +else if (obj->buffer.length >=2 ) + *result = *(u16 *)obj->buffer.pointer; +else + *result = *(u8 *)obj->buffer.pointer; +out: +ACPI_FREE (obj); + +return err; +} + +static int intel_dsm (struct intel_host *intel_host,struct device *dev, +unsigned int fn,u32 *result) +{ +if (fn >31 || !(intel_host->dsm_fns & (1 << fn))) +return -EOPNOTSUPP ; + +return __intel_dsm (intel_host, dev, fn, result); +} + +static void intel_dsm_init (struct intel_host *intel_host,struct device *dev, +struct mmc_host *mmc) +{ +int err; +u32 val; + + err =__intel_dsm (intel_host, dev,INTEL_DSM_FNS , &intel_host->dsm_fns); +if (err) { +pr_debug ("%s: DSM not supported, error %d\n" , +mmc_hostname (mmc), err); +return ; + } + +pr_debug ("%s: DSM function mask %#x\n" , +mmc_hostname (mmc), intel_host->dsm_fns); + + err =intel_dsm (intel_host, dev,INTEL_DSM_D3_RETUNE , &val); + intel_host->d3_retune = err ? true : !!val; +} +static void sdhci_pci_int_hw_reset (struct sdhci_host *host) {u8 reg;
@@ -359,8 +430,19 @@ static int bxt_get_cd(struct mmc_host *mmc)return ret; } +static void byt_read_dsm (struct sdhci_pci_slot *slot) +{ +struct intel_host *intel_host =sdhci_pci_priv (slot); +struct device *dev = &slot->chip->pdev->dev; +struct mmc_host *mmc = slot->host->mmc; + +intel_dsm_init (intel_host, dev, mmc); + slot->chip->rpm_retune = intel_host->d3_retune; +} +static int byt_emmc_probe_slot (struct sdhci_pci_slot *slot) { +byt_read_dsm (slot); slot->host->mmc->caps |=MMC_CAP_8_BIT_DATA |MMC_CAP_NONREMOVABLE |MMC_CAP_HW_RESET |MMC_CAP_1_8V_DDR | MMC_CAP_CMD_DURING_TFR |
@@ -405,6 +487,8 @@ static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot) {int err; +byt_read_dsm (slot); + err =ni_set_max_freq (slot);if (err)return err;
@@ -416,6 +500,7 @@ static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot)static int byt_sdio_probe_slot (struct sdhci_pci_slot *slot) { +byt_read_dsm (slot); slot->host->mmc->caps |=MMC_CAP_POWER_OFF_CARD |MMC_CAP_NONREMOVABLE |MMC_CAP_WAIT_WHILE_BUSY ;return 0 ;
@@ -423,6 +508,7 @@ static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)static int byt_sd_probe_slot (struct sdhci_pci_slot *slot) { +byt_read_dsm (slot); slot->host->mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY ; slot->cd_idx =0 ; slot->cd_override_level = true;
@@ -488,6 +574,7 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 | SDHCI_QUIRK2_STOP_WITH_TC, .ops = &sdhci_intel_byt_ops, + .priv_size = sizeof(struct intel_host), };static const struct sdhci_pci_fixes sdhci_ni_byt_sdio = {
@@ -497,6 +584,7 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, .allow_runtime_pm = true, .probe_slot = ni_byt_sdio_probe_slot, .ops = &sdhci_intel_byt_ops, + .priv_size = sizeof(struct intel_host), };static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
@@ -506,6 +594,7 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, .allow_runtime_pm = true, .probe_slot = byt_sdio_probe_slot, .ops = &sdhci_intel_byt_ops, + .priv_size = sizeof(struct intel_host), };static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
@@ -517,6 +606,7 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, .own_cd_for_runtime_pm = true, .probe_slot = byt_sd_probe_slot, .ops = &sdhci_intel_byt_ops, + .priv_size = sizeof(struct intel_host), };/* Define Host controllers for Intel Merrifield platform */
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 7/25 mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
In reply to Adrian HunterMake use of an Intel ACPI _DSM that provides eMMC driver strength.
--- drivers/mmc/host/sdhci-pci-core.c | 77 +++++++-------------------------------- drivers/mmc/host/sdhci-pci-data.c | 3 -- 2 files changed, 14 insertions(+), 66 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +14 -63
@@ -261,11 +261,13 @@ static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot)enum {INTEL_DSM_FNS =0 , +INTEL_DSM_DRV_STRENGTH =9 ,INTEL_DSM_D3_RETUNE =10 , };struct intel_host {u32 dsm_fns; +int drv_strength;bool d3_retune; };
@@ -326,6 +328,9 @@ static void intel_dsm_init(struct intel_host *intel_host, struct device *dev,pr_debug ("%s: DSM function mask %#x\n" ,mmc_hostname (mmc), intel_host->dsm_fns); + err =intel_dsm (intel_host, dev,INTEL_DSM_DRV_STRENGTH , &val); + intel_host->drv_strength = err ?0 : val; + err =intel_dsm (intel_host, dev,INTEL_DSM_D3_RETUNE , &val); intel_host->d3_retune = err ? true : !!val; }
@@ -345,67 +350,15 @@ static void sdhci_pci_int_hw_reset(struct sdhci_host *host)usleep_range (300 ,1000 ); } -static int spt_select_drive_strength (struct sdhci_host *host, -struct mmc_card *card, -unsigned int max_dtr, -int host_drv,int card_drv,int *drv_type) +static int intel_select_drive_strength (struct mmc_card *card, +unsigned int max_dtr,int host_drv, +int card_drv,int *drv_type) { -int drive_strength; - -if (sdhci_pci_spt_drive_strength >0 ) - drive_strength = sdhci_pci_spt_drive_strength &0xf ; -else - drive_strength =0 ;/* Default 50-ohm */ - -if ((mmc_driver_type_mask (drive_strength) & card_drv) ==0 ) - drive_strength =0 ;/* Default 50-ohm */ - -return drive_strength; -} - -/* Try to read the drive strength from the card */ -static void spt_read_drive_strength (struct sdhci_host *host) -{ -u32 val, i, t; -u16 m; - -if (sdhci_pci_spt_drive_strength) -return ; - - sdhci_pci_spt_drive_strength =-1 ; - - m =sdhci_readw (host,SDHCI_HOST_CONTROL2 ) &0x7 ; -if (m !=3 && m !=5 ) -return ; - val =sdhci_readl (host,SDHCI_PRESENT_STATE ); -if (val &0x3 ) -return ; -sdhci_writel (host,0x007f0023 ,SDHCI_INT_ENABLE ); -sdhci_writel (host,0 ,SDHCI_SIGNAL_ENABLE ); -sdhci_writew (host,0x10 ,SDHCI_TRANSFER_MODE ); -sdhci_writeb (host,0xe ,SDHCI_TIMEOUT_CONTROL ); -sdhci_writew (host,512 ,SDHCI_BLOCK_SIZE ); -sdhci_writew (host,1 ,SDHCI_BLOCK_COUNT ); -sdhci_writel (host,0 ,SDHCI_ARGUMENT ); -sdhci_writew (host,0x83b ,SDHCI_COMMAND ); -for (i =0 ; i <1000 ; i++) { - val =sdhci_readl (host,SDHCI_INT_STATUS ); -if (val &0xffff8000 ) -return ; -if (val &0x20 ) -break ; -udelay (1 ); - } - val =sdhci_readl (host,SDHCI_PRESENT_STATE ); -if (!(val &0x800 )) -return ; -for (i =0 ; i <47 ; i++) - val =sdhci_readl (host,SDHCI_BUFFER ); - t = val &0xf00 ; -if (t !=0x200 && t !=0x300 ) -return ; +struct sdhci_host *host =mmc_priv (card->host); +struct sdhci_pci_slot *slot =sdhci_priv (host); +struct intel_host *intel_host =sdhci_pci_priv (slot); - sdhci_pci_spt_drive_strength =0x10 | ((val >>12 ) &0xf ); +return intel_host->drv_strength; }static int bxt_get_cd (struct mmc_host *mmc)
@@ -451,10 +404,8 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) slot->hw_reset = sdhci_pci_int_hw_reset;if (slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_BSW_EMMC ) slot->host->timeout_clk =1000 ;/* 1000 kHz i.e. 1 MHz */ -if (slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_SPT_EMMC ) { -spt_read_drive_strength (slot->host); - slot->select_drive_strength = spt_select_drive_strength; - } + slot->host->mmc_host_ops.select_drive_strength = + intel_select_drive_strength;return 0 ; }
drivers/mmc/host/sdhci-pci-data.c +0 -3
@@ -3,6 +3,3 @@struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev,int slotno);EXPORT_SYMBOL_GPL (sdhci_pci_get_data); - -int sdhci_pci_spt_drive_strength; -EXPORT_SYMBOL_GPL (sdhci_pci_spt_drive_strength);
Signature · 1 line
1.9.1
Re: [PATCH 07/25] mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
Hi Adrian,
Quoted 3 lines · Adrian Hunter
Make use of an Intel ACPI
_DSMthat provides eMMC driver strength.Signed-off-by Adrian Hunter <[email protected]>
This is an interesting patch for me because it seems I have to deal with drive-strength soon, as well, for the SDHI driver. You basically fall back here to simply read the drive strength value from ACPI, right? So, do you think it makes sense then to have a similar encoded value from DT (maybe "mmc-fixed-driver-type-<n>" with n=0..4)? This is a largely reduced encoding of what you proposed in 2015 [1] but may be more pragmatic for soldered on-board devices working on their max speeds with fixed voltages and frequencies? Or did I get something wrong?
Thanks,
Wolfram
Adrian Hunter
maintainerRe: [PATCH 07/25] mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
Quoted 10 lines · Wolfram Sang
Hi Adrian,
Quoted 3 lines · Adrian Hunter
Make use of an Intel ACPI
_DSMthat provides eMMC driver strength.Signed-off-by Adrian Hunter <[email protected]>This is an interesting patch for me because it seems I have to deal with drive-strength soon, as well, for the SDHI driver. You basically fall back here to simply read the drive strength value from ACPI, right?
Yes, it is a single value. I did not design the _DSM, it was a preexisting method.
Quoted 3 lines
So,do you think it makes sense then to have a similar encoded value from DT (maybe "mmc-fixed-driver-type-<n>" with n=0..4)?
The _DSM, being a device-specific method does not have to support different devices with different requirements whereas DT does.
Quoted 4 lines
This is a largely
reduced encoding of what you proposed in 2015 [1] but may be more pragmatic for soldered on-board devices working on their max speeds with fixed voltages and frequencies? Or did I get something wrong?
What I proposed was being forced on me by the requirement to provide a solution that could meet any conceivable need. That gets over-complicated.
But as you say, in practice people are probably only interested in providing one value for the max speed / frequency.
Quoted 8 lines
Thanks,
Wolfram
Re: [PATCH 07/25] mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
Quoted 6 lines
Quoted 3 lines
do you think it makes sense then to have a similar encoded value from DT (maybe "mmc-fixed-driver-type-<n>" with n=0..4)?
The
_DSM, being a device-specific method does not have to support different devices with different requirements whereas DT does.
So, it is more like a vendor specific property (e.g. "renesas, mmc-driver-type")? Sorry, I don't know much about ACPI.
Quoted 7 lines
Quoted 4 lines
This is a largely
reduced encoding of what you proposed in 2015 [1] but may be more pragmatic for soldered on-board devices working on their max speeds with fixed voltages and frequencies? Or did I get something wrong?What I proposed was being forced on me by the requirement to provide a solution that could meet any conceivable need. That gets over-complicated.
Yeah, that became pretty clear.
Quoted 2 lines
But as you say, in practice people are probably only interested in providing one value for the max speed / frequency.
OK. Thanks for your answers! Much appreciated.
Adrian Hunter
maintainerRe: [PATCH 07/25] mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
Quoted 9 lines · Wolfram Sang
Quoted 6 lines
Quoted 3 lines
do you think it makes sense then to have a similar encoded value from DT (maybe "mmc-fixed-driver-type-<n>" with n=0..4)?
The
_DSM, being a device-specific method does not have to support different devices with different requirements whereas DT does.So, it is more like a vendor specific property (e.g. "renesas, mmc-driver-type")? Sorry, I don't know much about ACPI.
Yes, it is effectively vendor-specific in this case.
Adrian Hunter
maintainerPATCH 8/25 mmc: sdhci: Remove ->select_drive_strength() callback
In reply to Adrian HunterDrivers can use the host operation directly, so remove this now unused callback.
--- drivers/mmc/host/sdhci-pci-core.c | 20 -------------------- drivers/mmc/host/sdhci-pci.h | 4 ---- drivers/mmc/host/sdhci.c | 14 -------------- drivers/mmc/host/sdhci.h | 4 ---- 4 files changed, 42 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +0 -20
@@ -36,10 +36,6 @@static int sdhci_pci_enable_dma (struct sdhci_host *host);static void sdhci_pci_set_bus_width (struct sdhci_host *host,int width);static void sdhci_pci_hw_reset (struct sdhci_host *host); -static int sdhci_pci_select_drive_strength (struct sdhci_host *host, -struct mmc_card *card, -unsigned int max_dtr,int host_drv, -int card_drv,int *drv_type);/*****************************************************************************\ * *
@@ -514,7 +510,6 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, .hw_reset = sdhci_pci_hw_reset, - .select_drive_strength = sdhci_pci_select_drive_strength, };static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
@@ -1658,20 +1653,6 @@ static void sdhci_pci_hw_reset(struct sdhci_host *host) slot->hw_reset (host); } -static int sdhci_pci_select_drive_strength (struct sdhci_host *host, -struct mmc_card *card, -unsigned int max_dtr,int host_drv, -int card_drv,int *drv_type) -{ -struct sdhci_pci_slot *slot =sdhci_priv (host); - -if (!slot->select_drive_strength) -return 0 ; - -return slot->select_drive_strength (host, card, max_dtr, host_drv, - card_drv, drv_type); -} -static const struct sdhci_ops sdhci_pci_ops = { .set_clock = sdhci_set_clock, .enable_dma = sdhci_pci_enable_dma,
@@ -1679,7 +1660,6 @@ static int sdhci_pci_select_drive_strength(struct sdhci_host *host, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, .hw_reset = sdhci_pci_hw_reset, - .select_drive_strength = sdhci_pci_select_drive_strength, };/*****************************************************************************\
drivers/mmc/host/sdhci-pci.h +0 -4
@@ -86,10 +86,6 @@ struct sdhci_pci_slot {bool cd_override_level;void (*hw_reset)(struct sdhci_host *host); -int (*select_drive_strength)(struct sdhci_host *host, -struct mmc_card *card, -unsigned int max_dtr,int host_drv, -int card_drv,int *drv_type);unsigned long private[0 ]____cacheline_aligned ; };
drivers/mmc/host/sdhci.c +0 -14
@@ -2176,19 +2176,6 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) }EXPORT_SYMBOL_GPL (sdhci_execute_tuning); -static int sdhci_select_drive_strength (struct mmc_card *card, -unsigned int max_dtr,int host_drv, -int card_drv,int *drv_type) -{ -struct sdhci_host *host =mmc_priv (card->host); - -if (!host->ops->select_drive_strength) -return 0 ; - -return host->ops->select_drive_strength (host, card, max_dtr, host_drv, - card_drv, drv_type); -} -static void sdhci_enable_preset_value (struct sdhci_host *host,bool enable) {/* Host Controller v3.00 defines preset value registers */
@@ -2302,7 +2289,6 @@ static void sdhci_card_event(struct mmc_host *mmc) .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, .prepare_hs400_tuning = sdhci_prepare_hs400_tuning, .execute_tuning = sdhci_execute_tuning, - .select_drive_strength = sdhci_select_drive_strength, .card_event = sdhci_card_event, .card_busy = sdhci_card_busy, };
drivers/mmc/host/sdhci.h +0 -4
@@ -562,10 +562,6 @@ struct sdhci_ops {void (*adma_workaround)(struct sdhci_host *host,u32 intmask);void (*card_event)(struct sdhci_host *host);void (*voltage_switch)(struct sdhci_host *host); -int (*select_drive_strength)(struct sdhci_host *host, -struct mmc_card *card, -unsigned int max_dtr,int host_drv, -int card_drv,int *drv_type); };#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 9/25 mmc: sdhci: Do not use spin lock in set_ios paths
In reply to Adrian HunterThe spin lock is not necessary in set_ios. Anything that is racing with changes to the I/O state is already broken. The mmc core already provides synchronization via "claiming" the host. So remove spin_lock and friends from sdhci_set_ios and related callbacks.
--- drivers/mmc/host/sdhci-msm.c | 8 -------- drivers/mmc/host/sdhci-of-arasan.c | 6 ------ drivers/mmc/host/sdhci-of-at91.c | 2 -- drivers/mmc/host/sdhci-pci-core.c | 4 ---- drivers/mmc/host/sdhci-pxav3.c | 5 +---- drivers/mmc/host/sdhci-s3c.c | 4 ---- drivers/mmc/host/sdhci.c | 9 --------- 7 files changed, 1 insertion(+), 37 deletions(-)
drivers/mmc/host/sdhci-msm.c +0 -8
@@ -991,12 +991,8 @@ static void sdhci_msm_set_uhs_signaling(struct sdhci_host *host, mmc_hostname(host->mmc), host->clock, uhs, ctrl_2);sdhci_writew (host, ctrl_2,SDHCI_HOST_CONTROL2 ); -spin_unlock_irq (&host->lock); -if (mmc->ios.timing ==MMC_TIMING_MMC_HS400 )sdhci_msm_hs400 (host, &mmc->ios); - -spin_lock_irq (&host->lock); }static void sdhci_msm_voltage_switch (struct sdhci_host *host)
@@ -1089,13 +1085,9 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock) goto out; } -spin_unlock_irq (&host->lock); -sdhci_msm_hc_select_mode (host);msm_set_clock_rate_for_bus_mode (host, clock); - -spin_lock_irq (&host->lock); out:__sdhci_msm_set_clock (host, clock); }
drivers/mmc/host/sdhci-of-arasan.c +0 -6
@@ -194,9 +194,7 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)* through low speeds without power cycling. */ sdhci_set_clock (host, host->max_clk); -spin_unlock_irq (&host->lock);phy_power_on (sdhci_arasan->phy); -spin_lock_irq (&host->lock); sdhci_arasan->is_phy_on = true;/*
@@ -215,18 +213,14 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) }if (ctrl_phy && sdhci_arasan->is_phy_on) { -spin_unlock_irq (&host->lock);phy_power_off (sdhci_arasan->phy); -spin_lock_irq (&host->lock); sdhci_arasan->is_phy_on = false; }sdhci_set_clock (host, clock);if (ctrl_phy) { -spin_unlock_irq (&host->lock);phy_power_on (sdhci_arasan->phy); -spin_lock_irq (&host->lock); sdhci_arasan->is_phy_on = true; } }
drivers/mmc/host/sdhci-of-at91.c +0 -2
@@ -96,9 +96,7 @@ static void sdhci_at91_set_power(struct sdhci_host *host, unsigned char mode,if (!IS_ERR (host->mmc->supply.vmmc)) {struct mmc_host *mmc = host->mmc; -spin_unlock_irq (&host->lock);mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); -spin_lock_irq (&host->lock); }sdhci_set_power_noreg (host, mode, vdd); }
drivers/mmc/host/sdhci-pci-core.c +0 -4
@@ -484,8 +484,6 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,if (mode ==MMC_POWER_OFF )return ; -spin_unlock_irq (&host->lock); -/* * Bus power might not enable after D3 -> D0 transition due to the * present state not yet having propagated. Retry for up to 2ms.
@@ -498,8 +496,6 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, reg |=SDHCI_POWER_ON ;sdhci_writeb (host, reg,SDHCI_POWER_CONTROL ); } - -spin_lock_irq (&host->lock); }static const struct sdhci_ops sdhci_intel_byt_ops = {
drivers/mmc/host/sdhci-pxav3.c +1 -4
@@ -323,11 +323,8 @@ static void pxav3_set_power(struct sdhci_host *host, unsigned char mode,if (host->pwr ==0 ) vdd =0 ; -if (!IS_ERR (mmc->supply.vmmc)) { -spin_unlock_irq (&host->lock); +if (!IS_ERR (mmc->supply.vmmc))mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); -spin_lock_irq (&host->lock); - } }static const struct sdhci_ops pxav3_sdhci_ops = {
drivers/mmc/host/sdhci-s3c.c +0 -4
@@ -190,9 +190,7 @@ static unsigned int sdhci_s3c_consider_clock(struct sdhci_s3c *ourhost,* speed possible with selected clock source and skip the division. */ if (ourhost->no_divider) { -spin_unlock_irq (&ourhost->host->lock); rate =clk_round_rate (clksrc, wanted); -spin_lock_irq (&ourhost->host->lock);return wanted - rate; }
@@ -389,9 +387,7 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) clk &= ~SDHCI_CLOCK_CARD_EN ;sdhci_writew (host, clk,SDHCI_CLOCK_CONTROL ); -spin_unlock_irq (&host->lock); ret =clk_set_rate (ourhost->clk_bus[ourhost->cur_clk], clock); -spin_lock_irq (&host->lock);if (ret !=0 ) {dev_err (dev,"%s: failed to set clock rate %uHz\n" ,mmc_hostname (host->mmc), clock);
drivers/mmc/host/sdhci.c +0 -9
@@ -1361,9 +1361,7 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk)sdhci_dumpregs (host);return ; } -spin_unlock_irq (&host->lock);udelay (10 ); -spin_lock_irq (&host->lock); } clk |=SDHCI_CLOCK_CARD_EN ;
@@ -1392,9 +1390,7 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, {struct mmc_host *mmc = host->mmc; -spin_unlock_irq (&host->lock);mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); -spin_lock_irq (&host->lock);if (mode !=MMC_POWER_OFF )sdhci_writeb (host,SDHCI_POWER_ON ,SDHCI_POWER_CONTROL );
@@ -1574,16 +1570,12 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing)static void sdhci_set_ios (struct mmc_host *mmc,struct mmc_ios *ios) {struct sdhci_host *host =mmc_priv (mmc); -unsigned long flags;u8 ctrl;if (ios->power_mode ==MMC_POWER_UNDEFINED )return ; -spin_lock_irqsave (&host->lock, flags); -if (host->flags &SDHCI_DEVICE_DEAD ) { -spin_unlock_irqrestore (&host->lock, flags);if (!IS_ERR (mmc->supply.vmmc) && ios->power_mode ==MMC_POWER_OFF )mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 );
@@ -1729,7 +1721,6 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)sdhci_do_reset (host,SDHCI_RESET_CMD |SDHCI_RESET_DATA );mmiowb (); -spin_unlock_irqrestore (&host->lock, flags); }static int sdhci_get_cd (struct mmc_host *mmc)
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 10/25 mmc: sdhci: Reduce spin lock usage in sdhci_execute_tuning
In reply to Adrian HunterTuning execution is already synchronized with respect to other host operations by upper layers "claiming" the host, which also takes care of runtime pm. There can be no requests in progress. Retain the spin lock usage only for ensuring that sending tuning commands is synchronized with respect to the interrupt handler.
--- drivers/mmc/host/sdhci.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-)
drivers/mmc/host/sdhci.c +14 -22
@@ -1987,8 +1987,7 @@ static void sdhci_reset_tuning(struct sdhci_host *host)sdhci_writew (host, ctrl,SDHCI_HOST_CONTROL2 ); } -static void sdhci_abort_tuning (struct sdhci_host *host,u32 opcode, -unsigned long flags) +static void sdhci_abort_tuning (struct sdhci_host *host,u32 opcode) {sdhci_reset_tuning (host);
@@ -1997,9 +1996,7 @@ static void sdhci_abort_tuning(struct sdhci_host *host, u32 opcode,sdhci_end_tuning (host); -spin_unlock_irqrestore (&host->lock, flags);mmc_abort_tuning (host->mmc, opcode); -spin_lock_irqsave (&host->lock, flags); }/*
@@ -2009,12 +2006,14 @@ static void sdhci_abort_tuning(struct sdhci_host *host, u32 opcode,* interrupt setup is different to other commands and there is no timeout * interrupt so special handling is needed. */ -static void sdhci_send_tuning (struct sdhci_host *host,u32 opcode, -unsigned long flags) +static void sdhci_send_tuning (struct sdhci_host *host,u32 opcode) {struct mmc_host *mmc = host->mmc;struct mmc_command cmd = {};struct mmc_request mrq = {}; +unsigned long flags; + +spin_lock_irqsave (&host->lock, flags); cmd.opcode = opcode; cmd.flags =MMC_RSP_R1 |MMC_CMD_ADTC ;
@@ -2048,17 +2047,16 @@ static void sdhci_send_tuning(struct sdhci_host *host, u32 opcode, host->tuning_done =0 ; +mmiowb ();spin_unlock_irqrestore (&host->lock, flags);/* Wait for Buffer Read Ready interrupt */ wait_event_timeout (host->buf_ready_int, (host->tuning_done ==1 ),msecs_to_jiffies (50 )); -spin_lock_irqsave (&host->lock, flags); } -static void __sdhci_execute_tuning (struct sdhci_host *host,u32 opcode, -unsigned long flags) +static void __sdhci_execute_tuning (struct sdhci_host *host,u32 opcode) {int i;
@@ -2069,12 +2067,12 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode,for (i =0 ; i <MAX_TUNING_LOOP ; i++) {u16 ctrl; -sdhci_send_tuning (host, opcode, flags); +sdhci_send_tuning (host, opcode);if (!host->tuning_done) {pr_info ("%s: Tuning timeout, falling back to fixed sampling clock\n" ,mmc_hostname (host->mmc)); -sdhci_abort_tuning (host, opcode, flags); +sdhci_abort_tuning (host, opcode);return ; }
@@ -2099,12 +2097,9 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) {struct sdhci_host *host =mmc_priv (mmc);int err =0 ; -unsigned long flags;unsigned int tuning_count =0 ;bool hs400_tuning; -spin_lock_irqsave (&host->lock, flags); - hs400_tuning = host->flags &SDHCI_HS400_TUNING ;if (host->tuning_mode ==SDHCI_TUNING_MODE_1 )
@@ -2121,7 +2116,7 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)/* HS400 tuning is done in HS200 mode */ case MMC_TIMING_MMC_HS400 : err = -EINVAL ; - goto out_unlock; + goto out;case MMC_TIMING_MMC_HS200 :/*
@@ -2142,26 +2137,23 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)/* FALLTHROUGH */ default : - goto out_unlock; + goto out; }if (host->ops->platform_execute_tuning) { -spin_unlock_irqrestore (&host->lock, flags); err = host->ops->platform_execute_tuning (host, opcode); -spin_lock_irqsave (&host->lock, flags); - goto out_unlock; + goto out; } host->mmc->retune_period = tuning_count;sdhci_start_tuning (host); -__sdhci_execute_tuning (host, opcode, flags); +__sdhci_execute_tuning (host, opcode);sdhci_end_tuning (host); -out_unlock: +out: host->flags &= ~SDHCI_HS400_TUNING ; -spin_unlock_irqrestore (&host->lock, flags);return err; }
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 11/25 mmc: sdhci: Improve debug print format
In reply to Adrian HunterEnsure all debug prints start with the mmc host name.
--- drivers/mmc/host/sdhci.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/mmc/host/sdhci.c +12 -16
@@ -38,7 +38,7 @@#define DRIVER_NAME "sdhci" #define DBG(f, x...) \ - pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x) + pr_debug("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)#define MAX_TUNING_LOOP 40
@@ -715,8 +715,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) }if (count >=0xF ) { -DBG ("%s: Too large timeout 0x%x requested for CMD%d!\n" , -mmc_hostname (host->mmc), count, cmd->opcode); +DBG ("Too large timeout 0x%x requested for CMD%d!\n" , + count, cmd->opcode); count =0xE ; }
@@ -2479,7 +2479,6 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)#ifdef CONFIG_MMC_DEBUG static void sdhci_adma_show_error (struct sdhci_host *host) { -const char *name =mmc_hostname (host->mmc);void *desc = host->adma_table;sdhci_dumpregs (host);
@@ -2488,14 +2487,14 @@ static void sdhci_adma_show_error(struct sdhci_host *host)struct sdhci_adma2_64_desc *dma_desc = desc;if (host->flags &SDHCI_USE_64_BIT_DMA ) -DBG ("%s: %p: DMA 0x%08x%08x, LEN 0x%04x, Attr=0x%02x\n" , - name, desc,le32_to_cpu (dma_desc->addr_hi), +DBG ("%p: DMA 0x%08x%08x, LEN 0x%04x, Attr=0x%02x\n" , + desc,le32_to_cpu (dma_desc->addr_hi),le32_to_cpu (dma_desc->addr_lo),le16_to_cpu (dma_desc->len),le16_to_cpu (dma_desc->cmd));else -DBG ("%s: %p: DMA 0x%08x, LEN 0x%04x, Attr=0x%02x\n" , - name, desc,le32_to_cpu (dma_desc->addr_lo), +DBG ("%p: DMA 0x%08x, LEN 0x%04x, Attr=0x%02x\n" , + desc,le32_to_cpu (dma_desc->addr_lo),le16_to_cpu (dma_desc->len),le16_to_cpu (dma_desc->cmd));
@@ -2611,10 +2610,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) ~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1)) +SDHCI_DEFAULT_BOUNDARY_SIZE ; host->data->bytes_xfered = dmanow - dmastart; -DBG ("%s: DMA base 0x%08x, transferred 0x%06x bytes," -" next 0x%08x\n" , -mmc_hostname (host->mmc), dmastart, - host->data->bytes_xfered, dmanow); +DBG ("DMA base 0x%08x, transferred 0x%06x bytes, next 0x%08x\n" , + dmastart, host->data->bytes_xfered, dmanow);sdhci_writel (host, dmanow,SDHCI_DMA_ADDRESS ); }
@@ -2659,8 +2656,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) SDHCI_INT_BUS_POWER);sdhci_writel (host, mask,SDHCI_INT_STATUS ); -DBG ("*** %s got interrupt: 0x%08x\n" , -mmc_hostname (host->mmc), intmask); +DBG ("IRQ status 0x%08x\n" , intmask);if (intmask & (SDHCI_INT_CARD_INSERT |SDHCI_INT_CARD_REMOVE )) { u32 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
@@ -3290,9 +3286,9 @@ int sdhci_setup_host(struct sdhci_host *host) !(host->flags & SDHCI_USE_SDMA)) && !(host->quirks2 & SDHCI_QUIRK2_ACMD23_BROKEN)) { host->flags |= SDHCI_AUTO_CMD23; - DBG("%s: Auto-CMD23 available\n", mmc_hostname(mmc)); + DBG("Auto-CMD23 available\n"); } else { -DBG ("%s: Auto-CMD23 unavailable\n" ,mmc_hostname (mmc)); +DBG ("Auto-CMD23 unavailable\n" ); }/*
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 12/25 mmc: sdhci: Add response register to register dump
In reply to Adrian HunterAdd response register to register dump.
--- drivers/mmc/host/sdhci.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci.c +7 -0
@@ -87,6 +87,13 @@ static void sdhci_dumpregs(struct sdhci_host *host)pr_err (DRIVER_NAME ": Cmd: 0x%08x | Max curr: 0x%08x\n" ,sdhci_readw (host,SDHCI_COMMAND ),sdhci_readl (host,SDHCI_MAX_CURRENT )); +pr_err (DRIVER_NAME ": Resp[0]: 0x%08x | Resp[1]: 0x%08x\n" , +sdhci_readl (host,SDHCI_RESPONSE ), +sdhci_readl (host,SDHCI_RESPONSE +4 )); +pr_err (DRIVER_NAME ": Resp[2]: 0x%08x | Resp[3]: 0x%08x\n" , +sdhci_readl (host,SDHCI_RESPONSE +8 ), +sdhci_readl (host,SDHCI_RESPONSE +12 )); +pr_err (DRIVER_NAME ": Host ctl2: 0x%08x\n" ,sdhci_readw (host,SDHCI_HOST_CONTROL2 ));
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 13/25 mmc: sdhci: Use sdhci_readl() not readl() in sdhci_dumpregs()
In reply to Adrian HunterUse sdhci io wrappers consistently.
--- drivers/mmc/host/sdhci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci.c +5 -5
@@ -100,13 +100,13 @@ static void sdhci_dumpregs(struct sdhci_host *host)if (host->flags &SDHCI_USE_ADMA ) {if (host->flags &SDHCI_USE_64_BIT_DMA )pr_err (DRIVER_NAME ": ADMA Err: 0x%08x | ADMA Ptr: 0x%08x%08x\n" , -readl (host->ioaddr +SDHCI_ADMA_ERROR ), -readl (host->ioaddr +SDHCI_ADMA_ADDRESS_HI ), -readl (host->ioaddr +SDHCI_ADMA_ADDRESS )); +sdhci_readl (host,SDHCI_ADMA_ERROR ), +sdhci_readl (host,SDHCI_ADMA_ADDRESS_HI ), +sdhci_readl (host,SDHCI_ADMA_ADDRESS ));else pr_err (DRIVER_NAME ": ADMA Err: 0x%08x | ADMA Ptr: 0x%08x\n" , -readl (host->ioaddr +SDHCI_ADMA_ERROR ), -readl (host->ioaddr +SDHCI_ADMA_ADDRESS )); +sdhci_readl (host,SDHCI_ADMA_ERROR ), +sdhci_readl (host,SDHCI_ADMA_ADDRESS )); }pr_err (DRIVER_NAME ": ===========================================\n" );
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 14/25 mmc: sdhci: Improve register dump print format
In reply to Adrian HunterEnsure all prints start with the mmc host name, and the text all lines up.
--- drivers/mmc/host/sdhci.c | 104 ++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 51 deletions(-)
drivers/mmc/host/sdhci.c +53 -51
@@ -40,6 +40,9 @@ #define DBG(f, x...) \ pr_debug("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x) +#define SDHCI_DUMP(f, x...) \ + pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x) +#define MAX_TUNING_LOOP 40static unsigned int debug_quirks =0 ;
@@ -51,65 +54,64 @@static void sdhci_dumpregs (struct sdhci_host *host) { -pr_err (DRIVER_NAME ": =========== REGISTER DUMP (%s)===========\n" , -mmc_hostname (host->mmc)); - -pr_err (DRIVER_NAME ": Sys addr: 0x%08x | Version: 0x%08x\n" , -sdhci_readl (host,SDHCI_DMA_ADDRESS ), -sdhci_readw (host,SDHCI_HOST_VERSION )); -pr_err (DRIVER_NAME ": Blk size: 0x%08x | Blk cnt: 0x%08x\n" , -sdhci_readw (host,SDHCI_BLOCK_SIZE ), -sdhci_readw (host,SDHCI_BLOCK_COUNT )); -pr_err (DRIVER_NAME ": Argument: 0x%08x | Trn mode: 0x%08x\n" , -sdhci_readl (host,SDHCI_ARGUMENT ), -sdhci_readw (host,SDHCI_TRANSFER_MODE )); -pr_err (DRIVER_NAME ": Present: 0x%08x | Host ctl: 0x%08x\n" , -sdhci_readl (host,SDHCI_PRESENT_STATE ), -sdhci_readb (host,SDHCI_HOST_CONTROL )); -pr_err (DRIVER_NAME ": Power: 0x%08x | Blk gap: 0x%08x\n" , -sdhci_readb (host,SDHCI_POWER_CONTROL ), -sdhci_readb (host,SDHCI_BLOCK_GAP_CONTROL )); -pr_err (DRIVER_NAME ": Wake-up: 0x%08x | Clock: 0x%08x\n" , -sdhci_readb (host,SDHCI_WAKE_UP_CONTROL ), -sdhci_readw (host,SDHCI_CLOCK_CONTROL )); -pr_err (DRIVER_NAME ": Timeout: 0x%08x | Int stat: 0x%08x\n" , -sdhci_readb (host,SDHCI_TIMEOUT_CONTROL ), -sdhci_readl (host,SDHCI_INT_STATUS )); -pr_err (DRIVER_NAME ": Int enab: 0x%08x | Sig enab: 0x%08x\n" , -sdhci_readl (host,SDHCI_INT_ENABLE ), -sdhci_readl (host,SDHCI_SIGNAL_ENABLE )); -pr_err (DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n" , -sdhci_readw (host,SDHCI_ACMD12_ERR ), -sdhci_readw (host,SDHCI_SLOT_INT_STATUS )); -pr_err (DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n" , -sdhci_readl (host,SDHCI_CAPABILITIES ), -sdhci_readl (host,SDHCI_CAPABILITIES_1 )); -pr_err (DRIVER_NAME ": Cmd: 0x%08x | Max curr: 0x%08x\n" , -sdhci_readw (host,SDHCI_COMMAND ), -sdhci_readl (host,SDHCI_MAX_CURRENT )); -pr_err (DRIVER_NAME ": Resp[0]: 0x%08x | Resp[1]: 0x%08x\n" , +SDHCI_DUMP ("============ SDHCI REGISTER DUMP ===========\n" ); + +SDHCI_DUMP ("Sys addr: 0x%08x | Version: 0x%08x\n" , +sdhci_readl (host,SDHCI_DMA_ADDRESS ), +sdhci_readw (host,SDHCI_HOST_VERSION )); +SDHCI_DUMP ("Blk size: 0x%08x | Blk cnt: 0x%08x\n" , +sdhci_readw (host,SDHCI_BLOCK_SIZE ), +sdhci_readw (host,SDHCI_BLOCK_COUNT )); +SDHCI_DUMP ("Argument: 0x%08x | Trn mode: 0x%08x\n" , +sdhci_readl (host,SDHCI_ARGUMENT ), +sdhci_readw (host,SDHCI_TRANSFER_MODE )); +SDHCI_DUMP ("Present: 0x%08x | Host ctl: 0x%08x\n" , +sdhci_readl (host,SDHCI_PRESENT_STATE ), +sdhci_readb (host,SDHCI_HOST_CONTROL )); +SDHCI_DUMP ("Power: 0x%08x | Blk gap: 0x%08x\n" , +sdhci_readb (host,SDHCI_POWER_CONTROL ), +sdhci_readb (host,SDHCI_BLOCK_GAP_CONTROL )); +SDHCI_DUMP ("Wake-up: 0x%08x | Clock: 0x%08x\n" , +sdhci_readb (host,SDHCI_WAKE_UP_CONTROL ), +sdhci_readw (host,SDHCI_CLOCK_CONTROL )); +SDHCI_DUMP ("Timeout: 0x%08x | Int stat: 0x%08x\n" , +sdhci_readb (host,SDHCI_TIMEOUT_CONTROL ), +sdhci_readl (host,SDHCI_INT_STATUS )); +SDHCI_DUMP ("Int enab: 0x%08x | Sig enab: 0x%08x\n" , +sdhci_readl (host,SDHCI_INT_ENABLE ), +sdhci_readl (host,SDHCI_SIGNAL_ENABLE )); +SDHCI_DUMP ("AC12 err: 0x%08x | Slot int: 0x%08x\n" , +sdhci_readw (host,SDHCI_ACMD12_ERR ), +sdhci_readw (host,SDHCI_SLOT_INT_STATUS )); +SDHCI_DUMP ("Caps: 0x%08x | Caps_1: 0x%08x\n" , +sdhci_readl (host,SDHCI_CAPABILITIES ), +sdhci_readl (host,SDHCI_CAPABILITIES_1 )); +SDHCI_DUMP ("Cmd: 0x%08x | Max curr: 0x%08x\n" , +sdhci_readw (host,SDHCI_COMMAND ), +sdhci_readl (host,SDHCI_MAX_CURRENT )); +SDHCI_DUMP ("Resp[0]: 0x%08x | Resp[1]: 0x%08x\n" ,sdhci_readl (host,SDHCI_RESPONSE ),sdhci_readl (host,SDHCI_RESPONSE +4 )); -pr_err (DRIVER_NAME ": Resp[2]: 0x%08x | Resp[3]: 0x%08x\n" , +SDHCI_DUMP ("Resp[2]: 0x%08x | Resp[3]: 0x%08x\n" ,sdhci_readl (host,SDHCI_RESPONSE +8 ),sdhci_readl (host,SDHCI_RESPONSE +12 )); - -pr_err (DRIVER_NAME ": Host ctl2: 0x%08x\n" , -sdhci_readw (host,SDHCI_HOST_CONTROL2 )); +SDHCI_DUMP ("Host ctl2: 0x%08x\n" , +sdhci_readw (host,SDHCI_HOST_CONTROL2 ));if (host->flags &SDHCI_USE_ADMA ) { -if (host->flags &SDHCI_USE_64_BIT_DMA ) -pr_err (DRIVER_NAME ": ADMA Err: 0x%08x | ADMA Ptr: 0x%08x%08x\n" , -sdhci_readl (host,SDHCI_ADMA_ERROR ), -sdhci_readl (host,SDHCI_ADMA_ADDRESS_HI ), -sdhci_readl (host,SDHCI_ADMA_ADDRESS )); -else -pr_err (DRIVER_NAME ": ADMA Err: 0x%08x | ADMA Ptr: 0x%08x\n" , -sdhci_readl (host,SDHCI_ADMA_ERROR ), -sdhci_readl (host,SDHCI_ADMA_ADDRESS )); +if (host->flags &SDHCI_USE_64_BIT_DMA ) { +SDHCI_DUMP ("ADMA Err: 0x%08x | ADMA Ptr: 0x%08x%08x\n" , +sdhci_readl (host,SDHCI_ADMA_ERROR ), +sdhci_readl (host,SDHCI_ADMA_ADDRESS_HI ), +sdhci_readl (host,SDHCI_ADMA_ADDRESS )); + }else { +SDHCI_DUMP ("ADMA Err: 0x%08x | ADMA Ptr: 0x%08x\n" , +sdhci_readl (host,SDHCI_ADMA_ERROR ), +sdhci_readl (host,SDHCI_ADMA_ADDRESS )); + } } -pr_err (DRIVER_NAME ": ===========================================\n" ); +SDHCI_DUMP ("============================================\n" ); }/*****************************************************************************\
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 15/25 mmc: sdhci: Export sdhci_dumpregs
In reply to Adrian HunterExport sdhci_dumpregs so that it can be called by drivers.
--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
@@ -52,7 +52,7 @@static void sdhci_enable_preset_value (struct sdhci_host *host,bool enable); -static void sdhci_dumpregs (struct sdhci_host *host) +void sdhci_dumpregs (struct sdhci_host *host) {SDHCI_DUMP ("============ SDHCI REGISTER DUMP ===========\n" );
@@ -113,6 +113,7 @@ static void sdhci_dumpregs(struct sdhci_host *host)SDHCI_DUMP ("============================================\n" ); } +EXPORT_SYMBOL_GPL (sdhci_dumpregs);/*****************************************************************************\ * *
drivers/mmc/host/sdhci.h +2 -0
@@ -698,4 +698,6 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,extern int sdhci_runtime_resume_host (struct sdhci_host *host);#endif +void sdhci_dumpregs (struct sdhci_host *host); +#endif /* __SDHCI_HW_H */
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 16/25 mmc: sdhci: Get rid of 'extern' in header file
In reply to Adrian HunterGet rid of unnecessary 'extern' in header file.
--- drivers/mmc/host/sdhci.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/mmc/host/sdhci.h +15 -17
@@ -648,24 +648,22 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ -extern struct sdhci_host *sdhci_alloc_host (struct device *dev, -size_t priv_size); -extern void sdhci_free_host (struct sdhci_host *host); +struct sdhci_host *sdhci_alloc_host (struct device *dev,size_t priv_size); +void sdhci_free_host (struct sdhci_host *host);static inline void *sdhci_priv (struct sdhci_host *host) {return host->private; } -extern void sdhci_card_detect (struct sdhci_host *host); -extern void __sdhci_read_caps (struct sdhci_host *host,u16 *ver,u32 *caps, -u32 *caps1); -extern int sdhci_setup_host (struct sdhci_host *host); -extern int __sdhci_add_host (struct sdhci_host *host); -extern int sdhci_add_host (struct sdhci_host *host); -extern void sdhci_remove_host (struct sdhci_host *host,int dead); -extern void sdhci_send_command (struct sdhci_host *host, -struct mmc_command *cmd); +void sdhci_card_detect (struct sdhci_host *host); +void __sdhci_read_caps (struct sdhci_host *host,u16 *ver,u32 *caps, +u32 *caps1); +int sdhci_setup_host (struct sdhci_host *host); +int __sdhci_add_host (struct sdhci_host *host); +int sdhci_add_host (struct sdhci_host *host); +void sdhci_remove_host (struct sdhci_host *host,int dead); +void sdhci_send_command (struct sdhci_host *host,struct mmc_command *cmd);static inline void sdhci_read_caps (struct sdhci_host *host) {
@@ -691,11 +689,11 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,int sdhci_execute_tuning (struct mmc_host *mmc,u32 opcode);#ifdef CONFIG_PM -extern int sdhci_suspend_host (struct sdhci_host *host); -extern int sdhci_resume_host (struct sdhci_host *host); -extern void sdhci_enable_irq_wakeups (struct sdhci_host *host); -extern int sdhci_runtime_suspend_host (struct sdhci_host *host); -extern int sdhci_runtime_resume_host (struct sdhci_host *host); +int sdhci_suspend_host (struct sdhci_host *host); +int sdhci_resume_host (struct sdhci_host *host); +void sdhci_enable_irq_wakeups (struct sdhci_host *host); +int sdhci_runtime_suspend_host (struct sdhci_host *host); +int sdhci_runtime_resume_host (struct sdhci_host *host);#endif void sdhci_dumpregs (struct sdhci_host *host);
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 17/25 mmc: sdhci: Add sdhci_cleanup_host
In reply to Adrian HunterAdd sdhci_cleanup_host() to cleanup __sdhci_add_host().
--- drivers/mmc/host/sdhci.c | 37 ++++++++++++++++++++++++++----------- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 27 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci.c +26 -11
@@ -3562,6 +3562,22 @@ int sdhci_setup_host(struct sdhci_host *host) }EXPORT_SYMBOL_GPL (sdhci_setup_host); +void sdhci_cleanup_host (struct sdhci_host *host) +{ +struct mmc_host *mmc = host->mmc; + +if (!IS_ERR (mmc->supply.vqmmc)) +regulator_disable (mmc->supply.vqmmc); + +if (host->align_buffer) +dma_free_coherent (mmc_dev (mmc), host->align_buffer_sz + + host->adma_table_sz, host->align_buffer, + host->align_addr); + host->adma_table =NULL ; + host->align_buffer =NULL ; +} +EXPORT_SYMBOL_GPL (sdhci_cleanup_host); +int __sdhci_add_host (struct sdhci_host *host) {struct mmc_host *mmc = host->mmc;
@@ -3626,16 +3642,6 @@ int __sdhci_add_host(struct sdhci_host *host) untasklet:tasklet_kill (&host->finish_tasklet); -if (!IS_ERR (mmc->supply.vqmmc)) -regulator_disable (mmc->supply.vqmmc); - -if (host->align_buffer) -dma_free_coherent (mmc_dev (mmc), host->align_buffer_sz + - host->adma_table_sz, host->align_buffer, - host->align_addr); - host->adma_table =NULL ; - host->align_buffer =NULL ; -return ret; }EXPORT_SYMBOL_GPL (__sdhci_add_host);
@@ -3648,7 +3654,16 @@ int sdhci_add_host(struct sdhci_host *host)if (ret)return ret; -return __sdhci_add_host (host); + ret =__sdhci_add_host (host); +if (ret) + goto cleanup; + +return 0 ; + +cleanup: +sdhci_cleanup_host (host); + +return ret; }EXPORT_SYMBOL_GPL (sdhci_add_host);
drivers/mmc/host/sdhci.h +1 -0
@@ -660,6 +660,7 @@ static inline void *sdhci_priv(struct sdhci_host *host)void __sdhci_read_caps (struct sdhci_host *host,u16 *ver,u32 *caps,u32 *caps1);int sdhci_setup_host (struct sdhci_host *host); +void sdhci_cleanup_host (struct sdhci_host *host);int __sdhci_add_host (struct sdhci_host *host);int sdhci_add_host (struct sdhci_host *host);void sdhci_remove_host (struct sdhci_host *host,int dead);
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 18/25 mmc: sdhci: Factor out sdhci_set_default_irqs
In reply to Adrian HunterFactor out sdhci_set_default_irqs().
--- drivers/mmc/host/sdhci.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/mmc/host/sdhci.c +13 -8
@@ -225,15 +225,8 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask) } } -static void sdhci_init (struct sdhci_host *host,int soft) +static void sdhci_set_default_irqs (struct sdhci_host *host) { -struct mmc_host *mmc = host->mmc; - -if (soft) -sdhci_do_reset (host,SDHCI_RESET_CMD |SDHCI_RESET_DATA ); -else -sdhci_do_reset (host,SDHCI_RESET_ALL ); - host->ier =SDHCI_INT_BUS_POWER |SDHCI_INT_DATA_END_BIT |SDHCI_INT_DATA_CRC |SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC |
@@ -246,6 +239,18 @@ static void sdhci_init(struct sdhci_host *host, int soft)sdhci_writel (host, host->ier,SDHCI_INT_ENABLE );sdhci_writel (host, host->ier,SDHCI_SIGNAL_ENABLE ); +} + +static void sdhci_init (struct sdhci_host *host,int soft) +{ +struct mmc_host *mmc = host->mmc; + +if (soft) +sdhci_do_reset (host,SDHCI_RESET_CMD |SDHCI_RESET_DATA ); +else +sdhci_do_reset (host,SDHCI_RESET_ALL ); + +sdhci_set_default_irqs (host);if (soft) {/* force clock reconfiguration */
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 19/25 mmc: sdhci: Add CQE support
In reply to Adrian HunterAdd an interrupt hook and helper functions for enabling, disabling and delivering interrupts to a CQE.
--- drivers/mmc/host/sdhci.c | 130 +++++++++++++++++++++++++++++++++++++++++++++-- drivers/mmc/host/sdhci.h | 19 +++++++ 2 files changed, 146 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +127 -3
@@ -252,6 +252,8 @@ static void sdhci_init(struct sdhci_host *host, int soft)sdhci_set_default_irqs (host); + host->cqe_on = false; +if (soft) {/* force clock reconfiguration */ host->clock =0 ;
@@ -2666,13 +2668,19 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) } do { + DBG("IRQ status 0x%08x\n", intmask); + + if (host->ops->irq) { + intmask = host->ops->irq(host, intmask); + if (!intmask) + goto cont; + } + /* Clear selected interrupts. */ mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | SDHCI_INT_BUS_POWER); sdhci_writel(host, mask, SDHCI_INT_STATUS); - DBG("IRQ status 0x%08x\n", intmask); - if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { u32 present = sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT;
@@ -2732,7 +2740,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) unexpected |= intmask;sdhci_writel (host, intmask,SDHCI_INT_STATUS ); } - +cont:if (result ==IRQ_NONE ) result =IRQ_HANDLED ;
@@ -2961,6 +2969,119 @@ int sdhci_runtime_resume_host(struct sdhci_host *host)/*****************************************************************************\ * * +* Command Queue Engine (CQE) helpers * +* * +\*****************************************************************************/ + +void sdhci_cqe_enable (struct mmc_host *mmc) +{ +struct sdhci_host *host =mmc_priv (mmc); +unsigned long flags; +u8 ctrl; + +spin_lock_irqsave (&host->lock, flags); + + ctrl =sdhci_readb (host,SDHCI_HOST_CONTROL ); + ctrl &= ~SDHCI_CTRL_DMA_MASK ; +if (host->flags &SDHCI_USE_64_BIT_DMA ) + ctrl |=SDHCI_CTRL_ADMA64 ; +else + ctrl |=SDHCI_CTRL_ADMA32 ; +sdhci_writeb (host, ctrl,SDHCI_HOST_CONTROL ); + +sdhci_writew (host,SDHCI_MAKE_BLKSZ (SDHCI_DEFAULT_BOUNDARY_ARG ,512 ), +SDHCI_BLOCK_SIZE ); + +/* Set maximum timeout */ +sdhci_writeb (host,0xE ,SDHCI_TIMEOUT_CONTROL ); + + host->ier = host->cqe_ier; + +sdhci_writel (host, host->ier,SDHCI_INT_ENABLE ); +sdhci_writel (host, host->ier,SDHCI_SIGNAL_ENABLE ); + + host->cqe_on = true; + +pr_debug ("%s: sdhci: CQE on, IRQ mask %#x, IRQ status %#x\n" , +mmc_hostname (mmc), host->ier, +sdhci_readl (host,SDHCI_INT_STATUS )); + +mmiowb (); +spin_unlock_irqrestore (&host->lock, flags); +} +EXPORT_SYMBOL_GPL (sdhci_cqe_enable); + +void sdhci_cqe_disable (struct mmc_host *mmc,bool recovery) +{ +struct sdhci_host *host =mmc_priv (mmc); +unsigned long flags; + +spin_lock_irqsave (&host->lock, flags); + +sdhci_set_default_irqs (host); + + host->cqe_on = false; + +if (recovery) { +sdhci_do_reset (host,SDHCI_RESET_CMD ); +sdhci_do_reset (host,SDHCI_RESET_DATA ); + } + +pr_debug ("%s: sdhci: CQE off, IRQ mask %#x, IRQ status %#x\n" , +mmc_hostname (mmc), host->ier, +sdhci_readl (host,SDHCI_INT_STATUS )); + +mmiowb (); +spin_unlock_irqrestore (&host->lock, flags); +} +EXPORT_SYMBOL_GPL (sdhci_cqe_disable); + +bool sdhci_cqe_irq (struct sdhci_host *host,u32 intmask,int *cmd_error, +int *data_error) +{ +u32 mask; + +if (!host->cqe_on) +return false; + +if (intmask & (SDHCI_INT_INDEX |SDHCI_INT_END_BIT |SDHCI_INT_CRC )) + *cmd_error = -EILSEQ ; +else if (intmask &SDHCI_INT_TIMEOUT ) + *cmd_error = -ETIMEDOUT ; +else + *cmd_error =0 ; + +if (intmask & (SDHCI_INT_DATA_END_BIT |SDHCI_INT_DATA_CRC )) + *data_error = -EILSEQ ; +else if (intmask &SDHCI_INT_DATA_TIMEOUT ) + *data_error = -ETIMEDOUT ; +else if (intmask &SDHCI_INT_ADMA_ERROR ) + *data_error = -EIO ; +else + *data_error =0 ; + +/* Clear selected interrupts. */ + mask = intmask & host->cqe_ier; +sdhci_writel (host, mask,SDHCI_INT_STATUS ); + +if (intmask &SDHCI_INT_BUS_POWER ) +pr_err ("%s: Card is consuming too much power!\n" , +mmc_hostname (host->mmc)); + + intmask &= ~(host->cqe_ier |SDHCI_INT_ERROR ); +if (intmask) { +sdhci_writel (host, intmask,SDHCI_INT_STATUS ); +pr_err ("%s: CQE: Unexpected interrupt 0x%08x.\n" , +mmc_hostname (host->mmc), intmask); +sdhci_dumpregs (host); + } + +return true; +} +EXPORT_SYMBOL_GPL (sdhci_cqe_irq); + +/*****************************************************************************\ +* * * Device allocation/registration * * * \*****************************************************************************/
@@ -2984,6 +3105,9 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->flags =SDHCI_SIGNALING_330 ; + host->cqe_ier =SDHCI_CQE_INT_MASK ; + host->cqe_err_ier =SDHCI_CQE_INT_ERR_MASK ; +return host; }
drivers/mmc/host/sdhci.h +19 -0
@@ -134,6 +134,7 @@#define SDHCI_INT_CARD_REMOVE 0x00000080#define SDHCI_INT_CARD_INT 0x00000100#define SDHCI_INT_RETUNE 0x00001000 +#define SDHCI_INT_CQE 0x00004000#define SDHCI_INT_ERROR 0x00008000#define SDHCI_INT_TIMEOUT 0x00010000#define SDHCI_INT_CRC 0x00020000
@@ -158,6 +159,13 @@ SDHCI_INT_BLK_GAP)#define SDHCI_INT_ALL_MASK ((unsigned int)-1) +#define SDHCI_CQE_INT_ERR_MASK ( \ + SDHCI_INT_ADMA_ERROR | SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | \ + SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX | \ + SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT) + +#define SDHCI_CQE_INT_MASK (SDHCI_CQE_INT_ERR_MASK | SDHCI_INT_CQE) +#define SDHCI_ACMD12_ERR 0x3C#define SDHCI_HOST_CONTROL2 0x3E
@@ -518,6 +526,10 @@ struct sdhci_host {/* cached registers */ u32 ier; +bool cqe_on;/* CQE is operating */ +u32 cqe_ier;/* CQE interrupt mask */ +u32 cqe_err_ier;/* CQE error interrupt mask */ +wait_queue_head_t buf_ready_int;/* Waitqueue for Buffer Read Ready interrupt */ unsigned int tuning_done;/* Condition flag set when CMD19 succeeds */
@@ -544,6 +556,8 @@ struct sdhci_ops {void (*set_power)(struct sdhci_host *host,unsigned char mode,unsigned short vdd); +u32 (*irq)(struct sdhci_host *host,u32 intmask); +int (*enable_dma)(struct sdhci_host *host);unsigned int (*get_max_clock)(struct sdhci_host *host);unsigned int (*get_min_clock)(struct sdhci_host *host);
@@ -697,6 +711,11 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,int sdhci_runtime_resume_host (struct sdhci_host *host);#endif +void sdhci_cqe_enable (struct mmc_host *mmc); +void sdhci_cqe_disable (struct mmc_host *mmc,bool recovery); +bool sdhci_cqe_irq (struct sdhci_host *host,u32 intmask,int *cmd_error, +int *data_error); +void sdhci_dumpregs (struct sdhci_host *host);#endif /* __SDHCI_HW_H */
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 20/25 mmc: sdhci-pci: Let devices define how to add the host
In reply to Adrian HunterSDHCI provides more flexibility than simply calling sdhci_add_host(). Make that available by allowing devices to specify their own ->add_host() function.
--- drivers/mmc/host/sdhci-pci-core.c | 5 ++++- drivers/mmc/host/sdhci-pci.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +4 -1
@@ -1949,7 +1949,10 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( } } - ret =sdhci_add_host (host); +if (chip->fixes && chip->fixes->add_host) + ret = chip->fixes->add_host (slot); +else + ret =sdhci_add_host (host);if (ret) goto remove;
drivers/mmc/host/sdhci-pci.h +1 -0
@@ -64,6 +64,7 @@ struct sdhci_pci_fixes {int (*probe) (struct sdhci_pci_chip *);int (*probe_slot) (struct sdhci_pci_slot *); +int (*add_host) (struct sdhci_pci_slot *);void (*remove_slot) (struct sdhci_pci_slot *,int );int (*suspend) (struct sdhci_pci_chip *);
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 21/25 mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
In reply to Adrian HunterDo not use suspend/resume callbacks with runtime pm. It doesn't make sense and isn't being used, so remove.
--- drivers/mmc/host/sdhci-pci-core.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +0 -12
@@ -1783,12 +1783,6 @@ static int sdhci_pci_runtime_suspend(struct device *dev)mmc_retune_needed (host->mmc); } -if (chip->fixes && chip->fixes->suspend) { - ret = chip->fixes->suspend (chip); -if (ret) - goto err_pci_runtime_suspend; - } -return 0 ; err_pci_runtime_suspend:
@@ -1808,12 +1802,6 @@ static int sdhci_pci_runtime_resume(struct device *dev)if (!chip)return 0 ; -if (chip->fixes && chip->fixes->resume) { - ret = chip->fixes->resume (chip); -if (ret) -return ret; - } -for (i =0 ; i < chip->num_slots; i++) { slot = chip->slots[i];if (!slot)
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 22/25 mmc: sdhci-pci: Conditionally compile pm sleep functions
In reply to Adrian HunterIt is confusing to have some parts of suspend / resume under conditional compilation and some parts not. Use conditional compilation everywhere.
--- drivers/mmc/host/sdhci-pci-core.c | 10 ++++++++++ drivers/mmc/host/sdhci-pci-o2micro.c | 2 ++ drivers/mmc/host/sdhci-pci.h | 2 ++ 3 files changed, 14 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +10 -0
@@ -67,6 +67,7 @@ static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)return 0 ; } +#ifdef CONFIG_PM_SLEEP static int ricoh_mmc_resume (struct sdhci_pci_chip *chip) {/* Apply a delay to allow controller to settle */
@@ -75,6 +76,7 @@ static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)msleep (500 );return 0 ; } +#endif static const struct sdhci_pci_fixes sdhci_ricoh = { .probe = ricoh_probe,
@@ -85,7 +87,9 @@ static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)static const struct sdhci_pci_fixes sdhci_ricoh_mmc = { .probe_slot = ricoh_mmc_probe_slot, +#ifdef CONFIG_PM_SLEEP .resume = ricoh_mmc_resume, +#endif .quirks =SDHCI_QUIRK_32BIT_DMA_ADDR |SDHCI_QUIRK_CLOCK_BEFORE_RESET | SDHCI_QUIRK_NO_CARD_NO_RESET |
@@ -751,6 +755,7 @@ static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead)jmicron_enable_mmc (slot->host,0 ); } +#ifdef CONFIG_PM_SLEEP static int jmicron_suspend (struct sdhci_pci_chip *chip) {int i;
@@ -782,13 +787,16 @@ static int jmicron_resume(struct sdhci_pci_chip *chip)return 0 ; } +#endif static const struct sdhci_pci_fixes sdhci_o2 = { .probe = sdhci_pci_o2_probe, .quirks =SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC , .quirks2 =SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD , .probe_slot = sdhci_pci_o2_probe_slot, +#ifdef CONFIG_PM_SLEEP .resume = sdhci_pci_o2_resume, +#endif };static const struct sdhci_pci_fixes sdhci_jmicron = {
@@ -797,8 +805,10 @@ static int jmicron_resume(struct sdhci_pci_chip *chip) .probe_slot = jmicron_probe_slot, .remove_slot = jmicron_remove_slot, +#ifdef CONFIG_PM_SLEEP .suspend = jmicron_suspend, .resume = jmicron_resume, +#endif };/* SysKonnect CardBus2SDIO extra registers */
drivers/mmc/host/sdhci-pci-o2micro.c +2 -0
@@ -384,8 +384,10 @@ int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)return 0 ; } +#ifdef CONFIG_PM_SLEEP int sdhci_pci_o2_resume (struct sdhci_pci_chip *chip) {sdhci_pci_o2_probe (chip);return 0 ; } +#endif
drivers/mmc/host/sdhci-pci.h +2 -0
@@ -67,8 +67,10 @@ struct sdhci_pci_fixes {int (*add_host) (struct sdhci_pci_slot *);void (*remove_slot) (struct sdhci_pci_slot *,int ); +#ifdef CONFIG_PM_SLEEP int (*suspend) (struct sdhci_pci_chip *);int (*resume) (struct sdhci_pci_chip *); +#endif const struct sdhci_ops *ops;size_t priv_size;
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 23/25 mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
In reply to Adrian HunterThe suspend / resume callbacks lack the flexibility to allow a device to specify a different function entirely. Change them around so that device functions are called directly and they in turn can call the default implementations if needed.
--- drivers/mmc/host/sdhci-pci-core.c | 170 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-o2micro.c | 2 +- drivers/mmc/host/sdhci-pci.h | 4 + 3 files changed, 104 insertions(+), 72 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +99 -71
@@ -37,6 +37,88 @@static void sdhci_pci_set_bus_width (struct sdhci_host *host,int width);static void sdhci_pci_hw_reset (struct sdhci_host *host); +#ifdef CONFIG_PM_SLEEP +static int __sdhci_pci_suspend_host (struct sdhci_pci_chip *chip) +{ +int i, ret; + +for (i =0 ; i < chip->num_slots; i++) { +struct sdhci_pci_slot *slot = chip->slots[i]; +struct sdhci_host *host; + +if (!slot) +continue ; + + host = slot->host; + +if (chip->pm_retune && host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + + ret =sdhci_suspend_host (host); +if (ret) + goto err_pci_suspend; + +if (host->mmc->pm_flags &MMC_PM_WAKE_SDIO_IRQ ) +sdhci_enable_irq_wakeups (host); + } + +return 0 ; + +err_pci_suspend: +while (--i >=0 ) +sdhci_resume_host (chip->slots[i]->host); +return ret; +} + +static int sdhci_pci_init_wakeup (struct sdhci_pci_chip *chip) +{ +mmc_pm_flag_t pm_flags =0 ; +int i; + +for (i =0 ; i < chip->num_slots; i++) { +struct sdhci_pci_slot *slot = chip->slots[i]; + +if (slot) + pm_flags |= slot->host->mmc->pm_flags; + } + +return device_init_wakeup (&chip->pdev->dev, + (pm_flags &MMC_PM_KEEP_POWER ) && + (pm_flags &MMC_PM_WAKE_SDIO_IRQ )); +} + +static int sdhci_pci_suspend_host (struct sdhci_pci_chip *chip) +{ +int ret; + + ret =__sdhci_pci_suspend_host (chip); +if (ret) +return ret; + +sdhci_pci_init_wakeup (chip); + +return 0 ; +} + +int sdhci_pci_resume_host (struct sdhci_pci_chip *chip) +{ +struct sdhci_pci_slot *slot; +int i, ret; + +for (i =0 ; i < chip->num_slots; i++) { + slot = chip->slots[i]; +if (!slot) +continue ; + + ret =sdhci_resume_host (slot->host); +if (ret) +return ret; + } + +return 0 ; +} +#endif +/*****************************************************************************\ * * * Hardware specific quirk handling *
@@ -74,7 +156,7 @@ static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)/* Otherwise it becomes confused if card state changed during suspend */ msleep (500 ); - return 0; + return sdhci_pci_resume_host(chip); }#endif
@@ -758,7 +840,11 @@ static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead)#ifdef CONFIG_PM_SLEEP static int jmicron_suspend (struct sdhci_pci_chip *chip) { -int i; +int i, ret; + + ret =__sdhci_pci_suspend_host (chip); +if (ret) +return ret;if (chip->pdev->device ==PCI_DEVICE_ID_JMICRON_JMB38X_MMC || chip->pdev->device ==PCI_DEVICE_ID_JMICRON_JMB388_ESD ) {
@@ -766,6 +852,8 @@ static int jmicron_suspend(struct sdhci_pci_chip *chip)jmicron_enable_mmc (chip->slots[i]->host,0 ); } +sdhci_pci_init_wakeup (chip); +return 0 ; }
@@ -785,7 +873,7 @@ static int jmicron_resume(struct sdhci_pci_chip *chip) return ret; } -return 0 ; +return sdhci_pci_resume_host (chip); }#endif
@@ -1678,89 +1766,29 @@ static void sdhci_pci_hw_reset(struct sdhci_host *host)static int sdhci_pci_suspend (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev); -struct sdhci_pci_chip *chip; -struct sdhci_pci_slot *slot; -struct sdhci_host *host; -mmc_pm_flag_t slot_pm_flags; -mmc_pm_flag_t pm_flags =0 ; -int i, ret; +struct sdhci_pci_chip *chip =pci_get_drvdata (pdev); - chip =pci_get_drvdata (pdev);if (!chip)return 0 ; -for (i =0 ; i < chip->num_slots; i++) { - slot = chip->slots[i]; -if (!slot) -continue ; - - host = slot->host; - -if (chip->pm_retune && host->tuning_mode !=SDHCI_TUNING_MODE_3 ) -mmc_retune_needed (host->mmc); - - ret =sdhci_suspend_host (host); - -if (ret) - goto err_pci_suspend; - - slot_pm_flags = host->mmc->pm_flags; -if (slot_pm_flags &MMC_PM_WAKE_SDIO_IRQ ) -sdhci_enable_irq_wakeups (host); +if (chip->fixes && chip->fixes->suspend) +return chip->fixes->suspend (chip); - pm_flags |= slot_pm_flags; - } - -if (chip->fixes && chip->fixes->suspend) { - ret = chip->fixes->suspend (chip); -if (ret) - goto err_pci_suspend; - } - -if (pm_flags &MMC_PM_KEEP_POWER ) { -if (pm_flags &MMC_PM_WAKE_SDIO_IRQ ) -device_init_wakeup (dev, true); -else -device_init_wakeup (dev, false); - }else -device_init_wakeup (dev, false); - -return 0 ; - -err_pci_suspend: -while (--i >=0 ) -sdhci_resume_host (chip->slots[i]->host); -return ret; +return sdhci_pci_suspend_host (chip); }static int sdhci_pci_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev); -struct sdhci_pci_chip *chip; -struct sdhci_pci_slot *slot; -int i, ret; +struct sdhci_pci_chip *chip =pci_get_drvdata (pdev); - chip =pci_get_drvdata (pdev);if (!chip)return 0 ; -if (chip->fixes && chip->fixes->resume) { - ret = chip->fixes->resume (chip); -if (ret) -return ret; - } - -for (i =0 ; i < chip->num_slots; i++) { - slot = chip->slots[i]; -if (!slot) -continue ; - - ret =sdhci_resume_host (slot->host); -if (ret) -return ret; - } +if (chip->fixes && chip->fixes->resume) +return chip->fixes->resume (chip); -return 0 ; +return sdhci_pci_resume_host (chip); }#endif
drivers/mmc/host/sdhci-pci-o2micro.c +1 -1
@@ -388,6 +388,6 @@ int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)int sdhci_pci_o2_resume (struct sdhci_pci_chip *chip) {sdhci_pci_o2_probe (chip); -return 0 ; +return sdhci_pci_resume_host (chip); }#endif
drivers/mmc/host/sdhci-pci.h +4 -0
@@ -111,4 +111,8 @@ static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot) return (void *)slot->private; } +#ifdef CONFIG_PM_SLEEP +int sdhci_pci_resume_host (struct sdhci_pci_chip *chip); +#endif +#endif /* __SDHCI_PCI_H */
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 24/25 mmc: sdhci-pci: Add runtime suspend/resume callbacks
In reply to Adrian HunterAdd runtime suspend/resume callbacks to match suspend/resume callbacks.
--- drivers/mmc/host/sdhci-pci-core.c | 98 +++++++++++++++++++++++---------------- drivers/mmc/host/sdhci-pci.h | 4 ++ 2 files changed, 62 insertions(+), 40 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +58 -40
@@ -119,6 +119,56 @@ int sdhci_pci_resume_host(struct sdhci_pci_chip *chip) }#endif +#ifdef CONFIG_PM +static int sdhci_pci_runtime_suspend_host (struct sdhci_pci_chip *chip) +{ +struct sdhci_pci_slot *slot; +struct sdhci_host *host; +int i, ret; + +for (i =0 ; i < chip->num_slots; i++) { + slot = chip->slots[i]; +if (!slot) +continue ; + + host = slot->host; + + ret =sdhci_runtime_suspend_host (host); +if (ret) + goto err_pci_runtime_suspend; + +if (chip->rpm_retune && + host->tuning_mode !=SDHCI_TUNING_MODE_3 ) +mmc_retune_needed (host->mmc); + } + +return 0 ; + +err_pci_runtime_suspend: +while (--i >=0 ) +sdhci_runtime_resume_host (chip->slots[i]->host); +return ret; +} + +static int sdhci_pci_runtime_resume_host (struct sdhci_pci_chip *chip) +{ +struct sdhci_pci_slot *slot; +int i, ret; + +for (i =0 ; i < chip->num_slots; i++) { + slot = chip->slots[i]; +if (!slot) +continue ; + + ret =sdhci_runtime_resume_host (slot->host); +if (ret) +return ret; + } + +return 0 ; +} +#endif +/*****************************************************************************\ * * * Hardware specific quirk handling *
@@ -1796,61 +1846,29 @@ static int sdhci_pci_resume(struct device *dev)static int sdhci_pci_runtime_suspend (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev); -struct sdhci_pci_chip *chip; -struct sdhci_pci_slot *slot; -struct sdhci_host *host; -int i, ret; +struct sdhci_pci_chip *chip =pci_get_drvdata (pdev); - chip =pci_get_drvdata (pdev);if (!chip)return 0 ; -for (i =0 ; i < chip->num_slots; i++) { - slot = chip->slots[i]; -if (!slot) -continue ; - - host = slot->host; - - ret =sdhci_runtime_suspend_host (host); -if (ret) - goto err_pci_runtime_suspend; - -if (chip->rpm_retune && - host->tuning_mode !=SDHCI_TUNING_MODE_3 ) -mmc_retune_needed (host->mmc); - } - -return 0 ; +if (chip->fixes && chip->fixes->runtime_suspend) +return chip->fixes->runtime_suspend (chip); -err_pci_runtime_suspend: -while (--i >=0 ) -sdhci_runtime_resume_host (chip->slots[i]->host); -return ret; +return sdhci_pci_runtime_suspend_host (chip); }static int sdhci_pci_runtime_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev); -struct sdhci_pci_chip *chip; -struct sdhci_pci_slot *slot; -int i, ret; +struct sdhci_pci_chip *chip =pci_get_drvdata (pdev); - chip =pci_get_drvdata (pdev);if (!chip)return 0 ; -for (i =0 ; i < chip->num_slots; i++) { - slot = chip->slots[i]; -if (!slot) -continue ; +if (chip->fixes && chip->fixes->runtime_resume) +return chip->fixes->runtime_resume (chip); - ret =sdhci_runtime_resume_host (slot->host); -if (ret) -return ret; - } - -return 0 ; +return sdhci_pci_runtime_resume_host (chip); }#endif
drivers/mmc/host/sdhci-pci.h +4 -0
@@ -71,6 +71,10 @@ struct sdhci_pci_fixes {int (*suspend) (struct sdhci_pci_chip *);int (*resume) (struct sdhci_pci_chip *);#endif +#ifdef CONFIG_PM +int (*runtime_suspend) (struct sdhci_pci_chip *); +int (*runtime_resume) (struct sdhci_pci_chip *); +#endif const struct sdhci_ops *ops;size_t priv_size;
Signature · 1 line
1.9.1
Adrian Hunter
maintainerPATCH 25/25 mmc: sdhci-pci: Move a function to avoid later forward declaration
In reply to Adrian HunterMove a function to avoid having to forward declare it in a subsequent patch.
--- drivers/mmc/host/sdhci-pci-core.c | 76 +++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 38 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +38 -38
@@ -515,6 +515,44 @@ static int bxt_get_cd(struct mmc_host *mmc)return ret; } +#define SDHCI_INTEL_PWR_TIMEOUT_CNT 20 +#define SDHCI_INTEL_PWR_TIMEOUT_UDELAY 100 + +static void sdhci_intel_set_power (struct sdhci_host *host,unsigned char mode, +unsigned short vdd) +{ +int cntr; +u8 reg; + +sdhci_set_power (host, mode, vdd); + +if (mode ==MMC_POWER_OFF ) +return ; + +/* +* Bus power might not enable after D3 -> D0 transition due to the +* present state not yet having propagated. Retry for up to 2ms. +*/ +for (cntr =0 ; cntr <SDHCI_INTEL_PWR_TIMEOUT_CNT ; cntr++) { + reg =sdhci_readb (host,SDHCI_POWER_CONTROL ); +if (reg &SDHCI_POWER_ON ) +break ; +udelay (SDHCI_INTEL_PWR_TIMEOUT_UDELAY ); + reg |=SDHCI_POWER_ON ; +sdhci_writeb (host, reg,SDHCI_POWER_CONTROL ); + } +} + +static const struct sdhci_ops sdhci_intel_byt_ops = { + .set_clock = sdhci_set_clock, + .set_power = sdhci_intel_set_power, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_pci_set_bus_width, + .reset = sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, + .hw_reset = sdhci_pci_hw_reset, +}; +static void byt_read_dsm (struct sdhci_pci_slot *slot) {struct intel_host *intel_host =sdhci_pci_priv (slot);
@@ -606,44 +644,6 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)return 0 ; } -#define SDHCI_INTEL_PWR_TIMEOUT_CNT 20 -#define SDHCI_INTEL_PWR_TIMEOUT_UDELAY 100 - -static void sdhci_intel_set_power (struct sdhci_host *host,unsigned char mode, -unsigned short vdd) -{ -int cntr; -u8 reg; - -sdhci_set_power (host, mode, vdd); - -if (mode ==MMC_POWER_OFF ) -return ; - -/* -* Bus power might not enable after D3 -> D0 transition due to the -* present state not yet having propagated. Retry for up to 2ms. -*/ -for (cntr =0 ; cntr <SDHCI_INTEL_PWR_TIMEOUT_CNT ; cntr++) { - reg =sdhci_readb (host,SDHCI_POWER_CONTROL ); -if (reg &SDHCI_POWER_ON ) -break ; -udelay (SDHCI_INTEL_PWR_TIMEOUT_UDELAY ); - reg |=SDHCI_POWER_ON ; -sdhci_writeb (host, reg,SDHCI_POWER_CONTROL ); - } -} - -static const struct sdhci_ops sdhci_intel_byt_ops = { - .set_clock = sdhci_set_clock, - .set_power = sdhci_intel_set_power, - .enable_dma = sdhci_pci_enable_dma, - .set_bus_width = sdhci_pci_set_bus_width, - .reset = sdhci_reset, - .set_uhs_signaling = sdhci_set_uhs_signaling, - .hw_reset = sdhci_pci_hw_reset, -}; -static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = { .allow_runtime_pm = true, .probe_slot = byt_emmc_probe_slot,
Signature · 1 line
1.9.1
Quoted 62 lines · Adrian Hunter
Hi
Here are some sdhci patches that include preparation for CQE and some general improvements. Patches such as:
mmc: sdhci: Let drivers decide whether to use
mmc_retune_needed()with pm
mmc: sdhci: Do not use spin lock inset_iospathsaffect several drivers specifically, like:
drivers/mmc/host/sdhci-brcmstb.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-of-arasan.c
drivers/mmc/host/sdhci-of-at91.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pxav3.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sirf.c
drivers/mmc/host/sdhci-spear.c
drivers/mmc/host/sdhci-st.cAdrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts insdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to usemmc_retune_needed()with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock inset_iospaths
mmc: sdhci: Reduce spin lock usage insdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Usesdhci_readl()notreadl()insdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Exportsdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Addsdhci_cleanup_host
mmc: sdhci: Factor outsdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declarationdrivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 +
Quoted 9 lines
drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)
Adrian, I have reviewed this and it looks great to me!
I have applied patch 1 and 2 for fixes, while the rest of the series is applied for next.
Thanks and kind regards
Uffe
Quoted 41 lines · Adrian Hunter
Hi
Here are some sdhci patches that include preparation for CQE and some general improvements. Patches such as:
mmc: sdhci: Let drivers decide whether to use
mmc_retune_needed()with pm
mmc: sdhci: Do not use spin lock inset_iospathsaffect several drivers specifically, like:
drivers/mmc/host/sdhci-brcmstb.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-of-arasan.c
drivers/mmc/host/sdhci-of-at91.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pxav3.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sirf.c
drivers/mmc/host/sdhci-spear.c
drivers/mmc/host/sdhci-st.cAdrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts insdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to usemmc_retune_needed()with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock inset_iospaths
mmc: sdhci: Reduce spin lock usage insdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Usesdhci_readl()notreadl()insdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Exportsdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Addsdhci_cleanup_host
Quoted 8 lines
mmc: sdhci: Factor out
sdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declaration
Why have you sent this set to so many people?
Mores the point, why have you sent it to me?
Quoted 24 lines
drivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 + drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)Regards
Adrian
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Adrian Hunter
maintainerQuoted 52 lines · Lee Jones
Quoted 41 lines · Adrian Hunter
Hi
Here are some sdhci patches that include preparation for CQE and some general improvements. Patches such as:
mmc: sdhci: Let drivers decide whether to use
mmc_retune_needed()with pm
mmc: sdhci: Do not use spin lock inset_iospathsaffect several drivers specifically, like:
drivers/mmc/host/sdhci-brcmstb.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-of-arasan.c
drivers/mmc/host/sdhci-of-at91.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pxav3.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sirf.c
drivers/mmc/host/sdhci-spear.c
drivers/mmc/host/sdhci-st.cAdrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts insdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to usemmc_retune_needed()with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock inset_iospaths
mmc: sdhci: Reduce spin lock usage insdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Usesdhci_readl()notreadl()insdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Exportsdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Addsdhci_cleanup_hostQuoted 8 lines
mmc: sdhci: Factor out
sdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declaration
Quoted 1 line
Why have you sent this set to so many people?
Because they might have an interest in testing the drivers that they have contributed to.
Quoted 2 lines
Mores the point, why have you sent it to me?
Because you contributed to:
drivers/mmc/host/sdhci-st.c
and might have an interest in testing it.
Quoted 26 lines
Quoted 25 lines
drivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 + drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)Regards
Adrian
Quoted 35 lines · Adrian Hunter
Quoted 28 lines · Lee Jones
Quoted 18 lines · Adrian Hunter
Adrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts insdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to usemmc_retune_needed()with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock inset_iospaths
mmc: sdhci: Reduce spin lock usage insdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Usesdhci_readl()notreadl()insdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Exportsdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Addsdhci_cleanup_hostQuoted 8 lines
mmc: sdhci: Factor out
sdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declarationQuoted 1 line
Why have you sent this set to so many people?
Because they might have an interest in testing the drivers that they have contributed to.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
Mores the point, why have you sent it to me?
Because you contributed to:
drivers/mmc/host/sdhci-st.cand might have an interest in testing it.
Please don't send patches to every email address get_maintainer.pl spits out. If everyone did that contributors, especially the ones who work across many subsystems, would be completely swamped in mail.
Instead exercise common sense and only include the Maintainers and *maybe* super heavy, regular contributors or authors if you are that way inclined.
Personally I only send to the Maintainers of the file. If anyone else has a keen interest they will normally set up filters on the MLs to catch patches submitted.
Quoted 26 lines
Quoted 25 lines
Quoted 24 lines
drivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 + drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)Regards
Adrian
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 49 lines · Lee Jones
Quoted 35 lines · Adrian Hunter
Quoted 28 lines · Lee Jones
Quoted 18 lines · Adrian Hunter
Adrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts insdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to usemmc_retune_needed()with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock inset_iospaths
mmc: sdhci: Reduce spin lock usage insdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Usesdhci_readl()notreadl()insdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Exportsdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Addsdhci_cleanup_hostQuoted 8 lines
mmc: sdhci: Factor out
sdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declarationQuoted 1 line
Why have you sent this set to so many people?
Because they might have an interest in testing the drivers that they have contributed to.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
Mores the point, why have you sent it to me?
Because you contributed to:
drivers/mmc/host/sdhci-st.cand might have an interest in testing it.
Please don't send patches to every email address get_maintainer.pl spits out. If everyone did that contributors, especially the ones who work across many subsystems, would be completely swamped in mail.
Quoted 7 lines
Instead exercise common sense and only include the Maintainers and *maybe* super heavy, regular contributors or authors if you are that way inclined.
Personally I only send to the Maintainers of the file. If anyone else has a keen interest they will normally set up filters on the MLs to catch patches submitted.
I've just seen that you *are* the Maintainer of SDHCI, so I guess this it *slightly* different for you. In this case I would have only Cc'ed your Co- and Sub- Maintainers and any heavy contributors/authors.
The long as the short of it is, little people like me shouldn't really be in receipt of this change.
Quoted 27 lines
Quoted 26 lines
Quoted 25 lines
Quoted 24 lines
drivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 + drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)Regards
Adrian
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 62 lines · Adrian Hunter
Hi
Here are some sdhci patches that include preparation for CQE and some general improvements. Patches such as:
mmc: sdhci: Let drivers decide whether to use
mmc_retune_needed()with pm
mmc: sdhci: Do not use spin lock inset_iospathsaffect several drivers specifically, like:
drivers/mmc/host/sdhci-brcmstb.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-of-arasan.c
drivers/mmc/host/sdhci-of-at91.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pxav3.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sirf.c
drivers/mmc/host/sdhci-spear.c
drivers/mmc/host/sdhci-st.cAdrian Hunter (25):
mmc: sdhci: Do not disable interrupts while waiting for clock
mmc: sdhci-pci: Do not disable interrupts insdhci_intel_set_power
mmc: sdhci: Optimize delay loops
mmc: sdhci: Let drivers decide whether to usemmc_retune_needed()with pm
mmc: sdhci-pci: Let devices define their own private data
mmc: sdhci-pci: Don't re-tune with runtime pm for some Intel devices
mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices
mmc: sdhci: Remove ->select_drive_strength() callback
mmc: sdhci: Do not use spin lock inset_iospaths
mmc: sdhci: Reduce spin lock usage insdhci_execute_tuning
mmc: sdhci: Improve debug print format
mmc: sdhci: Add response register to register dump
mmc: sdhci: Usesdhci_readl()notreadl()insdhci_dumpregs()
mmc: sdhci: Improve register dump print format
mmc: sdhci: Exportsdhci_dumpregs
mmc: sdhci: Get rid of 'extern' in header file
mmc: sdhci: Addsdhci_cleanup_host
mmc: sdhci: Factor outsdhci_set_default_irqs
mmc: sdhci: Add CQE support
mmc: sdhci-pci: Let devices define how to add the host
mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm
mmc: sdhci-pci: Conditionally compile pm sleep functions
mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks
mmc: sdhci-pci: Add runtime suspend/resume callbacks
mmc: sdhci-pci: Move a function to avoid later forward declarationdrivers/mmc/host/sdhci-acpi.c | 12 +- drivers/mmc/host/sdhci-brcmstb.c | 3 + drivers/mmc/host/sdhci-esdhc-imx.c | 6 + drivers/mmc/host/sdhci-msm.c | 8 - drivers/mmc/host/sdhci-of-arasan.c | 9 +- drivers/mmc/host/sdhci-of-at91.c | 5 +- drivers/mmc/host/sdhci-of-esdhc.c | 3 + drivers/mmc/host/sdhci-pci-core.c | 551 ++++++++++++++++++++--------------- drivers/mmc/host/sdhci-pci-data.c | 3 - drivers/mmc/host/sdhci-pci-o2micro.c | 4 +- drivers/mmc/host/sdhci-pci.h | 24 +- drivers/mmc/host/sdhci-pltfm.c | 3 +
Quoted 9 lines
drivers/mmc/host/sdhci-pxav3.c | 10 +- drivers/mmc/host/sdhci-s3c.c | 10 +- drivers/mmc/host/sdhci-sirf.c | 3 + drivers/mmc/host/sdhci-spear.c | 3 + drivers/mmc/host/sdhci-st.c | 6 +- drivers/mmc/host/sdhci.c | 404 ++++++++++++++++--------- drivers/mmc/host/sdhci.h | 58 ++-- 19 files changed, 691 insertions(+), 434 deletions(-)
Quoted 7 lines
Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html