Implement I2C for BCM2835 (raspi)
Goal
When I try to add an I2C device, for example the PCA9552, to an emulated Raspberry Pi 3B,
qemu-system-aarch64 -M raspi3 -device pca9552,address=0x60
it results in this output:
qemu-system-aarch64: -device pca9552,address=0x60: No 'i2c-bus' bus found for device 'pca9552'
I assume this is because I2C is not implemented in QEMU for the BCM2835.
It would be great if someone were to implement this, so that simulated I2C devices can be added to an emulated Raspberry Pi.
Technical details
As can be seen in the following examples, I2C is currently not implemented for the BCM2835 in QEMU 6.0.0.
include/hw/arm/bcm2835_peripherals.h
struct BCM2835PeripheralState {
...
UnimplementedDeviceState i2c[3];
...
};
hw/arm/bcm2835_peripherals.c
static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
{
...
create_unimp(s, &s->i2c[0], "bcm2835-i2c0", BSC0_OFFSET, 0x20);
create_unimp(s, &s->i2c[1], "bcm2835-i2c1", BSC1_OFFSET, 0x20);
create_unimp(s, &s->i2c[2], "bcm2835-i2c2", BSC2_OFFSET, 0x20);
...
};
Edited by Filip Schauer