huangcm
2025-09-01 53d8e046ac1bf2ebe94f671983e3d3be059df91a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
*********************************************************************************************************
*                                                AR100 SYSTEM
*                                     AR100 Software System Develop Kits
*
*
*                                    (c) Copyright 2018-2024, Luojie China
*                                             All Rights Reserved
*
* File    : ccu.h
* By      : LuoJie
* Version : v1.0
* Date    : 2018-04-13 14:54
* Descript: .
* Update  :auther      ver     notes
*          Luojie      1.0     Create this file.
*********************************************************************************************************
*/
#ifndef __CCU_H__
#define __CCU_H__
 
#include "ibase.h"
#include "driver.h"
 
typedef struct {
   arisc_device dev;
   u32 freq;
   const struct ccu_ops *ops;
}ccu_device;
 
#define CCU_HOSC_WILL_OFF_NOTIFY    0x1
#define CCU_HOSC_ON_READY_NOTIFY    0x2
 
#define CCU_APBS2_CLK_CLKCHG_REQ    0x11
#define CCU_ABPS2_CLK_CLKCHG_DONE    0x12
 
#define GET_PRCMDEVICE        0x1
#define CPUS_SET_FREQ        0x2
 
 
#define GET_CCMUDEVICE        0x1
 
 
s32 prcm_set_div(ccu_device *prcm, u32 reg, u32 div);
s32 prcm_set_src(ccu_device *prcm, u32 reg, u32 clk);
s32 prcm_get_freq(ccu_device *prcm, u32 reg);
s32 prcm_set_freq(ccu_device *prcm, u32 reg, u32 freq);
s32 prcm_reset_reg(ccu_device *prcm, u32 reg);
s32 prcm_reset_clk(ccu_device *prcm, u32 reg);
s32 prcm_reset_clk_mask(ccu_device *prcm, u32 reg);
 
s32 prcm_resume(arisc_device *prcm);
s32 prcm_suspend(arisc_device *prcm);
s32 prcm_suspend_early(ccu_device *dev);
s32 prcm_resume_early(ccu_device *dev);
 
s32 ccmu_init(void);
void ccmu_exit(void);
s32 prcm_init(void);
void prcm_exit(void);
 
ccu_device *get_prcm_device(void);
ccu_device *get_ccmu_device(void);
 
s32 ccmu_get_freq(ccu_device *ccmu, u32 reg);
s32 ccmu_set_freq(ccu_device *ccmu, u32 reg, u32 freq);
s32 ccmu_set_m_div(u32 reg, u32 mdiv);
s32 ccmu_get_m_div(u32 reg);
s32 ccmu_reset_module(ccu_device *ccmu, u32 reg);
s32 ccmu_disbale_clk(ccu_device *ccmu, u32 reg);
s32 ccmu_reset_clk(ccu_device *ccmu, u32 reg);
s32 ccmu_reset_clk_mask(ccu_device *ccmu, u32 reg);
s32 ccmu_suspend(arisc_device *ccmu);
s32 ccmu_resume(arisc_device *ccmu);
s32 ccmu_suspend_early(arisc_device *ccmu);
s32 ccmu_resume_early(arisc_device *ccmu);
 
 
s32 ccu_register(arisc_device *dev,void *parg);
s32 prcm_reg_mclk_cb(u32 mclk, __pNotifier_t pcb);
s32 prcm_unreg_mclk_cb(u32 mclk, __pNotifier_t pcb);
 
 
s32 ccu_24mhosc_reg_cb(__pNotifier_t pcb,void *parg);
s32 ccu_apbs2_reg_mclk_cb(__pNotifier_t pcb,void *parg);
s32 ccu_set_sclk_freq(u32 freq);
s32 ccu_get_sclk_freq(void);
 
#endif