[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/15] hw/i2c/aspeed: support to set the different memory size
From: |
Cédric Le Goater |
Subject: |
[PULL 13/15] hw/i2c/aspeed: support to set the different memory size |
Date: |
Sun, 21 Jul 2024 10:13:59 +0200 |
From: Jamin Lin <jamin_lin@aspeedtech.com>
According to the datasheet of ASPEED SOCs,
an I2C controller owns 8KB of register space for AST2700,
owns 4KB of register space for AST2600, AST2500 and AST2400,
and owns 64KB of register space for AST1030.
It set the memory region size 4KB by default and it does not compatible
register space for AST2700.
Introduce a new class attribute to set the I2C controller memory size
for different ASPEED SOCs.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/i2c/aspeed_i2c.h | 2 +-
hw/i2c/aspeed_i2c.c | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index a064479e599c..065b636d2999 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -283,7 +283,7 @@ struct AspeedI2CClass {
uint8_t *(*bus_pool_base)(AspeedI2CBus *);
bool check_sram;
bool has_dma;
-
+ uint64_t mem_size;
};
static inline bool aspeed_i2c_is_new_mode(AspeedI2CState *s)
diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index b43afd250de4..7d5a53c4c015 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -1014,7 +1014,7 @@ static void aspeed_i2c_realize(DeviceState *dev, Error
**errp)
sysbus_init_irq(sbd, &s->irq);
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_i2c_ctrl_ops, s,
- "aspeed.i2c", 0x1000);
+ "aspeed.i2c", aic->mem_size);
sysbus_init_mmio(sbd, &s->iomem);
for (i = 0; i < aic->num_busses; i++) {
@@ -1286,6 +1286,7 @@ static void aspeed_2400_i2c_class_init(ObjectClass
*klass, void *data)
aic->pool_size = 0x800;
aic->pool_base = 0x800;
aic->bus_pool_base = aspeed_2400_i2c_bus_pool_base;
+ aic->mem_size = 0x1000;
}
static const TypeInfo aspeed_2400_i2c_info = {
@@ -1320,6 +1321,7 @@ static void aspeed_2500_i2c_class_init(ObjectClass
*klass, void *data)
aic->bus_pool_base = aspeed_2500_i2c_bus_pool_base;
aic->check_sram = true;
aic->has_dma = true;
+ aic->mem_size = 0x1000;
}
static const TypeInfo aspeed_2500_i2c_info = {
@@ -1353,6 +1355,7 @@ static void aspeed_2600_i2c_class_init(ObjectClass
*klass, void *data)
aic->pool_base = 0xC00;
aic->bus_pool_base = aspeed_2600_i2c_bus_pool_base;
aic->has_dma = true;
+ aic->mem_size = 0x1000;
}
static const TypeInfo aspeed_2600_i2c_info = {
@@ -1376,6 +1379,7 @@ static void aspeed_1030_i2c_class_init(ObjectClass
*klass, void *data)
aic->pool_base = 0xC00;
aic->bus_pool_base = aspeed_2600_i2c_bus_pool_base;
aic->has_dma = true;
+ aic->mem_size = 0x10000;
}
static const TypeInfo aspeed_1030_i2c_info = {
--
2.45.2
- [PULL 04/15] aspeed/scu: Add boot-from-eMMC HW strapping bit for AST2600 SoC, (continued)
- [PULL 04/15] aspeed/scu: Add boot-from-eMMC HW strapping bit for AST2600 SoC, Cédric Le Goater, 2024/07/21
- [PULL 05/15] aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' handler, Cédric Le Goater, 2024/07/21
- [PULL 07/15] aspeed: Add boot-from-eMMC HW strapping bit to rainier-bmc machine, Cédric Le Goater, 2024/07/21
- [PULL 09/15] aspeed: Introduce a 'boot-emmc' machine option, Cédric Le Goater, 2024/07/21
- [PULL 08/15] aspeed: Introduce a 'hw_strap1' machine attribute, Cédric Le Goater, 2024/07/21
- [PULL 11/15] aspeed/adc: Add AST2700 support, Cédric Le Goater, 2024/07/21
- [PULL 10/15] tests/avocado/machine_aspeed.py: Add eMMC boot tests, Cédric Le Goater, 2024/07/21
- [PULL 12/15] aspeed/soc: support ADC for AST2700, Cédric Le Goater, 2024/07/21
- [PULL 15/15] aspeed: fix coding style, Cédric Le Goater, 2024/07/21
- [PULL 14/15] hw/i2c/aspeed: rename the I2C class pool attribute to share_pool, Cédric Le Goater, 2024/07/21
- [PULL 13/15] hw/i2c/aspeed: support to set the different memory size,
Cédric Le Goater <=
- Re: [PULL 00/15] aspeed queue, Richard Henderson, 2024/07/22