soctherm coldboot fix
This commit is contained in:
1 parent
b8f728ac0a
commit
1b9156fbd6
3 files changed
+40
-18
No files matched your search
Binary file not shown.
@@ -32,6 +32,21 @@ namespace {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
void MainLoop(HocClkBpmpSharedInfo &info) {
|
||||||
|
for (;;) {
|
||||||
|
const u32 temp1 = MMIO32(SocthermBase + SocthermSensorTemp1);
|
||||||
|
const u32 temp2 = MMIO32(SocthermBase + SocthermSensorTemp2);
|
||||||
|
|
||||||
|
info.tempCpu = TranslateSocthermTemp(static_cast<u16>(temp1 >> 16));
|
||||||
|
info.tempGpu = TranslateSocthermTemp(static_cast<u16>(temp1));
|
||||||
|
info.tempMem = TranslateSocthermTemp(static_cast<u16>(temp2 >> 16));
|
||||||
|
info.tempPllx = TranslateSocthermTemp(static_cast<u16>(temp2));
|
||||||
|
// printf("tmr=%u\n", MMIO32(TmrBase + TimerUsCntr1Us));
|
||||||
|
msleep(500);
|
||||||
|
//printf("[hoc-bpmpfw]: Done logging\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void main() {
|
extern "C" void main() {
|
||||||
InitializeLibc();
|
InitializeLibc();
|
||||||
|
|
||||||
@@ -42,15 +57,15 @@ extern "C" void main() {
|
|||||||
info.status = 0;
|
info.status = 0;
|
||||||
info.magic = HOCCLK_BPMP_MAGIC; // written last
|
info.magic = HOCCLK_BPMP_MAGIC; // written last
|
||||||
|
|
||||||
for (;;) {
|
/* If the main loop exits then it is a panic or invalid state */
|
||||||
const u32 temp1 = MMIO32(SocthermBase + SocthermSensorTemp1);
|
MainLoop(info);
|
||||||
const u32 temp2 = MMIO32(SocthermBase + SocthermSensorTemp2);
|
|
||||||
|
|
||||||
info.tempCpu = TranslateSocthermTemp(static_cast<u16>(temp1 >> 16));
|
printf("[hoc-bpmpfw]: PANIC\n");
|
||||||
info.tempGpu = TranslateSocthermTemp(static_cast<u16>(temp1));
|
/* Clear the magic so sysmodule knows of a panic */
|
||||||
info.tempMem = TranslateSocthermTemp(static_cast<u16>(temp2 >> 16));
|
info.magic = 0x0;
|
||||||
info.tempPllx = TranslateSocthermTemp(static_cast<u16>(temp2));
|
|
||||||
|
|
||||||
usleep(250000); // 250ms
|
/* Give a panic code */
|
||||||
}
|
info.status = ~0;
|
||||||
|
for(;;)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
@@ -29,21 +29,28 @@ constexpr u32 FlowCtlrBase = 0x60007000;
|
|||||||
constexpr u32 FlowCtlrHaltCopEvents = 0x004;
|
constexpr u32 FlowCtlrHaltCopEvents = 0x004;
|
||||||
|
|
||||||
constexpr u32 HaltModeWaitEvent = (2u << 29);
|
constexpr u32 HaltModeWaitEvent = (2u << 29);
|
||||||
constexpr u32 HaltUsec = (0u << 24);
|
constexpr u32 HaltMsec = (1u << 24);
|
||||||
|
constexpr u32 HaltUsec = (1u << 25);
|
||||||
|
constexpr u32 HaltMaxCnt = 0xFF;
|
||||||
|
|
||||||
[[maybe_unused]] inline void FlowCtlrHaltUsec(u32 usec) {
|
[[maybe_unused]] inline void usleep(u32 us) {
|
||||||
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltUsec | (usec & 0xFFFFFFu);
|
while (us) {
|
||||||
|
const u32 delay = (us > HaltMaxCnt) ? HaltMaxCnt : us;
|
||||||
|
us -= delay;
|
||||||
|
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltUsec | delay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[[maybe_unused]] inline void msleep(u32 ms) {
|
||||||
|
while (ms) {
|
||||||
|
const u32 delay = (ms > HaltMaxCnt) ? HaltMaxCnt : ms;
|
||||||
|
ms -= delay;
|
||||||
|
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltMsec | delay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr u32 TmrBase = 0x60005000;
|
constexpr u32 TmrBase = 0x60005000;
|
||||||
constexpr u32 TimerUsCntr1Us = 0x10;
|
constexpr u32 TimerUsCntr1Us = 0x10;
|
||||||
|
|
||||||
[[maybe_unused]] inline void usleep(u32 us) {
|
|
||||||
const u32 start = MMIO32(TmrBase + TimerUsCntr1Us);
|
|
||||||
while ((MMIO32(TmrBase + TimerUsCntr1Us) - start) <= us)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 UartBBase = 0x70006040;
|
constexpr u32 UartBBase = 0x70006040;
|
||||||
constexpr u32 UartThr = 0x00;
|
constexpr u32 UartThr = 0x00;
|
||||||
constexpr u32 UartLsr = 0x14;
|
constexpr u32 UartLsr = 0x14;
|
||||||
|
|||||||
Reference in new issue
Block a user