* [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features
@ 2012-04-09 6:38 Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 1/4] mmc: omap_hsmmc: Enable Auto CMD12 Venkatraman S
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Venkatraman S @ 2012-04-09 6:38 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, Venkatraman S
Hi Chris,
As discussed previously [1], I've rebased the previous 2 patches
that you decided to queue for 3.5, plus 2 additional cleanups.
Best regards,
Venkat.
[1] http://marc.info/?l=linux-mmc&m=133336030703924&w=2
The following changes since commit 3bdc9ba892d6a294d16e9e6e0c4041926aa3d58c:
mmc: use really long write timeout to deal with crappy cards (2012-04-05 20:32:34 -0400)
are available in the git repository at:
git://github.com/svenkatr/linux.git mmc-omap_hsmmc-next
for you to fetch changes up to 11c6cb1453f55b21e50fd891b3981a98a572d314:
mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock (2012-04-09 11:58:22 +0530)
----------------------------------------------------------------
Balaji T K (2):
mmc: omap_hsmmc: Enable Auto CMD12
mmc: omap_hsmmc: add DDR support to omap_hsmmc
Rajendra Nayak (1):
mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock
Venkatraman S (1):
mmc: omap_hsmmc: use spinlock IRQ safe variant
drivers/mmc/host/omap_hsmmc.c | 78 +++++++++++++++++++++++++-------------------
1 file changed, 45 insertions(+), 33 deletions(-)
--
1.7.10.rc2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH RESEND 1/4] mmc: omap_hsmmc: Enable Auto CMD12
2012-04-09 6:38 [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Venkatraman S
@ 2012-04-09 6:38 ` Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 2/4] mmc: omap_hsmmc: add DDR support to omap_hsmmc Venkatraman S
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-04-09 6:38 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, Balaji T K, Venkatraman S
From: Balaji T K <balajitk@ti.com>
Enable Auto-CMD12 for multi block read/write on HSMMC
Tested on OMAP4430, OMAP3430 and OMAP2430 SDP
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5c2b1c1..1fcacb6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -85,6 +85,7 @@
#define BRR_ENABLE (1 << 5)
#define DTO_ENABLE (1 << 20)
#define INIT_STREAM (1 << 1)
+#define ACEN_ACMD12 (1 << 2)
#define DP_SELECT (1 << 21)
#define DDIR (1 << 4)
#define DMA_EN 0x1
@@ -115,6 +116,7 @@
#define OMAP_MMC_MAX_CLOCK 52000000
#define DRIVER_NAME "omap_hsmmc"
+#define AUTO_CMD12 (1 << 0) /* Auto CMD12 support */
/*
* One controller can have multiple slots, like on some omap boards using
* omap.c controller driver. Luckily this is not currently done on any known
@@ -175,6 +177,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+ unsigned int flags;
struct omap_hsmmc_next next_data;
struct omap_mmc_platform_data *pdata;
@@ -766,6 +769,8 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
cmdtype = 0x3;
cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22);
+ if ((host->flags & AUTO_CMD12) && mmc_op_multi(cmd->opcode))
+ cmdreg |= ACEN_ACMD12;
if (data) {
cmdreg |= DP_SELECT | MSBS | BCE;
@@ -837,11 +842,14 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data)
else
data->bytes_xfered = 0;
- if (!data->stop) {
+ if (data->stop && ((!(host->flags & AUTO_CMD12)) || data->error)) {
+ omap_hsmmc_start_command(host, data->stop, NULL);
+ } else {
+ if (data->stop)
+ data->stop->resp[0] = OMAP_HSMMC_READ(host->base,
+ RSP76);
omap_hsmmc_request_done(host, data->mrq);
- return;
}
- omap_hsmmc_start_command(host, data->stop, NULL);
}
/*
@@ -1844,6 +1852,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
host->mapbase = res->start + pdata->reg_offset;
host->base = ioremap(host->mapbase, SZ_4K);
host->power_mode = MMC_POWER_OFF;
+ host->flags = AUTO_CMD12;
host->next_data.cookie = 1;
platform_set_drvdata(pdev, host);
--
1.7.10.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH RESEND 2/4] mmc: omap_hsmmc: add DDR support to omap_hsmmc
2012-04-09 6:38 [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 1/4] mmc: omap_hsmmc: Enable Auto CMD12 Venkatraman S
@ 2012-04-09 6:38 ` Venkatraman S
2012-04-09 6:38 ` [PATCH 3/4] mmc: omap_hsmmc: use spinlock IRQ safe variant Venkatraman S
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-04-09 6:38 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, Balaji T K, Venkatraman S
From: Balaji T K <balajitk@ti.com>
Add Dual data rate support for omap_hsmmc
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1fcacb6..9e701f3 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -92,6 +92,7 @@
#define MSBS (1 << 5)
#define BCE (1 << 1)
#define FOUR_BIT (1 << 1)
+#define DDR (1 << 19)
#define DW8 (1 << 5)
#define CC 0x1
#define TC 0x02
@@ -523,6 +524,10 @@ static void omap_hsmmc_set_bus_width(struct omap_hsmmc_host *host)
u32 con;
con = OMAP_HSMMC_READ(host->base, CON);
+ if (ios->timing == MMC_TIMING_UHS_DDR50)
+ con |= DDR; /* configure in DDR mode */
+ else
+ con &= ~DDR;
switch (ios->bus_width) {
case MMC_BUS_WIDTH_8:
OMAP_HSMMC_WRITE(host->base, CON, con | DW8);
--
1.7.10.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] mmc: omap_hsmmc: use spinlock IRQ safe variant
2012-04-09 6:38 [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 1/4] mmc: omap_hsmmc: Enable Auto CMD12 Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 2/4] mmc: omap_hsmmc: add DDR support to omap_hsmmc Venkatraman S
@ 2012-04-09 6:38 ` Venkatraman S
2012-04-09 6:38 ` [PATCH 4/4] mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock Venkatraman S
2012-04-09 12:08 ` [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-04-09 6:38 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, Venkatraman S
Prevent possible races between HSMMC/DMA IRQs and next requests.
Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9e701f3..e8f296d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -806,11 +806,12 @@ omap_hsmmc_get_dma_dir(struct omap_hsmmc_host *host, struct mmc_data *data)
static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_request *mrq)
{
int dma_ch;
+ unsigned long flags;
- spin_lock(&host->irq_lock);
+ spin_lock_irqsave(&host->irq_lock, flags);
host->req_in_progress = 0;
dma_ch = host->dma_ch;
- spin_unlock(&host->irq_lock);
+ spin_unlock_irqrestore(&host->irq_lock, flags);
omap_hsmmc_disable_irq(host);
/* Do not complete the request if DMA is still in progress */
@@ -887,13 +888,14 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct mmc_command *cmd)
static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
{
int dma_ch;
+ unsigned long flags;
host->data->error = errno;
- spin_lock(&host->irq_lock);
+ spin_lock_irqsave(&host->irq_lock, flags);
dma_ch = host->dma_ch;
host->dma_ch = -1;
- spin_unlock(&host->irq_lock);
+ spin_unlock_irqrestore(&host->irq_lock, flags);
if (host->use_dma && dma_ch != -1) {
dma_unmap_sg(mmc_dev(host->mmc), host->data->sg,
@@ -1247,6 +1249,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data)
struct omap_hsmmc_host *host = cb_data;
struct mmc_data *data;
int dma_ch, req_in_progress;
+ unsigned long flags;
if (!(ch_status & OMAP_DMA_BLOCK_IRQ)) {
dev_warn(mmc_dev(host->mmc), "unexpected dma status %x\n",
@@ -1254,9 +1257,9 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data)
return;
}
- spin_lock(&host->irq_lock);
+ spin_lock_irqsave(&host->irq_lock, flags);
if (host->dma_ch < 0) {
- spin_unlock(&host->irq_lock);
+ spin_unlock_irqrestore(&host->irq_lock, flags);
return;
}
@@ -1266,7 +1269,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data)
/* Fire up the next transfer. */
omap_hsmmc_config_dma_params(host, data,
data->sg + host->dma_sg_idx);
- spin_unlock(&host->irq_lock);
+ spin_unlock_irqrestore(&host->irq_lock, flags);
return;
}
@@ -1277,7 +1280,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data)
req_in_progress = host->req_in_progress;
dma_ch = host->dma_ch;
host->dma_ch = -1;
- spin_unlock(&host->irq_lock);
+ spin_unlock_irqrestore(&host->irq_lock, flags);
omap_free_dma(dma_ch);
--
1.7.10.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock
2012-04-09 6:38 [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Venkatraman S
` (2 preceding siblings ...)
2012-04-09 6:38 ` [PATCH 3/4] mmc: omap_hsmmc: use spinlock IRQ safe variant Venkatraman S
@ 2012-04-09 6:38 ` Venkatraman S
2012-04-09 12:08 ` [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-04-09 6:38 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, Rajendra Nayak, Venkatraman S
From: Rajendra Nayak <rnayak@ti.com>
There really does not seem to be a need to use cpu_is_*
check for getting the debounce clock as clkdev is
perfectly capable of handling situations when certain
clocks are only available on select platforms.
Also get rid of the 'got_dbclk' flag and instead use the
dbclk clock pointer to know if a valid debounce clock
exists for the platform.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e8f296d..ea8afcb 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {
int use_dma, dma_ch;
int dma_line_tx, dma_line_rx;
int slot_id;
- int got_dbclk;
int response_busy;
int context_loss;
int vdd;
@@ -1097,7 +1096,7 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
/* Disable the clocks */
pm_runtime_put_sync(host->dev);
- if (host->got_dbclk)
+ if (host->dbclk)
clk_disable(host->dbclk);
/* Turn the power off */
@@ -1108,7 +1107,7 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
ret = mmc_slot(host).set_power(host->dev, host->slot_id, 1,
vdd);
pm_runtime_get_sync(host->dev);
- if (host->got_dbclk)
+ if (host->dbclk)
clk_enable(host->dbclk);
if (ret != 0)
@@ -1902,21 +1901,17 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
omap_hsmmc_context_save(host);
- if (cpu_is_omap2430()) {
- host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
- /*
- * MMC can still work without debounce clock.
- */
- if (IS_ERR(host->dbclk))
- dev_warn(mmc_dev(host->mmc),
- "Failed to get debounce clock\n");
- else
- host->got_dbclk = 1;
-
- if (host->got_dbclk)
- if (clk_enable(host->dbclk) != 0)
- dev_dbg(mmc_dev(host->mmc), "Enabling debounce"
- " clk failed\n");
+ host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
+ /*
+ * MMC can still work without debounce clock.
+ */
+ if (IS_ERR(host->dbclk)) {
+ dev_warn(mmc_dev(host->mmc), "Failed to get debounce clk\n");
+ host->dbclk = NULL;
+ } else if (clk_enable(host->dbclk) != 0) {
+ dev_warn(mmc_dev(host->mmc), "Failed to enable debounce clk\n");
+ clk_put(host->dbclk);
+ host->dbclk = NULL;
}
/* Since we do only SG emulation, we can have as many segs
@@ -2036,7 +2031,7 @@ err_irq:
pm_runtime_put_sync(host->dev);
pm_runtime_disable(host->dev);
clk_put(host->fclk);
- if (host->got_dbclk) {
+ if (host->dbclk) {
clk_disable(host->dbclk);
clk_put(host->dbclk);
}
@@ -2069,7 +2064,7 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
pm_runtime_put_sync(host->dev);
pm_runtime_disable(host->dev);
clk_put(host->fclk);
- if (host->got_dbclk) {
+ if (host->dbclk) {
clk_disable(host->dbclk);
clk_put(host->dbclk);
}
@@ -2127,7 +2122,7 @@ static int omap_hsmmc_suspend(struct device *dev)
OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
}
- if (host->got_dbclk)
+ if (host->dbclk)
clk_disable(host->dbclk);
err:
pm_runtime_put_sync(host->dev);
@@ -2148,7 +2143,7 @@ static int omap_hsmmc_resume(struct device *dev)
pm_runtime_get_sync(host->dev);
- if (host->got_dbclk)
+ if (host->dbclk)
clk_enable(host->dbclk);
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
--
1.7.10.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features
2012-04-09 6:38 [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Venkatraman S
` (3 preceding siblings ...)
2012-04-09 6:38 ` [PATCH 4/4] mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock Venkatraman S
@ 2012-04-09 12:08 ` Chris Ball
4 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2012-04-09 12:08 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap
Hi Venkat,
On Mon, Apr 09 2012, Venkatraman S wrote:
> Hi Chris,
> As discussed previously [1], I've rebased the previous 2 patches
> that you decided to queue for 3.5, plus 2 additional cleanups.
Thanks very much -- pushed out to mmc-next for 3.5.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-09 12:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-09 6:38 [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 1/4] mmc: omap_hsmmc: Enable Auto CMD12 Venkatraman S
2012-04-09 6:38 ` [PATCH RESEND 2/4] mmc: omap_hsmmc: add DDR support to omap_hsmmc Venkatraman S
2012-04-09 6:38 ` [PATCH 3/4] mmc: omap_hsmmc: use spinlock IRQ safe variant Venkatraman S
2012-04-09 6:38 ` [PATCH 4/4] mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock Venkatraman S
2012-04-09 12:08 ` [PATCH 0/4] mmc: omap_hsmmc: Additional cleanups / features 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).