Commit 0d8ea7fc authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

SDHCI_ANY_PRESENT

parent 85e1d930
...@@ -151,7 +151,16 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) ...@@ -151,7 +151,16 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
if (enable) { if (enable) {
present = sdhci_readl(host, SDHCI_PRESENT_STATE) & present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_DAT3_PRESENT; SDHCI_ANY_PRESENT;
/* oleg's debug
if (!present){
pr_err("Forcing Card Present\n");
present = SDHCI_ANY_PRESENT;
}else{
pr_err("Card Is Present\n");
}
*/
host->ier |= present ? SDHCI_INT_CARD_REMOVE : host->ier |= present ? SDHCI_INT_CARD_REMOVE :
SDHCI_INT_CARD_INSERT; SDHCI_INT_CARD_INSERT;
...@@ -207,9 +216,13 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask) ...@@ -207,9 +216,13 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
{ {
if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) { if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_DAT3_PRESENT)) SDHCI_ANY_PRESENT)){
// oleg's debug
//pr_err("!!!!!sdhci_doNOT_reset!!!!");
return; return;
}
} }
//pr_err("!!!!!sdhci_do_reset!!!!");
host->ops->reset(host, mask); host->ops->reset(host, mask);
...@@ -1395,10 +1408,19 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -1395,10 +1408,19 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
present = 1; present = 1;
else else
present = sdhci_readl(host, SDHCI_PRESENT_STATE) & present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_DAT3_PRESENT; SDHCI_ANY_PRESENT;
} }
/*oleg's debug
if (!present){
pr_err("sdhci card request: card not present?\n");
present = 1;
}else{
pr_err("sdhci card request: CARD IS PRESENT: 0x%08x\n",present);
}
*/
if (!present || host->flags & SDHCI_DEVICE_DEAD) { if (!present || host->flags & SDHCI_DEVICE_DEAD) {
host->mrq->cmd->error = -ENOMEDIUM; host->mrq->cmd->error = -ENOMEDIUM;
tasklet_schedule(&host->finish_tasklet); tasklet_schedule(&host->finish_tasklet);
} else { } else {
...@@ -1651,6 +1673,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1651,6 +1673,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
static int sdhci_do_get_cd(struct sdhci_host *host) static int sdhci_do_get_cd(struct sdhci_host *host)
{ {
int gpio_cd = mmc_gpio_get_cd(host->mmc); int gpio_cd = mmc_gpio_get_cd(host->mmc);
int present;
if (host->flags & SDHCI_DEVICE_DEAD) if (host->flags & SDHCI_DEVICE_DEAD)
return 0; return 0;
...@@ -1664,8 +1687,18 @@ static int sdhci_do_get_cd(struct sdhci_host *host) ...@@ -1664,8 +1687,18 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
if (!IS_ERR_VALUE(gpio_cd)) if (!IS_ERR_VALUE(gpio_cd))
return !!gpio_cd; return !!gpio_cd;
present = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_ANY_PRESENT);
/* oleg's debug
if (!present){
pr_err("sdhci_do_get_cd: card not present\n");
present = 1;
}else{
pr_err("sdhci_do_get_cd: CARD IS PRESENT\n");
}
*/
/* Host native card detect */ /* Host native card detect */
return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_DAT3_PRESENT); return present;
} }
static int sdhci_get_cd(struct mmc_host *mmc) static int sdhci_get_cd(struct mmc_host *mmc)
...@@ -2606,7 +2639,16 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) ...@@ -2606,7 +2639,16 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
u32 present = sdhci_readl(host, SDHCI_PRESENT_STATE) & u32 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_DAT3_PRESENT; SDHCI_ANY_PRESENT;
/*
if (!present){
pr_err("sdhci_irq: card not present\n");
present = 1;
}else{
pr_err("sdhci_irq: card is present\n");
}
*/
/* /*
* There is a observation on i.mx esdhc. INSERT * There is a observation on i.mx esdhc. INSERT
......
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
#define SDHCI_DATA_AVAILABLE 0x00000800 #define SDHCI_DATA_AVAILABLE 0x00000800
#define SDHCI_CARD_PRESENT 0x00010000 #define SDHCI_CARD_PRESENT 0x00010000
#define SDHCI_DAT3_PRESENT 0x00800000 #define SDHCI_DAT3_PRESENT 0x00800000
//For 10393 rev.B unreliable D3 detection
#define SDHCI_ANY_PRESENT (SDHCI_CARD_PRESENT | SDHCI_DAT3_PRESENT)
#define SDHCI_WRITE_PROTECT 0x00080000 #define SDHCI_WRITE_PROTECT 0x00080000
#define SDHCI_DATA_LVL_MASK 0x00F00000 #define SDHCI_DATA_LVL_MASK 0x00F00000
#define SDHCI_DATA_LVL_SHIFT 20 #define SDHCI_DATA_LVL_SHIFT 20
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment