soc/amd/common/block/i2c: implement proper read_resource
Before this patch the reservation of the MMIO region of the I2C controllers was done in the LPC controller PCI device despite the I2C controllers already being devices in the devicetree. This patch implements this functionality as read_resources function of the I2C device instead. This will only reserve the memory when the I2C devices are enabled in devicetree which is a change from the previous behavior. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I67c853df3be2f593ecfa113ae2f74e5df7cf74e0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58307 Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
6c08b1ff81
commit
c2cee06b4e
5 changed files with 6 additions and 22 deletions
|
|
@ -121,9 +121,13 @@ void i2c_soc_init(void)
|
|||
dw_i2c_soc_init(false);
|
||||
}
|
||||
|
||||
static void i2c_read_resources(struct device *dev)
|
||||
{
|
||||
mmio_resource(dev, 0, dev->path.mmio.addr / KiB, 4);
|
||||
}
|
||||
|
||||
struct device_operations soc_amd_i2c_mmio_ops = {
|
||||
/* TODO(kramasub): Move I2C resource info here. */
|
||||
.read_resources = noop_read_resources,
|
||||
.read_resources = i2c_read_resources,
|
||||
.set_resources = noop_set_resources,
|
||||
.scan_bus = scan_smbus,
|
||||
.acpi_name = i2c_acpi_name,
|
||||
|
|
|
|||
|
|
@ -119,14 +119,6 @@ static void lpc_read_resources(struct device *dev)
|
|||
res->size = 0x00001000;
|
||||
res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||
|
||||
#ifdef I2C_BASE_ADDRESS
|
||||
/* I2C devices */
|
||||
res = new_resource(dev, 4);
|
||||
res->base = I2C_BASE_ADDRESS;
|
||||
res->size = I2C_DEVICE_SIZE * I2C_DEVICE_COUNT;
|
||||
res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||
#endif
|
||||
|
||||
compact_resources(dev);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue