* [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC @ 2013-06-13 8:50 Adrian Hunter 2013-06-13 8:50 ` [PATCH 1/2] mmc: sdhci-pci: " Adrian Hunter ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Adrian Hunter @ 2013-06-13 8:50 UTC (permalink / raw) To: Chris Ball; +Cc: linux-mmc, Adrian Hunter Hi Here are 2 patches to add support for eMMC hardware reset for BYT eMMC. Adrian Hunter (2): mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 drivers/mmc/host/sdhci-acpi.c | 28 +++++++++++++++++++++++++++- drivers/mmc/host/sdhci-pci.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) Regards Adrian ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. 2013-06-13 8:50 [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Adrian Hunter @ 2013-06-13 8:50 ` Adrian Hunter 2013-06-13 8:50 ` [PATCH 2/2] mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 Adrian Hunter 2013-06-27 15:54 ` [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Chris Ball 2 siblings, 0 replies; 6+ messages in thread From: Adrian Hunter @ 2013-06-13 8:50 UTC (permalink / raw) To: Chris Ball; +Cc: linux-mmc, Adrian Hunter Add support for eMMC hardware reset for BYT eMMC. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> --- drivers/mmc/host/sdhci-pci.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index 611331a..e082fac 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c @@ -77,6 +77,8 @@ struct sdhci_pci_slot { int rst_n_gpio; int cd_gpio; int cd_irq; + + void (*hw_reset)(struct sdhci_host *host); }; struct sdhci_pci_chip { @@ -307,10 +309,27 @@ static const struct sdhci_pci_fixes sdhci_intel_pch_sdio = { .probe_slot = pch_hc_probe_slot, }; +static void sdhci_pci_int_hw_reset(struct sdhci_host *host) +{ + u8 reg; + + reg = sdhci_readb(host, SDHCI_POWER_CONTROL); + reg |= 0x10; + sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); + /* For eMMC, minimum is 1us but give it 9us for good measure */ + udelay(9); + reg &= ~0x10; + sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); + /* For eMMC, minimum is 200us but give it 300us for good measure */ + usleep_range(300, 1000); +} + static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) { - slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE; + slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | + MMC_CAP_HW_RESET; slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ; + slot->hw_reset = sdhci_pci_int_hw_reset; return 0; } @@ -1016,7 +1035,7 @@ static int sdhci_pci_bus_width(struct sdhci_host *host, int width) return 0; } -static void sdhci_pci_hw_reset(struct sdhci_host *host) +static void sdhci_pci_gpio_hw_reset(struct sdhci_host *host) { struct sdhci_pci_slot *slot = sdhci_priv(host); int rst_n_gpio = slot->rst_n_gpio; @@ -1031,6 +1050,14 @@ static void sdhci_pci_hw_reset(struct sdhci_host *host) usleep_range(300, 1000); } +static void sdhci_pci_hw_reset(struct sdhci_host *host) +{ + struct sdhci_pci_slot *slot = sdhci_priv(host); + + if (slot->hw_reset) + slot->hw_reset(host); +} + static const struct sdhci_ops sdhci_pci_ops = { .enable_dma = sdhci_pci_enable_dma, .platform_bus_width = sdhci_pci_bus_width, @@ -1328,6 +1355,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( if (!gpio_request(slot->rst_n_gpio, "eMMC_reset")) { gpio_direction_output(slot->rst_n_gpio, 1); slot->host->mmc->caps |= MMC_CAP_HW_RESET; + slot->hw_reset = sdhci_pci_gpio_hw_reset; } else { dev_warn(&pdev->dev, "failed to request rst_n_gpio\n"); slot->rst_n_gpio = -EINVAL; -- 1.7.11.7 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 2013-06-13 8:50 [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Adrian Hunter 2013-06-13 8:50 ` [PATCH 1/2] mmc: sdhci-pci: " Adrian Hunter @ 2013-06-13 8:50 ` Adrian Hunter 2013-06-27 15:54 ` [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Chris Ball 2 siblings, 0 replies; 6+ messages in thread From: Adrian Hunter @ 2013-06-13 8:50 UTC (permalink / raw) To: Chris Ball; +Cc: linux-mmc, Adrian Hunter Add support for eMMC hardware reset for HID 80860F14. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> --- drivers/mmc/host/sdhci-acpi.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index a51e603..baa579b 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -37,6 +37,7 @@ #include <linux/acpi_gpio.h> #include <linux/pm.h> #include <linux/pm_runtime.h> +#include <linux/delay.h> #include <linux/mmc/host.h> #include <linux/mmc/pm.h> @@ -85,12 +86,37 @@ static int sdhci_acpi_enable_dma(struct sdhci_host *host) return 0; } +static void sdhci_acpi_int_hw_reset(struct sdhci_host *host) +{ + u8 reg; + + reg = sdhci_readb(host, SDHCI_POWER_CONTROL); + reg |= 0x10; + sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); + /* For eMMC, minimum is 1us but give it 9us for good measure */ + udelay(9); + reg &= ~0x10; + sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); + /* For eMMC, minimum is 200us but give it 300us for good measure */ + usleep_range(300, 1000); +} + static const struct sdhci_ops sdhci_acpi_ops_dflt = { .enable_dma = sdhci_acpi_enable_dma, }; +static const struct sdhci_ops sdhci_acpi_ops_int = { + .enable_dma = sdhci_acpi_enable_dma, + .hw_reset = sdhci_acpi_int_hw_reset, +}; + +static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { + .ops = &sdhci_acpi_ops_int, +}; + static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { - .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, + .chip = &sdhci_acpi_chip_int, + .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | MMC_CAP_HW_RESET, .caps2 = MMC_CAP2_HC_ERASE_SZ, .flags = SDHCI_ACPI_RUNTIME_PM, }; -- 1.7.11.7 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC 2013-06-13 8:50 [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Adrian Hunter 2013-06-13 8:50 ` [PATCH 1/2] mmc: sdhci-pci: " Adrian Hunter 2013-06-13 8:50 ` [PATCH 2/2] mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 Adrian Hunter @ 2013-06-27 15:54 ` Chris Ball 2013-06-28 7:26 ` Adrian Hunter 2 siblings, 1 reply; 6+ messages in thread From: Chris Ball @ 2013-06-27 15:54 UTC (permalink / raw) To: Adrian Hunter; +Cc: linux-mmc Hi Adrian, On Thu, Jun 13 2013, Adrian Hunter wrote: > Here are 2 patches to add support for eMMC hardware reset for BYT eMMC. > > > Adrian Hunter (2): > mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. > mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 > > drivers/mmc/host/sdhci-acpi.c | 28 +++++++++++++++++++++++++++- > drivers/mmc/host/sdhci-pci.c | 32 ++++++++++++++++++++++++++++++-- > 2 files changed, 57 insertions(+), 3 deletions(-) Thanks, both pushed to mmc-next for 3.11. - Chris. -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC 2013-06-27 15:54 ` [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Chris Ball @ 2013-06-28 7:26 ` Adrian Hunter 2013-06-28 13:59 ` Chris Ball 0 siblings, 1 reply; 6+ messages in thread From: Adrian Hunter @ 2013-06-28 7:26 UTC (permalink / raw) To: Chris Ball; +Cc: linux-mmc On 27/06/13 18:54, Chris Ball wrote: > Hi Adrian, > > On Thu, Jun 13 2013, Adrian Hunter wrote: >> Here are 2 patches to add support for eMMC hardware reset for BYT eMMC. >> >> >> Adrian Hunter (2): >> mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. >> mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 >> >> drivers/mmc/host/sdhci-acpi.c | 28 +++++++++++++++++++++++++++- >> drivers/mmc/host/sdhci-pci.c | 32 ++++++++++++++++++++++++++++++-- >> 2 files changed, 57 insertions(+), 3 deletions(-) > > Thanks, both pushed to mmc-next for 3.11. Thanks, but "mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC." has been mixed with someone else's patch. i.e. it now looks like this: commit 4bef939873882b5f04b51e3e72e92dad1fdc527d Author: Adrian Hunter <adrian.hunter@intel.com> Date: Thu Jun 13 11:50:26 2013 +0300 mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. Add support for eMMC hardware reset for BYT eMMC. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org> --- drivers/mmc/host/dw_mmc.h | 2 +- drivers/mmc/host/sdhci-pci.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 81b2994..e3bf5a0 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -111,7 +111,7 @@ #define SDMMC_INT_ERROR 0xbfc2 /* Command register defines */ #define SDMMC_CMD_START BIT(31) -#define SDMMC_CMD_USE_HOLD_REG BIT(29) +#define SDMMC_CMD_USE_HOLD_REG BIT(29) #define SDMMC_CMD_CCS_EXP BIT(23) #define SDMMC_CMD_CEATA_RD BIT(22) #define SDMMC_CMD_UPD_CLK BIT(21) diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index 611331a..e082fac 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c @@ -77,6 +77,8 @@ struct sdhci_pci_slot { int rst_n_gpio; int cd_gpio; int cd_irq; + + void (*hw_reset)(struct sdhci_host *host); }; struct sdhci_pci_chip { @@ -307,10 +309,27 @@ static const struct sdhci_pci_fixes sdhci_intel_pch_sdio = { .probe_slot = pch_hc_probe_slot, }; +static void sdhci_pci_int_hw_reset(struct sdhci_host *host) +{ + u8 reg; + + reg = sdhci_readb(host, SDHCI_POWER_CONTROL); + reg |= 0x10; + sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); + /* For eMMC, minimum is 1us but give it 9us for good measure */ + udelay(9); + reg &= ~0x10; + sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); + /* For eMMC, minimum is 200us but give it 300us for good measure */ + usleep_range(300, 1000); +} + static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) { - slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE; + slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | + MMC_CAP_HW_RESET; slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ; + slot->hw_reset = sdhci_pci_int_hw_reset; return 0; } @@ -1016,7 +1035,7 @@ static int sdhci_pci_bus_width(struct sdhci_host *host, int width) return 0; } -static void sdhci_pci_hw_reset(struct sdhci_host *host) +static void sdhci_pci_gpio_hw_reset(struct sdhci_host *host) { struct sdhci_pci_slot *slot = sdhci_priv(host); int rst_n_gpio = slot->rst_n_gpio; @@ -1031,6 +1050,14 @@ static void sdhci_pci_hw_reset(struct sdhci_host *host) usleep_range(300, 1000); } +static void sdhci_pci_hw_reset(struct sdhci_host *host) +{ + struct sdhci_pci_slot *slot = sdhci_priv(host); + + if (slot->hw_reset) + slot->hw_reset(host); +} + static const struct sdhci_ops sdhci_pci_ops = { .enable_dma = sdhci_pci_enable_dma, .platform_bus_width = sdhci_pci_bus_width, @@ -1328,6 +1355,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( if (!gpio_request(slot->rst_n_gpio, "eMMC_reset")) { gpio_direction_output(slot->rst_n_gpio, 1); slot->host->mmc->caps |= MMC_CAP_HW_RESET; + slot->hw_reset = sdhci_pci_gpio_hw_reset; } else { dev_warn(&pdev->dev, "failed to request rst_n_gpio\n"); slot->rst_n_gpio = -EINVAL; ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC 2013-06-28 7:26 ` Adrian Hunter @ 2013-06-28 13:59 ` Chris Ball 0 siblings, 0 replies; 6+ messages in thread From: Chris Ball @ 2013-06-28 13:59 UTC (permalink / raw) To: Adrian Hunter; +Cc: Chris Ball, linux-mmc Hi Adrian, On Fri, Jun 28 2013, Adrian Hunter wrote: > Thanks, but "mmc: sdhci-pci: add support for eMMC hardware reset for BYT > eMMC." has been mixed with someone else's patch. i.e. it now looks like this: Ouch, that's terrible, thank you for catching it. Will fix. - Chris. -- Chris Ball <chris@printf.net> <http://printf.net/> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-28 13:59 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-06-13 8:50 [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Adrian Hunter 2013-06-13 8:50 ` [PATCH 1/2] mmc: sdhci-pci: " Adrian Hunter 2013-06-13 8:50 ` [PATCH 2/2] mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 Adrian Hunter 2013-06-27 15:54 ` [PATCH 0/2] mmc: add support for eMMC hardware reset for BYT eMMC Chris Ball 2013-06-28 7:26 ` Adrian Hunter 2013-06-28 13:59 ` Chris Ball
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.