Skip to content

Commit 9bb2f22

Browse files
committed
[ot] hw/riscv: ot_earlgrey: Add GPIO device
Signed-off-by: Emmanuel Blot <[email protected]>
1 parent df59a33 commit 9bb2f22

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

hw/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config OT_EARLGREY
2222
select OT_EDN
2323
select OT_ENTROPY_SRC
2424
select OT_FLASH
25+
select OT_GPIO
2526
select OT_HMAC
2627
select OT_IBEX_WRAPPER
2728
select OT_KMAC

hw/riscv/ot_earlgrey.c

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "hw/opentitan/ot_edn.h"
4242
#include "hw/opentitan/ot_entropy_src.h"
4343
#include "hw/opentitan/ot_flash.h"
44+
#include "hw/opentitan/ot_gpio.h"
4445
#include "hw/opentitan/ot_hmac.h"
4546
#include "hw/opentitan/ot_ibex_wrapper.h"
4647
#include "hw/opentitan/ot_kmac.h"
@@ -277,12 +278,45 @@ static const IbexDeviceDef ot_earlgrey_soc_devices[] = {
277278
),
278279
},
279280
[OT_EARLGREY_SOC_DEV_GPIO] = {
280-
.type = TYPE_UNIMPLEMENTED_DEVICE,
281+
.type = TYPE_OT_GPIO,
281282
.name = "ot-gpio",
282-
.cfg = &ibex_unimp_configure,
283283
.memmap = MEMMAPENTRIES(
284284
{ 0x40040000u, 0x40u }
285285
),
286+
.gpio = IBEXGPIOCONNDEFS(
287+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(0, PLIC, 33),
288+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(1, PLIC, 34),
289+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(2, PLIC, 35),
290+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(3, PLIC, 36),
291+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(4, PLIC, 37),
292+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(5, PLIC, 38),
293+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(6, PLIC, 49),
294+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(7, PLIC, 40),
295+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(8, PLIC, 41),
296+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(9, PLIC, 42),
297+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(10, PLIC, 43),
298+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(11, PLIC, 44),
299+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(12, PLIC, 45),
300+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(13, PLIC, 46),
301+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(14, PLIC, 47),
302+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(15, PLIC, 48),
303+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(16, PLIC, 59),
304+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(17, PLIC, 50),
305+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(18, PLIC, 51),
306+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(19, PLIC, 52),
307+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(20, PLIC, 53),
308+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(21, PLIC, 54),
309+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(22, PLIC, 55),
310+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(23, PLIC, 56),
311+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(24, PLIC, 57),
312+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(25, PLIC, 58),
313+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(26, PLIC, 69),
314+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(27, PLIC, 60),
315+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(28, PLIC, 61),
316+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(29, PLIC, 62),
317+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(30, PLIC, 63),
318+
OT_EARLGREY_SOC_GPIO_SYSBUS_IRQ(31, PLIC, 64)
319+
)
286320
},
287321
[OT_EARLGREY_SOC_DEV_SPI_DEVICE] = {
288322
.type = TYPE_UNIMPLEMENTED_DEVICE,

0 commit comments

Comments
 (0)