Don't initialize the SD card after a reboot on an OTPless install
This commit is contained in:
parent
ae7fc28c74
commit
5f96d42a9c
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
vu32 *arm11 = (vu32 *)0x1FFFFFF8;
|
vu32 *arm11Entry = (vu32 *)0x1FFFFFF8;
|
||||||
|
|
||||||
//Clear ARM11 entrypoint
|
//Clear ARM11 entrypoint
|
||||||
*arm11 = 0;
|
*arm11Entry = 0;
|
||||||
|
|
||||||
//Wait for the entrypoint to be set
|
//Wait for the entrypoint to be set
|
||||||
while(!*arm11);
|
while(!*arm11Entry);
|
||||||
|
|
||||||
//Jump to it
|
//Jump to it
|
||||||
((void (*)())*arm11)();
|
((void (*)())*arm11Entry)();
|
||||||
}
|
}
|
@ -24,14 +24,14 @@
|
|||||||
.align 4
|
.align 4
|
||||||
.global _start
|
.global _start
|
||||||
_start:
|
_start:
|
||||||
@ Change the stack pointer
|
|
||||||
mov sp, #0x27000000
|
|
||||||
|
|
||||||
@ Disable interrupts
|
@ Disable interrupts
|
||||||
mrs r0, cpsr
|
mrs r0, cpsr
|
||||||
orr r0, #0x1C0
|
orr r0, #0x1C0
|
||||||
msr cpsr_cx, r0
|
msr cpsr_cx, r0
|
||||||
|
|
||||||
|
@ Change the stack pointer
|
||||||
|
mov sp, #0x27000000
|
||||||
|
|
||||||
@ Disable caches / MPU
|
@ Disable caches / MPU
|
||||||
mrc p15, 0, r0, c1, c0, 0 @ read control register
|
mrc p15, 0, r0, c1, c0, 0 @ read control register
|
||||||
bic r0, #(1<<12) @ - instruction cache disable
|
bic r0, #(1<<12) @ - instruction cache disable
|
||||||
|
@ -63,11 +63,13 @@ static inline void setckl(u32 data)
|
|||||||
sdmmc_mask16(REG_SDCLKCTL, 0x0, 0x100);
|
sdmmc_mask16(REG_SDCLKCTL, 0x0, 0x100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
mmcdevice *getMMCDevice(int drive)
|
mmcdevice *getMMCDevice(int drive)
|
||||||
{
|
{
|
||||||
if(drive == 0) return &handleNAND;
|
if(drive == 0) return &handleNAND;
|
||||||
return &handleSD;
|
return &handleSD;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static int geterror(struct mmcdevice *ctx)
|
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);
|
sdmmc_send_command(device, 0x10507, device->initarg << 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sdmmc_sdcard_init()
|
bool sdmmc_sdcard_init(bool isOtpless)
|
||||||
{
|
{
|
||||||
InitSD();
|
InitSD();
|
||||||
return (Nand_Init() | SD_Init()) == 0;
|
int nand_ret = Nand_Init();
|
||||||
|
if(isOtpless) return true;
|
||||||
|
return (nand_ret | SD_Init()) == 0;
|
||||||
}
|
}
|
@ -91,10 +91,10 @@ typedef struct mmcdevice {
|
|||||||
u32 res;
|
u32 res;
|
||||||
} mmcdevice;
|
} 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_readsectors(u32 sector_no, u32 numsectors, u8 *out);
|
||||||
int sdmmc_sdcard_writesectors(u32 sector_no, u32 numsectors, const u8 *in);
|
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_readsectors(u32 sector_no, u32 numsectors, u8 *out);
|
||||||
int sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, const u8 *in);
|
int sdmmc_nand_writesectors(u32 sector_no, u32 numsectors, const u8 *in);
|
||||||
void sdmmc_get_cid(bool isNand, u32 *info);
|
void sdmmc_get_cid(bool isNand, u32 *info);
|
||||||
mmcdevice *getMMCDevice(int drive);
|
//mmcdevice *getMMCDevice(int drive);
|
@ -53,7 +53,7 @@ void main(void)
|
|||||||
drawString(TITLE, 10, 10, COLOR_TITLE);
|
drawString(TITLE, 10, 10, COLOR_TITLE);
|
||||||
posY = drawString("Thanks to delebile, #cakey and StandardBus", 10, 40, COLOR_WHITE);
|
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");
|
shutdown(1, "Error: failed to initialize SD and NAND");
|
||||||
|
|
||||||
u32 pressed;
|
u32 pressed;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
|
|
||||||
vu32 *const arm11Entry = (vu32 *)BRAHMA_ARM11_ENTRY;
|
vu32 *arm11Entry = (vu32 *)BRAHMA_ARM11_ENTRY;
|
||||||
|
|
||||||
static void invokeArm11Function(void (*func)())
|
static void invokeArm11Function(void (*func)())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user