Skip to contentSkip to conversation

hw/i2c/bcm2835_i2c: Correct iomem size

PATCH Applied botszhuang 3 participants 3 messages Aug 4 – Aug 11

Subsystems (2)
lore
Share & tools
lore

botszhuang

author
#0 lore raw

PATCH 1/1 hw/i2c/bcm2835_i2c: Correct iomem size

The last valid register is the Clock Stretch Timeout (CLKT) at offset 0x1c. Since it is a 32-bit register, the total memory region size should be 0x1c + 4 = 0x20.

Update the size parameter in memory_region_init_io() from 0x24 to 0x20 to accurately reflect the hardware specification.

---
 hw/i2c/bcm2835_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i2c/bcm2835_i2c.c +1 -1
index 34de1f36e5..5f6093087d 100644
@@ -222,7 +222,7 @@ static void bcm2835_i2c_realize(DeviceState *dev, Error **errp)
     s->bus = i2c_init_bus(dev, NULL);
 
     memory_region_init_io(&s->iomem, OBJECT(dev), &bcm2835_i2c_ops, s,
-                          TYPE_BCM2835_I2C, 0x24);
+                          TYPE_BCM2835_I2C, 0x20);
     sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
     sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
 }
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · botszhuang

The last valid register is the Clock Stretch Timeout (CLKT) at offset 0x1c. Since it is a 32-bit register, the total memory region size should be 0x1c + 4 = 0x20.

Update the size parameter in memory_region_init_io() from 0x24 to 0x20 to accurately reflect the hardware specification.

Quoted 1 line
Quoted 17 lines
---
  hw/i2c/bcm2835_i2c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i2c/bcm2835_i2c.c +1 -1
index 34de1f36e5..5f6093087d 100644
@@ -222,7 +222,7 @@ static void bcm2835_i2c_realize(DeviceState *dev, Error **errp)
      s->bus = i2c_init_bus(dev, NULL);
 
      memory_region_init_io(&s->iomem, OBJECT(dev), &bcm2835_i2c_ops, s,
-                          TYPE_BCM2835_I2C, 0x24);
+                          TYPE_BCM2835_I2C, 0x20);
      sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
      sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
  }
#2 lore raw
In reply to botszhuang
Quoted 9 lines · botszhuang

The last valid register is the Clock Stretch Timeout (CLKT) at offset 0x1c. Since it is a 32-bit register, the total memory region size should be 0x1c + 4 = 0x20.

Update the size parameter in memory_region_init_io() from 0x24 to 0x20 to accurately reflect the hardware specification.

Applied to target-arm.next ready for when we reopen development for 11.2; thanks.

-- PMM