Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / gpio / bcm2838_gpio.h
blobf2a57a697f20dbf0d2cdeb937ceac86cd9e6a17e
1 /*
2 * Raspberry Pi (BCM2838) GPIO Controller
3 * This implementation is based on bcm2835_gpio (hw/gpio/bcm2835_gpio.c)
5 * Copyright (c) 2022 Auriga LLC
7 * Authors:
8 * Lotosh, Aleksey <aleksey.lotosh@auriga.com>
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.
14 #ifndef BCM2838_GPIO_H
15 #define BCM2838_GPIO_H
17 #include "hw/sd/sd.h"
18 #include "hw/sysbus.h"
19 #include "qom/object.h"
21 #define TYPE_BCM2838_GPIO "bcm2838-gpio"
22 OBJECT_DECLARE_SIMPLE_TYPE(BCM2838GpioState, BCM2838_GPIO)
24 #define BCM2838_GPIO_REGS_SIZE 0x1000
25 #define BCM2838_GPIO_NUM 58
26 #define GPIO_PUP_PDN_CNTRL_NUM 4
28 struct BCM2838GpioState {
29 SysBusDevice parent_obj;
31 MemoryRegion iomem;
33 /* SDBus selector */
34 SDBus sdbus;
35 SDBus *sdbus_sdhci;
36 SDBus *sdbus_sdhost;
38 uint8_t fsel[BCM2838_GPIO_NUM];
39 uint32_t lev0, lev1;
40 uint8_t sd_fsel;
41 qemu_irq out[BCM2838_GPIO_NUM];
42 uint32_t pup_cntrl_reg[GPIO_PUP_PDN_CNTRL_NUM];
45 #endif