Skip to content

Commit 1ba9610

Browse files
committed
[ot] hw/riscv: ot_earlgrey: link SPI Device to SPI Host #0
Signed-off-by: Alice Ziuziakowska <[email protected]>
1 parent 13f47e6 commit 1ba9610

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

hw/riscv/ot_earlgrey.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ static const IbexDeviceDef ot_eg_soc_devices[] = {
552552
.memmap = MEMMAPENTRIES(
553553
{ .base = 0x40050000u }
554554
),
555+
.prop = IBEXDEVICEPROPDEFS(
556+
IBEX_DEV_STRING_PROP(OT_COMMON_DEV_ID, "spidev")
557+
),
558+
.link = IBEXDEVICELINKDEFS(
559+
OT_EG_SOC_DEVLINK("spihost", SPI_HOST0)
560+
),
555561
.gpio = IBEXGPIOCONNDEFS(
556562
OT_EG_SOC_GPIO_SYSBUS_IRQ(0, PLIC, 69),
557563
OT_EG_SOC_GPIO_SYSBUS_IRQ(1, PLIC, 70),
@@ -1917,6 +1923,16 @@ static void ot_eg_board_realize(DeviceState *dev, Error **errp)
19171923
g_free(flashname);
19181924
g_free(busname);
19191925
}
1926+
1927+
DeviceState *spidevice =
1928+
RISCV_OT_EG_SOC(soc)->devices[OT_EG_SOC_DEV_SPI_DEVICE];
1929+
DeviceState *spihost =
1930+
RISCV_OT_EG_SOC(soc)->devices[OT_EG_SOC_DEV_SPI_HOST0];
1931+
qemu_irq cs;
1932+
cs = qdev_get_gpio_in_named(spihost, "passthrough-en", 0);
1933+
qdev_connect_gpio_out_named(spidevice, "passthrough-en", 0, cs);
1934+
cs = qdev_get_gpio_in_named(spihost, "passthrough-cs", 0);
1935+
qdev_connect_gpio_out_named(spidevice, "passthrough-cs", 0, cs);
19201936
}
19211937

19221938
static void ot_eg_board_init(Object *obj)

0 commit comments

Comments
 (0)