diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/calculate_timings_mariko.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/calculate_timings_mariko.cpp index fab24dbf..c6efaa0f 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/calculate_timings_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/calculate_timings_mariko.cpp @@ -20,8 +20,8 @@ namespace ams::ldr::hoc::pcv::mariko { - void GetRext() { - if (auto r = FindRext()) { + void GetRext(u32 freq) { + if (auto r = FindRext(freq)) { rext = r->rext; return; } @@ -46,7 +46,7 @@ namespace ams::ldr::hoc::pcv::mariko { } void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) { - if (freq > 1600'000 && freq <= 1862'400) { /* 1866tRWL */ + if (freq > 1600'000 && freq <= 1866'000) { /* 1866tRWL */ latency += latencyStep * 2; } else { /* 2133tRWL */ latency += latencyStep * 3; @@ -130,10 +130,8 @@ namespace ams::ldr::hoc::pcv::mariko { HandleLatency(freq); - GetRext(); + GetRext(freq); - /* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */ - /* This is a lazy workaround until I find the issue... */ const bool lowFreq = freq < C.timingEmcTbreak; tRCD = tRCD_values[lowFreq ? C.low_t1_tRCD : C.t1_tRCD]; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/pcv_mariko.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/pcv_mariko.cpp index c2644620..331d988d 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/pcv_mariko.cpp @@ -315,6 +315,7 @@ namespace ams::ldr::hoc::pcv::mariko { cmd.val = val; Result res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All); i2csessionClose(&_session); + return res; } @@ -350,8 +351,6 @@ namespace ams::ldr::hoc::pcv::mariko { Result resultI2C = I2cSet_U8(I2cDevice_Max77812_2, 0x25, (emc_uv - uv_min) / uv_step); i2cExit(); - R_SUCCEED(); - return resultI2C; } diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.cpp index ecb4d47f..117fa995 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.cpp @@ -35,9 +35,9 @@ namespace ams::ldr::hoc::pcv::mariko { const u32 g_rext_table_size = sizeof(g_rext_table) / sizeof(g_rext_table[0]); - const ReplacePatch *FindRext() { + const ReplacePatch *FindRext(u32 freq) { for (u32 i = 0; i < g_rext_table_size; i++) { - if (g_rext_table[i].freq >= C.marikoEmcMaxClock) { + if (g_rext_table[i].freq >= freq) { return &g_rext_table[i]; } } diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.hpp index d682000e..1fe42bd9 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/mariko/timing_tables.hpp @@ -26,6 +26,6 @@ namespace ams::ldr::hoc::pcv::mariko { extern const ReplacePatch g_rext_table[]; extern const u32 g_rext_table_size; - const ReplacePatch *FindRext(); + const ReplacePatch *FindRext(u32 freq); }