public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc:sdhci:fix: Change default interrupts enabled at SDHCI initialization
@ 2013-01-11 15:08 Lukasz Majewski
  2013-01-29 14:47 ` Lukasz Majewski
  0 siblings, 1 reply; 13+ messages in thread
From: Lukasz Majewski @ 2013-01-11 15:08 UTC (permalink / raw)
  To: u-boot

This patch changes sdhci_init()'s behavior to NOT enable all interrupt
sources by default. Moreover interrupt signaling has been disabled.

This patch do not enable interrupts which aren't served in u-boot
(they are defined at sdhci.h but NOT used elsewhere):
- SDHCI_INT_CARD_INSERT, SDHCI_INT_CARD_REMOVE, SDHCI_BUS_POWER,
  SDHCI_INT_CARD_REMOVE, SDHCI_INT_CARD_INT

Special care shall be put on SDHCI_INT_CARD_INT, which indicates
interrupt generated by SD card.
According to "SD Host Controller Simplified Spec. ver 3.00" when bit 8
(Card Interrupt Status Enable) at "Normal Interrupt Status Enable
Register" (offset 0x34) is set, the card interrupt detection is started.
Then eMMC card may cause the SD controller to set this bit and then this
interrupt is passed to booted OS and might cause kernel crash.


To sum up:
- Only enable interrupts, which are served at u-boot
- This cleanup as a side effect fixes SDHCI's CARD INTERRUPT problem at 
  Linux kernel (versions 3.6+, sdhci controller)
- Keep masked bits at "Normal Interrupt Signal Enable Register" (0x38h)

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lei Wen <leiwen@marvell.com>
Cc: Andy Fleming <afleming@freescale.com>
---
 drivers/mmc/sdhci.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 0fd1337..76c14fb 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -412,9 +412,11 @@ int sdhci_init(struct mmc *mmc)
 			status = sdhci_readl(host, SDHCI_PRESENT_STATE);
 	}
 
-	/* Eable all state */
-	sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_ENABLE);
-	sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_SIGNAL_ENABLE);
+	/* Enable only interrupts served by the SD controller */
+	sdhci_writel(host, SDHCI_INT_DATA_MASK | SDHCI_INT_CMD_MASK
+		     , SDHCI_INT_ENABLE);
+	/* Mask all sdhci interrupt sources */
+	sdhci_writel(host, 0x0, SDHCI_SIGNAL_ENABLE);
 
 	return 0;
 }
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-03-12 10:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 15:08 [U-Boot] [PATCH] mmc:sdhci:fix: Change default interrupts enabled at SDHCI initialization Lukasz Majewski
2013-01-29 14:47 ` Lukasz Majewski
2013-01-30  4:52   ` Jaehoon Chung
2013-02-11  8:50   ` Lukasz Majewski
2013-02-11 13:58     ` Tom Rini
2013-02-21 17:21     ` Lukasz Majewski
2013-02-21 17:45       ` Tom Rini
2013-02-21 23:33         ` Jaehoon Chung
2013-02-21 23:43           ` Tom Rini
2013-02-22  7:11             ` Lukasz Majewski
2013-02-22  7:41               ` Jaehoon Chung
2013-03-11  8:22               ` Lukasz Majewski
2013-03-12 10:54                 ` Minkyu Kang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox