From 2b850a957ca424417b50e597f8d1c1a48e65155a Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Wed, 6 Jul 2022 18:32:33 -0600 Subject: [PATCH] Remove non-working code --- bootloader/source/sdmmc.c | 42 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/bootloader/source/sdmmc.c b/bootloader/source/sdmmc.c index 3b189fc..3910abe 100644 --- a/bootloader/source/sdmmc.c +++ b/bootloader/source/sdmmc.c @@ -329,59 +329,41 @@ int sdmmc_sdcard_init() { if (deviceSD.error & 0x4) return -1; sdmmc_send_command(&deviceSD,0x10403,0); - if (deviceSD.error & 0x4) return -2; + if (deviceSD.error & 0x4) return -1; deviceSD.initarg = deviceSD.ret[0] >> 0x10; sdmmc_send_command(&deviceSD,0x10609,deviceSD.initarg << 0x10); - if (deviceSD.error & 0x4) return -3; + if (deviceSD.error & 0x4) return -1; - // Command Class 10 support - const bool cmd6Supported = ((u8*)deviceSD.ret)[10] & 0x40; deviceSD.total_size = calcSDSize((u8*)&deviceSD.ret[0],-1); - setckl(0x201); // 16.756991 MHz + deviceSD.clk = 1; + setckl(1); sdmmc_send_command(&deviceSD,0x10507,deviceSD.initarg << 0x10); - if (deviceSD.error & 0x4) return -4; + if (deviceSD.error & 0x4) return -1; // CMD55 sdmmc_send_command(&deviceSD,0x10437,deviceSD.initarg << 0x10); - if (deviceSD.error & 0x4) return -5; + if (deviceSD.error & 0x4) return -1; // ACMD42 sdmmc_send_command(&deviceSD,0x1076A,0x0); - if (deviceSD.error & 0x4) return -6; + if (deviceSD.error & 0x4) return -1; // CMD55 sdmmc_send_command(&deviceSD,0x10437,deviceSD.initarg << 0x10); - if (deviceSD.error & 0x4) return -7; + if (deviceSD.error & 0x4) return -1; deviceSD.SDOPT = 1; sdmmc_send_command(&deviceSD,0x10446,0x2); - if (deviceSD.error & 0x4) return -8; - sdmmc_mask16(REG_SDOPT, 0x8000, 0); // Switch to 4 bit mode. - - // TODO: CMD6 to switch to high speed mode. - if(cmd6Supported) - { - sdmmc_write16(REG_SDSTOP,0); - sdmmc_write16(REG_SDBLKLEN32,64); - sdmmc_write16(REG_SDBLKLEN,64); - deviceSD.rData = NULL; - deviceSD.size = 64; - sdmmc_send_command(&deviceSD,0x31C06,0x80FFFFF1); - sdmmc_write16(REG_SDBLKLEN,512); - if(deviceSD.error & 0x4) return -9; - - deviceSD.clk = 0x200; // 33.513982 MHz - setckl(0x200); - } - else deviceSD.clk = 0x201; // 16.756991 MHz + if (deviceSD.error & 0x4) return -1; sdmmc_send_command(&deviceSD,0x1040D,deviceSD.initarg << 0x10); - if (deviceSD.error & 0x4) return -9; + if (deviceSD.error & 0x4) return -1; sdmmc_send_command(&deviceSD,0x10410,0x200); - if (deviceSD.error & 0x4) return -10; + if (deviceSD.error & 0x4) return -1; + deviceSD.clk |= 0x200; return 0;