warmboot: add flow_perform_ram_repair

This commit is contained in:
Michael Scire 2018-12-17 17:13:24 -08:00
parent 72594c6783
commit 7a704827f1
3 changed files with 40 additions and 1 deletions

View file

@ -23,6 +23,7 @@
#include "pmc.h"
#include "misc.h"
#include "i2c.h"
#include "flow.h"
#include "sysreg.h"
static void cluster_pmc_enable_partition(uint32_t mask, uint32_t toggle) {
@ -129,6 +130,9 @@ void cluster_initialize_cpu(void) {
/* Disable clock to CL_DVFS */
CLK_RST_CONTROLLER_CLK_ENB_W_CLR_0 = 0x08000000;
/* Perform RAM repair if necessary. */
flow_perform_ram_repair();
/* TODO: This function is enormous */
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2018 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include "utils.h"
#include "flow.h"
void flow_perform_ram_repair(void) {
/* Perform repair only if not active cluster. */
if (!(FLOW_CTLR_BPMP_CLUSTER_CONTROL_0 & 1)) {
/* Set REQ, to begin RAM repair. */
FLOW_CTLR_RAM_REPAIR_0 = 1;
/* Wait for STS to say RAM repair has completed. */
while (!(FLOW_CTLR_RAM_REPAIR_0 & 2)) { }
}
}

View file

@ -26,6 +26,10 @@
#define MAKE_FLOW_REG(ofs) MAKE_REG32(FLOW_BASE + ofs)
#define FLOW_CTLR_HALT_COP_EVENTS_0 MAKE_FLOW_REG(0x004)
#define FLOW_CTLR_HALT_COP_EVENTS_0 MAKE_FLOW_REG(0x004)
#define FLOW_CTLR_RAM_REPAIR_0 MAKE_FLOW_REG(0x040)
#define FLOW_CTLR_BPMP_CLUSTER_CONTROL_0 MAKE_FLOW_REG(0x098)
void flow_perform_ram_repair(void);
#endif