xref: /rk3399_ARM-atf/plat/mediatek/drivers/pmic/mt6359p/mt6359p_psc.c (revision d8fdff38b544b79c4f0b757e3b3c82ce9c8a2f9e)
1 /*
2  * Copyright (c) 2025, Mediatek Inc. All rights reserved.
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #include <errno.h>
7 
8 #include <common/debug.h>
9 #include <drivers/pmic/pmic_psc.h>
10 #include <lib/mtk_init/mtk_init.h>
11 #include <pmic_wrap_init_common.h>
12 
13 #include "registers.h"
14 
15 static const struct pmic_psc_reg mt6359p_psc_regs[] = {
16 	PMIC_PSC_REG(RG_PWRHOLD, MT6359P_PPCCTL0, 0),
17 	PMIC_PSC_REG(RG_CRST, MT6359P_PPCCTL1, 0),
18 	PMIC_PSC_REG(RG_SMART_RST_SDN_EN, MT6359P_STRUP_CON12, 9),
19 	PMIC_PSC_REG(RG_SMART_RST_MODE, MT6359P_STRUP_CON12, 10),
20 };
21 
22 static const struct pmic_psc_config mt6359p_psc_config = {
23 	.read_field = pwrap_read_field,
24 	.write_field = pwrap_write_field,
25 	.regs = mt6359p_psc_regs,
26 	.reg_size = ARRAY_SIZE(mt6359p_psc_regs),
27 };
28 
29 static int mt6359p_psc_init(void)
30 {
31 	return pmic_psc_register(&mt6359p_psc_config);
32 }
33 
34 MTK_PLAT_SETUP_0_INIT(mt6359p_psc_init);
35