mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
fusee: sdram scratch fixes
This commit is contained in:
parent
6d65aa7e72
commit
97157577ab
2 changed files with 123 additions and 122 deletions
|
@ -544,9 +544,9 @@ static void sdram_config_mariko(const sdram_params_mariko_t *params) {
|
|||
pmc->weak_bias = ((~params->EmcPmcScratch1 & 0x1000) << 19) | ((~params->EmcPmcScratch1 & 0xFFF) << 18) | ((~params->EmcPmcScratch1 & 0x8000) << 15);
|
||||
pmc->io_dpd3_req = (~params->EmcPmcScratch1 & 0x9FFF) + 0x80000000;
|
||||
udelay(params->PmcIoDpd3ReqWait);
|
||||
pmc->io_dpd4_req = (~params->EmcPmcScratch2 & 0x3FFF0000) + 0x80000000;
|
||||
pmc->io_dpd4_req = (~params->EmcPmcScratch2 & 0x3FFF0000) | 0x80000000;
|
||||
udelay(params->PmcIoDpd4ReqWait);
|
||||
pmc->io_dpd4_req = (~params->EmcPmcScratch2 & 0x1FFF) + 0x80000000;
|
||||
pmc->io_dpd4_req = (~params->EmcPmcScratch2 & 0x1FFF) | 0x80000000;
|
||||
udelay(1);
|
||||
|
||||
MAKE_EMC_REG(EMC_FBIO_CFG7) = params->EmcFbioCfg7;
|
||||
|
@ -585,7 +585,7 @@ static void sdram_config_mariko(const sdram_params_mariko_t *params) {
|
|||
udelay(params->PmcVddpSelWait + 2);
|
||||
car->clk_source_emc = params->EmcClockSource;
|
||||
car->clk_source_emc_dll = params->EmcClockSourceDll;
|
||||
MAKE_EMC_REG(EMC_DBG) = params->EmcDbg | 2 * params->EmcDbgWriteMux;
|
||||
MAKE_EMC_REG(EMC_DBG) = params->EmcDbg | (2 * params->EmcDbgWriteMux);
|
||||
|
||||
if (params->EmcBctSpare2) {
|
||||
*(volatile uint32_t *)params->EmcBctSpare2 = params->EmcBctSpare3;
|
||||
|
@ -1219,11 +1219,11 @@ static void sdram_save_params_erista(const void *save_params) {
|
|||
*/
|
||||
|
||||
/* [4.0.0+] Patch carveout parameters. */
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout1Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout2Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout3Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout4Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout5Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout1Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout2Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout3Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout4Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout5Cfg0 = 0;
|
||||
|
||||
/* Patch SDRAM parameters. */
|
||||
uint32_t t0 = params->EmcSwizzleRank0Byte0 << 5 >> 29 > params->EmcSwizzleRank0Byte0 << 1 >> 29;
|
||||
|
@ -1234,9 +1234,9 @@ static void sdram_save_params_erista(const void *save_params) {
|
|||
uint32_t t5 = (t4 & 0xFFFFFFBF) | ((params->EmcSwizzleRank1Byte2 << 5 >> 29 > params->EmcSwizzleRank1Byte2 << 1 >> 29) << 6);
|
||||
uint32_t t6 = (t5 & 0xFFFFFFF7) | ((params->EmcSwizzleRank0Byte3 << 5 >> 29 > params->EmcSwizzleRank0Byte3 << 1 >> 29) << 3);
|
||||
uint32_t t7 = (t6 & 0xFFFFFF7F) | ((params->EmcSwizzleRank1Byte3 << 5 >> 29 > params->EmcSwizzleRank1Byte3 << 1 >> 29) << 7);
|
||||
*(volatile uint32_t *)params->SwizzleRankByteEncode = t7;
|
||||
*(volatile uint32_t *)params->EmcBctSpare2 = 0x40000DD8;
|
||||
*(volatile uint32_t *)params->EmcBctSpare3 = t7;
|
||||
*(volatile uint32_t *)¶ms->SwizzleRankByteEncode = t7;
|
||||
*(volatile uint32_t *)¶ms->EmcBctSpare2 = 0x40000DD8;
|
||||
*(volatile uint32_t *)¶ms->EmcBctSpare3 = t7;
|
||||
|
||||
s(EmcClockSource, 7:0, scratch6, 15:8);
|
||||
s(EmcClockSourceDll, 7:0, scratch6, 23:16);
|
||||
|
@ -2246,14 +2246,14 @@ static void sdram_save_params_mariko(const void *save_params) {
|
|||
#define c32(value, pmcreg) pmc->pmcreg = value
|
||||
|
||||
/* Patch carveout parameters. */
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout1Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout2Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout3Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout4Cfg0 = 0;
|
||||
*(volatile uint32_t *)params->McGeneralizedCarveout5Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout1Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout2Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout3Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout4Cfg0 = 0;
|
||||
*(volatile uint32_t *)¶ms->McGeneralizedCarveout5Cfg0 = 0;
|
||||
|
||||
/* Patch SDRAM parameters. */
|
||||
*(volatile uint32_t *)params->SwizzleRankByteEncode = 0;
|
||||
*(volatile uint32_t *)¶ms->SwizzleRankByteEncode = 0;
|
||||
uint32_t t0 = params->EmcSwizzleRank0Byte0 << 5 >> 29 > params->EmcSwizzleRank0Byte0 << 1 >> 29;
|
||||
uint32_t t1 = (t0 & 0xFFFFFFEF) | ((params->EmcSwizzleRank1Byte0 << 5 >> 29 > params->EmcSwizzleRank1Byte0 << 1 >> 29) << 4);
|
||||
uint32_t t2 = (t1 & 0xFFFFFFFD) | ((params->EmcSwizzleRank0Byte1 << 5 >> 29 > params->EmcSwizzleRank0Byte1 << 1 >> 29) << 1);
|
||||
|
@ -2262,9 +2262,9 @@ static void sdram_save_params_mariko(const void *save_params) {
|
|||
uint32_t t5 = (t4 & 0xFFFFFFBF) | ((params->EmcSwizzleRank1Byte2 << 5 >> 29 > params->EmcSwizzleRank1Byte2 << 1 >> 29) << 6);
|
||||
uint32_t t6 = (t5 & 0xFFFFFFF7) | ((params->EmcSwizzleRank0Byte3 << 5 >> 29 > params->EmcSwizzleRank0Byte3 << 1 >> 29) << 3);
|
||||
uint32_t t7 = (t6 & 0xFFFFFF7F) | ((params->EmcSwizzleRank1Byte3 << 5 >> 29 > params->EmcSwizzleRank1Byte3 << 1 >> 29) << 7);
|
||||
*(volatile uint32_t *)params->SwizzleRankByteEncode = t7;
|
||||
*(volatile uint32_t *)params->EmcBctSpare2 = 0x40000DD8;
|
||||
*(volatile uint32_t *)params->EmcBctSpare3 = t7;
|
||||
*(volatile uint32_t *)¶ms->SwizzleRankByteEncode = t7;
|
||||
*(volatile uint32_t *)¶ms->EmcBctSpare2 = 0x40000DD8;
|
||||
*(volatile uint32_t *)¶ms->EmcBctSpare3 = t7;
|
||||
|
||||
s(EmcClockSource, 7:0, scratch6, 15:8);
|
||||
s(EmcClockSourceDll, 7:0, scratch6, 23:16);
|
||||
|
@ -2401,7 +2401,7 @@ static void sdram_save_params_mariko(const void *save_params) {
|
|||
s(EmcAutoCalChannel, 11:8, scratch83, 9:6);
|
||||
s(EmcAutoCalChannel, 27:16, scratch83, 21:10);
|
||||
s(EmcAutoCalChannel, 31:29, scratch83, 24:22);
|
||||
s(EmcAutoCalChannel, 6:0, scratch83, 31:25);
|
||||
s(EmcConfigSampleDelay, 6:0, scratch83, 31:25);
|
||||
s(EmcPmacroRxTerm, 5:0, scratch84, 5:0);
|
||||
s(EmcPmacroRxTerm, 13:8, scratch84, 11:6);
|
||||
s(EmcPmacroRxTerm, 21:16, scratch84, 17:12);
|
||||
|
@ -3265,7 +3265,7 @@ static void sdram_save_params_mariko(const void *save_params) {
|
|||
s(McGeneralizedCarveout1Cfg0, 26:22, secure_scratch57, 29:25);
|
||||
s(McGeneralizedCarveout3Cfg0, 1:0, secure_scratch57, 31:30);
|
||||
s(McGeneralizedCarveout3Cfg0, 2:2, secure_scratch58, 0:0);
|
||||
s(McGeneralizedCarveout3Cfg0, 26:22, secure_scratch57, 5:1);
|
||||
s(McGeneralizedCarveout3Cfg0, 26:22, secure_scratch58, 5:1);
|
||||
|
||||
s32(McGeneralizedCarveout1Access0, secure_scratch59);
|
||||
s32(McGeneralizedCarveout1Access1, secure_scratch60);
|
||||
|
@ -3337,7 +3337,8 @@ static void sdram_save_params_mariko(const void *save_params) {
|
|||
s(PllMSetupControl, 23:0, scratch36, 23:0);
|
||||
|
||||
c32(0, scratch4);
|
||||
s(PllMStableTime, 19:0, scratch4, 19:0);
|
||||
s(PllMStableTime, 9:0, scratch4, 9:0);
|
||||
s(PllMStableTime, 31:0, scratch4, 31:10);
|
||||
}
|
||||
|
||||
void sdram_init(void) {
|
||||
|
|
Loading…
Reference in a new issue