* [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4
@ 2013-10-20 18:55 Balaji T K
2013-10-20 18:55 ` [PATCH 2/5] mmc: omap_hsmmc: context save and restore for DT Balaji T K
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Balaji T K @ 2013-10-20 18:55 UTC (permalink / raw)
To: linux-mmc, cjb, tony; +Cc: linux-omap, Balaji T K
pbias_disable is set to protect the mmc pbias i/o cells in DT boot
by preventing voltage switch. Currently pbias_disable is enabled only
for omap3 and not for omap4 due to reg_offset difference of 0x100.
Enable pbias_disable for omap4+ too by using res->start
which does not include the reg_offset.
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7d2d929..84a1140 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1876,7 +1876,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
omap_hsmmc_context_save(host);
/* This can be removed once we support PBIAS with DT */
- if (host->dev->of_node && host->mapbase == 0x4809c000)
+ if (host->dev->of_node && res->start == 0x4809c000)
host->pbias_disable = 1;
host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] mmc: omap_hsmmc: context save and restore for DT
2013-10-20 18:55 [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Balaji T K
@ 2013-10-20 18:55 ` Balaji T K
2013-10-20 18:55 ` [PATCH 3/5] mmc: omap_hsmmc: fix timeout for cmd and data soft reset Balaji T K
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Balaji T K @ 2013-10-20 18:55 UTC (permalink / raw)
To: linux-mmc, cjb, tony; +Cc: linux-omap, Andreas Fenkart, Balaji T K
From: Tony Lindgren <tony@atomide.com>
We want to get rid of the omap specific platform init code
callbacks as they don't play nice with device tree.
Convert the context loss check to be based on a
register state detection instead.
Cc: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
[add check for CON and HCTL in context save and restore function]
---
drivers/mmc/host/omap_hsmmc.c | 52 +++++++++++++++-------------------------
1 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 84a1140..9ebff99 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -171,6 +171,10 @@ struct omap_hsmmc_host {
unsigned char bus_mode;
unsigned char power_mode;
int suspended;
+ u32 con;
+ u32 hctl;
+ u32 sysctl;
+ u32 capa;
int irq;
int use_dma, dma_ch;
struct dma_chan *tx_chan;
@@ -183,7 +187,6 @@ struct omap_hsmmc_host {
int use_reg;
int req_in_progress;
struct omap_hsmmc_next next_data;
-
struct omap_mmc_platform_data *pdata;
};
@@ -597,25 +600,20 @@ static void omap_hsmmc_set_bus_mode(struct omap_hsmmc_host *host)
static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
{
struct mmc_ios *ios = &host->mmc->ios;
- struct omap_mmc_platform_data *pdata = host->pdata;
- int context_loss = 0;
u32 hctl, capa;
unsigned long timeout;
- if (pdata->get_context_loss_count) {
- context_loss = pdata->get_context_loss_count(host->dev);
- if (context_loss < 0)
- return 1;
- }
-
- dev_dbg(mmc_dev(host->mmc), "context was %slost\n",
- context_loss == host->context_loss ? "not " : "");
- if (host->context_loss == context_loss)
- return 1;
-
if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
return 1;
+ if (host->con == OMAP_HSMMC_READ(host->base, CON) &&
+ host->hctl == OMAP_HSMMC_READ(host->base, HCTL) &&
+ host->sysctl == OMAP_HSMMC_READ(host->base, SYSCTL) &&
+ host->capa == OMAP_HSMMC_READ(host->base, CAPA))
+ return 0;
+
+ host->context_loss++;
+
if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
if (host->power_mode != MMC_POWER_OFF &&
(1 << ios->vdd) <= MMC_VDD_23_24)
@@ -655,9 +653,8 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
omap_hsmmc_set_bus_mode(host);
out:
- host->context_loss = context_loss;
-
- dev_dbg(mmc_dev(host->mmc), "context is restored\n");
+ dev_dbg(mmc_dev(host->mmc), "context is restored: restore count %d\n",
+ host->context_loss);
return 0;
}
@@ -666,15 +663,10 @@ out:
*/
static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
{
- struct omap_mmc_platform_data *pdata = host->pdata;
- int context_loss;
-
- if (pdata->get_context_loss_count) {
- context_loss = pdata->get_context_loss_count(host->dev);
- if (context_loss < 0)
- return;
- host->context_loss = context_loss;
- }
+ host->con = OMAP_HSMMC_READ(host->base, CON);
+ host->hctl = OMAP_HSMMC_READ(host->base, HCTL);
+ host->sysctl = OMAP_HSMMC_READ(host->base, SYSCTL);
+ host->capa = OMAP_HSMMC_READ(host->base, CAPA);
}
#else
@@ -1635,13 +1627,9 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data)
{
struct mmc_host *mmc = s->private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
- int context_loss = 0;
-
- if (host->pdata->get_context_loss_count)
- context_loss = host->pdata->get_context_loss_count(host->dev);
- seq_printf(s, "mmc%d:\n ctx_loss:\t%d:%d\n\nregs:\n",
- mmc->index, host->context_loss, context_loss);
+ seq_printf(s, "mmc%d:\n ctx_loss:\t%d\n\nregs:\n",
+ mmc->index, host->context_loss);
if (host->suspended) {
seq_printf(s, "host suspended, can't read registers\n");
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] mmc: omap_hsmmc: fix timeout for cmd and data soft reset
2013-10-20 18:55 [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Balaji T K
2013-10-20 18:55 ` [PATCH 2/5] mmc: omap_hsmmc: context save and restore for DT Balaji T K
@ 2013-10-20 18:55 ` Balaji T K
2013-10-20 18:55 ` [PATCH 4/5] mmc: omap_hsmmc: correct max value of clkd Balaji T K
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Balaji T K @ 2013-10-20 18:55 UTC (permalink / raw)
To: linux-mmc, cjb, tony; +Cc: linux-omap, Jianpeng Ma, Balaji T K
From: Jianpeng Ma <majianpeng@gmail.com>
With HSMMC_HAS_UPDATED_RESET reset of cmd/data (SRC/SRD) can be to
quick and can be missed resulting in wait for software timeout.
With cpu_relax timeout can be long and unpredictable. Use udelay instead for
timeout implementation.
Reported-by: Yuzheng Ma <mayuzheng@kedacom.com>
Tested-by: Yuzheng Ma <mayuzheng@kedacom.com>
Reviewed-by: Hein Tibosch <hein_tibosch@yahoo.es>
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9ebff99..9f74a57 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -119,7 +119,8 @@
BRR_EN | BWR_EN | TC_EN | CC_EN)
#define MMC_AUTOSUSPEND_DELAY 100
-#define MMC_TIMEOUT_MS 20
+#define MMC_TIMEOUT_MS 20 /* 20 mSec */
+#define MMC_TIMEOUT_US 20000 /* 20000 micro Sec */
#define OMAP_MMC_MIN_CLOCK 400000
#define OMAP_MMC_MAX_CLOCK 52000000
#define DRIVER_NAME "omap_hsmmc"
@@ -967,8 +968,7 @@ static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
unsigned long bit)
{
unsigned long i = 0;
- unsigned long limit = (loops_per_jiffy *
- msecs_to_jiffies(MMC_TIMEOUT_MS));
+ unsigned long limit = MMC_TIMEOUT_US;
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | bit);
@@ -980,13 +980,13 @@ static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
if (mmc_slot(host).features & HSMMC_HAS_UPDATED_RESET) {
while ((!(OMAP_HSMMC_READ(host->base, SYSCTL) & bit))
&& (i++ < limit))
- cpu_relax();
+ udelay(1);
}
i = 0;
while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) &&
(i++ < limit))
- cpu_relax();
+ udelay(1);
if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit)
dev_err(mmc_dev(host->mmc),
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] mmc: omap_hsmmc: correct max value of clkd
2013-10-20 18:55 [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Balaji T K
2013-10-20 18:55 ` [PATCH 2/5] mmc: omap_hsmmc: context save and restore for DT Balaji T K
2013-10-20 18:55 ` [PATCH 3/5] mmc: omap_hsmmc: fix timeout for cmd and data soft reset Balaji T K
@ 2013-10-20 18:55 ` Balaji T K
2013-10-20 18:55 ` [PATCH 5/5] mmc: omap_hsmmc: remove unused no_off Balaji T K
2013-10-27 1:30 ` [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Balaji T K @ 2013-10-20 18:55 UTC (permalink / raw)
To: linux-mmc, cjb, tony; +Cc: linux-omap, Balaji T K
clock divisor can take a max value of 1023.
Update code so that card init can be handled at f_min even at
higher IP clock frequencies from which clock to the card is
derived.
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9f74a57..60db34d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -75,6 +75,7 @@
#define ICE 0x1
#define ICS 0x2
#define CEN (1 << 2)
+#define CLKD_MAX 0x3FF /* max clock divisor: 1023 */
#define CLKD_MASK 0x0000FFC0
#define CLKD_SHIFT 6
#define DTO_MASK 0x000F0000
@@ -497,8 +498,8 @@ static u16 calc_divisor(struct omap_hsmmc_host *host, struct mmc_ios *ios)
if (ios->clock) {
dsor = DIV_ROUND_UP(clk_get_rate(host->fclk), ios->clock);
- if (dsor > 250)
- dsor = 250;
+ if (dsor > CLKD_MAX)
+ dsor = CLKD_MAX;
}
return dsor;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] mmc: omap_hsmmc: remove unused no_off
2013-10-20 18:55 [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Balaji T K
` (2 preceding siblings ...)
2013-10-20 18:55 ` [PATCH 4/5] mmc: omap_hsmmc: correct max value of clkd Balaji T K
@ 2013-10-20 18:55 ` Balaji T K
2013-10-27 1:30 ` [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Balaji T K @ 2013-10-20 18:55 UTC (permalink / raw)
To: linux-mmc, cjb, tony; +Cc: linux-omap, Balaji T K
With lazy disable gone, no_off is not used any more in omap_hsmmc
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 60db34d..1646347 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1829,13 +1829,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
mmc->ops = &omap_hsmmc_ops;
- /*
- * If regulator_disable can only put vcc_aux to sleep then there is
- * no off state.
- */
- if (mmc_slot(host).vcc_aux_disable_is_sleep)
- mmc_slot(host).no_off = 1;
-
mmc->f_min = OMAP_MMC_MIN_CLOCK;
if (pdata->max_freq > 0)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4
2013-10-20 18:55 [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Balaji T K
` (3 preceding siblings ...)
2013-10-20 18:55 ` [PATCH 5/5] mmc: omap_hsmmc: remove unused no_off Balaji T K
@ 2013-10-27 1:30 ` Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2013-10-27 1:30 UTC (permalink / raw)
To: Balaji T K; +Cc: linux-mmc, tony, linux-omap
Hi Balaji,
On Sun, Oct 20 2013, Balaji T K wrote:
> pbias_disable is set to protect the mmc pbias i/o cells in DT boot
> by preventing voltage switch. Currently pbias_disable is enabled only
> for omap3 and not for omap4 due to reg_offset difference of 0x100.
> Enable pbias_disable for omap4+ too by using res->start
> which does not include the reg_offset.
>
> Signed-off-by: Balaji T K <balajitk@ti.com>
Thanks, all five patches in this series pushed to mmc-next for 3.13.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-27 1:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-20 18:55 [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Balaji T K
2013-10-20 18:55 ` [PATCH 2/5] mmc: omap_hsmmc: context save and restore for DT Balaji T K
2013-10-20 18:55 ` [PATCH 3/5] mmc: omap_hsmmc: fix timeout for cmd and data soft reset Balaji T K
2013-10-20 18:55 ` [PATCH 4/5] mmc: omap_hsmmc: correct max value of clkd Balaji T K
2013-10-20 18:55 ` [PATCH 5/5] mmc: omap_hsmmc: remove unused no_off Balaji T K
2013-10-27 1:30 ` [PATCH 1/5] mmc: omap_hsmmc: Fix pbias_disable for omap4 Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).