1 From 0733a2e1b598dec898fef5066b737764170aaf62 Mon Sep 17 00:00:00 2001
2 From: Andy Green <agreen@pads.home.warmcat.com>
3 Date: Sun, 10 Aug 2008 09:27:16 +0100
4 Subject: [PATCH] My GTA01 2.6.26 kernel was crashing within mmc_power_up(), at the first
5 call to mmc_set_ios(host), due to host->ops being NULL. mmc_power_up()
6 was being called by mmc_rescan().
8 The only possible call path I can imagine for that is s3cmci_irq_cd
9 getting called before host->ops is set, thus calling mmc_detect_change()
10 which will schedule host->detect which is mmc_rescan.
12 This patch avoids the problem by moving the enable of the gpio_detect
13 interrupt to just before calling mmc_add_host(), where everything else
16 Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
18 drivers/mmc/host/s3cmci.c | 34 +++++++++++++++++-----------------
19 1 files changed, 17 insertions(+), 17 deletions(-)
21 diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
22 index 9ef4d5b..107847a 100644
23 --- a/drivers/mmc/host/s3cmci.c
24 +++ b/drivers/mmc/host/s3cmci.c
25 @@ -1226,17 +1226,6 @@ static int s3cmci_probe(struct platform_device *pdev, int is2440)
27 disable_irq(host->irq);
29 - s3c2410_gpio_cfgpin(host->pdata->gpio_detect, S3C2410_GPIO_IRQ);
30 - set_irq_type(host->irq_cd, IRQT_BOTHEDGE);
32 - if (request_irq(host->irq_cd, s3cmci_irq_cd, 0, DRIVER_NAME, host)) {
34 - "failed to request card detect interrupt.\n");
37 - goto probe_free_irq;
40 if (host->pdata->gpio_wprotect)
41 s3c2410_gpio_cfgpin(host->pdata->gpio_wprotect,
43 @@ -1244,7 +1233,7 @@ static int s3cmci_probe(struct platform_device *pdev, int is2440)
44 if (s3c2410_dma_request(host->dma, &s3cmci_dma_client, NULL)) {
45 dev_err(&pdev->dev, "unable to get DMA channel.\n");
47 - goto probe_free_irq_cd;
48 + goto probe_free_irq;
51 host->clk = clk_get(&pdev->dev, "sdi");
52 @@ -1281,10 +1270,21 @@ static int s3cmci_probe(struct platform_device *pdev, int is2440)
53 "irq_cd:%u dma:%u.\n", (host->is2440?"2440":""),
54 host->base, host->irq, host->irq_cd, host->dma);
56 + s3c2410_gpio_cfgpin(host->pdata->gpio_detect, S3C2410_GPIO_IRQ);
57 + set_irq_type(host->irq_cd, IRQT_BOTHEDGE);
59 + if (request_irq(host->irq_cd, s3cmci_irq_cd, 0, DRIVER_NAME, host)) {
61 + "failed to request card detect interrupt.\n");
64 + goto probe_disable_clk;
67 ret = mmc_add_host(mmc);
69 dev_err(&pdev->dev, "failed to add mmc host.\n");
70 - goto probe_disable_clk;
71 + goto probe_free_irq_cd;
74 platform_set_drvdata(pdev, mmc);
75 @@ -1292,15 +1292,15 @@ static int s3cmci_probe(struct platform_device *pdev, int is2440)
76 dev_info(&pdev->dev, "initialisation done.\n");
80 + free_irq(host->irq_cd, host);
83 clk_disable(host->clk);
89 - free_irq(host->irq_cd, host);
92 s3c2410_dma_free(host->dma, &s3cmci_dma_client);
94 @@ -1325,10 +1325,10 @@ static int s3cmci_remove(struct platform_device *pdev)
95 struct s3cmci_host *host = mmc_priv(mmc);
98 + free_irq(host->irq_cd, host);
99 clk_disable(host->clk);
101 s3c2410_dma_free(host->dma, &s3cmci_dma_client);
102 - free_irq(host->irq_cd, host);
103 free_irq(host->irq, host);
105 release_mem_region(host->mem->start, RESSIZE(host->mem));