clk: imx6sx: support suspend/resume with FastMix off

Add M4 related APIs for suspend/resume support, and make
MMDC P1 IPG clock always ON, as it is required during resume
with FastMix OFF.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: update to CLK HW APIs and add FIXME]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
This commit is contained in:
Anson Huang 2019-04-18 11:24:02 +08:00 committed by Dong Aisheng
parent 2be5e06f51
commit cc95063346
3 changed files with 48 additions and 0 deletions

View File

@ -14,6 +14,8 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/types.h>
#include <soc/imx/gpc.h>
#include <soc/imx/src.h>
#include "clk.h"
@ -123,6 +125,39 @@ static const int uart_clk_ids[] __initconst = {
static struct clk **uart_clks[ARRAY_SIZE(uart_clk_ids) + 1] __initdata;
/*
* As IMX6SX_CLK_M4_PRE_SEL is NOT a glitchless MUX, so when
* M4 is trying to change its clk parent, need to ask A9 to
* help do it, and M4 must be hold in wfi. To avoid glitch
* occur, need to gate M4 clk first before switching its parent.
*/
void imx6sx_set_m4_highfreq(bool high_freq)
{
static struct clk *m4_high_freq_sel;
imx_gpc_hold_m4_in_sleep();
clk_disable_unprepare(hws[IMX6SX_CLK_M4]->clk);
clk_set_parent(hws[IMX6SX_CLK_M4_SEL]->clk,
hws[IMX6SX_CLK_LDB_DI0]->clk);
if (high_freq) {
/* FIXME: m4_high_freq_sel possible used without intialization? */
clk_set_parent(hws[IMX6SX_CLK_M4_PRE_SEL]->clk,
m4_high_freq_sel);
} else {
m4_high_freq_sel = clk_get_parent(hws[IMX6SX_CLK_M4_PRE_SEL]->clk);
clk_set_parent(hws[IMX6SX_CLK_M4_PRE_SEL]->clk,
hws[IMX6SX_CLK_OSC]->clk);
}
clk_set_parent(hws[IMX6SX_CLK_M4_SEL]->clk,
hws[IMX6SX_CLK_M4_PRE_SEL]->clk);
clk_prepare_enable(hws[IMX6SX_CLK_M4]->clk);
imx_gpc_release_m4_in_sleep();
}
static void __init imx6sx_clocks_init(struct device_node *ccm_node)
{
struct device_node *np;

7
include/soc/imx/gpc.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef __SOC_IMX_GPC_H
#define __SOC_IMX_GPC_H
void imx_gpc_hold_m4_in_sleep(void);
void imx_gpc_release_m4_in_sleep(void);
#endif /* __SOC_IMX_GPC_H */

6
include/soc/imx/src.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __SOC_IMX_SRC_H
#define __SOC_IMX_SRC_H
bool imx_src_is_m4_enabled(void);
#endif /* __SOC_IMX_SRC_H */