| 1 | /* |
| 2 | * Facebook Anacapa |
| 3 | * |
| 4 | * Copyright (c) 2026 Meta Platforms, Inc. and affiliates. |
| 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/sensor/adc128d818.h" |
| 12 | #include "hw/arm/machines-qom.h" |
| 13 | #include "hw/arm/aspeed.h" |
| 14 | #include "hw/arm/aspeed_soc.h" |
| 15 | #include "hw/i2c/i2c_mux_pca954x.h" |
| 16 | #include "hw/gpio/pca9552.h" |
| 17 | #include "hw/nvram/eeprom_at24c.h" |
| 18 | |
| 19 | #define ANACAPA_BMC_HW_STRAP1 0x00002002 |
| 20 | #define ANACAPA_BMC_HW_STRAP2 0x00000000 |
| 21 | #define ANACAPA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) |
| 22 | |
| 23 | /* |
| 24 | * "Anacapa HPM (MB)" FRU data. Generated with frugen. |
| 25 | * |
| 26 | * { |
| 27 | * "board": { "mfg": "Inventec", "pname": "Anacapa QEMU MB EVT2", |
| 28 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 29 | * "product": { "mfg": "Inventec", "pname": "CI-Anacapa", |
| 30 | * "pn": "10000000001", "ver": "MP", |
| 31 | * "serial": "10000000000000", "atag": "QEMU" } |
| 32 | * } |
| 33 | */ |
| 34 | static const uint8_t hpm_eeprom[] = { |
| 35 | 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0xb4, |
| 36 | 0xa4, 0xf2, 0xc8, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x63, 0xd4, |
| 37 | 0x41, 0x6e, 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x51, 0x45, 0x4d, 0x55, |
| 38 | 0x20, 0x4d, 0x42, 0x20, 0x45, 0x56, 0x54, 0x32, 0x47, 0x00, 0x00, 0x00, |
| 39 | 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xc0, |
| 40 | 0xc1, 0x00, 0x00, 0xb8, 0x01, 0x06, 0x19, 0xc8, 0x49, 0x6e, 0x76, 0x65, |
| 41 | 0x6e, 0x74, 0x65, 0x63, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, 0x61, 0x63, |
| 42 | 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x82, 0x2d, |
| 43 | 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x71, 0xd9, |
| 44 | 0xd6, 0xc0, 0xc1, 0x0e |
| 45 | }; |
| 46 | static const size_t hpm_eeprom_len = sizeof(hpm_eeprom); |
| 47 | |
| 48 | /* |
| 49 | * "Anacapa R-PDB" FRU data. Generated with frugen. |
| 50 | * |
| 51 | * { |
| 52 | * "board": { "mfg": "Inventec", "pname": "Anacapa QEMU RPDB", |
| 53 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 54 | * "product": { "mfg": "Inventec", "pname": "CI-Anacapa", |
| 55 | * "pn": "10000000001", "ver": "MP", |
| 56 | * "serial": "10000000000000", "atag": "QEMU" } |
| 57 | * } |
| 58 | */ |
| 59 | static const uint8_t rpdb_eeprom[] = { |
| 60 | 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0x41, |
| 61 | 0x2d, 0xf2, 0xc8, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x63, 0xd1, |
| 62 | 0x41, 0x6e, 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x51, 0x45, 0x4d, 0x55, |
| 63 | 0x20, 0x52, 0x50, 0x44, 0x42, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 64 | 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xc0, 0xc1, 0x00, 0x00, |
| 65 | 0x00, 0x00, 0x00, 0x4d, 0x01, 0x06, 0x19, 0xc8, 0x49, 0x6e, 0x76, 0x65, |
| 66 | 0x6e, 0x74, 0x65, 0x63, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, 0x61, 0x63, |
| 67 | 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x82, 0x2d, |
| 68 | 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x71, 0xd9, |
| 69 | 0xd6, 0xc0, 0xc1, 0x0e |
| 70 | }; |
| 71 | static const size_t rpdb_eeprom_len = sizeof(rpdb_eeprom); |
| 72 | |
| 73 | /* |
| 74 | * "Anacapa L-PDB" FRU data. Generated with frugen. |
| 75 | * |
| 76 | * { |
| 77 | * "board": { "mfg": "Inventec", "pname": "Anacapa QEMU LPDB", |
| 78 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 79 | * "product": { "mfg": "Inventec", "pname": "CI-Anacapa", |
| 80 | * "pn": "10000000001", "ver": "MP", |
| 81 | * "serial": "10000000000000", "atag": "QEMU" } |
| 82 | * } |
| 83 | */ |
| 84 | static const uint8_t lpdb_eeprom[] = { |
| 85 | 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0x41, |
| 86 | 0x2d, 0xf2, 0xc8, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x63, 0xd1, |
| 87 | 0x41, 0x6e, 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x51, 0x45, 0x4d, 0x55, |
| 88 | 0x20, 0x4c, 0x50, 0x44, 0x42, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 89 | 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xc0, 0xc1, 0x00, 0x00, |
| 90 | 0x00, 0x00, 0x00, 0x53, 0x01, 0x06, 0x19, 0xc8, 0x49, 0x6e, 0x76, 0x65, |
| 91 | 0x6e, 0x74, 0x65, 0x63, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, 0x61, 0x63, |
| 92 | 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x82, 0x2d, |
| 93 | 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x71, 0xd9, |
| 94 | 0xd6, 0xc0, 0xc1, 0x0e |
| 95 | }; |
| 96 | static const size_t lpdb_eeprom_len = sizeof(lpdb_eeprom); |
| 97 | |
| 98 | /* |
| 99 | * "Anacapa SCM" FRU data. Generated with frugen. |
| 100 | * |
| 101 | * { |
| 102 | * "board": { "mfg": "Quanta", "pname": "Anacapa SCM", |
| 103 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 104 | * "product": { "mfg": "Quanta", "pname": "CI-Anacapa", |
| 105 | * "pn": "10000000001", "ver": "MP", |
| 106 | * "serial": "10000000000000", "atag": "QEMU" } |
| 107 | * } |
| 108 | */ |
| 109 | static const uint8_t scm_eeprom[] = { |
| 110 | 0x01, 0x00, 0x00, 0x01, 0x07, 0x00, 0x00, 0xf7, 0x01, 0x06, 0x19, 0x41, |
| 111 | 0x2d, 0xf2, 0xc6, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xcb, 0x41, 0x6e, |
| 112 | 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x53, 0x43, 0x4d, 0x47, 0x00, 0x00, |
| 113 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, |
| 114 | 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x01, 0x06, 0x19, 0xc6, |
| 115 | 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, |
| 116 | 0x61, 0x63, 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, |
| 117 | 0x82, 0x2d, 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, |
| 118 | 0x71, 0xd9, 0xd6, 0xc0, 0xc1, 0x00, 0x00, 0xe2 |
| 119 | }; |
| 120 | static const size_t scm_eeprom_len = sizeof(scm_eeprom); |
| 121 | |
| 122 | /* |
| 123 | * "Anacapa BMC Storage Module" FRU data. Generated with frugen. |
| 124 | * |
| 125 | * { |
| 126 | * "board": { "mfg": "Quanta", "pname": "Anacapa BMC Storage Module", |
| 127 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 128 | * "product": { "mfg": "Quanta", "pname": "CI-Anacapa", |
| 129 | * "pn": "10000000001", "ver": "MP", |
| 130 | * "serial": "10000000000000", "atag": "QEMU" } |
| 131 | * } |
| 132 | */ |
| 133 | static const uint8_t bsm_eeprom[] = { |
| 134 | 0x01, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x00, 0xf4, 0x01, 0x09, 0x00, 0x00, |
| 135 | 0x00, 0x00, 0xc6, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xda, 0x41, 0x6e, |
| 136 | 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x42, 0x4d, 0x43, 0x20, 0x53, 0x74, |
| 137 | 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, |
| 138 | 0xce, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, |
| 139 | 0x30, 0x30, 0x30, 0xcb, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, |
| 140 | 0x30, 0x30, 0x30, 0xc0, 0xc1, 0x00, 0x00, 0x10, 0x01, 0x08, 0x00, 0xc6, |
| 141 | 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, |
| 142 | 0x61, 0x63, 0x61, 0x70, 0x61, 0xcb, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, |
| 143 | 0x30, 0x30, 0x30, 0x30, 0x31, 0xc2, 0x4d, 0x50, 0xce, 0x31, 0x30, 0x30, |
| 144 | 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xc4, |
| 145 | 0x51, 0x45, 0x4d, 0x55, 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, |
| 146 | }; |
| 147 | static const size_t bsm_eeprom_len = sizeof(bsm_eeprom); |
| 148 | |
| 149 | /* |
| 150 | * "Anacapa R Bridge Board" FRU data. Generated with frugen. |
| 151 | * |
| 152 | * { |
| 153 | * "board": { "mfg": "Inventec", "pname": "Anacapa QEMU RBB EVT2", |
| 154 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 155 | * "product": { "mfg": "Inventec", "pname": "CI-Anacapa", |
| 156 | * "pn": "10000000001", "ver": "MP", |
| 157 | * "serial": "10000000000000", "atag": "QEMU" } |
| 158 | * } |
| 159 | */ |
| 160 | static const uint8_t rbb_eeprom[] = { |
| 161 | 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0xb4, |
| 162 | 0xa4, 0xf2, 0xc8, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x63, 0xd5, |
| 163 | 0x41, 0x6e, 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x51, 0x45, 0x4d, 0x55, |
| 164 | 0x20, 0x52, 0x42, 0x42, 0x20, 0x45, 0x56, 0x54, 0x32, 0x47, 0x00, 0x00, |
| 165 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, |
| 166 | 0xc0, 0xc1, 0x00, 0x70, 0x01, 0x06, 0x19, 0xc8, 0x49, 0x6e, 0x76, 0x65, |
| 167 | 0x6e, 0x74, 0x65, 0x63, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, 0x61, 0x63, |
| 168 | 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x82, 0x2d, |
| 169 | 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x71, 0xd9, |
| 170 | 0xd6, 0xc0, 0xc1, 0x0e |
| 171 | }; |
| 172 | static const size_t rbb_eeprom_len = sizeof(rbb_eeprom); |
| 173 | |
| 174 | /* |
| 175 | * "Anacapa L Bridge Board" FRU data. Generated with frugen. |
| 176 | * |
| 177 | * { |
| 178 | * "board": { "mfg": "Inventec", "pname": "Anacapa QEMU LBB EVT2", |
| 179 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 180 | * "product": { "mfg": "Inventec", "pname": "CI-Anacapa", |
| 181 | * "pn": "10000000001", "ver": "MP", |
| 182 | * "serial": "10000000000000", "atag": "QEMU" } |
| 183 | * } |
| 184 | */ |
| 185 | static const uint8_t lbb_eeprom[] = { |
| 186 | 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0xb4, |
| 187 | 0xa4, 0xf2, 0xc8, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x63, 0xd5, |
| 188 | 0x41, 0x6e, 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x51, 0x45, 0x4d, 0x55, |
| 189 | 0x20, 0x4c, 0x42, 0x42, 0x20, 0x45, 0x56, 0x54, 0x32, 0x47, 0x00, 0x00, |
| 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, |
| 191 | 0xc0, 0xc1, 0x00, 0x76, 0x01, 0x06, 0x19, 0xc8, 0x49, 0x6e, 0x76, 0x65, |
| 192 | 0x6e, 0x74, 0x65, 0x63, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, 0x61, 0x63, |
| 193 | 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x82, 0x2d, |
| 194 | 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x71, 0xd9, |
| 195 | 0xd6, 0xc0, 0xc1, 0x0e |
| 196 | }; |
| 197 | static const size_t lbb_eeprom_len = sizeof(lbb_eeprom); |
| 198 | |
| 199 | /* |
| 200 | * "Anacapa HPM BRD ID" FRU data. Generated with frugen. |
| 201 | * |
| 202 | * { |
| 203 | * "board": { "mfg": "Inventec", "pname": "Anacapa HPM BRD ID", |
| 204 | * "pn": "00000000000", "serial": "00000000000000" }, |
| 205 | * "product": { "mfg": "Inventec", "pname": "CI-Anacapa", |
| 206 | * "pn": "10000000001", "ver": "MP", |
| 207 | * "serial": "10000000000000", "atag": "QEMU" } |
| 208 | * } |
| 209 | */ |
| 210 | static const uint8_t hpm_brd_id_eeprom[] = { |
| 211 | 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0x41, |
| 212 | 0x2d, 0xf2, 0xc8, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x63, 0xd2, |
| 213 | 0x41, 0x6e, 0x61, 0x63, 0x61, 0x70, 0x61, 0x20, 0x48, 0x50, 0x4d, 0x20, |
| 214 | 0x42, 0x52, 0x44, 0x20, 0x49, 0x44, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 215 | 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xc0, 0xc1, 0x00, |
| 216 | 0x00, 0x00, 0x00, 0x42, 0x01, 0x06, 0x19, 0xc8, 0x49, 0x6e, 0x76, 0x65, |
| 217 | 0x6e, 0x74, 0x65, 0x63, 0xca, 0x43, 0x49, 0x2d, 0x41, 0x6e, 0x61, 0x63, |
| 218 | 0x61, 0x70, 0x61, 0x46, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x82, 0x2d, |
| 219 | 0x0c, 0x47, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x71, 0xd9, |
| 220 | 0xd6, 0xc0, 0xc1, 0x0e |
| 221 | }; |
| 222 | static const size_t hpm_brd_id_eeprom_len = sizeof(hpm_brd_id_eeprom); |
| 223 | |
| 224 | static void anacapa_add_adc128d818(I2CBus *bus, uint8_t addr, |
| 225 | const char *description) |
| 226 | { |
| 227 | DeviceState *dev = DEVICE(i2c_slave_new(TYPE_ADC128D818, addr)); |
| 228 | g_autofree char *childname = g_strdup_printf("0x%02x", addr); |
| 229 | |
| 230 | qdev_prop_set_string(dev, "description", description); |
| 231 | object_property_add_child(OBJECT(bus), childname, OBJECT(dev)); |
| 232 | i2c_slave_realize_and_unref(I2C_SLAVE(dev), bus, &error_fatal); |
| 233 | } |
| 234 | |
| 235 | static void anacapa_bmc_i2c_init(AspeedMachineState *bmc) |
| 236 | { |
| 237 | /* Reference: aspeed-bmc-facebook-anacapa.dts */ |
| 238 | |
| 239 | AspeedSoCState *soc = bmc->soc; |
| 240 | I2CBus *i2c[16] = {}; |
| 241 | I2CSlave *i2c_mux; |
| 242 | |
| 243 | for (int i = 0; i < ARRAY_SIZE(i2c); i++) { |
| 244 | i2c[i] = aspeed_i2c_get_bus(&soc->i2c, i); |
| 245 | } |
| 246 | |
| 247 | /* &i2c0 */ |
| 248 | /* eeprom@50 */ |
| 249 | at24c_eeprom_init(i2c[0], 0x50, 256 * KiB); |
| 250 | /* i2c-mux@70 */ |
| 251 | i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x70); |
| 252 | |
| 253 | /* &i2c1 */ |
| 254 | /* eeprom@50 */ |
| 255 | at24c_eeprom_init(i2c[1], 0x50, 256 * KiB); |
| 256 | /* i2c-mux@70 (PCA9546) - 4 channels, empty */ |
| 257 | i2c_slave_create_simple(i2c[1], TYPE_PCA9546, 0x70); |
| 258 | |
| 259 | /* &i2c4 */ |
| 260 | /* i2c-mux@70 (PCA9548) */ |
| 261 | i2c_slave_create_simple(i2c[4], TYPE_PCA9548, 0x70); |
| 262 | |
| 263 | /* &i2c6 */ |
| 264 | /* eeprom@50 */ |
| 265 | at24c_eeprom_init_rom(i2c[6], 0x50, 32 * KiB, |
| 266 | hpm_eeprom, hpm_eeprom_len); |
| 267 | |
| 268 | /* &i2c8 */ |
| 269 | /* i2c-mux@72 (PCA9546) */ |
| 270 | i2c_mux = i2c_slave_create_simple(i2c[8], TYPE_PCA9546, 0x72); |
| 271 | |
| 272 | /* i2c8mux ch0 */ |
| 273 | /* adc128d818@1f - R-PDB ADC (mode 1: 8 voltage channels) */ |
| 274 | anacapa_add_adc128d818(pca954x_i2c_get_bus(i2c_mux, 0), 0x1f, "i2c8:0:1f"); |
| 275 | /* pca9555@22 */ |
| 276 | i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0), |
| 277 | TYPE_PCA9552, 0x22); |
| 278 | /* pca9555@24 */ |
| 279 | i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0), |
| 280 | TYPE_PCA9552, 0x24); |
| 281 | /* eeprom@50 */ |
| 282 | at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 16 * KiB, |
| 283 | rpdb_eeprom, rpdb_eeprom_len); |
| 284 | |
| 285 | /* i2c8mux ch1 */ |
| 286 | /* pca9555@22 */ |
| 287 | i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 1), |
| 288 | TYPE_PCA9552, 0x22); |
| 289 | /* pca9555@24 */ |
| 290 | i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 1), |
| 291 | TYPE_PCA9552, 0x24); |
| 292 | /* eeprom@50 */ |
| 293 | at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 1), 0x50, 16 * KiB, |
| 294 | lpdb_eeprom, lpdb_eeprom_len); |
| 295 | |
| 296 | /* &i2c9 */ |
| 297 | /* eeprom@50 */ |
| 298 | at24c_eeprom_init_rom(i2c[9], 0x50, 16 * KiB, |
| 299 | scm_eeprom, scm_eeprom_len); |
| 300 | /* eeprom@56 */ |
| 301 | at24c_eeprom_init_rom(i2c[9], 0x56, 8 * KiB, |
| 302 | bsm_eeprom, bsm_eeprom_len); |
| 303 | |
| 304 | /* &i2c10 */ |
| 305 | /* i2c-mux@71 (PCA9548) */ |
| 306 | i2c_mux = i2c_slave_create_simple(i2c[10], TYPE_PCA9548, 0x71); |
| 307 | |
| 308 | /* i2c10mux ch5 */ |
| 309 | /* pca9555@22*/ |
| 310 | i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), |
| 311 | TYPE_PCA9552, 0x22); |
| 312 | /* eeprom@52 */ |
| 313 | at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 5), 0x52, 32 * KiB, |
| 314 | rbb_eeprom, rbb_eeprom_len); |
| 315 | |
| 316 | /* &i2c11 */ |
| 317 | /* i2c-mux@71 (PCA9548) */ |
| 318 | i2c_mux = i2c_slave_create_simple(i2c[11], TYPE_PCA9548, 0x71); |
| 319 | |
| 320 | /* i2c11mux ch0-ch4 - empty */ |
| 321 | |
| 322 | /* i2c11mux ch5 */ |
| 323 | /* pca9555@22 */ |
| 324 | i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), |
| 325 | TYPE_PCA9552, 0x22); |
| 326 | /* eeprom@52 */ |
| 327 | at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 5), 0x52, 32 * KiB, |
| 328 | lbb_eeprom, lbb_eeprom_len); |
| 329 | |
| 330 | /* &i2c13 */ |
| 331 | /* i2c-mux@70 (PCA9548) */ |
| 332 | i2c_mux = i2c_slave_create_simple(i2c[13], TYPE_PCA9548, 0x70); |
| 333 | |
| 334 | /* i2c13mux ch3 */ |
| 335 | /* adc128d818@1f - MB ADC (mode 1: 8 voltage channels) */ |
| 336 | anacapa_add_adc128d818(pca954x_i2c_get_bus(i2c_mux, 3), 0x1f, "i2c13:3:1f"); |
| 337 | |
| 338 | /* i2c13mux ch4 */ |
| 339 | /* eeprom@51 */ |
| 340 | at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 4), 0x51, 32 * KiB, |
| 341 | hpm_brd_id_eeprom, hpm_brd_id_eeprom_len); |
| 342 | |
| 343 | /* i2c13mux ch7 */ |
| 344 | /* nfc@28 - no model */ |
| 345 | } |
| 346 | |
| 347 | static void aspeed_machine_anacapa_class_init(ObjectClass *oc, |
| 348 | const void *data) |
| 349 | { |
| 350 | MachineClass *mc = MACHINE_CLASS(oc); |
| 351 | AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc); |
| 352 | |
| 353 | mc->desc = "Facebook Anacapa BMC (Cortex-A7)"; |
| 354 | amc->soc_name = "ast2600-a3"; |
| 355 | amc->hw_strap1 = ANACAPA_BMC_HW_STRAP1; |
| 356 | amc->hw_strap2 = ANACAPA_BMC_HW_STRAP2; |
| 357 | amc->fmc_model = "mx66l1g45g"; |
| 358 | amc->spi_model = NULL; |
| 359 | amc->num_cs = 2; |
| 360 | amc->macs_mask = ASPEED_MAC2_ON; |
| 361 | amc->i2c_init = anacapa_bmc_i2c_init; |
| 362 | mc->default_ram_size = ANACAPA_BMC_RAM_SIZE; |
| 363 | aspeed_machine_class_init_cpus_defaults(mc); |
| 364 | } |
| 365 | |
| 366 | static const TypeInfo aspeed_ast2600_anacapa_types[] = { |
| 367 | { |
| 368 | .name = MACHINE_TYPE_NAME("anacapa-bmc"), |
| 369 | .parent = TYPE_ASPEED_MACHINE, |
| 370 | .class_init = aspeed_machine_anacapa_class_init, |
| 371 | .interfaces = arm_machine_interfaces, |
| 372 | } |
| 373 | }; |
| 374 | |
| 375 | DEFINE_TYPES(aspeed_ast2600_anacapa_types) |