]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Xilinx: ARM: Fix mmcinfo hang if booted from SD
authorJoe Hershberger <joe.hershberger@ni.com>
Thu, 19 Apr 2012 20:05:24 +0000 (15:05 -0500)
committerJagan <jaganna@xilinx.com>
Thu, 31 May 2012 07:39:14 +0000 (13:09 +0530)
Include the same check that was added to the FSBL

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
board/xilinx/dfe/mmc.c
board/xilinx/dfe/sd_hardware.h

index 33dfe2897683d606929598d1f6eb03779ff6b5f8..232a870ae073792bd405e6cd8b9d02a46495cf3d 100755 (executable)
@@ -52,6 +52,20 @@ static u8 sd_in8(u32 InAddress)
        return *(volatile u8 *) InAddress;
 }
 
+static void connect_test_mode(void)
+{
+       volatile unsigned  statusreg;
+
+       /* Fake out the card detect since it is also NAND CS */
+       sd_out8(SD_HOST_CTRL_R, SD_CD_TEST | SD_CD_TEST_INS);
+
+       /* Wait for card detected */
+       statusreg = sd_in32(SD_PRES_STATE_R);
+       while ( (!(statusreg & SD_CARD_DPL)) || (!(statusreg & SD_CARD_DB)) || (!(statusreg & SD_CARD_INS)) ) {
+               statusreg = sd_in32(SD_PRES_STATE_R);
+       }
+}
+
 /* Initialize the SD controller */
 static void init_port(void)
 {
@@ -73,6 +87,8 @@ static void init_port(void)
        /* Power on the card */
        sd_out8(SD_PWR_CTRL_R, SD_POWER_33|SD_POWER_ON);
 
+       connect_test_mode();
+
        /* Enable Internal clock and wait for it to stablilize */
        clk = (0x4 << SD_DIV_SHIFT) | SD_CLK_INT_EN;
        sd_out16(SD_CLK_CTL_R, clk);
index 53f06228410258ebcddf26bcdba7d3320b4e3d4d..7a07241c8220724902d51e007bc3bfdb27458230 100644 (file)
 #define  SD_WRITE_ACTIVE     0x00000100
 #define  SD_READ_ACTIVE      0x00000200
 #define  SD_CARD_INS         0x00010000
+#define  SD_CARD_DB          0x00020000
+#define  SD_CARD_DPL         0x00040000
+#define  SD_CARD_WP          0x00080000
 
 #define SD_HOST_CTRL_R       0x28
+#define  SD_CD_TEST_INS      0x40
+#define  SD_CD_TEST          0x80
 
 #define SD_PWR_CTRL_R     0x29
 #define  SD_POWER_ON         0x01