17e83c9ddSNiek Linnenbank /* 27e83c9ddSNiek Linnenbank * Allwinner H3 System Control emulation 37e83c9ddSNiek Linnenbank * 47e83c9ddSNiek Linnenbank * Copyright (C) 2019 Niek Linnenbank <nieklinnenbank@gmail.com> 57e83c9ddSNiek Linnenbank * 67e83c9ddSNiek Linnenbank * This program is free software: you can redistribute it and/or modify 77e83c9ddSNiek Linnenbank * it under the terms of the GNU General Public License as published by 87e83c9ddSNiek Linnenbank * the Free Software Foundation, either version 2 of the License, or 97e83c9ddSNiek Linnenbank * (at your option) any later version. 107e83c9ddSNiek Linnenbank * 117e83c9ddSNiek Linnenbank * This program is distributed in the hope that it will be useful, 127e83c9ddSNiek Linnenbank * but WITHOUT ANY WARRANTY; without even the implied warranty of 137e83c9ddSNiek Linnenbank * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 147e83c9ddSNiek Linnenbank * GNU General Public License for more details. 157e83c9ddSNiek Linnenbank * 167e83c9ddSNiek Linnenbank * You should have received a copy of the GNU General Public License 177e83c9ddSNiek Linnenbank * along with this program. If not, see <http://www.gnu.org/licenses/>. 187e83c9ddSNiek Linnenbank */ 197e83c9ddSNiek Linnenbank 207e83c9ddSNiek Linnenbank #ifndef HW_MISC_ALLWINNER_H3_SYSCTRL_H 217e83c9ddSNiek Linnenbank #define HW_MISC_ALLWINNER_H3_SYSCTRL_H 227e83c9ddSNiek Linnenbank 237e83c9ddSNiek Linnenbank #include "qom/object.h" 247e83c9ddSNiek Linnenbank #include "hw/sysbus.h" 257e83c9ddSNiek Linnenbank 267e83c9ddSNiek Linnenbank /** 277e83c9ddSNiek Linnenbank * @name Constants 287e83c9ddSNiek Linnenbank * @{ 297e83c9ddSNiek Linnenbank */ 307e83c9ddSNiek Linnenbank 317e83c9ddSNiek Linnenbank /** Highest register address used by System Control device */ 327e83c9ddSNiek Linnenbank #define AW_H3_SYSCTRL_REGS_MAXADDR (0x30) 337e83c9ddSNiek Linnenbank 347e83c9ddSNiek Linnenbank /** Total number of known registers */ 357e83c9ddSNiek Linnenbank #define AW_H3_SYSCTRL_REGS_NUM ((AW_H3_SYSCTRL_REGS_MAXADDR / \ 367e83c9ddSNiek Linnenbank sizeof(uint32_t)) + 1) 377e83c9ddSNiek Linnenbank 387e83c9ddSNiek Linnenbank /** @} */ 397e83c9ddSNiek Linnenbank 407e83c9ddSNiek Linnenbank /** 417e83c9ddSNiek Linnenbank * @name Object model 427e83c9ddSNiek Linnenbank * @{ 437e83c9ddSNiek Linnenbank */ 447e83c9ddSNiek Linnenbank 457e83c9ddSNiek Linnenbank #define TYPE_AW_H3_SYSCTRL "allwinner-h3-sysctrl" 46*8063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(AwH3SysCtrlState, AW_H3_SYSCTRL) 477e83c9ddSNiek Linnenbank 487e83c9ddSNiek Linnenbank /** @} */ 497e83c9ddSNiek Linnenbank 507e83c9ddSNiek Linnenbank /** 517e83c9ddSNiek Linnenbank * Allwinner H3 System Control object instance state 527e83c9ddSNiek Linnenbank */ 53db1015e9SEduardo Habkost struct AwH3SysCtrlState { 547e83c9ddSNiek Linnenbank /*< private >*/ 557e83c9ddSNiek Linnenbank SysBusDevice parent_obj; 567e83c9ddSNiek Linnenbank /*< public >*/ 577e83c9ddSNiek Linnenbank 587e83c9ddSNiek Linnenbank /** Maps I/O registers in physical memory */ 597e83c9ddSNiek Linnenbank MemoryRegion iomem; 607e83c9ddSNiek Linnenbank 617e83c9ddSNiek Linnenbank /** Array of hardware registers */ 627e83c9ddSNiek Linnenbank uint32_t regs[AW_H3_SYSCTRL_REGS_NUM]; 637e83c9ddSNiek Linnenbank 64db1015e9SEduardo Habkost }; 657e83c9ddSNiek Linnenbank 667e83c9ddSNiek Linnenbank #endif /* HW_MISC_ALLWINNER_H3_SYSCTRL_H */ 67