@@ -595,6 +595,7 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
for (i = 0; i < ARRAY_SIZE(s->gpio); i++) {
Object *obj = OBJECT(&s->gpio[i]);
+ object_property_set_uint(obj, "controller-num", i, &error_abort);
object_property_set_uint(obj, "reset-pullup",
npcm7xx_gpio[i].reset_pu, &error_abort);
object_property_set_uint(obj, "reset-pulldown",
@@ -387,6 +387,8 @@ static const VMStateDescription vmstate_npcm7xx_gpio = {
};
static Property npcm7xx_gpio_properties[] = {
+ /* The GPIO controller number (out of 8) */
+ DEFINE_PROP_UINT8("controller-num", NPCM7xxGPIOState, controller_num, 0),
/* Bit n set => pin n has pullup enabled by default. */
DEFINE_PROP_UINT32("reset-pullup", NPCM7xxGPIOState, reset_pu, 0),
/* Bit n set => pin n has pulldown enabled by default. */
@@ -35,6 +35,7 @@ typedef struct NPCM7xxGPIOState {
uint32_t reset_pd;
uint32_t reset_osrc;
uint32_t reset_odsc;
+ uint8_t controller_num;
MemoryRegion mmio;
For transmitting the GPIO state to the outside world, the GPIO transmitter will need to know which controller's state has been updated. To do this, we'll just number each controller at initialization. Signed-off-by: Joe Komlodi <komlodi@google.com> --- hw/arm/npcm7xx.c | 1 + hw/gpio/npcm7xx_gpio.c | 2 ++ include/hw/gpio/npcm7xx_gpio.h | 1 + 3 files changed, 4 insertions(+)