aboutsummaryrefslogtreecommitdiff
path: root/include/hw/sd/bcm2835_sdhost.h
blob: 751ba531d662f8c54bf1aa33d31efcb19b13e4d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Raspberry Pi (BCM2835) SD Host Controller
 *
 * Copyright (c) 2017 Antfield SAS
 *
 * Authors:
 *  Clement Deschamps <clement.deschamps@antfield.fr>
 *  Luc Michel <luc.michel@antfield.fr>
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */

#ifndef BCM2835_SDHOST_H
#define BCM2835_SDHOST_H

#include "hw/sysbus.h"
#include "hw/sd/sd.h"
#include "qom/object.h"

#define TYPE_BCM2835_SDHOST "bcm2835-sdhost"
typedef struct BCM2835SDHostState BCM2835SDHostState;
DECLARE_INSTANCE_CHECKER(BCM2835SDHostState, BCM2835_SDHOST,
                         TYPE_BCM2835_SDHOST)

#define BCM2835_SDHOST_FIFO_LEN 16

struct BCM2835SDHostState {
    SysBusDevice busdev;
    SDBus sdbus;
    MemoryRegion iomem;

    uint32_t cmd;
    uint32_t cmdarg;
    uint32_t status;
    uint32_t rsp[4];
    uint32_t config;
    uint32_t edm;
    uint32_t vdd;
    uint32_t hbct;
    uint32_t hblc;
    int32_t fifo_pos;
    int32_t fifo_len;
    uint32_t fifo[BCM2835_SDHOST_FIFO_LEN];
    uint32_t datacnt;

    qemu_irq irq;
};

#endif