* [PATCH 0/2] sunxi-mci: Fix hang on boot caused by irq storm
@ 2014-02-07 14:00 Hans de Goede
[not found] ` <1391781641-7382-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2014-02-07 14:00 UTC (permalink / raw)
To: David Lanzendörfer
Cc: Maxime Ripard, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi David,
Here are 2 patches fixing a hang on boot caused by an irq storm, which
I've sometimes observed on my cubietruck during testing. Can you please
squash these fixes into the next version of the sunxi-mci patch-set ?
Thanks & Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] sunxi-mci: Move clk_enable / disable into host_init / exit
[not found] ` <1391781641-7382-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2014-02-07 14:00 ` Hans de Goede
2014-02-07 14:00 ` [PATCH 2/2] sunxi-mci: Fix hang on boot caused by irq storm Hans de Goede
2014-02-07 14:31 ` [PATCH 0/2] " David Lanzendörfer
2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2014-02-07 14:00 UTC (permalink / raw)
To: David Lanzendörfer
Cc: Maxime Ripard, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/mmc/host/sunxi-mci.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mci.c b/drivers/mmc/host/sunxi-mci.c
index 627d0ee..0eb59be 100644
--- a/drivers/mmc/host/sunxi-mci.c
+++ b/drivers/mmc/host/sunxi-mci.c
@@ -45,10 +45,23 @@
#include "sunxi-mci.h"
-static void sunxi_mmc_init_host(struct mmc_host *mmc)
+static int sunxi_mmc_init_host(struct mmc_host *mmc)
{
u32 rval;
struct sunxi_mmc_host *smc_host = mmc_priv(mmc);
+ int ret;
+
+ ret = clk_prepare_enable(smc_host->clk_ahb);
+ if (ret) {
+ dev_err(mmc_dev(smc_host->mmc), "AHB clk err %d\n", ret);
+ return ret;
+ }
+ ret = clk_prepare_enable(smc_host->clk_mod);
+ if (ret) {
+ dev_err(mmc_dev(smc_host->mmc), "MOD clk err %d\n", ret);
+ clk_disable_unprepare(smc_host->clk_ahb);
+ return ret;
+ }
/* reset controller */
rval = mci_readl(smc_host, REG_GCTRL) | SDXC_HWReset;
@@ -64,11 +77,15 @@ static void sunxi_mmc_init_host(struct mmc_host *mmc)
rval = mci_readl(smc_host, REG_GCTRL)|SDXC_INTEnb;
rval &= ~SDXC_AccessDoneDirect;
mci_writel(smc_host, REG_GCTRL, rval);
+
+ return 0;
}
static void sunxi_mmc_exit_host(struct sunxi_mmc_host *smc_host)
{
mci_writel(smc_host, REG_GCTRL, SDXC_HWReset);
+ clk_disable_unprepare(smc_host->clk_ahb);
+ clk_disable_unprepare(smc_host->clk_mod);
}
/* /\* UHS-I Operation Modes */
@@ -515,21 +532,11 @@ static void sunxi_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
udelay(200);
}
- err = clk_prepare_enable(host->clk_ahb);
- if (err) {
- dev_err(mmc_dev(host->mmc), "AHB clk err %d\n", err);
- host->ferror = 1;
- return;
- }
- err = clk_prepare_enable(host->clk_mod);
+ err = sunxi_mmc_init_host(mmc);
if (err) {
- dev_err(mmc_dev(host->mmc), "MOD clk err %d\n", err);
- clk_disable_unprepare(host->clk_ahb);
host->ferror = 1;
return;
}
-
- sunxi_mmc_init_host(mmc);
enable_irq(host->irq);
dev_dbg(mmc_dev(host->mmc), "power on!\n");
@@ -540,8 +547,6 @@ static void sunxi_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
dev_dbg(mmc_dev(host->mmc), "power off!\n");
disable_irq(host->irq);
sunxi_mmc_exit_host(host);
- clk_disable_unprepare(host->clk_ahb);
- clk_disable_unprepare(host->clk_mod);
if (!IS_ERR(host->vmmc))
mmc_regulator_set_ocr(host->mmc, host->vmmc, 0);
host->ferror = 0;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] sunxi-mci: Fix hang on boot caused by irq storm
[not found] ` <1391781641-7382-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-02-07 14:00 ` [PATCH 1/2] sunxi-mci: Move clk_enable / disable into host_init / exit Hans de Goede
@ 2014-02-07 14:00 ` Hans de Goede
2014-02-07 14:31 ` [PATCH 0/2] " David Lanzendörfer
2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2014-02-07 14:00 UTC (permalink / raw)
To: David Lanzendörfer
Cc: Maxime Ripard, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
On power up / reboot sometimes the mmc controller will have its irq line
asserted. Getting this de-asserted requires enabling the clocks and then
resetting the mmc controller.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/mmc/host/sunxi-mci.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mci.c b/drivers/mmc/host/sunxi-mci.c
index 0eb59be..8b47c99 100644
--- a/drivers/mmc/host/sunxi-mci.c
+++ b/drivers/mmc/host/sunxi-mci.c
@@ -737,13 +737,6 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
if (IS_ERR(host->reg_base))
return PTR_ERR(host->reg_base);
- host->irq = platform_get_irq(pdev, 0);
- ret = devm_request_irq(&pdev->dev, host->irq, sunxi_mmc_irq, 0,
- "sunxi-mci", host);
- if (ret)
- return ret;
- disable_irq(host->irq);
-
host->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(host->clk_ahb)) {
dev_err(&pdev->dev, "Could not get ahb clock\n");
@@ -756,7 +749,21 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
return PTR_ERR(host->clk_mod);
}
- return 0;
+ /* Make sure the controller is in a sane state before enabling irqs */
+ ret = sunxi_mmc_init_host(host->mmc);
+ if (ret)
+ return ret;
+
+ host->irq = platform_get_irq(pdev, 0);
+ ret = devm_request_irq(&pdev->dev, host->irq, sunxi_mmc_irq, 0,
+ "sunxi-mci", host);
+ if (ret == 0)
+ disable_irq(host->irq);
+
+ /* And put it back in reset */
+ sunxi_mmc_exit_host(host);
+
+ return ret;
}
static int sunxi_mmc_probe(struct platform_device *pdev)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] sunxi-mci: Fix hang on boot caused by irq storm
[not found] ` <1391781641-7382-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-02-07 14:00 ` [PATCH 1/2] sunxi-mci: Move clk_enable / disable into host_init / exit Hans de Goede
2014-02-07 14:00 ` [PATCH 2/2] sunxi-mci: Fix hang on boot caused by irq storm Hans de Goede
@ 2014-02-07 14:31 ` David Lanzendörfer
2 siblings, 0 replies; 4+ messages in thread
From: David Lanzendörfer @ 2014-02-07 14:31 UTC (permalink / raw)
To: Hans de Goede
Cc: Maxime Ripard, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 326 bytes --]
Hi Hans
> Here are 2 patches fixing a hang on boot caused by an irq storm, which
> I've sometimes observed on my cubietruck during testing. Can you please
> squash these fixes into the next version of the sunxi-mci patch-set ?
Ok.
Good thing you've discovered this issue.
I will incorporate that into patchset v4
cheers
David
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-07 14:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07 14:00 [PATCH 0/2] sunxi-mci: Fix hang on boot caused by irq storm Hans de Goede
[not found] ` <1391781641-7382-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-02-07 14:00 ` [PATCH 1/2] sunxi-mci: Move clk_enable / disable into host_init / exit Hans de Goede
2014-02-07 14:00 ` [PATCH 2/2] sunxi-mci: Fix hang on boot caused by irq storm Hans de Goede
2014-02-07 14:31 ` [PATCH 0/2] " David Lanzendörfer
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).