* [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:54 ` Felipe Balbi
2012-03-15 14:57 ` Felipe Balbi
2012-03-15 14:33 ` [PATCH RESEND 2/8] mmc: omap: add DDR support to omap_hsmmc Venkatraman S
` (6 subsequent siblings)
7 siblings, 2 replies; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
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>
---
drivers/mmc/host/omap_hsmmc.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f29e1a2..b1e9be7 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,16 @@ 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);
+
+ return;
}
/*
@@ -1826,6 +1836,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
host->mapbase = res->start;
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.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12
2012-03-15 14:33 ` [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12 Venkatraman S
@ 2012-03-15 14:54 ` Felipe Balbi
2012-03-15 14:57 ` Felipe Balbi
1 sibling, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-15 14:54 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap, cjb, balajitk, balbi
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
Hi,
On Thu, Mar 15, 2012 at 08:03:35PM +0530, Venkatraman S wrote:
> From: Balaji T K <balajitk@ti.com>
> @@ -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))
This should have braces too.
> @@ -837,11 +842,16 @@ 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);
> +
> + return;
return is unnecessary.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12
2012-03-15 14:33 ` [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12 Venkatraman S
2012-03-15 14:54 ` Felipe Balbi
@ 2012-03-15 14:57 ` Felipe Balbi
2012-03-16 5:25 ` S, Venkatraman
1 sibling, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2012-03-15 14:57 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap, cjb, balajitk, balbi
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
On Thu, Mar 15, 2012 at 08:03:35PM +0530, Venkatraman S wrote:
> 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>
BTW, since patches are flowing through you now, they should have your
SoB line.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12
2012-03-15 14:57 ` Felipe Balbi
@ 2012-03-16 5:25 ` S, Venkatraman
0 siblings, 0 replies; 19+ messages in thread
From: S, Venkatraman @ 2012-03-16 5:25 UTC (permalink / raw)
To: balbi; +Cc: linux-mmc, linux-omap, cjb, balajitk
On Thu, Mar 15, 2012 at 8:27 PM, Felipe Balbi <balbi@ti.com> wrote:
> On Thu, Mar 15, 2012 at 08:03:35PM +0530, Venkatraman S wrote:
>> 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>
>
> BTW, since patches are flowing through you now, they should have your
> SoB line.
>
Sure. I'll edit and send again.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RESEND 2/8] mmc: omap: add DDR support to omap_hsmmc
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12 Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 3/8] mmc: omap: use runtime put sync in probe error patch Venkatraman S
` (5 subsequent siblings)
7 siblings, 0 replies; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Balaji T K <balajitk@ti.com>
Add Dual data rate support for omap_hsmmc
Signed-off-by: Balaji T K <balajitk@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 b1e9be7..db8af43 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.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RESEND 3/8] mmc: omap: use runtime put sync in probe error patch
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 1/8] mmc: omap: Enable Auto CMD12 Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 2/8] mmc: omap: add DDR support to omap_hsmmc Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:58 ` Felipe Balbi
2012-03-15 14:33 ` [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm Venkatraman S
` (4 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Balaji T K <balajitk@ti.com>
pm_runtime_put_sync instead of autosuspend pm runtime API
because iounmap(host->base) follows immediately.
Reported-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index db8af43..0f8d34b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2014,8 +2014,7 @@ err_reg:
err_irq_cd_init:
free_irq(host->irq, host);
err_irq:
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
+ pm_runtime_put_sync(host->dev);
pm_runtime_disable(host->dev);
clk_put(host->fclk);
if (host->got_dbclk) {
--
1.7.10.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 3/8] mmc: omap: use runtime put sync in probe error patch
2012-03-15 14:33 ` [PATCH RESEND 3/8] mmc: omap: use runtime put sync in probe error patch Venkatraman S
@ 2012-03-15 14:58 ` Felipe Balbi
0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-15 14:58 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap, cjb, balajitk, balbi
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
On Thu, Mar 15, 2012 at 08:03:37PM +0530, Venkatraman S wrote:
> From: Balaji T K <balajitk@ti.com>
>
> pm_runtime_put_sync instead of autosuspend pm runtime API
> because iounmap(host->base) follows immediately.
>
> Reported-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Balaji T K <balajitk@ti.com>
should this one go to stable too ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
` (2 preceding siblings ...)
2012-03-15 14:33 ` [PATCH RESEND 3/8] mmc: omap: use runtime put sync in probe error patch Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:59 ` Felipe Balbi
2012-03-15 15:12 ` Shubhrajyoti
2012-03-15 14:33 ` [PATCH RESEND 5/8] mmc: host: omap_hsmmc: trivial cleanups Venkatraman S
` (3 subsequent siblings)
7 siblings, 2 replies; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Balaji T K <balajitk@ti.com>
call context save api after enabling runtime pm
to make sure register access in context save api happens with clk enabled.
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 0f8d34b..9fa2f39 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1871,8 +1871,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
goto err1;
}
- omap_hsmmc_context_save(host);
-
if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n");
mmc->caps2 |= MMC_CAP2_NO_MULTI_READ;
@@ -1883,6 +1881,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
pm_runtime_set_autosuspend_delay(host->dev, MMC_AUTOSUSPEND_DELAY);
pm_runtime_use_autosuspend(host->dev);
+ omap_hsmmc_context_save(host);
+
if (cpu_is_omap2430()) {
host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
/*
--
1.7.10.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm
2012-03-15 14:33 ` [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm Venkatraman S
@ 2012-03-15 14:59 ` Felipe Balbi
2012-03-15 15:12 ` Shubhrajyoti
1 sibling, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-15 14:59 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap, cjb, balajitk, balbi
[-- Attachment #1: Type: text/plain, Size: 315 bytes --]
On Thu, Mar 15, 2012 at 08:03:38PM +0530, Venkatraman S wrote:
> From: Balaji T K <balajitk@ti.com>
>
> call context save api after enabling runtime pm
> to make sure register access in context save api happens with clk enabled.
>
> Signed-off-by: Balaji T K <balajitk@ti.com>
Cc stable ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm
2012-03-15 14:33 ` [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm Venkatraman S
2012-03-15 14:59 ` Felipe Balbi
@ 2012-03-15 15:12 ` Shubhrajyoti
2012-03-16 13:32 ` T Krishnamoorthy, Balaji
1 sibling, 1 reply; 19+ messages in thread
From: Shubhrajyoti @ 2012-03-15 15:12 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap, cjb, balajitk, balbi
On Thursday 15 March 2012 08:03 PM, Venkatraman S wrote:
> From: Balaji T K <balajitk@ti.com>
>
> call context save api after enabling runtime pm
> to make sure register access in context save api
If I am not mistaken the api would
store the number of power state changes and accesses no registers.
Am I missing something?
> happens with clk enabled.
>
> Signed-off-by: Balaji T K <balajitk@ti.com>
> ---
> drivers/mmc/host/omap_hsmmc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 0f8d34b..9fa2f39 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1871,8 +1871,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
> goto err1;
> }
>
> - omap_hsmmc_context_save(host);
> -
> if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
> dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n");
> mmc->caps2 |= MMC_CAP2_NO_MULTI_READ;
> @@ -1883,6 +1881,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
> pm_runtime_set_autosuspend_delay(host->dev, MMC_AUTOSUSPEND_DELAY);
> pm_runtime_use_autosuspend(host->dev);
>
> + omap_hsmmc_context_save(host);
> +
> if (cpu_is_omap2430()) {
> host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
> /*
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm
2012-03-15 15:12 ` Shubhrajyoti
@ 2012-03-16 13:32 ` T Krishnamoorthy, Balaji
0 siblings, 0 replies; 19+ messages in thread
From: T Krishnamoorthy, Balaji @ 2012-03-16 13:32 UTC (permalink / raw)
To: Shubhrajyoti; +Cc: Venkatraman S, linux-mmc, linux-omap, cjb, balbi
On Thu, Mar 15, 2012 at 8:42 PM, Shubhrajyoti <shubhrajyoti@ti.com> wrote:
> On Thursday 15 March 2012 08:03 PM, Venkatraman S wrote:
>> From: Balaji T K <balajitk@ti.com>
>>
>> call context save api after enabling runtime pm
>> to make sure register access in context save api
> If I am not mistaken the api would
> store the number of power state changes and accesses no registers.
>
> Am I missing something?
Yes, as of now no registers are accessed in context store. However
this patch is needed if registers are accessed in context save api.
>
>> happens with clk enabled.
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>> drivers/mmc/host/omap_hsmmc.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 0f8d34b..9fa2f39 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1871,8 +1871,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
>> goto err1;
>> }
>>
>> - omap_hsmmc_context_save(host);
>> -
>> if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
>> dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n");
>> mmc->caps2 |= MMC_CAP2_NO_MULTI_READ;
>> @@ -1883,6 +1881,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
>> pm_runtime_set_autosuspend_delay(host->dev, MMC_AUTOSUSPEND_DELAY);
>> pm_runtime_use_autosuspend(host->dev);
>>
>> + omap_hsmmc_context_save(host);
>> +
>> if (cpu_is_omap2430()) {
>> host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
>> /*
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RESEND 5/8] mmc: host: omap_hsmmc: trivial cleanups
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
` (3 preceding siblings ...)
2012-03-15 14:33 ` [PATCH RESEND 4/8] mmc: omap: context save after enabling runtime pm Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 6/8] mmc: host: omap_hsmmc: make it behave well as a module Venkatraman S
` (2 subsequent siblings)
7 siblings, 0 replies; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Felipe Balbi <balbi@ti.com>
a bunch of non-functional cleanups to the omap_hsmmc
driver.
It basically decreases indentation level, drop unneded
dereferences and drop unneded accesses to the platform_device
structure.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 147 ++++++++++++++++++++---------------------
1 file changed, 70 insertions(+), 77 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9fa2f39..6b30782 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2037,30 +2037,28 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
- if (host) {
- pm_runtime_get_sync(host->dev);
- mmc_remove_host(host->mmc);
- if (host->use_reg)
- omap_hsmmc_reg_put(host);
- if (host->pdata->cleanup)
- host->pdata->cleanup(&pdev->dev);
- free_irq(host->irq, host);
- if (mmc_slot(host).card_detect_irq)
- free_irq(mmc_slot(host).card_detect_irq, host);
-
- pm_runtime_put_sync(host->dev);
- pm_runtime_disable(host->dev);
- clk_put(host->fclk);
- if (host->got_dbclk) {
- clk_disable(host->dbclk);
- clk_put(host->dbclk);
- }
+ pm_runtime_get_sync(host->dev);
+ mmc_remove_host(host->mmc);
+ if (host->use_reg)
+ omap_hsmmc_reg_put(host);
+ if (host->pdata->cleanup)
+ host->pdata->cleanup(&pdev->dev);
+ free_irq(host->irq, host);
+ if (mmc_slot(host).card_detect_irq)
+ free_irq(mmc_slot(host).card_detect_irq, host);
- mmc_free_host(host->mmc);
- iounmap(host->base);
- omap_hsmmc_gpio_free(pdev->dev.platform_data);
+ pm_runtime_put_sync(host->dev);
+ pm_runtime_disable(host->dev);
+ clk_put(host->fclk);
+ if (host->got_dbclk) {
+ clk_disable(host->dbclk);
+ clk_put(host->dbclk);
}
+ mmc_free_host(host->mmc);
+ iounmap(host->base);
+ omap_hsmmc_gpio_free(pdev->dev.platform_data);
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res->start, resource_size(res));
@@ -2073,49 +2071,45 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
static int omap_hsmmc_suspend(struct device *dev)
{
int ret = 0;
- struct platform_device *pdev = to_platform_device(dev);
- struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
- if (host && host->suspended)
+ if (!host)
return 0;
- if (host) {
- pm_runtime_get_sync(host->dev);
- host->suspended = 1;
- if (host->pdata->suspend) {
- ret = host->pdata->suspend(&pdev->dev,
- host->slot_id);
- if (ret) {
- dev_dbg(mmc_dev(host->mmc),
- "Unable to handle MMC board"
- " level suspend\n");
- host->suspended = 0;
- return ret;
- }
- }
- ret = mmc_suspend_host(host->mmc);
+ if (host && host->suspended)
+ return 0;
+ pm_runtime_get_sync(host->dev);
+ host->suspended = 1;
+ if (host->pdata->suspend) {
+ ret = host->pdata->suspend(dev, host->slot_id);
if (ret) {
+ dev_dbg(dev, "Unable to handle MMC board"
+ " level suspend\n");
host->suspended = 0;
- if (host->pdata->resume) {
- ret = host->pdata->resume(&pdev->dev,
- host->slot_id);
- if (ret)
- dev_dbg(mmc_dev(host->mmc),
- "Unmask interrupt failed\n");
- }
- goto err;
+ return ret;
}
+ }
+ ret = mmc_suspend_host(host->mmc);
- if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
- omap_hsmmc_disable_irq(host);
- OMAP_HSMMC_WRITE(host->base, HCTL,
- OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
+ if (ret) {
+ host->suspended = 0;
+ if (host->pdata->resume) {
+ ret = host->pdata->resume(dev, host->slot_id);
+ if (ret)
+ dev_dbg(dev, "Unmask interrupt failed\n");
}
- if (host->got_dbclk)
- clk_disable(host->dbclk);
+ goto err;
+ }
+ if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
+ omap_hsmmc_disable_irq(host);
+ OMAP_HSMMC_WRITE(host->base, HCTL,
+ OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
}
+
+ if (host->got_dbclk)
+ clk_disable(host->dbclk);
err:
pm_runtime_put_sync(host->dev);
return ret;
@@ -2125,38 +2119,37 @@ err:
static int omap_hsmmc_resume(struct device *dev)
{
int ret = 0;
- struct platform_device *pdev = to_platform_device(dev);
- struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
+
+ if (!host)
+ return 0;
if (host && !host->suspended)
return 0;
- if (host) {
- pm_runtime_get_sync(host->dev);
+ pm_runtime_get_sync(host->dev);
- if (host->got_dbclk)
- clk_enable(host->dbclk);
+ if (host->got_dbclk)
+ clk_enable(host->dbclk);
- if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
- omap_hsmmc_conf_bus_power(host);
+ if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
+ omap_hsmmc_conf_bus_power(host);
- if (host->pdata->resume) {
- ret = host->pdata->resume(&pdev->dev, host->slot_id);
- if (ret)
- dev_dbg(mmc_dev(host->mmc),
- "Unmask interrupt failed\n");
- }
+ if (host->pdata->resume) {
+ ret = host->pdata->resume(dev, host->slot_id);
+ if (ret)
+ dev_dbg(dev, "Unmask interrupt failed\n");
+ }
- omap_hsmmc_protect_card(host);
+ omap_hsmmc_protect_card(host);
- /* Notify the core to resume the host */
- ret = mmc_resume_host(host->mmc);
- if (ret == 0)
- host->suspended = 0;
+ /* Notify the core to resume the host */
+ ret = mmc_resume_host(host->mmc);
+ if (ret == 0)
+ host->suspended = 0;
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
- }
+ pm_runtime_mark_last_busy(host->dev);
+ pm_runtime_put_autosuspend(host->dev);
return ret;
@@ -2173,7 +2166,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
host = platform_get_drvdata(to_platform_device(dev));
omap_hsmmc_context_save(host);
- dev_dbg(mmc_dev(host->mmc), "disabled\n");
+ dev_dbg(dev, "disabled\n");
return 0;
}
@@ -2184,7 +2177,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
host = platform_get_drvdata(to_platform_device(dev));
omap_hsmmc_context_restore(host);
- dev_dbg(mmc_dev(host->mmc), "enabled\n");
+ dev_dbg(dev, "enabled\n");
return 0;
}
--
1.7.10.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RESEND 6/8] mmc: host: omap_hsmmc: make it behave well as a module
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
` (4 preceding siblings ...)
2012-03-15 14:33 ` [PATCH RESEND 5/8] mmc: host: omap_hsmmc: trivial cleanups Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 7/8] mmc: host: omap_hsmmc: convert to module_platform_driver Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion Venkatraman S
7 siblings, 0 replies; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Felipe Balbi <balbi@ti.com>
if we put probe() on __init section, that will never
work for multiple module insertions/removals.
In order to make it work properly, move probe to
__devinit section and use platform_driver_register()
instead of platform_driver_probe().
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6b30782..67cb63e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1780,7 +1780,7 @@ static inline struct omap_mmc_platform_data
}
#endif
-static int __init omap_hsmmc_probe(struct platform_device *pdev)
+static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
{
struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;
struct mmc_host *mmc;
@@ -2032,7 +2032,7 @@ err:
return ret;
}
-static int omap_hsmmc_remove(struct platform_device *pdev)
+static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
{
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
@@ -2190,7 +2190,8 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
};
static struct platform_driver omap_hsmmc_driver = {
- .remove = omap_hsmmc_remove,
+ .probe = omap_hsmmc_probe,
+ .remove = __devexit_p(omap_hsmmc_remove),
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -2202,7 +2203,7 @@ static struct platform_driver omap_hsmmc_driver = {
static int __init omap_hsmmc_init(void)
{
/* Register the MMC driver */
- return platform_driver_probe(&omap_hsmmc_driver, omap_hsmmc_probe);
+ return platform_driver_register(&omap_hsmmc_driver);
}
static void __exit omap_hsmmc_cleanup(void)
--
1.7.10.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RESEND 7/8] mmc: host: omap_hsmmc: convert to module_platform_driver
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
` (5 preceding siblings ...)
2012-03-15 14:33 ` [PATCH RESEND 6/8] mmc: host: omap_hsmmc: make it behave well as a module Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 14:33 ` [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion Venkatraman S
7 siblings, 0 replies; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Felipe Balbi <balbi@ti.com>
this will delete some boilerplate code, no functional
changes.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 67cb63e..4476b26 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2200,21 +2200,7 @@ static struct platform_driver omap_hsmmc_driver = {
},
};
-static int __init omap_hsmmc_init(void)
-{
- /* Register the MMC driver */
- return platform_driver_register(&omap_hsmmc_driver);
-}
-
-static void __exit omap_hsmmc_cleanup(void)
-{
- /* Unregister MMC driver */
- platform_driver_unregister(&omap_hsmmc_driver);
-}
-
-module_init(omap_hsmmc_init);
-module_exit(omap_hsmmc_cleanup);
-
+module_platform_driver(omap_hsmmc_driver);
MODULE_DESCRIPTION("OMAP High Speed Multimedia Card driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRIVER_NAME);
--
1.7.10.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion
2012-03-15 14:33 [PATCH 0/8][git pull] mmc: omap: Assorted fixes for 3.4 merge window Venkatraman S
` (6 preceding siblings ...)
2012-03-15 14:33 ` [PATCH RESEND 7/8] mmc: host: omap_hsmmc: convert to module_platform_driver Venkatraman S
@ 2012-03-15 14:33 ` Venkatraman S
2012-03-15 15:04 ` Felipe Balbi
7 siblings, 1 reply; 19+ messages in thread
From: Venkatraman S @ 2012-03-15 14:33 UTC (permalink / raw)
To: linux-mmc, linux-omap; +Cc: cjb, balajitk, balbi
From: Balaji T K <balajitk@ti.com>
OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
Addng the offset to platform_device resource structure
increments the start address for every insmod operation.
MMC command fails on re-insertion as module due to incorrect register base.
Fix this by updating the ioremap base address only.
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4476b26..f324cf4 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1813,8 +1813,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
if (res == NULL || irq < 0)
return -ENXIO;
- res->start += pdata->reg_offset;
- res->end += pdata->reg_offset;
res = request_mem_region(res->start, resource_size(res), pdev->name);
if (res == NULL)
return -EBUSY;
@@ -1838,7 +1836,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
host->dma_ch = -1;
host->irq = irq;
host->slot_id = 0;
- host->mapbase = res->start;
+ host->mapbase = res->start + pdata->reg_offset;
host->base = ioremap(host->mapbase, SZ_4K);
host->power_mode = MMC_POWER_OFF;
host->flags = AUTO_CMD12;
--
1.7.10.rc0.41.gfa678
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion
2012-03-15 14:33 ` [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion Venkatraman S
@ 2012-03-15 15:04 ` Felipe Balbi
2012-03-16 10:32 ` S, Venkatraman
0 siblings, 1 reply; 19+ messages in thread
From: Felipe Balbi @ 2012-03-15 15:04 UTC (permalink / raw)
To: Venkatraman S; +Cc: linux-mmc, linux-omap, cjb, balajitk, balbi
[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]
Hi,
On Thu, Mar 15, 2012 at 08:03:42PM +0530, Venkatraman S wrote:
> From: Balaji T K <balajitk@ti.com>
>
> OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
> Addng the offset to platform_device resource structure
> increments the start address for every insmod operation.
> MMC command fails on re-insertion as module due to incorrect register base.
> Fix this by updating the ioremap base address only.
>
> Signed-off-by: Balaji T K <balajitk@ti.com>
> ---
> drivers/mmc/host/omap_hsmmc.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 4476b26..f324cf4 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1813,8 +1813,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
> if (res == NULL || irq < 0)
> return -ENXIO;
>
> - res->start += pdata->reg_offset;
> - res->end += pdata->reg_offset;
> res = request_mem_region(res->start, resource_size(res), pdev->name);
> if (res == NULL)
> return -EBUSY;
> @@ -1838,7 +1836,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
> host->dma_ch = -1;
> host->irq = irq;
> host->slot_id = 0;
> - host->mapbase = res->start;
> + host->mapbase = res->start + pdata->reg_offset;
could this be done with a revision check at some point so we drop the
pdata requirement ? Not part of $SUBJECT though, because you're just
moving the increment.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion
2012-03-15 15:04 ` Felipe Balbi
@ 2012-03-16 10:32 ` S, Venkatraman
2012-03-16 10:38 ` Felipe Balbi
0 siblings, 1 reply; 19+ messages in thread
From: S, Venkatraman @ 2012-03-16 10:32 UTC (permalink / raw)
To: balbi; +Cc: linux-mmc, linux-omap, cjb, balajitk
On Thu, Mar 15, 2012 at 8:34 PM, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Thu, Mar 15, 2012 at 08:03:42PM +0530, Venkatraman S wrote:
>> From: Balaji T K <balajitk@ti.com>
>>
>> OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
>> Addng the offset to platform_device resource structure
>> increments the start address for every insmod operation.
>> MMC command fails on re-insertion as module due to incorrect register base.
>> Fix this by updating the ioremap base address only.
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>> drivers/mmc/host/omap_hsmmc.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 4476b26..f324cf4 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1813,8 +1813,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
>> if (res == NULL || irq < 0)
>> return -ENXIO;
>>
>> - res->start += pdata->reg_offset;
>> - res->end += pdata->reg_offset;
>> res = request_mem_region(res->start, resource_size(res), pdev->name);
>> if (res == NULL)
>> return -EBUSY;
>> @@ -1838,7 +1836,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
>> host->dma_ch = -1;
>> host->irq = irq;
>> host->slot_id = 0;
>> - host->mapbase = res->start;
>> + host->mapbase = res->start + pdata->reg_offset;
>
> could this be done with a revision check at some point so we drop the
> pdata requirement ? Not part of $SUBJECT though, because you're just
> moving the increment.
>
That's a good idea. Will post that patch as part of another clean up series in
the pipeline.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RESEND 8/8] mmc: omap4: hsmmc: fix module re-insertion
2012-03-16 10:32 ` S, Venkatraman
@ 2012-03-16 10:38 ` Felipe Balbi
0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-16 10:38 UTC (permalink / raw)
To: S, Venkatraman; +Cc: balbi, linux-mmc, linux-omap, cjb, balajitk
[-- Attachment #1: Type: text/plain, Size: 2007 bytes --]
On Fri, Mar 16, 2012 at 04:02:16PM +0530, S, Venkatraman wrote:
> On Thu, Mar 15, 2012 at 8:34 PM, Felipe Balbi <balbi@ti.com> wrote:
> > Hi,
> >
> > On Thu, Mar 15, 2012 at 08:03:42PM +0530, Venkatraman S wrote:
> >> From: Balaji T K <balajitk@ti.com>
> >>
> >> OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
> >> Addng the offset to platform_device resource structure
> >> increments the start address for every insmod operation.
> >> MMC command fails on re-insertion as module due to incorrect register base.
> >> Fix this by updating the ioremap base address only.
> >>
> >> Signed-off-by: Balaji T K <balajitk@ti.com>
> >> ---
> >> drivers/mmc/host/omap_hsmmc.c | 4 +---
> >> 1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> >> index 4476b26..f324cf4 100644
> >> --- a/drivers/mmc/host/omap_hsmmc.c
> >> +++ b/drivers/mmc/host/omap_hsmmc.c
> >> @@ -1813,8 +1813,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
> >> if (res == NULL || irq < 0)
> >> return -ENXIO;
> >>
> >> - res->start += pdata->reg_offset;
> >> - res->end += pdata->reg_offset;
> >> res = request_mem_region(res->start, resource_size(res), pdev->name);
> >> if (res == NULL)
> >> return -EBUSY;
> >> @@ -1838,7 +1836,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
> >> host->dma_ch = -1;
> >> host->irq = irq;
> >> host->slot_id = 0;
> >> - host->mapbase = res->start;
> >> + host->mapbase = res->start + pdata->reg_offset;
> >
> > could this be done with a revision check at some point so we drop the
> > pdata requirement ? Not part of $SUBJECT though, because you're just
> > moving the increment.
> >
> That's a good idea. Will post that patch as part of another clean up series in
> the pipeline.
sounds good to me ;-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread