xref: /qemu/include/hw/misc/allwinner-a10-ccm.h (revision 29b62a10)
1 /*
2  * Allwinner A10 Clock Control Module emulation
3  *
4  * Copyright (C) 2022 Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
5  *
6  *  This file is derived from Allwinner H3 CCU,
7  *  by Niek Linnenbank.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef HW_MISC_ALLWINNER_A10_CCM_H
24 #define HW_MISC_ALLWINNER_A10_CCM_H
25 
26 #include "qom/object.h"
27 #include "hw/sysbus.h"
28 
29 /**
30  * @name Constants
31  * @{
32  */
33 
34 /** Size of register I/O address space used by CCM device */
35 #define AW_A10_CCM_IOSIZE        (0x400)
36 
37 /** Total number of known registers */
38 #define AW_A10_CCM_REGS_NUM      (AW_A10_CCM_IOSIZE / sizeof(uint32_t))
39 
40 /** @} */
41 
42 /**
43  * @name Object model
44  * @{
45  */
46 
47 #define TYPE_AW_A10_CCM    "allwinner-a10-ccm"
48 OBJECT_DECLARE_SIMPLE_TYPE(AwA10ClockCtlState, AW_A10_CCM)
49 
50 /** @} */
51 
52 /**
53  * Allwinner A10 CCM object instance state.
54  */
55 struct AwA10ClockCtlState {
56     /*< private >*/
57     SysBusDevice parent_obj;
58     /*< public >*/
59 
60     /** Maps I/O registers in physical memory */
61     MemoryRegion iomem;
62 
63     /** Array of hardware registers */
64     uint32_t regs[AW_A10_CCM_REGS_NUM];
65 };
66 
67 #endif /* HW_MISC_ALLWINNER_H3_CCU_H */
68