[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 5/6] hw/gpio/npcm7xx: init GPIO transmitter allowlist
From: |
Joe Komlodi |
Subject: |
[RFC PATCH 5/6] hw/gpio/npcm7xx: init GPIO transmitter allowlist |
Date: |
Thu, 16 Dec 2021 01:54:16 +0000 |
For the GPIO transmitter to properly transmit on pin changes, it must
know the initial state of the GPIO pins on the controller.
Signed-off-by: Joe Komlodi <komlodi@google.com>
---
hw/gpio/npcm7xx_gpio.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/gpio/npcm7xx_gpio.c b/hw/gpio/npcm7xx_gpio.c
index 0d683903a2..64a74c87a5 100644
--- a/hw/gpio/npcm7xx_gpio.c
+++ b/hw/gpio/npcm7xx_gpio.c
@@ -370,6 +370,14 @@ static void npcm7xx_gpio_hold_reset(Object *obj)
npcm7xx_gpio_update_pins(s, -1);
}
+static void npcm7xx_gpio_realize(DeviceState *dev, Error **errp)
+{
+ NPCM7xxGPIOState *s = NPCM7XX_GPIO(dev);
+ uint32_t state = s->regs[NPCM7XX_GPIO_DOUT] | s->regs[NPCM7XX_GPIO_DIN];
+
+ google_gpio_tx_state_init(s->txs, s->controller_num, state);
+}
+
static void npcm7xx_gpio_init(Object *obj)
{
NPCM7xxGPIOState *s = NPCM7XX_GPIO(obj);
@@ -423,6 +431,7 @@ static void npcm7xx_gpio_class_init(ObjectClass *klass,
void *data)
dc->desc = "NPCM7xx GPIO Controller";
dc->vmsd = &vmstate_npcm7xx_gpio;
+ dc->realize = npcm7xx_gpio_realize;
reset->phases.enter = npcm7xx_gpio_enter_reset;
reset->phases.hold = npcm7xx_gpio_hold_reset;
device_class_set_props(dc, npcm7xx_gpio_properties);
--
2.34.1.173.g76aa8bc2d0-goog
- [RFC PATCH 0/6] Introduce GPIO transmitter and connect to NPCM7xx, Joe Komlodi, 2021/12/15
- [RFC PATCH 2/6] hw/gpio/gpio_transmitter: Add allowlist, Joe Komlodi, 2021/12/15
- [RFC PATCH 6/6] qtests/gpio_transmitter: Add test, Joe Komlodi, 2021/12/15
- [RFC PATCH 4/6] hw/arm/npcm7xx: gpio: Add GPIO transmitter, Joe Komlodi, 2021/12/15
- [RFC PATCH 5/6] hw/gpio/npcm7xx: init GPIO transmitter allowlist,
Joe Komlodi <=
- [RFC PATCH 1/6] hw/gpio/gpio_transmitter: Add Device, Joe Komlodi, 2021/12/15
- [RFC PATCH 3/6] hw/gpio/npcm7xx: Number controllers, Joe Komlodi, 2021/12/15
- Re: [RFC PATCH 0/6] Introduce GPIO transmitter and connect to NPCM7xx, Philippe Mathieu-Daudé, 2021/12/16