qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] aspeed: Add support for IBM Bonnell
@ 2024-09-06 12:35 Guenter Roeck
  2024-09-06 14:49 ` Cédric Le Goater
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2024-09-06 12:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, Cédric Le Goater, Peter Maydell, Steven Lee,
	Troy Lee, Jamin Lin, Andrew Jeffery, Joel Stanley, Guenter Roeck

Introduce support for the IBM Bonnell BMC.

Use Rainier machine information for HW strapping and other machine details
since the actual hardware configuration is unknown. I2C device
instantiation is based on the devicetree file in the upstream Linux kernel.

Major difference to Rainier is that the Bonnell devicetree file
instantiates a TPM. It is therefore possible to test TPM functionality
without having to instantiate the TPM manually from the Linux command
line.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/arm/aspeed.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index fd5603f7aa..4f833c5708 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -865,6 +865,70 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
     create_pca9552(soc, 15, 0x60);
 }
 
+static void bonnell_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+    I2CBus *bus;
+
+    bus = aspeed_i2c_get_bus(&soc->i2c, 0);
+
+    at24c_eeprom_init(bus, 0x51, 8 * KiB);      /* atmel,24c64 */
+    /* tca9554@11:20 */
+    i2c_slave_create_simple(bus, "pca9554", 0x20);
+
+    /* ucd90160@2:64 */
+
+    /* fsg032@3:5a */
+    /* fsg032@3:5b */
+
+    bus = aspeed_i2c_get_bus(&soc->i2c, 7);
+
+    /* si7020@7:40 */
+
+    /* Bonnell expects a TMP275 but a TMP105 is compatible */
+    i2c_slave_create_simple(bus, TYPE_TMP105, 0x48);
+    at24c_eeprom_init(bus, 0x50, 8 * KiB);      /* atmel,24c64 */
+    at24c_eeprom_init(bus, 0x51, 8 * KiB);      /* atmel,24c64 */
+    i2c_slave_create_simple(bus, "max31785", 0x52);
+
+    /* pca9551; assume/hope pca9552 is compatible enough */
+    create_pca9552(soc, 7, 0x60);
+
+    /* ibm,op-panel@7:62 */
+    /* dps310@7:76 */
+
+    bus = aspeed_i2c_get_bus(&soc->i2c, 8);
+
+    /* rx8900@8:32 */
+
+    /* Bonnell expects a TMP275 but a TMP105 is compatible */
+    i2c_slave_create_simple(bus, TYPE_TMP105, 0x48);
+    at24c_eeprom_init(bus, 0x51, 16 * KiB);      /* atmel,24c128 */
+
+    /* pca9551@8:60 */
+    create_pca9552(soc, 8, 0x60);
+
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4c);
+
+    bus = aspeed_i2c_get_bus(&soc->i2c, 11);
+
+    /* tca9554@11:20 */
+    i2c_slave_create_simple(bus, "pca9554", 0x20);
+    i2c_slave_create_simple(bus, "tmp423", 0x4c);
+    /* pca9849@11:75 */
+    i2c_slave_create_simple(bus, "pca9546", 0x75);
+
+    /* npct75x@12:2e (tpm) */
+
+    /* atmel,24c64 */
+    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 12), 0x50, 8 * KiB);
+
+    /* atmel,24c64 */
+    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, 8 * KiB);
+    /* pca9551@13:60 */
+    create_pca9552(soc, 13, 0x60);
+}
+
 static void get_pca9548_channels(I2CBus *bus, uint8_t mux_addr,
                                  I2CBus **channels)
 {
@@ -1488,6 +1552,25 @@ static void aspeed_machine_rainier_class_init(ObjectClass *oc, void *data)
     aspeed_machine_ast2600_class_emmc_init(oc);
 };
 
+static void aspeed_machine_bonnell_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "IBM Bonnell BMC (Cortex-A7)";
+    amc->soc_name  = "ast2600-a3";
+    amc->hw_strap1 = RAINIER_BMC_HW_STRAP1;
+    amc->hw_strap2 = RAINIER_BMC_HW_STRAP2;
+    amc->fmc_model = "mx66l1g45g";
+    amc->spi_model = "mx66l1g45g";
+    amc->num_cs    = 2;
+    amc->macs_mask  = ASPEED_MAC2_ON | ASPEED_MAC3_ON;
+    amc->i2c_init  = bonnell_bmc_i2c_init;
+    mc->default_ram_size = 1 * GiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+    aspeed_machine_ast2600_class_emmc_init(oc);
+};
+
 #define FUJI_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
 
 static void aspeed_machine_fuji_class_init(ObjectClass *oc, void *data)
@@ -1776,6 +1859,10 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("rainier-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_rainier_class_init,
+    }, {
+        .name          = MACHINE_TYPE_NAME("bonnell-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_bonnell_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("fuji-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-06 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 12:35 [PATCH] aspeed: Add support for IBM Bonnell Guenter Roeck
2024-09-06 14:49 ` Cédric Le Goater
2024-09-06 14:57   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).