master
c 91 lines 3.83 KB
Raw
1 /*
2 * Facebook YosemiteV2
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/nvram/eeprom_at24c.h"
15
16 /* value: 0xF100C2E6 */
17 #define YOSEMITEV2_BMC_HW_STRAP1 (( \
18 AST2500_HW_STRAP1_DEFAULTS | \
19 SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
20 SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
21 SCU_AST2500_HW_STRAP_UART_DEBUG | \
22 SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
23 SCU_HW_STRAP_MAC1_RGMII | \
24 SCU_HW_STRAP_MAC0_RGMII) & \
25 ~SCU_HW_STRAP_2ND_BOOT_WDT)
26
27 /* Yosemite V2 BMC FRU */
28 static const uint8_t yosemitev2_bmc_fruid[] = {
29 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
30 0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x61,
31 0x73, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x4d, 0x50, 0x00, 0x00,
32 0x00, 0x00, 0x00, 0x00, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
33 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
34 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
35 0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
36 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
37 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
38 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
39 0x69, 0x74, 0x65, 0x20, 0x56, 0x32, 0x20, 0x4d, 0x50, 0x00, 0x00, 0x00,
40 0x00, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
41 0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
42 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
43 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
44 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
45 0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
46 };
47
48 static const size_t yosemitev2_bmc_fruid_len = sizeof(yosemitev2_bmc_fruid);
49
50 static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
51 {
52 AspeedSoCState *soc = bmc->soc;
53
54 at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x51, 128 * KiB);
55 at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
56 yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len);
57 /* TMP421 */
58 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "tmp421", 0x1f);
59 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4e);
60 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4f);
61
62 }
63
64 static void aspeed_machine_yosemitev2_class_init(ObjectClass *oc,
65 const void *data)
66 {
67 MachineClass *mc = MACHINE_CLASS(oc);
68 AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
69
70 mc->desc = "Facebook YosemiteV2 BMC (ARM1176)";
71 amc->soc_name = "ast2500-a1";
72 amc->hw_strap1 = YOSEMITEV2_BMC_HW_STRAP1;
73 amc->hw_strap2 = 0;
74 amc->fmc_model = "n25q256a";
75 amc->spi_model = "mx25l25635e";
76 amc->num_cs = 2;
77 amc->i2c_init = yosemitev2_bmc_i2c_init;
78 mc->default_ram_size = 512 * MiB;
79 aspeed_machine_class_init_cpus_defaults(mc);
80 };
81
82 static const TypeInfo aspeed_ast2500_yosemitev2_types[] = {
83 {
84 .name = MACHINE_TYPE_NAME("yosemitev2-bmc"),
85 .parent = TYPE_ASPEED_MACHINE,
86 .class_init = aspeed_machine_yosemitev2_class_init,
87 .interfaces = arm_machine_interfaces,
88 }
89 };
90
91 DEFINE_TYPES(aspeed_ast2500_yosemitev2_types)