SemiDrive SSDK Appication Program Interface PTG3.0
sdrv_power.h
Go to the documentation of this file.
1
9#ifndef SDRV_POWER_H_
10#define SDRV_POWER_H_
11
12#include <sdrv_common.h>
13#include <types.h>
14#include <regs_base.h>
15#include <part.h>
16#include "sdrv_smc.h"
17#include "sdrv_pmu.h"
18
19#if CONFIG_E3 || CONFIG_D3
20#define SDRV_SF_MODULE_CANFD1_MASK (0x1UL)
21#define SDRV_SF_MODULE_CANFD2_MASK (0x2UL)
22#define SDRV_SF_MODULE_CANFD3_4_MASK (0x4UL)
23#define SDRV_SF_MODULE_CANFD5_8_MASK (0x8UL)
24#define SDRV_SF_MODULE_CANFD9_16_MASK (0x10UL)
25#define SDRV_SF_MODULE_CANFD17_24_MASK (0x20UL)
26#define SDRV_SF_MODULE_XSPI1A_MASK (0x40UL)
27#define SDRV_SF_MODULE_XSPI1B_MASK (0x80UL)
28#define SDRV_SF_MODULE_XSPI2A_MASK (0x100UL)
29#define SDRV_SF_MODULE_XSPI2B_MASK (0x200UL)
30#define SDRV_SF_MODULE_DMA_MASK (0x400UL)
31#define SDRV_SF_MODULE_GAMA1_MASK (0x800UL)
32#define SDRV_SF_MODULE_GAMA2_MASK (0x1000UL)
33#define SDRV_SF_MODULE_ENET1_MASK (0x2000UL)
34#define SDRV_SF_MODULE_ENET2_MASK (0x4000UL)
35#define SDRV_SF_MODULE_VIC1_MASK (0x8000UL)
36#define SDRV_SF_MODULE_VIC2A_MASK (0x10000UL)
37#define SDRV_SF_MODULE_VIC2B_MASK (0x20000UL)
38#define SDRV_SF_MODULE_VIC3A_MASK (0x40000UL)
39#define SDRV_SF_MODULE_VIC3B_MASK (0x80000UL)
40#define SDRV_SF_MODULE_XSPI_SLV_MASK (0x100000UL)
41#define SDRV_SF_MODULE_MB_MASK (0x200000UL)
42#define SDRV_SF_MODULE_XTRG_MASK (0x400000UL)
43
44#define SDRV_SF_PD_MASK (0x1UL)
45#define SDRV_SP_PD_MASK (0x2UL)
46#define SDRV_SX_PD_MASK (0x4UL)
47#define SDRV_GAMA1_PD_MASK (0x8UL)
48#define SDRV_AP_DISP_PD_MASK (0x10UL)
49#endif /* #if CONFIG_E3 || CONFIG_D3 */
50
51#if CONFIG_E3L || CONFIG_D3L
52/* If SF_BOOT set power down in hib, Module reset below can't be mask:
53 CANFD16, CANFD21, CANFD3, CANFD4, CANFD5, CANFD6, CANFD7, CANFD23
54 XSPI1A, XSPI1B, DMA_RST0, DMA_RST1, ENET1, VIC1, XSPI_SLV, XTRG
55
56 If AP_MIX set power down in hib, Module reset below can't be mask:
57 SACI2, SEHC1, USB, SEIP
58*/
59#define SDRV_SF_MODULE_CANFD16_MASK (0x1UL)
60#define SDRV_SF_MODULE_CANFD21_MASK (0x2UL)
61#define SDRV_SF_MODULE_CANFD3_MASK (0x4UL)
62#define SDRV_SF_MODULE_CANFD4_MASK (0x8UL)
63#define SDRV_SF_MODULE_CANFD5_MASK (0x10UL)
64#define SDRV_SF_MODULE_CANFD6_MASK (0x20UL)
65#define SDRV_SF_MODULE_CANFD7_MASK (0x40UL)
66#define SDRV_SF_MODULE_CANFD23_MASK (0x80UL)
67#define SDRV_SF_MODULE_XSPI1A_MASK (0x100UL)
68#define SDRV_SF_MODULE_XSPI1B_MASK (0x200UL)
69#define SDRV_SF_MODULE_DMA_RST0_MASK (0x400UL)
70#define SDRV_SF_MODULE_DMA_RST1_MASK (0x800UL)
71#define SDRV_SF_MODULE_ENET1_MASK (0x1000UL)
72#define SDRV_SF_MODULE_VIC1_MASK (0x2000UL)
73#define SDRV_SF_MODULE_XSPI_SLV_MASK (0x4000UL)
74#define SDRV_SF_MODULE_XTRG_MASK (0x8000UL)
75#define SDRV_SF_MODULE_SACI2_MASK (0x10000UL)
76#define SDRV_SF_MODULE_SEHC1_MASK (0x20000UL)
77#define SDRV_SF_MODULE_USB_MASK (0x40000UL)
78#define SDRV_SF_MODULE_SEIP_MASK (0x80000UL)
79#define SDRV_SF_MODULE_CSLITE_MASK (0x100000UL)
80
81#define SDRV_SF_PD_MASK (0x1UL)
82#define SDRV_SF_BOOT_PD_MASK (0x2UL)
83#define SDRV_AP_MIX_PD_MASK (0x4UL)
84#endif /* #if CONFIG_E3L || CONFIG_D3L */
85
86#define SDRV_AP_MODULE_CSI_MASK (0x1UL)
87#define SDRV_AP_MODULE_DC_MASK (0x2UL)
88#define SDRV_AP_MODULE_G2D_MASK (0x4UL)
89#define SDRV_AP_MODULE_SDRAMC_MASK (0x8UL)
90#define SDRV_AP_MODULE_SACI1_MASK (0x10UL)
91#define SDRV_AP_MODULE_SACI2_MASK (0x20UL)
92#define SDRV_AP_MODULE_DMA_MASK (0x40UL)
93#define SDRV_AP_MODULE_SEHC1_MASK (0x80UL)
94#define SDRV_AP_MODULE_SEHC2_MASK (0x100UL)
95#define SDRV_AP_MODULE_USB_MASK (0x200UL)
96#define SDRV_AP_MODULE_SEIP_MASK (0x400UL)
97#define SDRV_AP_MODULE_LVDS_MASK (0x800UL)
98
99#define SDRV_PLL1_PD_MASK (0x1UL)
100#define SDRV_PLL2_PD_MASK (0x2UL)
101#define SDRV_PLL3_PD_MASK (0x4UL)
102#define SDRV_PLL4_PD_MASK (0x8UL)
103#define SDRV_PLL5_PD_MASK (0x10UL)
104#define SDRV_PLL_LVDS_PD_MASK (0x20UL)
105
106#define SDRV_PWR_CTRL0_PD_MASK (0x1UL)
107#define SDRV_PWR_CTRL1_PD_MASK (0x2UL)
108#define SDRV_PWR_CTRL2_PD_MASK (0x4UL)
109#define SDRV_PWR_CTRL3_PD_MASK (0x8UL)
110#define SDRV_PWR_ON0_PD_MASK (0x10UL)
111#define SDRV_PWR_ON1_PD_MASK (0x20UL)
112#define SDRV_PWR_ON2_PD_MASK (0x40UL)
113#define SDRV_PWR_ON3_PD_MASK (0x80UL)
114
115#define SDRV_IRAM1_PD_MASK (0x1UL)
116#define SDRV_IRAM2_PD_MASK (0x2UL)
117#define SDRV_IRAM3_PD_MASK (0x4UL)
118#define SDRV_IRAM4_PD_MASK (0x8UL)
119
132};
133
137typedef enum mcu_power {
150 MCU_POWER_END = 0xFFFFFFFF,
152
156typedef enum sdrv_wakeup_src {
159
162
171
172#ifdef APB_UART9_BASE
173 SDRV_WAKEUP_UART9,
174 SDRV_WAKEUP_UART10,
175 SDRV_WAKEUP_UART11,
176 SDRV_WAKEUP_UART12,
177#endif
178
179#ifdef APB_UART13_BASE
180 SDRV_WAKEUP_UART13,
181 SDRV_WAKEUP_UART14,
182 SDRV_WAKEUP_UART15,
183 SDRV_WAKEUP_UART16,
184#endif
185
186#ifdef APB_CANFD1_BASE
187 SDRV_WAKEUP_CANFD1,
188 SDRV_WAKEUP_CANFD2,
189#endif
190
191#ifdef APB_CANFD3_BASE
192 SDRV_WAKEUP_CANFD3,
193 SDRV_WAKEUP_CANFD4,
194#endif
195
196#ifdef APB_CANFD5_BASE
197 SDRV_WAKEUP_CANFD5,
198 SDRV_WAKEUP_CANFD6,
199#endif
200
201#ifdef APB_CANFD7_BASE
202 SDRV_WAKEUP_CANFD7,
203#endif
204
205#ifdef APB_CANFD8_BASE
206 SDRV_WAKEUP_CANFD8,
207 SDRV_WAKEUP_CANFD9,
208 SDRV_WAKEUP_CANFD10,
209 SDRV_WAKEUP_CANFD11,
210 SDRV_WAKEUP_CANFD12,
211 SDRV_WAKEUP_CANFD13,
212 SDRV_WAKEUP_CANFD14,
213 SDRV_WAKEUP_CANFD15,
214#endif
215
216#ifdef APB_CANFD16_BASE
217 SDRV_WAKEUP_CANFD16,
218#endif
219
220#ifdef APB_CANFD17_BASE
221 SDRV_WAKEUP_CANFD17,
222 SDRV_WAKEUP_CANFD18,
223 SDRV_WAKEUP_CANFD19,
224 SDRV_WAKEUP_CANFD20,
225#endif
226
227#ifdef APB_CANFD21_BASE
228 SDRV_WAKEUP_CANFD21,
229#endif
230
231#ifdef APB_CANFD22_BASE
232 SDRV_WAKEUP_CANFD22,
233#endif
234
235#ifdef APB_CANFD23_BASE
236 SDRV_WAKEUP_CANFD23,
237#endif
238
239#ifdef APB_CANFD24_BASE
240 SDRV_WAKEUP_CANFD24,
241#endif
242
243 SDRV_WAKEUP_END = 0x7FFFFFFFUL,
245
249typedef enum sdrv_power_mode {
255
263
279
283typedef enum sdrv_iram {
289
293typedef enum sdrv_clock_mode {
298
302typedef struct sdrv_power_analog {
303 bool vd_sf_pd;
305 bool rc24m_pd;
310 bool vd_ap_pd;
318
330 uint32_t pll_pd_mask;
335
347 uint32_t pll_pd_mask;
350 uint32_t core_pd_mask;
352 uint32_t iram_pd_mask;
363
377
391
402
413
422
429
440 sdrv_power_dcdc_reg_e dcdc_reg, uint8_t cfg_val);
441
442#endif /* SDRV_POWER_H_ */
SemiDrive driver common header file.
@ SDRV_STATUS_GROUP_POWER
Definition: sdrv_common.h:51
int32_t status_t
Type used for all status and error return values.
Definition: sdrv_common.h:82
#define SDRV_ERROR_STATUS(group, code)
Construct a status code value from a group and code number. All the error statuses are negetive numbe...
Definition: sdrv_common.h:17
SemiDrive PMU header file.
status_t sdrv_power_clock_set_mode(sdrv_clock_mode_e mode)
Set clock mode for core and bus.
enum sdrv_wakeup_src sdrv_wakeup_src_e
Definition for wakeup source.
enum sdrv_iram sdrv_iram_e
Definition for iram.
status_t sdrv_power_set_mode(sdrv_power_mode_e mode)
Set soc to specific power mode.
struct sdrv_power_analog sdrv_power_analog_t
Definition for soc internal analog part power control.
enum mcu_power mcu_power_e
Definition for MCU power switch and IRAMC power.
sdrv_wakeup_src
Definition for wakeup source.
Definition: sdrv_power.h:156
@ SDRV_WAKEUP_UART4
Definition: sdrv_power.h:166
@ SDRV_WAKEUP_UART3
Definition: sdrv_power.h:165
@ SDRV_WAKEUP_RTC2
Definition: sdrv_power.h:161
@ SDRV_WAKEUP_UART1
Definition: sdrv_power.h:163
@ SDRV_WAKEUP_UART7
Definition: sdrv_power.h:169
@ SDRV_WAKEUP_UART6
Definition: sdrv_power.h:168
@ SDRV_WAKEUP_UART5
Definition: sdrv_power.h:167
@ SDRV_WAKEUP_RTC1
Definition: sdrv_power.h:160
@ SDRV_WAKEUP_GPIO_AP
Definition: sdrv_power.h:158
@ SDRV_WAKEUP_UART2
Definition: sdrv_power.h:164
@ SDRV_WAKEUP_END
Definition: sdrv_power.h:243
@ SDRV_WAKEUP_UART8
Definition: sdrv_power.h:170
@ SDRV_WAKEUP_GPIO_SF
Definition: sdrv_power.h:157
enum sdrv_clock_mode sdrv_clock_mode_e
Definition for core clock mode.
status_t sdrv_power_usb_power_down(void)
USB phy power down.
struct sdrv_hibernate_mode_config sdrv_hibernate_mode_config_t
Definition for hibernate mode config.
struct sdrv_sleep_mode_config sdrv_sleep_mode_config_t
Definition for sleep mode config.
status_t sdrv_power_init(sdrv_sleep_mode_config_t *sleep_cfg, sdrv_hibernate_mode_config_t *hib_cfg)
Initialize clock/reset/power config under sleep and hibernate mode.
sdrv_power_dcdc_mode
Definition for DCDC work mode.
Definition: sdrv_power.h:259
@ DCDC_HP_MODE
Definition: sdrv_power.h:260
@ DCDC_LP_MODE
Definition: sdrv_power.h:261
status_t sdrv_power_dcdc_config(paddr_t dcdc_base, sdrv_power_dcdc_mode_e mode, sdrv_power_dcdc_reg_e dcdc_reg, uint8_t cfg_val)
Config DCDC REG0~8.
sdrv_iram
Definition for iram.
Definition: sdrv_power.h:283
@ SDRV_IRAM1
Definition: sdrv_power.h:284
@ SDRV_IRAM4
Definition: sdrv_power.h:287
@ SDRV_IRAM3
Definition: sdrv_power.h:286
@ SDRV_IRAM2
Definition: sdrv_power.h:285
sdrv_power_dcdc_reg
DCDC reg config, each reg has 8bit. REG0,7,8 are common config. REG1~6 are separate config for HP_MOD...
Definition: sdrv_power.h:268
@ DCDC_REG_8
Definition: sdrv_power.h:277
@ DCDC_REG_3
Definition: sdrv_power.h:272
@ DCDC_REG_0
Definition: sdrv_power.h:269
@ DCDC_REG_7
Definition: sdrv_power.h:276
@ DCDC_REG_6
Definition: sdrv_power.h:275
@ DCDC_REG_2
Definition: sdrv_power.h:271
@ DCDC_REG_1
Definition: sdrv_power.h:270
@ DCDC_REG_5
Definition: sdrv_power.h:274
@ DCDC_REG_4
Definition: sdrv_power.h:273
enum sdrv_power_dcdc_mode sdrv_power_dcdc_mode_e
Definition for DCDC work mode.
enum sdrv_power_dcdc_reg sdrv_power_dcdc_reg_e
DCDC reg config, each reg has 8bit. REG0,7,8 are common config. REG1~6 are separate config for HP_MOD...
sdrv_clock_mode
Definition for core clock mode.
Definition: sdrv_power.h:293
@ SDRV_CLOCK_NORMAL
Definition: sdrv_power.h:294
@ SDRV_CLOCK_LOW
Definition: sdrv_power.h:296
@ SDRV_CLOCK_MEDIUM
Definition: sdrv_power.h:295
sdrv_power_mode
Definition for system work mode.
Definition: sdrv_power.h:249
@ SDRV_HIBERNATE_MODE
Definition: sdrv_power.h:252
@ SDRV_SLEEP_MODE
Definition: sdrv_power.h:251
@ SDRV_RUN_MODE
Definition: sdrv_power.h:250
@ SDRV_RTC_MODE
Definition: sdrv_power.h:253
sdrv_power_error
Power status error code.
Definition: sdrv_power.h:123
@ SDRV_POWER_CLOCK_SET_FAILED
Definition: sdrv_power.h:128
@ SDRV_POWER_CONFIG_PARAMETER_WRONG
Definition: sdrv_power.h:124
@ SDRV_POWER_PMU_STATUS_ERROR
Definition: sdrv_power.h:130
@ SDRV_POWER_MODE_SET_WRONG
Definition: sdrv_power.h:125
@ SDRV_POWER_SMC_STATUS_ERROR
Definition: sdrv_power.h:131
@ SDRV_POWER_AP_STATUS_ERROR
Definition: sdrv_power.h:129
@ SDRV_POWER_WAKEUP_STATUS_ERROR
Definition: sdrv_power.h:126
@ SDRV_POWER_IRAM_REINIT_TIMEOUT
Definition: sdrv_power.h:127
status_t sdrv_power_rom_disable(void)
Set rom disable.
enum sdrv_power_mode sdrv_power_mode_e
Definition for system work mode.
status_t sdrv_power_iram_reinit(sdrv_iram_e iram)
Reinit specific iram.
mcu_power
Definition for MCU power switch and IRAMC power.
Definition: sdrv_power.h:137
@ MCU_POWER_IRAM4
Definition: sdrv_power.h:145
@ MCU_POWER_IRAM3
Definition: sdrv_power.h:144
@ MCU_POWER_SF
Definition: sdrv_power.h:138
@ MCU_POWER_IRAM1
Definition: sdrv_power.h:142
@ MCU_POWER_END
Definition: sdrv_power.h:150
@ MCU_POWER_ACMP1
Definition: sdrv_power.h:146
@ MCU_POWER_ACMP3
Definition: sdrv_power.h:148
@ MCU_POWER_SP
Definition: sdrv_power.h:139
@ MCU_POWER_ACMP4
Definition: sdrv_power.h:149
@ MCU_POWER_IRAM2
Definition: sdrv_power.h:143
@ MCU_POWER_GAMA
Definition: sdrv_power.h:141
@ MCU_POWER_SX
Definition: sdrv_power.h:140
@ MCU_POWER_ACMP2
Definition: sdrv_power.h:147
SemiDrive System work Mode Controller (SMC) driver header file.
Definition for hibernate mode config.
Definition: sdrv_power.h:339
uint32_t sf_module_reset_mask
Definition: sdrv_power.h:341
bool rc_24m_disable
Definition: sdrv_power.h:356
sdrv_wakeup_src_e * wakeup_srcs
Definition: sdrv_power.h:340
uint32_t ap_module_reset_mask
Definition: sdrv_power.h:344
sdrv_power_analog_t analog_power
Definition: sdrv_power.h:361
bool ap_domain_powered
Definition: sdrv_power.h:357
uint32_t pll_pd_mask
Definition: sdrv_power.h:347
uint32_t core_pd_mask
Definition: sdrv_power.h:350
uint32_t regulator_pd_mask
Definition: sdrv_power.h:358
uint32_t iram_pd_mask
Definition: sdrv_power.h:352
bool xtal_24m_disable
Definition: sdrv_power.h:355
Definition for soc internal analog part power control.
Definition: sdrv_power.h:302
bool bgr_sf_auto_en
Definition: sdrv_power.h:315
bool bgr_disp_pd
Definition: sdrv_power.h:313
bool por_ap_pd
Definition: sdrv_power.h:311
bool rc24m_pd
Definition: sdrv_power.h:305
bool por_sf_pd
Definition: sdrv_power.h:304
bool bgr_ana_pd
Definition: sdrv_power.h:307
bool vd_sf_pd
Definition: sdrv_power.h:303
bool vd_ap_pd
Definition: sdrv_power.h:310
bool bgr_ap_pd
Definition: sdrv_power.h:312
bool analog_cven33_pd
Definition: sdrv_power.h:309
bool bgr_ldo_auto_en
Definition: sdrv_power.h:316
bool bgr_ldo_pd
Definition: sdrv_power.h:308
bool bgr_sf_pd
Definition: sdrv_power.h:306
Definition for sleep mode config.
Definition: sdrv_power.h:322
uint32_t sf_module_reset_mask
Definition: sdrv_power.h:324
sdrv_wakeup_src_e * wakeup_srcs
Definition: sdrv_power.h:323
uint32_t ap_module_reset_mask
Definition: sdrv_power.h:327
uint32_t pll_pd_mask
Definition: sdrv_power.h:330
bool xtal_24m_disable
Definition: sdrv_power.h:333