From: Joe Hershberger Date: Thu, 19 Apr 2012 20:05:24 +0000 (-0500) Subject: Xilinx: ARM: Fix mmcinfo hang if booted from SD X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=209f4a42b2fccfab973654b95c1843c52b9aea87;p=thirdparty%2Fu-boot.git Xilinx: ARM: Fix mmcinfo hang if booted from SD Include the same check that was added to the FSBL Signed-off-by: Joe Hershberger --- diff --git a/board/xilinx/dfe/mmc.c b/board/xilinx/dfe/mmc.c index 33dfe289768..232a870ae07 100755 --- a/board/xilinx/dfe/mmc.c +++ b/board/xilinx/dfe/mmc.c @@ -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); diff --git a/board/xilinx/dfe/sd_hardware.h b/board/xilinx/dfe/sd_hardware.h index 53f06228410..7a07241c822 100644 --- a/board/xilinx/dfe/sd_hardware.h +++ b/board/xilinx/dfe/sd_hardware.h @@ -40,8 +40,13 @@ #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