* [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet
@ 2013-10-06 17:36 Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 2/7] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
Omap MMC driver initialization can cause a NULL pointer dereference in
tasklet_hi_action on Nokia N810 if its miniSD cover is open during driver
initialization.
Reason for this is that omap_notify_cover_event which calls
tasklet_hi_schedule gets called before struct cover_tasklet is initialized.
Call to omap_notify_cover_event on Nokia N810 happens from menelaus.c PMIC
driver via board-n8x0.c during execution of mmc_add_host in case of open
miniSD cover.
Fix this by moving cover_timer and cover_tasklet initialization before
mmc_add_host call in mmc_omap_new_slot.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index b94f38e..31f33ac 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1273,6 +1273,13 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
mmc->max_seg_size = mmc->max_req_size;
+ if (slot->pdata->get_cover_state != NULL) {
+ setup_timer(&slot->cover_timer, mmc_omap_cover_timer,
+ (unsigned long)slot);
+ tasklet_init(&slot->cover_tasklet, mmc_omap_cover_handler,
+ (unsigned long)slot);
+ }
+
r = mmc_add_host(mmc);
if (r < 0)
goto err_remove_host;
@@ -1289,11 +1296,6 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
&dev_attr_cover_switch);
if (r < 0)
goto err_remove_slot_name;
-
- setup_timer(&slot->cover_timer, mmc_omap_cover_timer,
- (unsigned long)slot);
- tasklet_init(&slot->cover_tasklet, mmc_omap_cover_handler,
- (unsigned long)slot);
tasklet_schedule(&slot->cover_tasklet);
}
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH FIX+RESEND 2/7] mmc: omap: Convert to devm_kzalloc
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
@ 2013-10-06 17:36 ` Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 3/7] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
` (6 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 31f33ac..1d0d21f 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1356,7 +1356,8 @@ static int mmc_omap_probe(struct platform_device *pdev)
if (res == NULL)
return -EBUSY;
- host = kzalloc(sizeof(struct mmc_omap_host), GFP_KERNEL);
+ host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
+ GFP_KERNEL);
if (host == NULL) {
ret = -ENOMEM;
goto err_free_mem_region;
@@ -1475,7 +1476,6 @@ err_free_iclk:
err_free_mmc_host:
iounmap(host->virt_base);
err_ioremap:
- kfree(host);
err_free_mem_region:
release_mem_region(res->start, resource_size(res));
return ret;
@@ -1510,8 +1510,6 @@ static int mmc_omap_remove(struct platform_device *pdev)
pdev->resource[0].end - pdev->resource[0].start + 1);
destroy_workqueue(host->mmc_omap_wq);
- kfree(host);
-
return 0;
}
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH FIX+RESEND 3/7] mmc: omap: Remove duplicate host->irq assignment
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 2/7] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
@ 2013-10-06 17:36 ` Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 4/7] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
` (5 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
host-irq is set twice so remove needless one.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 1d0d21f..7668d47 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1386,7 +1386,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->mem_res = res;
host->irq = irq;
host->use_dma = 1;
- host->irq = irq;
host->phys_base = host->mem_res->start;
host->virt_base = ioremap(res->start, resource_size(res));
if (!host->virt_base)
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH FIX+RESEND 4/7] mmc: omap: Remove mem_res field from struct mmc_omap_host
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 2/7] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 3/7] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
@ 2013-10-06 17:36 ` Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 5/7] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
` (4 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
Field mem_res in struct mmc_omap_host is used only once in mmc_omap_probe
when setting the phys_base field so we may just se the phys_base straight
and remove needless mem_res.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 7668d47..ec5defa 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -141,7 +141,6 @@ struct mmc_omap_host {
u32 dma_rx_burst;
struct dma_chan *dma_tx;
u32 dma_tx_burst;
- struct resource *mem_res;
void __iomem *virt_base;
unsigned int phys_base;
int irq;
@@ -1383,10 +1382,9 @@ static int mmc_omap_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host);
host->id = pdev->id;
- host->mem_res = res;
host->irq = irq;
host->use_dma = 1;
- host->phys_base = host->mem_res->start;
+ host->phys_base = res->start;
host->virt_base = ioremap(res->start, resource_size(res));
if (!host->virt_base)
goto err_ioremap;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH FIX+RESEND 5/7] mmc: omap: Convert to devm_ioremap_resource
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (2 preceding siblings ...)
2013-10-06 17:36 ` [PATCH FIX+RESEND 4/7] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
@ 2013-10-06 17:36 ` Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 6/7] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
` (3 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
Simplify probe and cleanup code by using devm_ioremap_resource. This also
makes probe code to follow more common allocate private struct followed by
other initialization style.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 41 ++++++++++++-----------------------------
1 file changed, 12 insertions(+), 29 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index ec5defa..0737ea4 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1345,22 +1345,19 @@ static int mmc_omap_probe(struct platform_device *pdev)
return -ENXIO;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
+ GFP_KERNEL);
+ if (host == NULL)
+ return -ENOMEM;
+
irq = platform_get_irq(pdev, 0);
- if (res == NULL || irq < 0)
+ if (irq < 0)
return -ENXIO;
- res = request_mem_region(res->start, resource_size(res),
- pdev->name);
- if (res == NULL)
- return -EBUSY;
-
- host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
- GFP_KERNEL);
- if (host == NULL) {
- ret = -ENOMEM;
- goto err_free_mem_region;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ host->virt_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(host->virt_base))
+ return PTR_ERR(host->virt_base);
INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
@@ -1385,15 +1382,9 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->irq = irq;
host->use_dma = 1;
host->phys_base = res->start;
- host->virt_base = ioremap(res->start, resource_size(res));
- if (!host->virt_base)
- goto err_ioremap;
-
host->iclk = clk_get(&pdev->dev, "ick");
- if (IS_ERR(host->iclk)) {
- ret = PTR_ERR(host->iclk);
- goto err_free_mmc_host;
- }
+ if (IS_ERR(host->iclk))
+ return PTR_ERR(host->iclk);
clk_enable(host->iclk);
host->fclk = clk_get(&pdev->dev, "fck");
@@ -1470,11 +1461,6 @@ err_free_dma:
err_free_iclk:
clk_disable(host->iclk);
clk_put(host->iclk);
-err_free_mmc_host:
- iounmap(host->virt_base);
-err_ioremap:
-err_free_mem_region:
- release_mem_region(res->start, resource_size(res));
return ret;
}
@@ -1502,9 +1488,6 @@ static int mmc_omap_remove(struct platform_device *pdev)
if (host->dma_rx)
dma_release_channel(host->dma_rx);
- iounmap(host->virt_base);
- release_mem_region(pdev->resource[0].start,
- pdev->resource[0].end - pdev->resource[0].start + 1);
destroy_workqueue(host->mmc_omap_wq);
return 0;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH FIX+RESEND 6/7] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (3 preceding siblings ...)
2013-10-06 17:36 ` [PATCH FIX+RESEND 5/7] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
@ 2013-10-06 17:36 ` Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 7/7] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
` (2 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
Because use_dma is set only in mmc_omap_probe and unset nowhere there is no
need to carry that flag in struct mmc_omap_host for mmc_omap_prepare_data
function.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 0737ea4..1b56f06 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -163,7 +163,6 @@ struct mmc_omap_host {
u32 total_bytes_left;
unsigned features;
- unsigned use_dma:1;
unsigned brs_received:1, dma_done:1;
unsigned dma_in_use:1;
spinlock_t dma_lock;
@@ -955,7 +954,7 @@ static void
mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
{
struct mmc_data *data = req->data;
- int i, use_dma, block_size;
+ int i, use_dma = 1, block_size;
unsigned sg_len;
host->data = data;
@@ -980,13 +979,10 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
sg_len = (data->blocks == 1) ? 1 : data->sg_len;
/* Only do DMA for entire blocks */
- use_dma = host->use_dma;
- if (use_dma) {
- for (i = 0; i < sg_len; i++) {
- if ((data->sg[i].length % block_size) != 0) {
- use_dma = 0;
- break;
- }
+ for (i = 0; i < sg_len; i++) {
+ if ((data->sg[i].length % block_size) != 0) {
+ use_dma = 0;
+ break;
}
}
@@ -1380,7 +1376,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->id = pdev->id;
host->irq = irq;
- host->use_dma = 1;
host->phys_base = res->start;
host->iclk = clk_get(&pdev->dev, "ick");
if (IS_ERR(host->iclk))
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH FIX+RESEND 7/7] mmc: omap: Get DMA request numbers via platform resource
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (4 preceding siblings ...)
2013-10-06 17:36 ` [PATCH FIX+RESEND 6/7] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
@ 2013-10-06 17:36 ` Jarkko Nikula
2013-10-26 14:55 ` [PATCH] mmc: omap: Add erase capability Jarkko Nikula
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-06 17:36 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, aaro.koskinen, Jarkko Nikula
There is no need to define MMC DMA TX and RX request numbers locally for
OMAP1xxx and OMAP24xx and assign them non-portable way since they already
come via platform resources. See commits
6c432f7 ("ARM: OMAP1: Pass dma request lines in platform data to MMC driver")
b955eef ("ARM: OMAP2: Use hwmod to initialize mmc for 2420")
Note that mmc_omap_probe doesn't change failure mechanism in case if it
fails get DMA request number or DMA channel. In that case it just falls
back to PIO transfer for TX and/or RX.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
Aaro:
Sorry to bother you but I know you have OMAP1xxx based boards and I
apreciate if you can give a quick test :-)
I have tested this set on OMAP2420 based Nokia N810.
---
drivers/mmc/host/omap.c | 39 +++++++++++++--------------------------
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 1b56f06..eb22953 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -90,17 +90,6 @@
#define OMAP_MMC_CMDTYPE_AC 2
#define OMAP_MMC_CMDTYPE_ADTC 3
-#define OMAP_DMA_MMC_TX 21
-#define OMAP_DMA_MMC_RX 22
-#define OMAP_DMA_MMC2_TX 54
-#define OMAP_DMA_MMC2_RX 55
-
-#define OMAP24XX_DMA_MMC2_TX 47
-#define OMAP24XX_DMA_MMC2_RX 48
-#define OMAP24XX_DMA_MMC1_TX 61
-#define OMAP24XX_DMA_MMC1_RX 62
-
-
#define DRIVER_NAME "mmci-omap"
/* Specifies how often in millisecs to poll for card status changes
@@ -1328,7 +1317,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
struct mmc_omap_host *host = NULL;
struct resource *res;
dma_cap_mask_t mask;
- unsigned sig;
int i, ret = 0;
int irq;
@@ -1394,22 +1382,21 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->dma_tx_burst = -1;
host->dma_rx_burst = -1;
- if (mmc_omap2())
- sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
- else
- sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
- host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
+ if (res)
+ host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn,
+ &res->start);
if (!host->dma_tx)
- dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
- sig);
- if (mmc_omap2())
- sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
- else
- sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
- host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+ dev_warn(host->dev,
+ "unable to obtain TX DMA. Falling back to PIO\n");
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
+ if (res)
+ host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn,
+ &res->start);
if (!host->dma_rx)
- dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n",
- sig);
+ dev_warn(host->dev,
+ "unable to obtain RX DMA. Falling back to PIO\n");
ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host);
if (ret)
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] mmc: omap: Add erase capability
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (5 preceding siblings ...)
2013-10-06 17:36 ` [PATCH FIX+RESEND 7/7] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
@ 2013-10-26 14:55 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
7 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-10-26 14:55 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
This patch adds the erase capability to OMAP1/OMAP2420 MMC driver. Idea is
the same than in commit 93caf8e ("omap_hsmmc: add erase capability") that we
disable the data timeout interrupt for erases.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
This goes on top of my previous omap mmc patches:
http://article.gmane.org/gmane.linux.kernel.mmc/22893
---
drivers/mmc/host/omap.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index eb22953..7bb2d25 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -25,6 +25,7 @@
#include <linux/omap-dma.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
+#include <linux/mmc/mmc.h>
#include <linux/clk.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
@@ -336,6 +337,7 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
u32 cmdreg;
u32 resptype;
u32 cmdtype;
+ u16 irq_mask;
host->cmd = cmd;
@@ -388,12 +390,14 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
OMAP_MMC_WRITE(host, CTO, 200);
OMAP_MMC_WRITE(host, ARGL, cmd->arg & 0xffff);
OMAP_MMC_WRITE(host, ARGH, cmd->arg >> 16);
- OMAP_MMC_WRITE(host, IE,
- OMAP_MMC_STAT_A_EMPTY | OMAP_MMC_STAT_A_FULL |
- OMAP_MMC_STAT_CMD_CRC | OMAP_MMC_STAT_CMD_TOUT |
- OMAP_MMC_STAT_DATA_CRC | OMAP_MMC_STAT_DATA_TOUT |
- OMAP_MMC_STAT_END_OF_CMD | OMAP_MMC_STAT_CARD_ERR |
- OMAP_MMC_STAT_END_OF_DATA);
+ irq_mask = OMAP_MMC_STAT_A_EMPTY | OMAP_MMC_STAT_A_FULL |
+ OMAP_MMC_STAT_CMD_CRC | OMAP_MMC_STAT_CMD_TOUT |
+ OMAP_MMC_STAT_DATA_CRC | OMAP_MMC_STAT_DATA_TOUT |
+ OMAP_MMC_STAT_END_OF_CMD | OMAP_MMC_STAT_CARD_ERR |
+ OMAP_MMC_STAT_END_OF_DATA;
+ if (cmd->opcode == MMC_ERASE)
+ irq_mask &= ~OMAP_MMC_STAT_DATA_TOUT;
+ OMAP_MMC_WRITE(host, IE, irq_mask);
OMAP_MMC_WRITE(host, CMD, cmdreg);
}
@@ -1234,7 +1238,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
mmc->caps = 0;
if (host->pdata->slots[id].wires >= 4)
- mmc->caps |= MMC_CAP_4_BIT_DATA;
+ mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_ERASE;
mmc->ops = &mmc_omap_ops;
mmc->f_min = 400000;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (6 preceding siblings ...)
2013-10-26 14:55 ` [PATCH] mmc: omap: Add erase capability Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 2/8] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
` (6 more replies)
7 siblings, 7 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
Omap MMC driver initialization can cause a NULL pointer dereference in
tasklet_hi_action on Nokia N810 if its miniSD cover is open during driver
initialization.
Reason for this is that omap_notify_cover_event which calls
tasklet_hi_schedule gets called before struct cover_tasklet is initialized.
Call to omap_notify_cover_event on Nokia N810 happens from menelaus.c PMIC
driver via board-n8x0.c during execution of mmc_add_host in case of open
miniSD cover.
Fix this by moving cover_timer and cover_tasklet initialization before
mmc_add_host call in mmc_omap_new_slot.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 0b10a90..df2d10f 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1272,6 +1272,13 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
mmc->max_seg_size = mmc->max_req_size;
+ if (slot->pdata->get_cover_state != NULL) {
+ setup_timer(&slot->cover_timer, mmc_omap_cover_timer,
+ (unsigned long)slot);
+ tasklet_init(&slot->cover_tasklet, mmc_omap_cover_handler,
+ (unsigned long)slot);
+ }
+
r = mmc_add_host(mmc);
if (r < 0)
goto err_remove_host;
@@ -1288,11 +1295,6 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
&dev_attr_cover_switch);
if (r < 0)
goto err_remove_slot_name;
-
- setup_timer(&slot->cover_timer, mmc_omap_cover_timer,
- (unsigned long)slot);
- tasklet_init(&slot->cover_tasklet, mmc_omap_cover_handler,
- (unsigned long)slot);
tasklet_schedule(&slot->cover_tasklet);
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 2/8] mmc: omap: Convert to devm_kzalloc
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 3/8] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
` (5 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index df2d10f..4ea13e3 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1355,7 +1355,8 @@ static int mmc_omap_probe(struct platform_device *pdev)
if (res == NULL)
return -EBUSY;
- host = kzalloc(sizeof(struct mmc_omap_host), GFP_KERNEL);
+ host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
+ GFP_KERNEL);
if (host == NULL) {
ret = -ENOMEM;
goto err_free_mem_region;
@@ -1474,7 +1475,6 @@ err_free_iclk:
err_free_mmc_host:
iounmap(host->virt_base);
err_ioremap:
- kfree(host);
err_free_mem_region:
release_mem_region(res->start, resource_size(res));
return ret;
@@ -1509,8 +1509,6 @@ static int mmc_omap_remove(struct platform_device *pdev)
pdev->resource[0].end - pdev->resource[0].start + 1);
destroy_workqueue(host->mmc_omap_wq);
- kfree(host);
-
return 0;
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 3/8] mmc: omap: Remove duplicate host->irq assignment
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-11-16 15:53 ` [RESEND 2/8] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 4/8] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
` (4 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
host-irq is set twice so remove needless one.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 4ea13e3..e6987ae 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1385,7 +1385,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->mem_res = res;
host->irq = irq;
host->use_dma = 1;
- host->irq = irq;
host->phys_base = host->mem_res->start;
host->virt_base = ioremap(res->start, resource_size(res));
if (!host->virt_base)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 4/8] mmc: omap: Remove mem_res field from struct mmc_omap_host
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-11-16 15:53 ` [RESEND 2/8] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
2013-11-16 15:53 ` [RESEND 3/8] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 5/8] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
` (3 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
Field mem_res in struct mmc_omap_host is used only once in mmc_omap_probe
when setting the phys_base field so we may just se the phys_base straight
and remove needless mem_res.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index e6987ae..74990ef 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -140,7 +140,6 @@ struct mmc_omap_host {
u32 dma_rx_burst;
struct dma_chan *dma_tx;
u32 dma_tx_burst;
- struct resource *mem_res;
void __iomem *virt_base;
unsigned int phys_base;
int irq;
@@ -1382,10 +1381,9 @@ static int mmc_omap_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host);
host->id = pdev->id;
- host->mem_res = res;
host->irq = irq;
host->use_dma = 1;
- host->phys_base = host->mem_res->start;
+ host->phys_base = res->start;
host->virt_base = ioremap(res->start, resource_size(res));
if (!host->virt_base)
goto err_ioremap;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 5/8] mmc: omap: Convert to devm_ioremap_resource
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (2 preceding siblings ...)
2013-11-16 15:53 ` [RESEND 4/8] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 6/8] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
` (2 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
Simplify probe and cleanup code by using devm_ioremap_resource. This also
makes probe code to follow more common allocate private struct followed by
other initialization style.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 41 ++++++++++++-----------------------------
1 file changed, 12 insertions(+), 29 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 74990ef..c20c625 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1344,22 +1344,19 @@ static int mmc_omap_probe(struct platform_device *pdev)
return -ENXIO;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
+ GFP_KERNEL);
+ if (host == NULL)
+ return -ENOMEM;
+
irq = platform_get_irq(pdev, 0);
- if (res == NULL || irq < 0)
+ if (irq < 0)
return -ENXIO;
- res = request_mem_region(res->start, resource_size(res),
- pdev->name);
- if (res == NULL)
- return -EBUSY;
-
- host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
- GFP_KERNEL);
- if (host == NULL) {
- ret = -ENOMEM;
- goto err_free_mem_region;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ host->virt_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(host->virt_base))
+ return PTR_ERR(host->virt_base);
INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
@@ -1384,15 +1381,9 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->irq = irq;
host->use_dma = 1;
host->phys_base = res->start;
- host->virt_base = ioremap(res->start, resource_size(res));
- if (!host->virt_base)
- goto err_ioremap;
-
host->iclk = clk_get(&pdev->dev, "ick");
- if (IS_ERR(host->iclk)) {
- ret = PTR_ERR(host->iclk);
- goto err_free_mmc_host;
- }
+ if (IS_ERR(host->iclk))
+ return PTR_ERR(host->iclk);
clk_enable(host->iclk);
host->fclk = clk_get(&pdev->dev, "fck");
@@ -1469,11 +1460,6 @@ err_free_dma:
err_free_iclk:
clk_disable(host->iclk);
clk_put(host->iclk);
-err_free_mmc_host:
- iounmap(host->virt_base);
-err_ioremap:
-err_free_mem_region:
- release_mem_region(res->start, resource_size(res));
return ret;
}
@@ -1501,9 +1487,6 @@ static int mmc_omap_remove(struct platform_device *pdev)
if (host->dma_rx)
dma_release_channel(host->dma_rx);
- iounmap(host->virt_base);
- release_mem_region(pdev->resource[0].start,
- pdev->resource[0].end - pdev->resource[0].start + 1);
destroy_workqueue(host->mmc_omap_wq);
return 0;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 6/8] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (3 preceding siblings ...)
2013-11-16 15:53 ` [RESEND 5/8] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 7/8] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
2013-11-16 15:53 ` [RESEND 8/8] mmc: omap: Add erase capability Jarkko Nikula
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
Because use_dma is set only in mmc_omap_probe and unset nowhere there is no
need to carry that flag in struct mmc_omap_host for mmc_omap_prepare_data
function.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c20c625..c975051 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -162,7 +162,6 @@ struct mmc_omap_host {
u32 total_bytes_left;
unsigned features;
- unsigned use_dma:1;
unsigned brs_received:1, dma_done:1;
unsigned dma_in_use:1;
spinlock_t dma_lock;
@@ -954,7 +953,7 @@ static void
mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
{
struct mmc_data *data = req->data;
- int i, use_dma, block_size;
+ int i, use_dma = 1, block_size;
unsigned sg_len;
host->data = data;
@@ -979,13 +978,10 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
sg_len = (data->blocks == 1) ? 1 : data->sg_len;
/* Only do DMA for entire blocks */
- use_dma = host->use_dma;
- if (use_dma) {
- for (i = 0; i < sg_len; i++) {
- if ((data->sg[i].length % block_size) != 0) {
- use_dma = 0;
- break;
- }
+ for (i = 0; i < sg_len; i++) {
+ if ((data->sg[i].length % block_size) != 0) {
+ use_dma = 0;
+ break;
}
}
@@ -1379,7 +1375,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->id = pdev->id;
host->irq = irq;
- host->use_dma = 1;
host->phys_base = res->start;
host->iclk = clk_get(&pdev->dev, "ick");
if (IS_ERR(host->iclk))
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 7/8] mmc: omap: Get DMA request numbers via platform resource
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (4 preceding siblings ...)
2013-11-16 15:53 ` [RESEND 6/8] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
2013-11-16 15:53 ` [RESEND 8/8] mmc: omap: Add erase capability Jarkko Nikula
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
There is no need to define MMC DMA TX and RX request numbers locally for
OMAP1xxx and OMAP24xx and assign them non-portable way since they already
come via platform resources. See commits
6c432f7 ("ARM: OMAP1: Pass dma request lines in platform data to MMC driver")
b955eef ("ARM: OMAP2: Use hwmod to initialize mmc for 2420")
Note that mmc_omap_probe doesn't change failure mechanism in case if it
fails get DMA request number or DMA channel. In that case it just falls
back to PIO transfer for TX and/or RX.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 39 +++++++++++++--------------------------
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c975051..24235f1 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -90,17 +90,6 @@
#define OMAP_MMC_CMDTYPE_AC 2
#define OMAP_MMC_CMDTYPE_ADTC 3
-#define OMAP_DMA_MMC_TX 21
-#define OMAP_DMA_MMC_RX 22
-#define OMAP_DMA_MMC2_TX 54
-#define OMAP_DMA_MMC2_RX 55
-
-#define OMAP24XX_DMA_MMC2_TX 47
-#define OMAP24XX_DMA_MMC2_RX 48
-#define OMAP24XX_DMA_MMC1_TX 61
-#define OMAP24XX_DMA_MMC1_RX 62
-
-
#define DRIVER_NAME "mmci-omap"
/* Specifies how often in millisecs to poll for card status changes
@@ -1327,7 +1316,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
struct mmc_omap_host *host = NULL;
struct resource *res;
dma_cap_mask_t mask;
- unsigned sig;
int i, ret = 0;
int irq;
@@ -1393,22 +1381,21 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->dma_tx_burst = -1;
host->dma_rx_burst = -1;
- if (mmc_omap2())
- sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
- else
- sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
- host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
+ if (res)
+ host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn,
+ &res->start);
if (!host->dma_tx)
- dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
- sig);
- if (mmc_omap2())
- sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
- else
- sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
- host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+ dev_warn(host->dev,
+ "unable to obtain TX DMA. Falling back to PIO\n");
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
+ if (res)
+ host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn,
+ &res->start);
if (!host->dma_rx)
- dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n",
- sig);
+ dev_warn(host->dev,
+ "unable to obtain RX DMA. Falling back to PIO\n");
ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host);
if (ret)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RESEND 8/8] mmc: omap: Add erase capability
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
` (5 preceding siblings ...)
2013-11-16 15:53 ` [RESEND 7/8] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
@ 2013-11-16 15:53 ` Jarkko Nikula
6 siblings, 0 replies; 16+ messages in thread
From: Jarkko Nikula @ 2013-11-16 15:53 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Jarkko Nikula
This patch adds the erase capability to OMAP1/OMAP2420 MMC driver. Idea is
the same than in commit 93caf8e ("omap_hsmmc: add erase capability") that we
disable the data timeout interrupt for erases.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
drivers/mmc/host/omap.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 24235f1..134885a 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -25,6 +25,7 @@
#include <linux/omap-dma.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
+#include <linux/mmc/mmc.h>
#include <linux/clk.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
@@ -335,6 +336,7 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
u32 cmdreg;
u32 resptype;
u32 cmdtype;
+ u16 irq_mask;
host->cmd = cmd;
@@ -387,12 +389,14 @@ mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
OMAP_MMC_WRITE(host, CTO, 200);
OMAP_MMC_WRITE(host, ARGL, cmd->arg & 0xffff);
OMAP_MMC_WRITE(host, ARGH, cmd->arg >> 16);
- OMAP_MMC_WRITE(host, IE,
- OMAP_MMC_STAT_A_EMPTY | OMAP_MMC_STAT_A_FULL |
- OMAP_MMC_STAT_CMD_CRC | OMAP_MMC_STAT_CMD_TOUT |
- OMAP_MMC_STAT_DATA_CRC | OMAP_MMC_STAT_DATA_TOUT |
- OMAP_MMC_STAT_END_OF_CMD | OMAP_MMC_STAT_CARD_ERR |
- OMAP_MMC_STAT_END_OF_DATA);
+ irq_mask = OMAP_MMC_STAT_A_EMPTY | OMAP_MMC_STAT_A_FULL |
+ OMAP_MMC_STAT_CMD_CRC | OMAP_MMC_STAT_CMD_TOUT |
+ OMAP_MMC_STAT_DATA_CRC | OMAP_MMC_STAT_DATA_TOUT |
+ OMAP_MMC_STAT_END_OF_CMD | OMAP_MMC_STAT_CARD_ERR |
+ OMAP_MMC_STAT_END_OF_DATA;
+ if (cmd->opcode == MMC_ERASE)
+ irq_mask &= ~OMAP_MMC_STAT_DATA_TOUT;
+ OMAP_MMC_WRITE(host, IE, irq_mask);
OMAP_MMC_WRITE(host, CMD, cmdreg);
}
@@ -1233,7 +1237,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
mmc->caps = 0;
if (host->pdata->slots[id].wires >= 4)
- mmc->caps |= MMC_CAP_4_BIT_DATA;
+ mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_ERASE;
mmc->ops = &mmc_omap_ops;
mmc->f_min = 400000;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2013-11-16 15:53 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 2/7] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 3/7] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 4/7] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 5/7] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 6/7] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 7/7] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
2013-10-26 14:55 ` [PATCH] mmc: omap: Add erase capability Jarkko Nikula
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-11-16 15:53 ` [RESEND 2/8] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
2013-11-16 15:53 ` [RESEND 3/8] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
2013-11-16 15:53 ` [RESEND 4/8] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
2013-11-16 15:53 ` [RESEND 5/8] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
2013-11-16 15:53 ` [RESEND 6/8] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
2013-11-16 15:53 ` [RESEND 7/8] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
2013-11-16 15:53 ` [RESEND 8/8] mmc: omap: Add erase capability Jarkko Nikula
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).