| 1 | /* |
| 2 | * ASPEED AST2600 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 | /* AST2600 evb hardware value */ |
| 18 | #define AST2600_EVB_HW_STRAP1 0x000000C0 |
| 19 | #define AST2600_EVB_HW_STRAP2 0x00000003 |
| 20 | |
| 21 | static void ast2600_evb_i2c_init(AspeedMachineState *bmc) |
| 22 | { |
| 23 | AspeedSoCState *soc = bmc->soc; |
| 24 | uint8_t *eeprom_buf = g_malloc0(8 * 1024); |
| 25 | |
| 26 | smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50, |
| 27 | eeprom_buf); |
| 28 | |
| 29 | /* LM75 is compatible with TMP105 driver */ |
| 30 | i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), |
| 31 | TYPE_TMP105, 0x4d); |
| 32 | } |
| 33 | |
| 34 | static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, |
| 35 | const void *data) |
| 36 | { |
| 37 | MachineClass *mc = MACHINE_CLASS(oc); |
| 38 | AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc); |
| 39 | |
| 40 | mc->desc = "Aspeed AST2600 EVB (Cortex-A7)"; |
| 41 | amc->soc_name = "ast2600-a3"; |
| 42 | amc->hw_strap1 = AST2600_EVB_HW_STRAP1; |
| 43 | amc->hw_strap2 = AST2600_EVB_HW_STRAP2; |
| 44 | amc->fmc_model = "w25q512jv"; |
| 45 | amc->spi_model = "w25q512jv"; |
| 46 | amc->num_cs = 1; |
| 47 | amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON | |
| 48 | ASPEED_MAC3_ON; |
| 49 | amc->sdhci_wp_inverted = true; |
| 50 | amc->i2c_init = ast2600_evb_i2c_init; |
| 51 | mc->default_ram_size = 1 * GiB; |
| 52 | aspeed_machine_class_init_cpus_defaults(mc); |
| 53 | aspeed_machine_ast2600_class_emmc_init(oc); |
| 54 | }; |
| 55 | |
| 56 | static const TypeInfo aspeed_ast2600_evb_types[] = { |
| 57 | { |
| 58 | .name = MACHINE_TYPE_NAME("ast2600-evb"), |
| 59 | .parent = TYPE_ASPEED_MACHINE, |
| 60 | .class_init = aspeed_machine_ast2600_evb_class_init, |
| 61 | .interfaces = arm_machine_interfaces, |
| 62 | } |
| 63 | }; |
| 64 | |
| 65 | DEFINE_TYPES(aspeed_ast2600_evb_types) |