ask card to go back into IDLE state on reset before powering off SDHOST
authorchristinaa <kristinaa@tuta.io>
Tue, 3 Jan 2017 10:14:18 +0000 (10:14 +0000)
committerchristinaa <kristinaa@tuta.io>
Tue, 3 Jan 2017 10:14:18 +0000 (10:14 +0000)
arm_chainloader/drivers/sdhost_impl.cc

index 1b4a5de..d35f0d6 100644 (file)
@@ -91,6 +91,8 @@ struct BCM2708GPIO {
 #undef logf\r
 #define logf(fmt, ...) printf("[EMMC:%s]: " fmt, __FUNCTION__, ##__VA_ARGS__);\r
 \r
+#define kIdentSafeClockRate 0x148\r
+\r
 struct BCM2708SDHost : BlockDevice {\r
        bool is_sdhc;\r
        bool is_high_capacity;\r
@@ -540,7 +542,7 @@ struct BCM2708SDHost : BlockDevice {
 \r
                SH_HCFG &= ~SH_HCFG_WIDE_EXT_BUS_SET;\r
                SH_HCFG = SH_HCFG_SLOW_CARD_SET | SH_HCFG_WIDE_INT_BUS_SET;\r
-               SH_CDIV = 0x148;\r
+               SH_CDIV = kIdentSafeClockRate;\r
 \r
                udelay(300);\r
                mfence();\r
@@ -566,6 +568,13 @@ struct BCM2708SDHost : BlockDevice {
                if (card_ready) {\r
                        logf("flushing fifo ...\n");\r
                        drain_fifo_nowait();\r
+\r
+                       logf("asking card to enter idle state ...\n");\r
+                       SH_CDIV = kIdentSafeClockRate;\r
+                       udelay(150);\r
+\r
+                       send_no_resp(MMC_GO_IDLE_STATE);\r
+                       udelay(500);\r
                }\r
 \r
                logf("stopping sdhost controller driver ...\n");\r
This page took 0.025787 seconds and 4 git commands to generate.