mmc:sd hotplug fixes for omap
cover mmc:sd hotplug fixes for omap
This patch set has fixes for SD card hotplug for OMAP SOCs.
Viswanath Puttagunta (3):
mmc: omap_hsmmc: Errata i705: SD hot unplug
mmc: omap_hsmmc: Errata: Fix SD card removal detection
mfd: Enable Debounce logic for SD hotplug detection
drivers/mfd/twl6030-irq.c | 8 ++++++++ drivers/mmc/host/omap_hsmmc.c | 41 ++++++++++++++++++++++++++++++++++++++--- include/linux/i2c/twl.h | 5 +++++ 3 files changed, 51 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/3 mmc: omap_hsmmc: Errata i705: SD hot unplug
Turn off IO & PBIAS cells and then SD card VMMC as soon as we get disconnect interrupt. Failure to do so might cause current spikes (latch-up issue) which can potentially burn the IO cells.
--- drivers/mmc/host/omap_hsmmc.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
drivers/mmc/host/omap_hsmmc.c +10 -3
@@ -1177,10 +1177,17 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) carddetect = -ENOSYS ; } -if (carddetect) +if (carddetect) {mmc_detect_change (host->mmc, (HZ *200 ) /1000 ); -else -mmc_detect_change (host->mmc, (HZ *50 ) /1000 ); + }else { +if ((MMC_POWER_OFF != host->power_mode) && + (mmc_slot (host).set_power !=NULL )) { +mmc_slot (host).set_power (host->dev, host->slot_id, +0 ,0 ); + host->power_mode =MMC_POWER_OFF ; + } +mmc_detect_change (host->mmc,0 ); + }return IRQ_HANDLED ; }
Signature · 1 line
1.7.4.1
Re: [PATCH 1/3] mmc: omap_hsmmc: Errata i705: SD hot unplug
Quoted 15 lines · Viswanath Puttagunta
Turn off IO & PBIAS cells and then SD card VMMC as soon as we get disconnect interrupt. Failure to do so might cause current spikes (latch-up issue) which can potentially burn the IO cells.
Signed-off-by Viswanath Puttagunta <[email protected]>---
drivers/mmc/host/omap_hsmmc.c | 13 ++++++++++---1 files changed, 10 insertions(+), 3 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-0
drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) · line 1183
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +3
-3@@ -1177,10 +1177,17 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) carddetect = -ENOSYS; } - if (carddetect) + if (carddetect) { mmc_detect_change(host->mmc, (HZ * 200) / 1000); - else - mmc_detect_change(host->mmc, (HZ * 50) / 1000); + } else { + if ((MMC_POWER_OFF != host->power_mode) &&
Should be if((host->power_mode != MMC_POWER_OFF)
drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) · line 1187
Quoted 4 lines
drivers/mmc/host/omap_hsmmc.c +4
-0+ (mmc_slot(host).set_power != NULL)) { + mmc_slot(host).set_power(host->dev, host->slot_id, + 0, 0); + host->power_mode = MMC_POWER_OFF;
This is just changing the default behaviour, irrespective of whether the errata is applicable.
What is the effect of this change for other boards / platforms ?
Quoted 9 lines
drivers/mmc/host/omap_hsmmc.c +3
-1+ } + mmc_detect_change(host->mmc, 0); + } return IRQ_HANDLED; } --1.7.4.1
Re: [PATCH 1/3] mmc: omap_hsmmc: Errata i705: SD hot unplug
Quoted 39 lines · Venkatraman
Quoted 17 lines · Viswanath Puttagunta
Turn off IO & PBIAS cells and then SD card VMMC as soon as we get disconnect interrupt. Failure to do so might cause current spikes (latch-up issue) which can potentially burn the IO cells.
Signed-off-by Viswanath Puttagunta <[email protected]>---
drivers/mmc/host/omap_hsmmc.c | 13 ++++++++++---1 files changed, 10 insertions(+), 3 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-0@@ -1177,10 +1177,17 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_detect(int irq, · line 1184
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +3
-3carddetect = -ENOSYS; } - if (carddetect) + if (carddetect) { mmc_detect_change(host->mmc, (HZ * 200) / 1000); - else - mmc_detect_change(host->mmc, (HZ * 50) / 1000); + } else { + if ((MMC_POWER_OFF != host->power_mode) &&Should be if((host->power_mode !=
MMC_POWER_OFF)drivers/mmc/host/omap_hsmmc.c static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) · line 1187
Quoted 5 lines
drivers/mmc/host/omap_hsmmc.c +4
-0+ (mmc_slot(host).set_power != NULL)) { + mmc_slot(host).set_power(host->dev, host->slot_id, + 0, 0); + host->power_mode = MMC_POWER_OFF;
Quoted 13 lines
This is just changing the default behaviour, irrespective of whether the errata is applicable.
What is the effect of this change for other boards / platforms ?Quoted 9 lines
drivers/mmc/host/omap_hsmmc.c +3
-0+ } + mmc_detect_change(host->mmc, 0); + } return IRQ_HANDLED;}
--
1.7.4.1
Resending as plain text without any html content/formatting.
I did not see any -ve effects of turning off the power cell as soon as possible when the SD card is turned off. This is why I did not differentiate.
- Vish
PATCH 2/3 mmc: omap_hsmmc: Errata: Fix SD card removal detection
In reply to Viswanath PuttaguntaBecause of OMAP4 Silicon errata (i705), we have to turn off the PBIAS and VMMC for SD card as soon as we get card disconnect interrupt. Because of this, we don't wait for all higher layer structures to be dismantled before turning off power. As a side effect of this, we might end up getting a mmc_request even after SD is removed and VMMC and PBIAS are turned off. In that case, just fail the mmc_request and return immediately
--- drivers/mmc/host/omap_hsmmc.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +28 -0
@@ -1180,12 +1180,20 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)if (carddetect) {mmc_detect_change (host->mmc, (HZ *200 ) /1000 ); }else { +/* +* Because of OMAP4 Silicon errata (i705), we have to turn off the +* PBIAS and VMMC for SD card as soon as we get card disconnect +* interrupt. Because of this, we don't wait for all higher layer +* structures to be dismantled before turning off power +*/ +mmc_claim_host (host->mmc);if ((MMC_POWER_OFF != host->power_mode) && (mmc_slot (host).set_power !=NULL )) {mmc_slot (host).set_power (host->dev, host->slot_id,0 ,0 ); host->power_mode =MMC_POWER_OFF ; } +mmc_release_host (host->mmc);mmc_detect_change (host->mmc,0 ); }return IRQ_HANDLED ;
@@ -1500,6 +1508,26 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req) }else if (host->reqs_blocked) host->reqs_blocked =0 ;WARN_ON (host->mrq !=NULL ); + +/* +* Because of OMAP4 Silicon errata (i705), we have to turn off the +* PBIAS and VMMC for SD card as soon as we get card disconnect +* interrupt. Because of this, we don't wait for all higher layer +* structures to be dismantled before turning off power. Because +* of this, we might end up here even after SD card is removed +* and VMMC and PBIAS are turned off. In that case, just fail +* the commands immediately +*/ +if (host->power_mode ==MMC_POWER_OFF ) { + req->cmd->error =EIO ; +if (req->data) + req->data->error = -EIO ; +dev_warn (mmc_dev (host->mmc), +"Card is no longer present\n" ); +mmc_request_done (mmc, req); +return ; + } + host->mrq = req; err =omap_hsmmc_prepare_data (host, req);if (err) {
Signature · 1 line
1.7.4.1
PATCH 3/3 mfd: Enable Debounce logic for SD hotplug detection
In reply to Viswanath PuttaguntaEnable debounce logic in TWL6030 so that erroneous disconnect/connect interrupts will be suppressed.
This will fix issue where SD card is either plugged or unplugged very slowly.
--- drivers/mfd/twl6030-irq.c | 8 ++++++++ include/linux/i2c/twl.h | 5 +++++ 2 files changed, 13 insertions(+), 0 deletions(-)
drivers/mfd/twl6030-irq.c +8 -0
@@ -317,6 +317,14 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } + ret =twl_i2c_write_u8 (TWL6030_MODULE_ID0 , + (MMC_MINS_DEB_MASK |MMC_MEXT_DEB_MASK ), +TWL6030_MMCDEBOUNCING ); +if (ret <0 ) { +pr_err ("twl6030: Failed to write MMC_MEXT_DEB_MASK %d\n" , + ret); +return ret; + }return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }
include/linux/i2c/twl.h +5 -0
@@ -147,6 +147,11 @@#define SW_FC (0x1 << 2)#define STS_MMC 0x1 +#define TWL6030_MMCDEBOUNCING 0xED +#define MMC_DEB_BYPASS (0x1 << 7) +#define MMC_MINS_DEB_MASK (0xF << 3) +#define MMC_MEXT_DEB_MASK (0x7 << 0) +#define TWL6030_CFG_INPUT_PUPD3 0xF2#define MMC_PU (0x1 << 3)#define MMC_PD (0x1 << 2)
Signature · 1 line
1.7.4.1
Re: [PATCH 3/3] mfd: Enable Debounce logic for SD hotplug detection
Quoted 9 lines · Viswanath Puttagunta
Enable debounce logic in TWL6030 so that erroneous disconnect/connect interrupts will be suppressed.
This will fix issue where SD card is either plugged or unplugged very slowly.
Change-Id Icc3afa4c66b3bc7920f27ff9c9a3f32e67d5833cSigned-off-by Viswanath Puttagunta <[email protected]>
Would be better without the Change-Id.
Also, this needs to be posted to linux-omap and linux-mfd, apart from linux-mmc.
Quoted 30 lines
---
drivers/mfd/twl6030-irq.c | 8 ++++++++
include/linux/i2c/twl.h | 5 +++++2 files changed, 13 insertions(+), 0 deletions(-)drivers/mfd/twl6030-irq.c +8
-0@@ -317,6 +317,14 @@ int twl6030_mmc_card_detect_config(void) ret); return ret; } + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, + (MMC_MINS_DEB_MASK | MMC_MEXT_DEB_MASK), + TWL6030_MMCDEBOUNCING); + if (ret < 0) { + pr_err("twl6030: Failed to write MMC_MEXT_DEB_MASK %d\n", + ret); + return ret; + } return twl6030_irq_base + MMCDETECT_INTR_OFFSET;}
include/linux/i2c/twl.h +0
-0
include/linux/i2c/twl.h line 153
Quoted 7 lines
include/linux/i2c/twl.h +4
-0@@ -147,6 +147,11 @@ #define SW_FC (0x1 << 2) #define STS_MMC 0x1 +#define TWL6030_MMCDEBOUNCING 0xED +#define MMC_DEB_BYPASS (0x1 << 7) +#define MMC_MINS_DEB_MASK (0xF << 3) +#define MMC_MEXT_DEB_MASK (0x7 << 0)
Some description about what these values mean (timing etc) would be helpful.
Quoted 7 lines
include/linux/i2c/twl.h +1
-1+ #define TWL6030_CFG_INPUT_PUPD3 0xF2 #define MMC_PU (0x1 << 3) #define MMC_PD (0x1 << 2) --1.7.4.1
Quoted 6 lines · Viswanath Puttagunta
This patch set has fixes for SD card hotplug for OMAP SOCs.
Viswanath Puttagunta (3):
mmc:omap_hsmmc: Errata i705: SD hot unplug
mmc:omap_hsmmc: Errata: Fix SD card removal detection
mfd: Enable Debounce logic for SD hotplug detection
Please copy [email protected] as well, for these patches.
Quoted 9 lines
drivers/mfd/twl6030-irq.c | 8 ++++++++
drivers/mmc/host/omap_hsmmc.c| 41 ++++++++++++++++++++++++++++++++++++++---include/linux/i2c/twl.h| 5 +++++3 files changed, 51 insertions(+), 3 deletions(-)--
1.7.4.1