Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lowRISC/qemu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0a35efdd26abcd9dc38ebf9fb487f20ed4d4313d
Choose a base ref
..
head repository: lowRISC/qemu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1063c4c5dc078a9f86d5e6e36688fff0b87e5c05
Choose a head ref
Showing with 18 additions and 9 deletions.
  1. +17 −7 hw/opentitan/ot_spi_host.c
  2. +1 −2 include/hw/opentitan/ot_spi_host.h
24 changes: 17 additions & 7 deletions hw/opentitan/ot_spi_host.c
Original file line number Diff line number Diff line change
@@ -1279,12 +1279,11 @@ static Property ot_spi_host_properties[] = {

static void ot_spi_host_reset_enter(Object *obj, ResetType type)
{
OtSPIHostClass *c = OT_SPI_HOST_GET_CLASS(obj);
OtSPIHostState *s = OT_SPI_HOST(obj);
(void)type;

if (!s->ot_id) {
s->ot_id =
g_strdup(object_get_canonical_path_component(OBJECT(s)->parent));
if (c->parent_phases.enter) {
c->parent_phases.enter(obj, type);
}

s->regs[R_INTR_STATE] = 0x00u;
@@ -1304,8 +1303,12 @@ static void ot_spi_host_reset_enter(Object *obj, ResetType type)

static void ot_spi_host_reset_exit(Object *obj, ResetType type)
{
OtSPIHostClass *c = OT_SPI_HOST_GET_CLASS(obj);
OtSPIHostState *s = OT_SPI_HOST(obj);
(void)type;

if (c->parent_phases.exit) {
c->parent_phases.exit(obj, type);
}

s->on_reset = false;
}
@@ -1317,6 +1320,11 @@ static void ot_spi_host_realize(DeviceState *dev, Error **errp)

g_assert(s->pclk);

if (!s->ot_id) {
s->ot_id =
g_strdup(object_get_canonical_path_component(OBJECT(s)->parent));
}

s->cs_lines = g_new0(qemu_irq, (size_t)s->num_cs);

qdev_init_gpio_out_named(DEVICE(s), s->cs_lines, SSI_GPIO_CS,
@@ -1366,8 +1374,10 @@ static void ot_spi_host_class_init(ObjectClass *klass, void *data)
dc->realize = ot_spi_host_realize;
device_class_set_props(dc, ot_spi_host_properties);
ResettableClass *rc = RESETTABLE_CLASS(klass);
rc->phases.enter = &ot_spi_host_reset_enter;
rc->phases.exit = &ot_spi_host_reset_exit;
OtSPIHostClass *sc = OT_SPI_HOST_CLASS(klass);
resettable_class_set_parent_phases(rc, &ot_spi_host_reset_enter, NULL,
&ot_spi_host_reset_exit,
&sc->parent_phases);
}

static const TypeInfo ot_spi_host_info = {
3 changes: 1 addition & 2 deletions include/hw/opentitan/ot_spi_host.h
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
*
* Copyright (C) 2022 Western Digital
* Copyright (c) 2022-2023 Rivos, Inc.
* Copyright (c) 2025 lowRISC contributors.
*
* Author(s):
* Wilfred Mallawa <wilfred.mallawa@wdc.com>
@@ -35,6 +36,4 @@
#define TYPE_OT_SPI_HOST "ot-spi_host"
OBJECT_DECLARE_TYPE(OtSPIHostState, OtSPIHostClass, OT_SPI_HOST)

#define OT_SPI_HOST_IRQ_NUM 2

#endif /* HW_OPENTITAN_OT_SPI_HOST_H */