| 1 | /* |
| 2 | * ASPEED AST2500 EVB |
| 3 | * |
| 4 | * Copyright 2016 IBM Corp. |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #include "qemu/osdep.h" |
| 10 | #include "qapi/error.h" |
| 11 | #include "hw/arm/machines-qom.h" |
| 12 | #include "hw/arm/aspeed.h" |
| 13 | #include "hw/arm/aspeed_soc.h" |
| 14 | #include "hw/i2c/smbus_eeprom.h" |
| 15 | #include "hw/sensor/tmp105.h" |
| 16 | |
| 17 | /* AST2500 evb hardware value: 0xF100C2E6 */ |
| 18 | #define AST2500_EVB_HW_STRAP1 (( \ |
| 19 | AST2500_HW_STRAP1_DEFAULTS | \ |
| 20 | SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \ |
| 21 | SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \ |
| 22 | SCU_AST2500_HW_STRAP_UART_DEBUG | \ |
| 23 | SCU_AST2500_HW_STRAP_DDR4_ENABLE | \ |
| 24 | SCU_HW_STRAP_MAC1_RGMII | \ |
| 25 | SCU_HW_STRAP_MAC0_RGMII) & \ |
| 26 | ~SCU_HW_STRAP_2ND_BOOT_WDT) |
| 27 | |
| 28 | static void ast2500_evb_i2c_init(AspeedMachineState *bmc) |
| 29 | { |
| 30 | AspeedSoCState *soc = bmc->soc; |
| 31 | uint8_t *eeprom_buf = g_malloc0(8 * 1024); |
| 32 | |
| 33 | smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 3), 0x50, |
| 34 | eeprom_buf); |
| 35 | |
| 36 | /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ |
| 37 | i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), |
| 38 | TYPE_TMP105, 0x4d); |
| 39 | } |
| 40 | |
| 41 | static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, |
| 42 | const void *data) |
| 43 | { |
| 44 | MachineClass *mc = MACHINE_CLASS(oc); |
| 45 | AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc); |
| 46 | |
| 47 | mc->desc = "Aspeed AST2500 EVB (ARM1176)"; |
| 48 | amc->soc_name = "ast2500-a1"; |
| 49 | amc->hw_strap1 = AST2500_EVB_HW_STRAP1; |
| 50 | amc->fmc_model = "mx25l25635e"; |
| 51 | amc->spi_model = "mx25l25635f"; |
| 52 | amc->num_cs = 1; |
| 53 | amc->i2c_init = ast2500_evb_i2c_init; |
| 54 | mc->default_ram_size = 512 * MiB; |
| 55 | aspeed_machine_class_init_cpus_defaults(mc); |
| 56 | }; |
| 57 | |
| 58 | static const TypeInfo aspeed_ast2500_evb_types[] = { |
| 59 | { |
| 60 | .name = MACHINE_TYPE_NAME("ast2500-evb"), |
| 61 | .parent = TYPE_ASPEED_MACHINE, |
| 62 | .class_init = aspeed_machine_ast2500_evb_class_init, |
| 63 | .interfaces = arm_machine_interfaces, |
| 64 | } |
| 65 | }; |
| 66 | |
| 67 | DEFINE_TYPES(aspeed_ast2500_evb_types) |