* [PATCH 00/13] mmc: Some Braswell and misc patches
@ 2014-09-22 10:17 Adrian Hunter
2014-09-22 10:17 ` [PATCH 01/13] mmc: Fix use of wrong device in mmc_gpiod_free_cd() Adrian Hunter
` (13 more replies)
0 siblings, 14 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Hi
Here are some patches to further support for Intel Braswell
SoC plus some miscellaneous changes.
The patches needed for Braswell are:
mmc: sdhci: Add quirk for always getting TC with stop cmd
mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
mmc: sdhci: Let a driver override timeout clock frequency
mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
Adrian Hunter (13):
mmc: Fix use of wrong device in mmc_gpiod_free_cd()
mmc: Fix incorrect warning when setting 0 Hz via debugfs
mmc: It is not an error for the card to be removed while suspended
mmc: block: Fix error recovery stop cmd timeout calculation
mmc: block: Fix SD card stop cmd response type
mmc: sdhci: Add quirk for always getting TC with stop cmd
mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
mmc: sdhci: Let a driver override timeout clock frequency
mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error
drivers/mmc/card/block.c | 30 ++++++++++++++++++++++++------
drivers/mmc/core/core.c | 2 +-
drivers/mmc/core/mmc.c | 2 +-
drivers/mmc/core/sd.c | 2 +-
drivers/mmc/core/slot-gpio.c | 2 +-
drivers/mmc/host/sdhci-acpi.c | 6 ++++--
drivers/mmc/host/sdhci-pci.c | 28 +++++++++++++++++++++++++---
drivers/mmc/host/sdhci-pci.h | 4 ++++
drivers/mmc/host/sdhci.c | 27 +++++++++++++++++++--------
include/linux/mmc/sdhci.h | 2 ++
10 files changed, 82 insertions(+), 23 deletions(-)
Regards
Adrian
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 01/13] mmc: Fix use of wrong device in mmc_gpiod_free_cd()
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 02/13] mmc: Fix incorrect warning when setting 0 Hz via debugfs Adrian Hunter
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
mmc_gpiod_free_cd() is paired with mmc_gpiod_request_cd()
and both must reference the same device which is the
actual host controller device not the mmc_host class
device.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/slot-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index e3fce44..06616cd 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -392,7 +392,7 @@ void mmc_gpiod_free_cd(struct mmc_host *host)
host->slot.cd_irq = -EINVAL;
}
- devm_gpiod_put(&host->class_dev, ctx->cd_gpio);
+ devm_gpiod_put(host->parent, ctx->cd_gpio);
ctx->cd_gpio = NULL;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 02/13] mmc: Fix incorrect warning when setting 0 Hz via debugfs
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
2014-09-22 10:17 ` [PATCH 01/13] mmc: Fix use of wrong device in mmc_gpiod_free_cd() Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 03/13] mmc: It is not an error for the card to be removed while suspended Adrian Hunter
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
It is possible to turn off the card clock by setting
the frequency to zero via debugfs e.g.
echo 0 > /sys/kernel/debug/mmc0/clock
However that produces an incorrect warning that is
designed to warn if the frequency is below the minimum
operating frequency. So correct the warning.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e2e1dd4..16aa7bd 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -995,7 +995,7 @@ void mmc_set_chip_select(struct mmc_host *host, int mode)
*/
static void __mmc_set_clock(struct mmc_host *host, unsigned int hz)
{
- WARN_ON(hz < host->f_min);
+ WARN_ON(hz && hz < host->f_min);
if (hz > host->f_max)
hz = host->f_max;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 03/13] mmc: It is not an error for the card to be removed while suspended
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
2014-09-22 10:17 ` [PATCH 01/13] mmc: Fix use of wrong device in mmc_gpiod_free_cd() Adrian Hunter
2014-09-22 10:17 ` [PATCH 02/13] mmc: Fix incorrect warning when setting 0 Hz via debugfs Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 04/13] mmc: block: Fix error recovery stop cmd timeout calculation Adrian Hunter
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
A removable card can be removed while it is runtime suspended.
Do not print an error message.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/mmc.c | 2 +-
drivers/mmc/core/sd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index ce11d89..1d827eb 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1804,7 +1804,7 @@ static int mmc_runtime_resume(struct mmc_host *host)
return 0;
err = _mmc_resume(host);
- if (err)
+ if (err && (err != -ENOMEDIUM || (host->caps & MMC_CAP_NONREMOVABLE)))
pr_err("%s: error %d doing aggessive resume\n",
mmc_hostname(host), err);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 2591388..28089b3 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1178,7 +1178,7 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
return 0;
err = _mmc_sd_resume(host);
- if (err)
+ if (err && (err != -ENOMEDIUM || (host->caps & MMC_CAP_NONREMOVABLE)))
pr_err("%s: error %d doing aggessive resume\n",
mmc_hostname(host), err);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 04/13] mmc: block: Fix error recovery stop cmd timeout calculation
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (2 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 03/13] mmc: It is not an error for the card to be removed while suspended Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 05/13] mmc: block: Fix SD card stop cmd response type Adrian Hunter
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Data timeout has two components: one in nanoseconds
and one in clock cycles. Clock cycles were not being
added when using the data timeout for the error
recovery stop cmd timeout.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/card/block.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 5d27997..c3770dd 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -945,9 +945,19 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
*/
if (R1_CURRENT_STATE(status) == R1_STATE_DATA ||
R1_CURRENT_STATE(status) == R1_STATE_RCV) {
- err = send_stop(card,
- DIV_ROUND_UP(brq->data.timeout_ns, 1000000),
- req, gen_err, &stop_status);
+ unsigned int timeout_ms, clock;
+
+ timeout_ms = DIV_ROUND_UP(brq->data.timeout_ns, 1000000);
+ if (brq->data.timeout_clks) {
+ clock = card->host->actual_clock;
+ if (!clock)
+ clock = card->host->ios.clock;
+ if (clock) {
+ clock = DIV_ROUND_UP(clock, 1000);
+ timeout_ms += brq->data.timeout_clks / clock;
+ }
+ }
+ err = send_stop(card, timeout_ms, req, gen_err, &stop_status);
if (err) {
pr_err("%s: error %d sending stop command\n",
req->rq_disk->disk_name, err);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 05/13] mmc: block: Fix SD card stop cmd response type
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (3 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 04/13] mmc: block: Fix error recovery stop cmd timeout calculation Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 06/13] mmc: sdhci: Add quirk for always getting TC with stop cmd Adrian Hunter
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Nowhere in the SD Association Specifications does
it state that the stop command has an R1 response
type. It is always R1B. Change accordingly.
Note that, for SD cards, this puts the situation back
to what it was prior to commit
bcc3e1726d827c2d6f62f0e0e7bbc99eed7ad925.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/card/block.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index c3770dd..0736efb 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -801,6 +801,9 @@ static int send_stop(struct mmc_card *card, unsigned int timeout_ms,
if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout))
use_r1b_resp = false;
+ if (!mmc_card_mmc(card))
+ use_r1b_resp = true;
+
cmd.opcode = MMC_STOP_TRANSMISSION;
if (use_r1b_resp) {
cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
@@ -1436,9 +1439,14 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
if (rq_data_dir(req) == READ) {
brq->cmd.opcode = readcmd;
brq->data.flags |= MMC_DATA_READ;
- if (brq->mrq.stop)
- brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 |
- MMC_CMD_AC;
+ if (brq->mrq.stop) {
+ if (mmc_card_mmc(card))
+ brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 |
+ MMC_CMD_AC;
+ else
+ brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1B |
+ MMC_CMD_AC;
+ }
} else {
brq->cmd.opcode = writecmd;
brq->data.flags |= MMC_DATA_WRITE;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 06/13] mmc: sdhci: Add quirk for always getting TC with stop cmd
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (4 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 05/13] mmc: block: Fix SD card stop cmd response type Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 07/13] mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers Adrian Hunter
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Add a quirk for a host controller that always sets
a Transfer Complete interrupt status for the stop
command even when a busy response is not indicated.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci.c | 8 ++++++--
include/linux/mmc/sdhci.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7481bd8..d20d104 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2224,7 +2224,7 @@ static void sdhci_tuning_timer(unsigned long data)
* *
\*****************************************************************************/
-static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
+static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *mask)
{
BUG_ON(intmask == 0);
@@ -2271,6 +2271,9 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
/* The controller does not support the end-of-busy IRQ,
* fall through and take the SDHCI_INT_RESPONSE */
+ } else if ((host->quirks2 & SDHCI_QUIRK2_STOP_WITH_TC) &&
+ host->cmd->opcode == MMC_STOP_TRANSMISSION && !host->data) {
+ *mask &= ~SDHCI_INT_DATA_END;
}
if (intmask & SDHCI_INT_RESPONSE)
@@ -2480,7 +2483,8 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
}
if (intmask & SDHCI_INT_CMD_MASK)
- sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK);
+ sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK,
+ &intmask);
if (intmask & SDHCI_INT_DATA_MASK)
sdhci_data_irq(host, intmask & SDHCI_INT_DATA_MASK);
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 0aa85ca..dba793e 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -98,6 +98,8 @@ struct sdhci_host {
#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
/* Controller does not support DDR50 */
#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
+/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
+#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 07/13] mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (5 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 06/13] mmc: sdhci: Add quirk for always getting TC with stop cmd Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 08/13] mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller Adrian Hunter
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Add quirk SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-acpi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 3483c08..1bc92c6 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -175,7 +175,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR,
.caps2 = MMC_CAP2_HC_ERASE_SZ,
.flags = SDHCI_ACPI_RUNTIME_PM,
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_STOP_WITH_TC,
.probe_slot = sdhci_acpi_emmc_probe_slot,
};
@@ -191,7 +191,8 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = {
.flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL |
SDHCI_ACPI_RUNTIME_PM,
- .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON,
+ .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
+ SDHCI_QUIRK2_STOP_WITH_TC,
.probe_slot = sdhci_acpi_sd_probe_slot,
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 08/13] mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (6 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 07/13] mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 09/13] mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers Adrian Hunter
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Add a HID (INT33BB) and UID (3) for a SD Card host controller.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-acpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 1bc92c6..c38f089 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -207,6 +207,7 @@ static const struct sdhci_acpi_uid_slot sdhci_acpi_uids[] = {
{ "80860F14" , "3" , &sdhci_acpi_slot_int_sd },
{ "80860F16" , NULL, &sdhci_acpi_slot_int_sd },
{ "INT33BB" , "2" , &sdhci_acpi_slot_int_sdio },
+ { "INT33BB" , "3" , &sdhci_acpi_slot_int_sd },
{ "INT33C6" , NULL, &sdhci_acpi_slot_int_sdio },
{ "INT3436" , NULL, &sdhci_acpi_slot_int_sdio },
{ "PNP0D40" },
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 09/13] mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (7 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 08/13] mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 10/13] mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect Adrian Hunter
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Add quirk SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 580073b..31181d8 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -283,7 +283,8 @@ static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
.allow_runtime_pm = true,
.probe_slot = byt_emmc_probe_slot,
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+ SDHCI_QUIRK2_STOP_WITH_TC,
};
static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
@@ -295,7 +296,8 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
.quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
- SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+ SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+ SDHCI_QUIRK2_STOP_WITH_TC,
.allow_runtime_pm = true,
.own_cd_for_runtime_pm = true,
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 10/13] mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (8 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 09/13] mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 11/13] mmc: sdhci: Let a driver override timeout clock frequency Adrian Hunter
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Add support for card detect for Bay Trail
and Braswell SD Card host controllers in PCI
mode.
This uses the gpio descriptor API which can find
gpio descriptors, for example, on an ACPI comapnion
device.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci.c | 20 +++++++++++++++++++-
drivers/mmc/host/sdhci-pci.h | 4 ++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 31181d8..39499fb 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -24,6 +24,7 @@
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
+#include <linux/mmc/slot-gpio.h>
#include <linux/mmc/sdhci-pci-data.h>
#include "sdhci.h"
@@ -280,6 +281,14 @@ static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
return 0;
}
+static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
+{
+ slot->cd_con_id = NULL;
+ slot->cd_idx = 0;
+ slot->cd_override_level = true;
+ return 0;
+}
+
static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
.allow_runtime_pm = true,
.probe_slot = byt_emmc_probe_slot,
@@ -300,6 +309,7 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
SDHCI_QUIRK2_STOP_WITH_TC,
.allow_runtime_pm = true,
.own_cd_for_runtime_pm = true,
+ .probe_slot = byt_sd_probe_slot,
};
/* Define Host controllers for Intel Merrifield platform */
@@ -1354,6 +1364,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
slot->pci_bar = bar;
slot->rst_n_gpio = -EINVAL;
slot->cd_gpio = -EINVAL;
+ slot->cd_idx = -1;
/* Retrieve platform data if there is any */
if (*sdhci_pci_get_data)
@@ -1412,6 +1423,13 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
host->mmc->slotno = slotno;
host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;
+ if (slot->cd_idx >= 0 &&
+ mmc_gpiod_request_cd(host->mmc, slot->cd_con_id, slot->cd_idx,
+ slot->cd_override_level, 0)) {
+ dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
+ slot->cd_idx = -1;
+ }
+
ret = sdhci_add_host(host);
if (ret)
goto remove;
@@ -1424,7 +1442,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
* Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure.
*/
if (chip->fixes && chip->fixes->own_cd_for_runtime_pm &&
- !gpio_is_valid(slot->cd_gpio))
+ !gpio_is_valid(slot->cd_gpio) && slot->cd_idx < 0)
chip->allow_runtime_pm = false;
return slot;
diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
index 9c1909b..d57c3d1 100644
--- a/drivers/mmc/host/sdhci-pci.h
+++ b/drivers/mmc/host/sdhci-pci.h
@@ -64,6 +64,10 @@ struct sdhci_pci_slot {
int cd_gpio;
int cd_irq;
+ char *cd_con_id;
+ int cd_idx;
+ bool cd_override_level;
+
void (*hw_reset)(struct sdhci_host *host);
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 11/13] mmc: sdhci: Let a driver override timeout clock frequency
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (9 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 10/13] mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 12/13] mmc: sdhci-pci: Fix Braswell eMMC " Adrian Hunter
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Let a driver override the timeout clock frequency by
populating it before calling sdhci_add_host(). Note
the value will otherwise be zero because sdhci_host is
zeroed when allocated.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index d20d104..8588550 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2790,6 +2790,7 @@ int sdhci_add_host(struct sdhci_host *host)
u32 caps[2] = {0, 0};
u32 max_current_caps;
unsigned int ocr_avail;
+ unsigned int override_timeout_clk;
int ret;
WARN_ON(host == NULL);
@@ -2803,6 +2804,8 @@ int sdhci_add_host(struct sdhci_host *host)
if (debug_quirks2)
host->quirks2 = debug_quirks2;
+ override_timeout_clk = host->timeout_clk;
+
sdhci_do_reset(host, SDHCI_RESET_ALL);
host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
@@ -2971,6 +2974,9 @@ int sdhci_add_host(struct sdhci_host *host)
mmc->max_busy_timeout /= host->timeout_clk;
}
+ if (override_timeout_clk)
+ host->timeout_clk = override_timeout_clk;
+
mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23;
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 12/13] mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (10 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 11/13] mmc: sdhci: Let a driver override timeout clock frequency Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-22 10:17 ` [PATCH 13/13] mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error Adrian Hunter
2014-09-23 7:34 ` [PATCH 00/13] mmc: Some Braswell and misc patches Ulf Hansson
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
Braswell eMMC host controller specifies an incorrect
timeout clock frequncy in the capabilities registers.
The correct value is 1 MHz.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 39499fb..9e791e9 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -272,6 +272,8 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR;
slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
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 */
return 0;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 13/13] mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (11 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 12/13] mmc: sdhci-pci: Fix Braswell eMMC " Adrian Hunter
@ 2014-09-22 10:17 ` Adrian Hunter
2014-09-23 7:34 ` [PATCH 00/13] mmc: Some Braswell and misc patches Ulf Hansson
13 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-22 10:17 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: linux-mmc
According to the SD Host Controller Standard Specification:
"...Transfer Complete has higher priority than Data Timeout
Error. If both bits are set to 1, execution of a command
can be considered to be completed."
Adjust the checking of SDHCI_INT_DATA_TIMEOUT and
SDHCI_INT_DATA_END (Transfer Complete) accordingly.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 8588550..6ada726 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2332,11 +2332,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
* above in sdhci_cmd_irq().
*/
if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) {
- if (intmask & SDHCI_INT_DATA_TIMEOUT) {
- host->cmd->error = -ETIMEDOUT;
- tasklet_schedule(&host->finish_tasklet);
- return;
- }
if (intmask & SDHCI_INT_DATA_END) {
/*
* Some cards handle busy-end interrupt
@@ -2349,6 +2344,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
host->busy_handle = 1;
return;
}
+ if (intmask & SDHCI_INT_DATA_TIMEOUT) {
+ host->cmd->error = -ETIMEDOUT;
+ tasklet_schedule(&host->finish_tasklet);
+ return;
+ }
}
pr_err("%s: Got data interrupt 0x%08x even "
@@ -2359,7 +2359,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
return;
}
- if (intmask & SDHCI_INT_DATA_TIMEOUT)
+ if ((intmask & SDHCI_INT_DATA_TIMEOUT) &&
+ !(intmask & SDHCI_INT_DATA_END))
host->data->error = -ETIMEDOUT;
else if (intmask & SDHCI_INT_DATA_END_BIT)
host->data->error = -EILSEQ;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 00/13] mmc: Some Braswell and misc patches
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
` (12 preceding siblings ...)
2014-09-22 10:17 ` [PATCH 13/13] mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error Adrian Hunter
@ 2014-09-23 7:34 ` Ulf Hansson
2014-09-24 7:45 ` Adrian Hunter
13 siblings, 1 reply; 16+ messages in thread
From: Ulf Hansson @ 2014-09-23 7:34 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Chris Ball, linux-mmc
On 22 September 2014 12:17, Adrian Hunter <adrian.hunter@intel.com> wrote:
> Hi
>
> Here are some patches to further support for Intel Braswell
> SoC plus some miscellaneous changes.
>
> The patches needed for Braswell are:
>
> mmc: sdhci: Add quirk for always getting TC with stop cmd
> mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
> mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
> mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
> mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
> mmc: sdhci: Let a driver override timeout clock frequency
> mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
>
The above seems like a good argument to at least split this patchset
into two pieces, could you please do that?
Kind regards
Uffe
>
> Adrian Hunter (13):
> mmc: Fix use of wrong device in mmc_gpiod_free_cd()
> mmc: Fix incorrect warning when setting 0 Hz via debugfs
> mmc: It is not an error for the card to be removed while suspended
> mmc: block: Fix error recovery stop cmd timeout calculation
> mmc: block: Fix SD card stop cmd response type
> mmc: sdhci: Add quirk for always getting TC with stop cmd
> mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
> mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
> mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
> mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
> mmc: sdhci: Let a driver override timeout clock frequency
> mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
> mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error
>
> drivers/mmc/card/block.c | 30 ++++++++++++++++++++++++------
> drivers/mmc/core/core.c | 2 +-
> drivers/mmc/core/mmc.c | 2 +-
> drivers/mmc/core/sd.c | 2 +-
> drivers/mmc/core/slot-gpio.c | 2 +-
> drivers/mmc/host/sdhci-acpi.c | 6 ++++--
> drivers/mmc/host/sdhci-pci.c | 28 +++++++++++++++++++++++++---
> drivers/mmc/host/sdhci-pci.h | 4 ++++
> drivers/mmc/host/sdhci.c | 27 +++++++++++++++++++--------
> include/linux/mmc/sdhci.h | 2 ++
> 10 files changed, 82 insertions(+), 23 deletions(-)
>
>
> Regards
> Adrian
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/13] mmc: Some Braswell and misc patches
2014-09-23 7:34 ` [PATCH 00/13] mmc: Some Braswell and misc patches Ulf Hansson
@ 2014-09-24 7:45 ` Adrian Hunter
0 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2014-09-24 7:45 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Chris Ball, linux-mmc
On 23/09/2014 10:34 a.m., Ulf Hansson wrote:
> On 22 September 2014 12:17, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> Hi
>>
>> Here are some patches to further support for Intel Braswell
>> SoC plus some miscellaneous changes.
>>
>> The patches needed for Braswell are:
>>
>> mmc: sdhci: Add quirk for always getting TC with stop cmd
>> mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
>> mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
>> mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
>> mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
>> mmc: sdhci: Let a driver override timeout clock frequency
>> mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
>>
>
> The above seems like a good argument to at least split this patchset
> into two pieces, could you please do that?
OK, split into 2 patch sets:
http://marc.info/?l=linux-mmc&m=141150256610085&w=2
http://marc.info/?l=linux-mmc&m=141154429821225&w=2
>
> Kind regards
> Uffe
>
>>
>> Adrian Hunter (13):
>> mmc: Fix use of wrong device in mmc_gpiod_free_cd()
>> mmc: Fix incorrect warning when setting 0 Hz via debugfs
>> mmc: It is not an error for the card to be removed while suspended
>> mmc: block: Fix error recovery stop cmd timeout calculation
>> mmc: block: Fix SD card stop cmd response type
>> mmc: sdhci: Add quirk for always getting TC with stop cmd
>> mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers
>> mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
>> mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers
>> mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
>> mmc: sdhci: Let a driver override timeout clock frequency
>> mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
>> mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error
>>
>> drivers/mmc/card/block.c | 30 ++++++++++++++++++++++++------
>> drivers/mmc/core/core.c | 2 +-
>> drivers/mmc/core/mmc.c | 2 +-
>> drivers/mmc/core/sd.c | 2 +-
>> drivers/mmc/core/slot-gpio.c | 2 +-
>> drivers/mmc/host/sdhci-acpi.c | 6 ++++--
>> drivers/mmc/host/sdhci-pci.c | 28 +++++++++++++++++++++++++---
>> drivers/mmc/host/sdhci-pci.h | 4 ++++
>> drivers/mmc/host/sdhci.c | 27 +++++++++++++++++++--------
>> include/linux/mmc/sdhci.h | 2 ++
>> 10 files changed, 82 insertions(+), 23 deletions(-)
>>
>>
>> Regards
>> Adrian
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2014-09-24 7:45 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-22 10:17 [PATCH 00/13] mmc: Some Braswell and misc patches Adrian Hunter
2014-09-22 10:17 ` [PATCH 01/13] mmc: Fix use of wrong device in mmc_gpiod_free_cd() Adrian Hunter
2014-09-22 10:17 ` [PATCH 02/13] mmc: Fix incorrect warning when setting 0 Hz via debugfs Adrian Hunter
2014-09-22 10:17 ` [PATCH 03/13] mmc: It is not an error for the card to be removed while suspended Adrian Hunter
2014-09-22 10:17 ` [PATCH 04/13] mmc: block: Fix error recovery stop cmd timeout calculation Adrian Hunter
2014-09-22 10:17 ` [PATCH 05/13] mmc: block: Fix SD card stop cmd response type Adrian Hunter
2014-09-22 10:17 ` [PATCH 06/13] mmc: sdhci: Add quirk for always getting TC with stop cmd Adrian Hunter
2014-09-22 10:17 ` [PATCH 07/13] mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host controllers Adrian Hunter
2014-09-22 10:17 ` [PATCH 08/13] mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller Adrian Hunter
2014-09-22 10:17 ` [PATCH 09/13] mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host controllers Adrian Hunter
2014-09-22 10:17 ` [PATCH 10/13] mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect Adrian Hunter
2014-09-22 10:17 ` [PATCH 11/13] mmc: sdhci: Let a driver override timeout clock frequency Adrian Hunter
2014-09-22 10:17 ` [PATCH 12/13] mmc: sdhci-pci: Fix Braswell eMMC " Adrian Hunter
2014-09-22 10:17 ` [PATCH 13/13] mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error Adrian Hunter
2014-09-23 7:34 ` [PATCH 00/13] mmc: Some Braswell and misc patches Ulf Hansson
2014-09-24 7:45 ` Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox