xref: /qemu/include/hw/gpio/bcm2838_gpio.h (revision 23c82c1daf30b3ed8d988f3f1d7fbb0557059ac6)
1 /*
2  * Raspberry Pi (BCM2838) GPIO Controller
3  * This implementation is based on bcm2835_gpio (hw/gpio/bcm2835_gpio.c)
4  *
5  * Copyright (c) 2022 Auriga LLC
6  *
7  * Authors:
8  *  Lotosh, Aleksey <aleksey.lotosh@auriga.com>
9  *
10  * This work is licensed under the terms of the GNU GPL, version 2 or later.
11  * See the COPYING file in the top-level directory.
12  */
13 
14 #ifndef BCM2838_GPIO_H
15 #define BCM2838_GPIO_H
16 
17 #include "hw/sysbus.h"
18 #include "qom/object.h"
19 
20 #define TYPE_BCM2838_GPIO "bcm2838-gpio"
21 OBJECT_DECLARE_SIMPLE_TYPE(BCM2838GpioState, BCM2838_GPIO)
22 
23 #define BCM2838_GPIO_REGS_SIZE 0x1000
24 #define BCM2838_GPIO_NUM       58
25 #define GPIO_PUP_PDN_CNTRL_NUM 4
26 
27 struct BCM2838GpioState {
28     SysBusDevice parent_obj;
29 
30     MemoryRegion iomem;
31 
32 
33     uint8_t fsel[BCM2838_GPIO_NUM];
34     uint32_t lev0, lev1;
35     uint8_t sd_fsel;
36     qemu_irq out[BCM2838_GPIO_NUM];
37     uint32_t pup_cntrl_reg[GPIO_PUP_PDN_CNTRL_NUM];
38 };
39 
40 #endif
41