mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 19:31:12 +00:00
mc: Simplify clock enable/reset
Additionally utilize the redirect flag.
This commit is contained in:
parent
cbbd427d3a
commit
df80339060
1 changed files with 11 additions and 7 deletions
18
bdk/mem/mc.c
18
bdk/mem/mc.c
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 naehrwert
|
* Copyright (c) 2018 naehrwert
|
||||||
* Copyright (c) 2018 CTCaer
|
* Copyright (c) 2018-2020 CTCaer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
#include <soc/clock.h>
|
#include <soc/clock.h>
|
||||||
#include <utils/util.h>
|
#include <utils/util.h>
|
||||||
|
|
||||||
|
//#define CONFIG_ENABLE_AHB_REDIRECT
|
||||||
|
|
||||||
void mc_config_tsec_carveout(u32 bom, u32 size1mb, bool lock)
|
void mc_config_tsec_carveout(u32 bom, u32 size1mb, bool lock)
|
||||||
{
|
{
|
||||||
MC(MC_SEC_CARVEOUT_BOM) = bom;
|
MC(MC_SEC_CARVEOUT_BOM) = bom;
|
||||||
|
@ -143,17 +145,19 @@ void mc_disable_ahb_redirect()
|
||||||
|
|
||||||
void mc_enable()
|
void mc_enable()
|
||||||
{
|
{
|
||||||
|
// Reset EMC source to PLLP.
|
||||||
CLOCK(CLK_RST_CONTROLLER_CLK_SOURCE_EMC) = (CLOCK(CLK_RST_CONTROLLER_CLK_SOURCE_EMC) & 0x1FFFFFFF) | 0x40000000;
|
CLOCK(CLK_RST_CONTROLLER_CLK_SOURCE_EMC) = (CLOCK(CLK_RST_CONTROLLER_CLK_SOURCE_EMC) & 0x1FFFFFFF) | 0x40000000;
|
||||||
// Enable memory clocks.
|
// Enable memory clocks.
|
||||||
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_H_SET) = (CLOCK(CLK_RST_CONTROLLER_CLK_ENB_H_SET) & ~BIT(CLK_H_EMC)) | BIT(CLK_H_EMC);
|
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_H_SET) = BIT(CLK_H_EMC);
|
||||||
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_H_SET) = (CLOCK(CLK_RST_CONTROLLER_CLK_ENB_H_SET) & ~BIT(CLK_H_MEM)) | BIT(CLK_H_MEM);
|
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_H_SET) = BIT(CLK_H_MEM);
|
||||||
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_X_SET) = (CLOCK(CLK_RST_CONTROLLER_CLK_ENB_X_SET) & ~BIT(CLK_X_EMC_DLL)) | BIT(CLK_X_EMC_DLL);
|
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_X_SET) = BIT(CLK_X_EMC_DLL);
|
||||||
// Clear clock resets for memory.
|
// Clear clock resets for memory.
|
||||||
CLOCK(CLK_RST_CONTROLLER_RST_DEV_H_CLR) = BIT(CLK_H_EMC) | BIT(CLK_H_MEM);
|
CLOCK(CLK_RST_CONTROLLER_RST_DEV_H_CLR) = BIT(CLK_H_EMC) | BIT(CLK_H_MEM);
|
||||||
usleep(5);
|
usleep(5);
|
||||||
|
|
||||||
//#ifdef CONFIG_ENABLE_AHB_REDIRECT
|
#ifdef CONFIG_ENABLE_AHB_REDIRECT
|
||||||
|
mc_enable_ahb_redirect();
|
||||||
|
#else
|
||||||
mc_disable_ahb_redirect();
|
mc_disable_ahb_redirect();
|
||||||
//mc_enable_ahb_redirect();
|
#endif
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue