xref: /openbmc/qemu/include/hw/sd/bcm2835_sdhost.h (revision 8fa3b702)
1 /*
2  * Raspberry Pi (BCM2835) SD Host Controller
3  *
4  * Copyright (c) 2017 Antfield SAS
5  *
6  * Authors:
7  *  Clement Deschamps <clement.deschamps@antfield.fr>
8  *  Luc Michel <luc.michel@antfield.fr>
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 BCM2835_SDHOST_H
15 #define BCM2835_SDHOST_H
16 
17 #include "hw/sysbus.h"
18 #include "hw/sd/sd.h"
19 #include "qom/object.h"
20 
21 #define TYPE_BCM2835_SDHOST "bcm2835-sdhost"
22 typedef struct BCM2835SDHostState BCM2835SDHostState;
23 DECLARE_INSTANCE_CHECKER(BCM2835SDHostState, BCM2835_SDHOST,
24                          TYPE_BCM2835_SDHOST)
25 
26 #define BCM2835_SDHOST_FIFO_LEN 16
27 
28 struct BCM2835SDHostState {
29     SysBusDevice busdev;
30     SDBus sdbus;
31     MemoryRegion iomem;
32 
33     uint32_t cmd;
34     uint32_t cmdarg;
35     uint32_t status;
36     uint32_t rsp[4];
37     uint32_t config;
38     uint32_t edm;
39     uint32_t vdd;
40     uint32_t hbct;
41     uint32_t hblc;
42     int32_t fifo_pos;
43     int32_t fifo_len;
44     uint32_t fifo[BCM2835_SDHOST_FIFO_LEN];
45     uint32_t datacnt;
46 
47     qemu_irq irq;
48 };
49 
50 #endif
51