xref: /openbmc/linux/arch/arm/mach-imx/pm-imx7ulp.c (revision 31af04cd)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016 Freescale Semiconductor, Inc.
4  * Copyright 2017-2018 NXP
5  *   Author: Dong Aisheng <aisheng.dong@nxp.com>
6  */
7 
8 #include <linux/io.h>
9 #include <linux/of.h>
10 #include <linux/of_address.h>
11 
12 #define SMC_PMCTRL		0x10
13 #define BP_PMCTRL_PSTOPO        16
14 #define PSTOPO_PSTOP3		0x3
15 
16 void __init imx7ulp_pm_init(void)
17 {
18 	struct device_node *np;
19 	void __iomem *smc1_base;
20 
21 	np = of_find_compatible_node(NULL, NULL, "fsl,imx7ulp-smc1");
22 	smc1_base = of_iomap(np, 0);
23 	WARN_ON(!smc1_base);
24 
25 	/* Partial Stop mode 3 with system/bus clock enabled */
26 	writel_relaxed(PSTOPO_PSTOP3 << BP_PMCTRL_PSTOPO,
27 		       smc1_base + SMC_PMCTRL);
28 	iounmap(smc1_base);
29 }
30