From a4ce50ffd52173d2f521d410e67f0a1b4e940098 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 17 Dec 2018 16:18:27 -0800 Subject: [PATCH] warmboot: add through dpd disable --- exosphere/lp0fw/src/car.h | 4 +++- exosphere/lp0fw/src/cluster.c | 11 +++++++++++ exosphere/lp0fw/src/cluster.h | 6 ++++++ exosphere/lp0fw/src/pmc.h | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/exosphere/lp0fw/src/car.h b/exosphere/lp0fw/src/car.h index bc08731d7..9174b4598 100644 --- a/exosphere/lp0fw/src/car.h +++ b/exosphere/lp0fw/src/car.h @@ -25,7 +25,7 @@ #define CLK_RST_CONTROLLER_MISC_CLK_ENB_0 MAKE_CAR_REG(0x048) #define CLK_RST_CONTROLLER_OSC_CTRL_0 MAKE_CAR_REG(0x050) -#define CLK_RST_CONTROLLER_RST_DEVICES_H_0 MAKE_CAR_REG(0x008) +#define CLK_RST_CONTROLLER_PLLX_BASE_0 MAKE_CAR_REG(0x0E0) #define CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRD_0 MAKE_CAR_REG(0x3A4) #define CLK_RST_CONTROLLER_RST_CPUG_CMPLX_SET_0 MAKE_CAR_REG(0x450) #define CLK_RST_CONTROLLER_RST_CPUG_CMPLX_CLR_0 MAKE_CAR_REG(0x454) @@ -42,6 +42,8 @@ #define CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRD_0 MAKE_CAR_REG(0x3A4) #define CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRE_0 MAKE_CAR_REG(0x554) +#define CLK_RST_CONTROLLER_RST_DEVICES_H_0 MAKE_CAR_REG(0x008) + #define CLK_RST_CONTROLLER_SPARE_REG0_0 MAKE_CAR_REG(0x55C) #define CLK_RST_CONTROLLER_RST_DEV_U_SET_0 MAKE_CAR_REG(0x310) diff --git a/exosphere/lp0fw/src/cluster.c b/exosphere/lp0fw/src/cluster.c index daa5c6d84..26b1bda0b 100644 --- a/exosphere/lp0fw/src/cluster.c +++ b/exosphere/lp0fw/src/cluster.c @@ -50,6 +50,17 @@ void cluster_initialize_cpu(void) { timer_wait(2); CLK_RST_CONTROLLER_RST_DEV_V_CLR_0 = 0x8; + /* Set MSELECT WRAP_TO_SLAVE_INCR[0-2], clear ERR_RESP_EN_SLAVE[1-2]. */ + MSELECT_CONFIG_0 = (MSELECT_CONFIG_0 & 0xFCFFFFFF) | 0x38000000; + + /* Clear PLLX_ENABLE. */ + CLK_RST_CONTROLLER_PLLX_BASE_0 &= 0xBFFFFFFF; + + /* Clear PMC scratch 190, disable PMC DPD then wait 10 us. */ + APBDEV_PMC_SCRATCH190_0 &= 0xFFFFFFFE; + APBDEV_PMC_DPD_SAMPLE_0 = 0; + timer_wait(10); + /* TODO: This function is enormous */ } diff --git a/exosphere/lp0fw/src/cluster.h b/exosphere/lp0fw/src/cluster.h index 0551deb3f..5daf26f09 100644 --- a/exosphere/lp0fw/src/cluster.h +++ b/exosphere/lp0fw/src/cluster.h @@ -18,6 +18,12 @@ #ifndef EXOSPHERE_WARMBOOT_BIN_CLUSTER_H #define EXOSPHERE_WARMBOOT_BIN_CLUSTER_H +#include + +#include "utils.h" + +#define MSELECT_CONFIG_0 MAKE_REG32(0x50060000) + void cluster_initialize_cpu(void); void cluster_power_on_cpu(void); diff --git a/exosphere/lp0fw/src/pmc.h b/exosphere/lp0fw/src/pmc.h index 17a821903..08cd1f3b8 100644 --- a/exosphere/lp0fw/src/pmc.h +++ b/exosphere/lp0fw/src/pmc.h @@ -36,6 +36,7 @@ #define APBDEV_PMC_SCRATCH12_0 MAKE_PMC_REG(0x080) #define APBDEV_PMC_SCRATCH13_0 MAKE_PMC_REG(0x084) #define APBDEV_PMC_SCRATCH18_0 MAKE_PMC_REG(0x098) +#define APBDEV_PMC_SCRATCH190_0 MAKE_PMC_REG(0x818) #define APBDEV_PMC_OSC_EDPD_OVER_0 MAKE_PMC_REG(0x1A4)