Skip to content

Commit 074b601

Browse files
committed
[ot] hw/opentitan: ot_spi_device: rename ot_spi_device_release_cs
Function name was confusing. It may also be called when no CS change occurs. Signed-off-by: Emmanuel Blot <[email protected]> (cherry picked from commit 12c6a1a)
1 parent 04daaac commit 074b601

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

hw/opentitan/ot_spi_device.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,13 @@ static bool ot_spi_device_is_hw_read_command(const OtSPIDeviceState *s)
787787
}
788788
}
789789

790-
static void ot_spi_device_release_cs(OtSPIDeviceState *s)
790+
static void ot_spi_device_release(OtSPIDeviceState *s)
791791
{
792792
SpiDeviceFlash *f = &s->flash;
793793
SpiDeviceBus *bus = &s->bus;
794794

795+
trace_ot_spi_device_release();
796+
795797
BUS_CHANGE_STATE(bus, IDLE);
796798
bus->byte_count = 0;
797799

@@ -1988,7 +1990,7 @@ static void ot_spi_device_chr_receive(void *opaque, const uint8_t *buf,
19881990

19891991
if (!bus->byte_count) {
19901992
if (bus->release) {
1991-
ot_spi_device_release_cs(s);
1993+
ot_spi_device_release(s);
19921994
} else {
19931995
BUS_CHANGE_STATE(bus, IDLE);
19941996
}
@@ -2008,11 +2010,11 @@ static void ot_spi_device_chr_event_hander(void *opaque, QEMUChrEvent event)
20082010
return;
20092011
}
20102012

2011-
ot_spi_device_release_cs(s);
2013+
ot_spi_device_release(s);
20122014
}
20132015

20142016
if (event == CHR_EVENT_CLOSED) {
2015-
ot_spi_device_release_cs(s);
2017+
ot_spi_device_release(s);
20162018
}
20172019
}
20182020

@@ -2041,7 +2043,7 @@ static int ot_spi_device_chr_be_change(void *opaque)
20412043

20422044
fifo8_reset(&bus->chr_fifo);
20432045

2044-
ot_spi_device_release_cs(s);
2046+
ot_spi_device_release(s);
20452047

20462048
if (s->watch_tag > 0) {
20472049
g_source_remove(s->watch_tag);
@@ -2098,7 +2100,7 @@ static void ot_spi_device_reset(DeviceState *dev)
20982100
fifo8_reset(&f->cmd_fifo);
20992101
ot_fifo32_reset(&f->address_fifo);
21002102

2101-
ot_spi_device_release_cs(s);
2103+
ot_spi_device_release(s);
21022104
f->watermark = false;
21032105
f->new_cmd = false;
21042106
s->spi_regs[R_CONTROL] = 0x10u;

hw/opentitan/trace-events

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ ot_spi_device_io_spi_write_in(uint32_t addr, const char * regname, uint32_t val,
459459
ot_spi_device_set_irq(const char *name, unsigned irq, bool level) "%s [%u]: %u"
460460
ot_spi_device_io_tpm_read_out(uint32_t addr, const char * regname, uint32_t val, uint32_t pc) "addr=0x%02x (%s), val=0x%x, pc=0x%x"
461461
ot_spi_device_io_tpm_write_in(uint32_t addr, const char * regname, uint32_t val, uint32_t pc) "addr=0x%02x (%s), val=0x%x, pc=0x%x"
462+
ot_spi_device_release(void) ""
462463
ot_spi_device_update_last_read_addr(uint32_t addr) "0x%08x"
463464

464465
# ot_spi_host.c

0 commit comments

Comments
 (0)