diff mbox series

[5/5] aspeed: Add support for the tacoma-bmc board

Message ID 20191114094544.30114-6-clg@kaod.org
State New
Headers show
Series aspeed: AST2600 SMC fixes and tacoma-bmc machine | expand

Commit Message

Cédric Le Goater Nov. 14, 2019, 9:45 a.m. UTC
The Tacoma BMC board is replacement board for the BMC of the OpenPOWER
Witherspoon system. It uses a AST2600 SoC instead of a AST2500 and is
used for HW bringup.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/arm/aspeed.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

Comments

Joel Stanley Nov. 18, 2019, 7:18 a.m. UTC | #1
On Thu, 14 Nov 2019 at 09:46, Cédric Le Goater <clg@kaod.org> wrote:
>
> The Tacoma BMC board is replacement board for the BMC of the OpenPOWER
> Witherspoon system. It uses a AST2600 SoC instead of a AST2500 and is
> used for HW bringup.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/arm/aspeed.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index e34e6787430b..729f2e79cd79 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -92,6 +92,10 @@ struct AspeedBoardState {
>  #define AST2600_EVB_HW_STRAP1 0x000000C0
>  #define AST2600_EVB_HW_STRAP2 0x00000003
>
> +/* Tacoma hardware value */
> +#define TACOMA_BMC_HW_STRAP1  0x00000000
> +#define TACOMA_BMC_HW_STRAP2  0x00000000
> +
>  /*
>   * The max ram region is for firmwares that scan the address space
>   * with load/store to guess how much RAM the SoC has.
> @@ -167,6 +171,34 @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
>      }
>  }
>
> +static void tacoma_bmc_i2c_init(AspeedBoardState *bmc)

This should be identical to witherspoon. Do you want to use the same callback?

Either way,

Reviewed-by: Joel Stanley <joel@jms.id.au>


> +{
> +    AspeedSoCState *soc = &bmc->soc;
> +    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
> +
> +    /* Bus 3: TODO bmp280@77 */
> +    /* Bus 3: TODO max31785@52 */
> +    /* Bus 3: TODO dps310@76 */
> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60);
> +
> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c);
> +
> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c);
> +
> +    /* The tacoma expects a TMP275 but a TMP105 is compatible */
> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), TYPE_TMP105,
> +                     0x4a);
> +
> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "pca9552",
> +                     0x60);
> +    /* The tacoma expects Epson RX8900 RTC but a ds1338 is compatible */
> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338",
> +                     0x32);
> +    smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51,
> +                          eeprom_buf);
> +    /* Bus 11: TODO ucd90160@64 */
> +}
> +
>  static void aspeed_machine_init(MachineState *machine)
>  {
>      AspeedBoardState *bmc;
> @@ -485,6 +517,22 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
>      mc->default_ram_size = 1 * GiB;
>  };
>
> +static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data)
> +{
> +    MachineClass *mc = MACHINE_CLASS(oc);
> +    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
> +
> +    mc->desc       = "Aspeed AST2600 EVB (Cortex A7)";
> +    amc->soc_name  = "ast2600-a0";
> +    amc->hw_strap1 = TACOMA_BMC_HW_STRAP1;
> +    amc->hw_strap2 = TACOMA_BMC_HW_STRAP2;
> +    amc->fmc_model = "mx66l1g45g";
> +    amc->spi_model = "mx66l1g45g";
> +    amc->num_cs    = 2;
> +    amc->i2c_init  = tacoma_bmc_i2c_init;
> +    mc->default_ram_size = 1 * GiB;
> +};
> +
>  static const TypeInfo aspeed_machine_types[] = {
>      {
>          .name          = MACHINE_TYPE_NAME("palmetto-bmc"),
> @@ -510,6 +558,10 @@ static const TypeInfo aspeed_machine_types[] = {
>          .name          = MACHINE_TYPE_NAME("ast2600-evb"),
>          .parent        = TYPE_ASPEED_MACHINE,
>          .class_init    = aspeed_machine_ast2600_evb_class_init,
> +    }, {
> +        .name          = MACHINE_TYPE_NAME("tacoma-bmc"),
> +        .parent        = TYPE_ASPEED_MACHINE,
> +        .class_init    = aspeed_machine_tacoma_class_init,
>      }, {
>          .name          = TYPE_ASPEED_MACHINE,
>          .parent        = TYPE_MACHINE,
> --
> 2.21.0
>
Cédric Le Goater Nov. 18, 2019, 7:44 a.m. UTC | #2
On 18/11/2019 08:18, Joel Stanley wrote:
> On Thu, 14 Nov 2019 at 09:46, Cédric Le Goater <clg@kaod.org> wrote:
>>
>> The Tacoma BMC board is replacement board for the BMC of the OpenPOWER
>> Witherspoon system. It uses a AST2600 SoC instead of a AST2500 and is
>> used for HW bringup.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  hw/arm/aspeed.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 52 insertions(+)
>>
>> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
>> index e34e6787430b..729f2e79cd79 100644
>> --- a/hw/arm/aspeed.c
>> +++ b/hw/arm/aspeed.c
>> @@ -92,6 +92,10 @@ struct AspeedBoardState {
>>  #define AST2600_EVB_HW_STRAP1 0x000000C0
>>  #define AST2600_EVB_HW_STRAP2 0x00000003
>>
>> +/* Tacoma hardware value */
>> +#define TACOMA_BMC_HW_STRAP1  0x00000000
>> +#define TACOMA_BMC_HW_STRAP2  0x00000000
>> +
>>  /*
>>   * The max ram region is for firmwares that scan the address space
>>   * with load/store to guess how much RAM the SoC has.
>> @@ -167,6 +171,34 @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
>>      }
>>  }
>>
>> +static void tacoma_bmc_i2c_init(AspeedBoardState *bmc)
> 
> This should be identical to witherspoon. Do you want to use the same callback?

You are right. The tacoma board should use the same callback.

Thanks,

C. 

> Either way,
> 
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> 
> 
>> +{
>> +    AspeedSoCState *soc = &bmc->soc;
>> +    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
>> +
>> +    /* Bus 3: TODO bmp280@77 */
>> +    /* Bus 3: TODO max31785@52 */
>> +    /* Bus 3: TODO dps310@76 */
>> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60);
>> +
>> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c);
>> +
>> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c);
>> +
>> +    /* The tacoma expects a TMP275 but a TMP105 is compatible */
>> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), TYPE_TMP105,
>> +                     0x4a);
>> +
>> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "pca9552",
>> +                     0x60);
>> +    /* The tacoma expects Epson RX8900 RTC but a ds1338 is compatible */
>> +    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338",
>> +                     0x32);
>> +    smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51,
>> +                          eeprom_buf);
>> +    /* Bus 11: TODO ucd90160@64 */
>> +}
>> +
>>  static void aspeed_machine_init(MachineState *machine)
>>  {
>>      AspeedBoardState *bmc;
>> @@ -485,6 +517,22 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
>>      mc->default_ram_size = 1 * GiB;
>>  };
>>
>> +static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data)
>> +{
>> +    MachineClass *mc = MACHINE_CLASS(oc);
>> +    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
>> +
>> +    mc->desc       = "Aspeed AST2600 EVB (Cortex A7)";
>> +    amc->soc_name  = "ast2600-a0";
>> +    amc->hw_strap1 = TACOMA_BMC_HW_STRAP1;
>> +    amc->hw_strap2 = TACOMA_BMC_HW_STRAP2;
>> +    amc->fmc_model = "mx66l1g45g";
>> +    amc->spi_model = "mx66l1g45g";
>> +    amc->num_cs    = 2;
>> +    amc->i2c_init  = tacoma_bmc_i2c_init;
>> +    mc->default_ram_size = 1 * GiB;
>> +};
>> +
>>  static const TypeInfo aspeed_machine_types[] = {
>>      {
>>          .name          = MACHINE_TYPE_NAME("palmetto-bmc"),
>> @@ -510,6 +558,10 @@ static const TypeInfo aspeed_machine_types[] = {
>>          .name          = MACHINE_TYPE_NAME("ast2600-evb"),
>>          .parent        = TYPE_ASPEED_MACHINE,
>>          .class_init    = aspeed_machine_ast2600_evb_class_init,
>> +    }, {
>> +        .name          = MACHINE_TYPE_NAME("tacoma-bmc"),
>> +        .parent        = TYPE_ASPEED_MACHINE,
>> +        .class_init    = aspeed_machine_tacoma_class_init,
>>      }, {
>>          .name          = TYPE_ASPEED_MACHINE,
>>          .parent        = TYPE_MACHINE,
>> --
>> 2.21.0
>>
diff mbox series

Patch

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index e34e6787430b..729f2e79cd79 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -92,6 +92,10 @@  struct AspeedBoardState {
 #define AST2600_EVB_HW_STRAP1 0x000000C0
 #define AST2600_EVB_HW_STRAP2 0x00000003
 
+/* Tacoma hardware value */
+#define TACOMA_BMC_HW_STRAP1  0x00000000
+#define TACOMA_BMC_HW_STRAP2  0x00000000
+
 /*
  * The max ram region is for firmwares that scan the address space
  * with load/store to guess how much RAM the SoC has.
@@ -167,6 +171,34 @@  static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
     }
 }
 
+static void tacoma_bmc_i2c_init(AspeedBoardState *bmc)
+{
+    AspeedSoCState *soc = &bmc->soc;
+    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
+
+    /* Bus 3: TODO bmp280@77 */
+    /* Bus 3: TODO max31785@52 */
+    /* Bus 3: TODO dps310@76 */
+    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60);
+
+    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c);
+
+    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c);
+
+    /* The tacoma expects a TMP275 but a TMP105 is compatible */
+    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), TYPE_TMP105,
+                     0x4a);
+
+    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "pca9552",
+                     0x60);
+    /* The tacoma expects Epson RX8900 RTC but a ds1338 is compatible */
+    i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338",
+                     0x32);
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51,
+                          eeprom_buf);
+    /* Bus 11: TODO ucd90160@64 */
+}
+
 static void aspeed_machine_init(MachineState *machine)
 {
     AspeedBoardState *bmc;
@@ -485,6 +517,22 @@  static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
     mc->default_ram_size = 1 * GiB;
 };
 
+static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Aspeed AST2600 EVB (Cortex A7)";
+    amc->soc_name  = "ast2600-a0";
+    amc->hw_strap1 = TACOMA_BMC_HW_STRAP1;
+    amc->hw_strap2 = TACOMA_BMC_HW_STRAP2;
+    amc->fmc_model = "mx66l1g45g";
+    amc->spi_model = "mx66l1g45g";
+    amc->num_cs    = 2;
+    amc->i2c_init  = tacoma_bmc_i2c_init;
+    mc->default_ram_size = 1 * GiB;
+};
+
 static const TypeInfo aspeed_machine_types[] = {
     {
         .name          = MACHINE_TYPE_NAME("palmetto-bmc"),
@@ -510,6 +558,10 @@  static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("ast2600-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_ast2600_evb_class_init,
+    }, {
+        .name          = MACHINE_TYPE_NAME("tacoma-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_tacoma_class_init,
     }, {
         .name          = TYPE_ASPEED_MACHINE,
         .parent        = TYPE_MACHINE,