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)
{
/* 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);
#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