Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / misc / sifive_e_aon.h
blob2ae1c4139ca35dfb6c8558ee9fbc726efc972728
1 /*
2 * SiFive HiFive1 AON (Always On Domain) interface.
4 * Copyright (c) 2022 SiFive, Inc. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2 or later, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef HW_SIFIVE_AON_H
20 #define HW_SIFIVE_AON_H
22 #include "hw/sysbus.h"
23 #include "qom/object.h"
25 #define TYPE_SIFIVE_E_AON "riscv.sifive.e.aon"
26 OBJECT_DECLARE_SIMPLE_TYPE(SiFiveEAONState, SIFIVE_E_AON)
28 #define SIFIVE_E_AON_WDOGKEY (0x51F15E)
29 #define SIFIVE_E_AON_WDOGFEED (0xD09F00D)
30 #define SIFIVE_E_LFCLK_DEFAULT_FREQ (32768)
32 enum {
33 SIFIVE_E_AON_WDT = 0x0,
34 SIFIVE_E_AON_RTC = 0x40,
35 SIFIVE_E_AON_LFROSC = 0x70,
36 SIFIVE_E_AON_BACKUP = 0x80,
37 SIFIVE_E_AON_PMU = 0x100,
38 SIFIVE_E_AON_MAX = 0x150
41 struct SiFiveEAONState {
42 /*< private >*/
43 SysBusDevice parent_obj;
45 /*< public >*/
46 MemoryRegion mmio;
48 /*< watchdog timer >*/
49 QEMUTimer *wdog_timer;
50 qemu_irq wdog_irq;
51 uint64_t wdog_restart_time;
52 uint64_t wdogclk_freq;
54 uint32_t wdogcfg;
55 uint16_t wdogcmp0;
56 uint32_t wdogcount;
57 uint8_t wdogunlock;
60 #endif