Skip to content

Commit 7b85f00

Browse files
milesg-githubnpiggin
authored andcommitted
ppc/pnv: Use resettable interface to reset child I2C buses
The QEMU I2C buses and devices use the resettable interface for resetting while the PNV I2C controller and parent buses and devices have not yet transitioned to this new interface and use the old reset strategy. This was preventing the I2C buses and devices wired to the PNV I2C controller from being reset. The short term fix for this is to have the PNV I2C Controller's reset function explicitly call the resettable interface function, bus_cold_reset(), on all child I2C buses. The long term fix should be to transition all PNV parent devices and buses to use the resettable interface so that all child buses and devices are automatically reset. Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
1 parent 6f86885 commit 7b85f00

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

hw/ppc/pnv_i2c.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,19 @@ static int pnv_i2c_dt_xscom(PnvXScomInterface *dev, void *fdt,
629629
return 0;
630630
}
631631

632+
static void pnv_i2c_sys_reset(void *dev)
633+
{
634+
int port;
635+
PnvI2C *i2c = PNV_I2C(dev);
636+
637+
pnv_i2c_reset(dev);
638+
639+
/* reset all buses connected to this i2c controller */
640+
for (port = 0; port < i2c->num_busses; port++) {
641+
bus_cold_reset(BUS(i2c->busses[port]));
642+
}
643+
}
644+
632645
static void pnv_i2c_realize(DeviceState *dev, Error **errp)
633646
{
634647
PnvI2C *i2c = PNV_I2C(dev);
@@ -654,7 +667,7 @@ static void pnv_i2c_realize(DeviceState *dev, Error **errp)
654667

655668
fifo8_create(&i2c->fifo, PNV_I2C_FIFO_SIZE);
656669

657-
qemu_register_reset(pnv_i2c_reset, dev);
670+
qemu_register_reset(pnv_i2c_sys_reset, dev);
658671

659672
qdev_init_gpio_out(DEVICE(dev), &i2c->psi_irq, 1);
660673
}

0 commit comments

Comments
 (0)