Don't initialize the SD card after a reboot on an OTPless install

This commit is contained in:
Aurora 2016-10-06 17:12:44 +02:00
parent ae7fc28c74
commit 5f96d42a9c
7 changed files with 27 additions and 23 deletions

View File

@ -2,14 +2,14 @@
void main(void)
{
vu32 *arm11 = (vu32 *)0x1FFFFFF8;
vu32 *arm11Entry = (vu32 *)0x1FFFFFF8;
//Clear ARM11 entrypoint
*arm11 = 0;
*arm11Entry = 0;
//Wait for the entrypoint to be set
while(!*arm11);
while(!*arm11Entry);
//Jump to it
((void (*)())*arm11)();
((void (*)())*arm11Entry)();
}

View File

@ -24,14 +24,14 @@
.align 4
.global _start
_start:
@ Change the stack pointer
mov sp, #0x27000000
@ Disable interrupts
mrs r0, cpsr
orr r0, #0x1C0
msr cpsr_cx, r0
@ Change the stack pointer
mov sp, #0x27000000
@ Disable caches / MPU
mrc p15, 0, r0, c1, c0, 0 @ read control register
bic r0, #(1<<12) @ - instruction cache disable

View File

@ -63,11 +63,13 @@ static inline void setckl(u32 data)
sdmmc_mask16(REG_SDCLKCTL, 0x0, 0x100);
}
/*
mmcdevice *getMMCDevice(int drive)
{
if(drive == 0) return &handleNAND;
return &handleSD;
}
*/
static int geterror(struct mmcdevice *ctx)
{
@ -470,8 +472,10 @@ void sdmmc_get_cid(bool isNand, u32 *info)
sdmmc_send_command(device, 0x10507, device->initarg << 0x10);
}
bool sdmmc_sdcard_init()
bool sdmmc_sdcard_init(bool isOtpless)
{
InitSD();
return (Nand_Init() | SD_Init()) == 0;
int nand_ret = Nand_Init();
if(isOtpless) return true;
return (nand_ret | SD_Init()) == 0;
}

View File

@ -91,10 +91,10 @@ typedef struct mmcdevice {
u32 res;
} mmcdevice;
bool sdmmc_sdcard_init();
bool sdmmc_sdcard_init(bool isOtpless);
int sdmmc_sdcard_readsectors(u32 sector_no, u32 numsectors, u8 *out);
int sdmmc_sdcard_writesectors(u32 sector_no, u32 numsectors, const u8 *in);
int sdmmc_nand_readsectors(u32 sector_no, u32 numsectors, u8 *out);
int sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, const u8 *in);
void sdmmc_get_cid(bool isNand, u32 *info);
mmcdevice *getMMCDevice(int drive);
//mmcdevice *getMMCDevice(int drive);

View File

@ -53,7 +53,7 @@ void main(void)
drawString(TITLE, 10, 10, COLOR_TITLE);
posY = drawString("Thanks to delebile, #cakey and StandardBus", 10, 40, COLOR_WHITE);
if(!sdmmc_sdcard_init() && !isOtpless)
if(!sdmmc_sdcard_init(isOtpless))
shutdown(1, "Error: failed to initialize SD and NAND");
u32 pressed;

View File

@ -38,7 +38,7 @@
#include "cache.h"
#include "i2c.h"
vu32 *const arm11Entry = (vu32 *)BRAHMA_ARM11_ENTRY;
vu32 *arm11Entry = (vu32 *)BRAHMA_ARM11_ENTRY;
static void invokeArm11Function(void (*func)())
{