Skip to content

Commit 28e987a

Browse files
committed
hw/arm/mps2.c: Mark internal-only I2C buses as 'full'
The various MPS2 boards implemented in mps2.c have multiple I2C buses: a bus dedicated to the audio configuration, one for the LCD touchscreen controller, and two which are connected to the external Shield expansion connector. Mark the buses which are used only for board-internal devices as 'full' so that if the user creates i2c devices on the commandline without specifying a bus name then they will be connected to the I2C controller used for the Shield connector, where guest software will expect them. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-id: [email protected]
1 parent 68e5795 commit 28e987a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

hw/arm/mps2.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,17 @@ static void mps2_common_init(MachineState *machine)
428428
0x40023000, /* Audio */
429429
0x40029000, /* Shield0 */
430430
0x4002a000}; /* Shield1 */
431-
sysbus_create_simple(TYPE_ARM_SBCON_I2C, i2cbase[i], NULL);
431+
DeviceState *dev;
432+
433+
dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, i2cbase[i], NULL);
434+
if (i < 2) {
435+
/*
436+
* internal-only bus: mark it full to avoid user-created
437+
* i2c devices being plugged into it.
438+
*/
439+
BusState *qbus = qdev_get_child_bus(dev, "i2c");
440+
qbus_mark_full(qbus);
441+
}
432442
}
433443
create_unimplemented_device("i2s", 0x40024000, 0x400);
434444

0 commit comments

Comments
 (0)