master
c 90 lines 3.81 KB
Raw
1 /*
2 * Facebook Tiogapass
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 TIOGAPASS_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 /* Tiogapass BMC FRU */
28 static const uint8_t tiogapass_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, 0x4d,
31 0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
32 0x64, 0x75, 0x6c, 0x65, 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, 0x54, 0x69, 0x6f, 0x67, 0x61,
39 0x20, 0x50, 0x61, 0x73, 0x73, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
40 0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
41 0x58, 0x58, 0x58, 0x58, 0xc4, 0x58, 0x58, 0x58, 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 tiogapass_bmc_fruid_len = sizeof(tiogapass_bmc_fruid);
49
50 static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
51 {
52 AspeedSoCState *soc = bmc->soc;
53
54 at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54, 128 * KiB);
55 at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * KiB,
56 tiogapass_bmc_fruid, tiogapass_bmc_fruid_len);
57 /* TMP421 */
58 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), "tmp421", 0x1f);
59 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4f);
60 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4e);
61 }
62
63 static void aspeed_machine_tiogapass_class_init(ObjectClass *oc,
64 const void *data)
65 {
66 MachineClass *mc = MACHINE_CLASS(oc);
67 AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
68
69 mc->desc = "Facebook Tiogapass BMC (ARM1176)";
70 amc->soc_name = "ast2500-a1";
71 amc->hw_strap1 = TIOGAPASS_BMC_HW_STRAP1;
72 amc->hw_strap2 = 0;
73 amc->fmc_model = "n25q256a";
74 amc->spi_model = "mx25l25635e";
75 amc->num_cs = 2;
76 amc->i2c_init = tiogapass_bmc_i2c_init;
77 mc->default_ram_size = 1 * GiB;
78 aspeed_machine_class_init_cpus_defaults(mc);
79 };
80
81 static const TypeInfo aspeed_ast2500_tiogapass_types[] = {
82 {
83 .name = MACHINE_TYPE_NAME("tiogapass-bmc"),
84 .parent = TYPE_ASPEED_MACHINE,
85 .class_init = aspeed_machine_tiogapass_class_init,
86 .interfaces = arm_machine_interfaces,
87 }
88 };
89
90 DEFINE_TYPES(aspeed_ast2500_tiogapass_types)