mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
sdhci: implement CMD/DAT[] fields in the Present State register
[based on a patch from Alistair Francis <alistair.francis@xilinx.com> from qemu/xilinx tag xilinx-v2015.2] Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Message-Id: <20180208164818.7961-23-f4bug@amsat.org>
This commit is contained in:
parent
0034ebe6ee
commit
da34692234
6 changed files with 62 additions and 0 deletions
16
hw/sd/sd.c
16
hw/sd/sd.c
|
@ -126,8 +126,20 @@ struct SDState {
|
|||
BlockBackend *blk;
|
||||
|
||||
bool enable;
|
||||
uint8_t dat_lines;
|
||||
bool cmd_line;
|
||||
};
|
||||
|
||||
static uint8_t sd_get_dat_lines(SDState *sd)
|
||||
{
|
||||
return sd->enable ? sd->dat_lines : 0;
|
||||
}
|
||||
|
||||
static bool sd_get_cmd_line(SDState *sd)
|
||||
{
|
||||
return sd->enable ? sd->cmd_line : false;
|
||||
}
|
||||
|
||||
static void sd_set_voltage(SDState *sd, uint16_t millivolts)
|
||||
{
|
||||
switch (millivolts) {
|
||||
|
@ -457,6 +469,8 @@ static void sd_reset(DeviceState *dev)
|
|||
sd->blk_len = 0x200;
|
||||
sd->pwd_len = 0;
|
||||
sd->expecting_acmd = false;
|
||||
sd->dat_lines = 0xf;
|
||||
sd->cmd_line = true;
|
||||
sd->multi_blk_cnt = 0;
|
||||
}
|
||||
|
||||
|
@ -1939,6 +1953,8 @@ static void sd_class_init(ObjectClass *klass, void *data)
|
|||
dc->bus_type = TYPE_SD_BUS;
|
||||
|
||||
sc->set_voltage = sd_set_voltage;
|
||||
sc->get_dat_lines = sd_get_dat_lines;
|
||||
sc->get_cmd_line = sd_get_cmd_line;
|
||||
sc->do_command = sd_do_command;
|
||||
sc->write_data = sd_write_data;
|
||||
sc->read_data = sd_read_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue