Skip to content

Commit 70071a5

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 <eblot@rivosinc.com>
1 parent a246f25 commit 70071a5

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
@@ -1029,11 +1029,13 @@ static bool ot_spi_device_is_hw_read_command(const OtSPIDeviceState *s)
10291029
}
10301030
}
10311031

1032-
static void ot_spi_device_release_cs(OtSPIDeviceState *s)
1032+
static void ot_spi_device_release(OtSPIDeviceState *s)
10331033
{
10341034
SpiDeviceFlash *f = &s->flash;
10351035
SpiDeviceBus *bus = &s->bus;
10361036

1037+
trace_ot_spi_device_release();
1038+
10371039
BUS_CHANGE_STATE(bus, IDLE);
10381040
bus->byte_count = 0;
10391041

@@ -2469,7 +2471,7 @@ static void ot_spi_device_chr_receive(void *opaque, const uint8_t *buf,
24692471

24702472
if (!bus->byte_count) {
24712473
if (bus->release) {
2472-
ot_spi_device_release_cs(s);
2474+
ot_spi_device_release(s);
24732475
} else {
24742476
BUS_CHANGE_STATE(bus, IDLE);
24752477
}
@@ -2489,11 +2491,11 @@ static void ot_spi_device_chr_event_hander(void *opaque, QEMUChrEvent event)
24892491
return;
24902492
}
24912493

2492-
ot_spi_device_release_cs(s);
2494+
ot_spi_device_release(s);
24932495
}
24942496

24952497
if (event == CHR_EVENT_CLOSED) {
2496-
ot_spi_device_release_cs(s);
2498+
ot_spi_device_release(s);
24972499
}
24982500
}
24992501

@@ -2527,7 +2529,7 @@ static int ot_spi_device_chr_be_change(void *opaque)
25272529

25282530
fifo8_reset(&bus->chr_fifo);
25292531

2530-
ot_spi_device_release_cs(s);
2532+
ot_spi_device_release(s);
25312533

25322534
if (s->watch_tag > 0) {
25332535
g_source_remove(s->watch_tag);
@@ -2588,7 +2590,7 @@ static void ot_spi_device_reset(DeviceState *dev)
25882590
fifo8_reset(&f->cmd_fifo);
25892591
ot_fifo32_reset(&f->address_fifo);
25902592

2591-
ot_spi_device_release_cs(s);
2593+
ot_spi_device_release(s);
25922594
f->watermark = false;
25932595
f->new_cmd = false;
25942596
s->spi_regs[R_CONTROL] = 0x80000010u;

hw/opentitan/trace-events

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ ot_spi_device_io_spi_write_in(uint32_t addr, const char * regname, uint32_t val,
460460
ot_spi_device_set_irq(const char *name, unsigned irq, bool level) "%s [%u]: %u"
461461
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"
462462
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"
463+
ot_spi_device_release(void) ""
463464
ot_spi_device_update_last_read_addr(uint32_t addr) "0x%08x"
464465

465466
# ot_spi_host.c

0 commit comments

Comments
 (0)