aspeed.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. /*
  2. * OpenPOWER Palmetto BMC
  3. *
  4. * Andrew Jeffery <andrew@aj.id.au>
  5. *
  6. * Copyright 2016 IBM Corp.
  7. *
  8. * This code is licensed under the GPL version 2 or later. See
  9. * the COPYING file in the top-level directory.
  10. */
  11. #include "qemu/osdep.h"
  12. #include "qapi/error.h"
  13. #include "cpu.h"
  14. #include "exec/address-spaces.h"
  15. #include "hw/arm/boot.h"
  16. #include "hw/arm/aspeed.h"
  17. #include "hw/arm/aspeed_soc.h"
  18. #include "hw/boards.h"
  19. #include "hw/i2c/smbus_eeprom.h"
  20. #include "hw/misc/pca9552.h"
  21. #include "hw/misc/tmp105.h"
  22. #include "hw/qdev-properties.h"
  23. #include "qemu/log.h"
  24. #include "sysemu/block-backend.h"
  25. #include "sysemu/sysemu.h"
  26. #include "hw/loader.h"
  27. #include "qemu/error-report.h"
  28. #include "qemu/units.h"
  29. static struct arm_boot_info aspeed_board_binfo = {
  30. .board_id = -1, /* device-tree-only board */
  31. };
  32. struct AspeedBoardState {
  33. AspeedSoCState soc;
  34. MemoryRegion ram_container;
  35. MemoryRegion ram;
  36. MemoryRegion max_ram;
  37. };
  38. /* Palmetto hardware value: 0x120CE416 */
  39. #define PALMETTO_BMC_HW_STRAP1 ( \
  40. SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_256MB) | \
  41. SCU_AST2400_HW_STRAP_DRAM_CONFIG(2 /* DDR3 with CL=6, CWL=5 */) | \
  42. SCU_AST2400_HW_STRAP_ACPI_DIS | \
  43. SCU_AST2400_HW_STRAP_SET_CLK_SOURCE(AST2400_CLK_48M_IN) | \
  44. SCU_HW_STRAP_VGA_CLASS_CODE | \
  45. SCU_HW_STRAP_LPC_RESET_PIN | \
  46. SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_M_S_EN) | \
  47. SCU_AST2400_HW_STRAP_SET_CPU_AHB_RATIO(AST2400_CPU_AHB_RATIO_2_1) | \
  48. SCU_HW_STRAP_SPI_WIDTH | \
  49. SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) | \
  50. SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT))
  51. /* AST2500 evb hardware value: 0xF100C2E6 */
  52. #define AST2500_EVB_HW_STRAP1 (( \
  53. AST2500_HW_STRAP1_DEFAULTS | \
  54. SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
  55. SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
  56. SCU_AST2500_HW_STRAP_UART_DEBUG | \
  57. SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
  58. SCU_HW_STRAP_MAC1_RGMII | \
  59. SCU_HW_STRAP_MAC0_RGMII) & \
  60. ~SCU_HW_STRAP_2ND_BOOT_WDT)
  61. /* Romulus hardware value: 0xF10AD206 */
  62. #define ROMULUS_BMC_HW_STRAP1 ( \
  63. AST2500_HW_STRAP1_DEFAULTS | \
  64. SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
  65. SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
  66. SCU_AST2500_HW_STRAP_UART_DEBUG | \
  67. SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
  68. SCU_AST2500_HW_STRAP_ACPI_ENABLE | \
  69. SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
  70. /* Swift hardware value: 0xF11AD206 */
  71. #define SWIFT_BMC_HW_STRAP1 ( \
  72. AST2500_HW_STRAP1_DEFAULTS | \
  73. SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
  74. SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
  75. SCU_AST2500_HW_STRAP_UART_DEBUG | \
  76. SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
  77. SCU_H_PLL_BYPASS_EN | \
  78. SCU_AST2500_HW_STRAP_ACPI_ENABLE | \
  79. SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
  80. /* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
  81. #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
  82. /* AST2600 evb hardware value */
  83. #define AST2600_EVB_HW_STRAP1 0x000000C0
  84. #define AST2600_EVB_HW_STRAP2 0x00000003
  85. /*
  86. * The max ram region is for firmwares that scan the address space
  87. * with load/store to guess how much RAM the SoC has.
  88. */
  89. static uint64_t max_ram_read(void *opaque, hwaddr offset, unsigned size)
  90. {
  91. return 0;
  92. }
  93. static void max_ram_write(void *opaque, hwaddr offset, uint64_t value,
  94. unsigned size)
  95. {
  96. /* Discard writes */
  97. }
  98. static const MemoryRegionOps max_ram_ops = {
  99. .read = max_ram_read,
  100. .write = max_ram_write,
  101. .endianness = DEVICE_NATIVE_ENDIAN,
  102. };
  103. #define FIRMWARE_ADDR 0x0
  104. static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
  105. Error **errp)
  106. {
  107. BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
  108. uint8_t *storage;
  109. int64_t size;
  110. /* The block backend size should have already been 'validated' by
  111. * the creation of the m25p80 object.
  112. */
  113. size = blk_getlength(blk);
  114. if (size <= 0) {
  115. error_setg(errp, "failed to get flash size");
  116. return;
  117. }
  118. if (rom_size > size) {
  119. rom_size = size;
  120. }
  121. storage = g_new0(uint8_t, rom_size);
  122. if (blk_pread(blk, 0, storage, rom_size) < 0) {
  123. error_setg(errp, "failed to read the initial flash content");
  124. return;
  125. }
  126. rom_add_blob_fixed("aspeed.boot_rom", storage, rom_size, addr);
  127. g_free(storage);
  128. }
  129. static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
  130. Error **errp)
  131. {
  132. int i ;
  133. for (i = 0; i < s->num_cs; ++i) {
  134. AspeedSMCFlash *fl = &s->flashes[i];
  135. DriveInfo *dinfo = drive_get_next(IF_MTD);
  136. qemu_irq cs_line;
  137. fl->flash = ssi_create_slave_no_init(s->spi, flashtype);
  138. if (dinfo) {
  139. qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo),
  140. errp);
  141. }
  142. qdev_init_nofail(fl->flash);
  143. cs_line = qdev_get_gpio_in_named(fl->flash, SSI_GPIO_CS, 0);
  144. sysbus_connect_irq(SYS_BUS_DEVICE(s), i + 1, cs_line);
  145. }
  146. }
  147. static void aspeed_board_init(MachineState *machine,
  148. const AspeedBoardConfig *cfg)
  149. {
  150. AspeedBoardState *bmc;
  151. AspeedSoCClass *sc;
  152. DriveInfo *drive0 = drive_get(IF_MTD, 0, 0);
  153. ram_addr_t max_ram_size;
  154. int i;
  155. bmc = g_new0(AspeedBoardState, 1);
  156. memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container",
  157. UINT32_MAX);
  158. object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
  159. (sizeof(bmc->soc)), cfg->soc_name, &error_abort,
  160. NULL);
  161. sc = ASPEED_SOC_GET_CLASS(&bmc->soc);
  162. object_property_set_uint(OBJECT(&bmc->soc), ram_size, "ram-size",
  163. &error_abort);
  164. object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
  165. &error_abort);
  166. object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap2, "hw-strap2",
  167. &error_abort);
  168. object_property_set_int(OBJECT(&bmc->soc), cfg->num_cs, "num-cs",
  169. &error_abort);
  170. object_property_set_int(OBJECT(&bmc->soc), machine->smp.cpus, "num-cpus",
  171. &error_abort);
  172. object_property_set_link(OBJECT(&bmc->soc), OBJECT(&bmc->ram_container),
  173. "dram", &error_abort);
  174. if (machine->kernel_filename) {
  175. /*
  176. * When booting with a -kernel command line there is no u-boot
  177. * that runs to unlock the SCU. In this case set the default to
  178. * be unlocked as the kernel expects
  179. */
  180. object_property_set_int(OBJECT(&bmc->soc), ASPEED_SCU_PROT_KEY,
  181. "hw-prot-key", &error_abort);
  182. }
  183. object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
  184. &error_abort);
  185. /*
  186. * Allocate RAM after the memory controller has checked the size
  187. * was valid. If not, a default value is used.
  188. */
  189. ram_size = object_property_get_uint(OBJECT(&bmc->soc), "ram-size",
  190. &error_abort);
  191. memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
  192. memory_region_add_subregion(&bmc->ram_container, 0, &bmc->ram);
  193. memory_region_add_subregion(get_system_memory(),
  194. sc->memmap[ASPEED_SDRAM],
  195. &bmc->ram_container);
  196. max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size",
  197. &error_abort);
  198. memory_region_init_io(&bmc->max_ram, NULL, &max_ram_ops, NULL,
  199. "max_ram", max_ram_size - ram_size);
  200. memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_ram);
  201. aspeed_board_init_flashes(&bmc->soc.fmc, cfg->fmc_model, &error_abort);
  202. aspeed_board_init_flashes(&bmc->soc.spi[0], cfg->spi_model, &error_abort);
  203. /* Install first FMC flash content as a boot rom. */
  204. if (drive0) {
  205. AspeedSMCFlash *fl = &bmc->soc.fmc.flashes[0];
  206. MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
  207. /*
  208. * create a ROM region using the default mapping window size of
  209. * the flash module. The window size is 64MB for the AST2400
  210. * SoC and 128MB for the AST2500 SoC, which is twice as big as
  211. * needed by the flash modules of the Aspeed machines.
  212. */
  213. memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
  214. fl->size, &error_abort);
  215. memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
  216. boot_rom);
  217. write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort);
  218. }
  219. aspeed_board_binfo.ram_size = ram_size;
  220. aspeed_board_binfo.loader_start = sc->memmap[ASPEED_SDRAM];
  221. aspeed_board_binfo.nb_cpus = bmc->soc.num_cpus;
  222. if (cfg->i2c_init) {
  223. cfg->i2c_init(bmc);
  224. }
  225. for (i = 0; i < ARRAY_SIZE(bmc->soc.sdhci.slots); i++) {
  226. SDHCIState *sdhci = &bmc->soc.sdhci.slots[i];
  227. DriveInfo *dinfo = drive_get_next(IF_SD);
  228. BlockBackend *blk;
  229. DeviceState *card;
  230. blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
  231. card = qdev_create(qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
  232. TYPE_SD_CARD);
  233. qdev_prop_set_drive(card, "drive", blk, &error_fatal);
  234. object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
  235. }
  236. arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
  237. }
  238. static void palmetto_bmc_i2c_init(AspeedBoardState *bmc)
  239. {
  240. AspeedSoCState *soc = &bmc->soc;
  241. DeviceState *dev;
  242. uint8_t *eeprom_buf = g_malloc0(32 * 1024);
  243. /* The palmetto platform expects a ds3231 RTC but a ds1338 is
  244. * enough to provide basic RTC features. Alarms will be missing */
  245. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), "ds1338", 0x68);
  246. smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), 0x50,
  247. eeprom_buf);
  248. /* add a TMP423 temperature sensor */
  249. dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2),
  250. "tmp423", 0x4c);
  251. object_property_set_int(OBJECT(dev), 31000, "temperature0", &error_abort);
  252. object_property_set_int(OBJECT(dev), 28000, "temperature1", &error_abort);
  253. object_property_set_int(OBJECT(dev), 20000, "temperature2", &error_abort);
  254. object_property_set_int(OBJECT(dev), 110000, "temperature3", &error_abort);
  255. }
  256. static void ast2500_evb_i2c_init(AspeedBoardState *bmc)
  257. {
  258. AspeedSoCState *soc = &bmc->soc;
  259. uint8_t *eeprom_buf = g_malloc0(8 * 1024);
  260. smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), 0x50,
  261. eeprom_buf);
  262. /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
  263. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7),
  264. TYPE_TMP105, 0x4d);
  265. /* The AST2500 EVB does not have an RTC. Let's pretend that one is
  266. * plugged on the I2C bus header */
  267. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
  268. }
  269. static void ast2600_evb_i2c_init(AspeedBoardState *bmc)
  270. {
  271. /* Start with some devices on our I2C busses */
  272. ast2500_evb_i2c_init(bmc);
  273. }
  274. static void romulus_bmc_i2c_init(AspeedBoardState *bmc)
  275. {
  276. AspeedSoCState *soc = &bmc->soc;
  277. /* The romulus board expects Epson RX8900 I2C RTC but a ds1338 is
  278. * good enough */
  279. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
  280. }
  281. static void swift_bmc_i2c_init(AspeedBoardState *bmc)
  282. {
  283. AspeedSoCState *soc = &bmc->soc;
  284. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60);
  285. /* The swift board expects a TMP275 but a TMP105 is compatible */
  286. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x48);
  287. /* The swift board expects a pca9551 but a pca9552 is compatible */
  288. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "pca9552", 0x60);
  289. /* The swift board expects an Epson RX8900 RTC but a ds1338 is compatible */
  290. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 8), "ds1338", 0x32);
  291. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 8), "pca9552", 0x60);
  292. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp423", 0x4c);
  293. /* The swift board expects a pca9539 but a pca9552 is compatible */
  294. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "pca9552", 0x74);
  295. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 10), "tmp423", 0x4c);
  296. /* The swift board expects a pca9539 but a pca9552 is compatible */
  297. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 10), "pca9552",
  298. 0x74);
  299. /* The swift board expects a TMP275 but a TMP105 is compatible */
  300. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 12), "tmp105", 0x48);
  301. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 12), "tmp105", 0x4a);
  302. }
  303. static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
  304. {
  305. AspeedSoCState *soc = &bmc->soc;
  306. uint8_t *eeprom_buf = g_malloc0(8 * 1024);
  307. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), TYPE_PCA9552,
  308. 0x60);
  309. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c);
  310. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c);
  311. /* The Witherspoon expects a TMP275 but a TMP105 is compatible */
  312. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), TYPE_TMP105,
  313. 0x4a);
  314. /* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is
  315. * good enough */
  316. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
  317. smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51,
  318. eeprom_buf);
  319. i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), TYPE_PCA9552,
  320. 0x60);
  321. }
  322. static void aspeed_machine_init(MachineState *machine)
  323. {
  324. AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(machine);
  325. aspeed_board_init(machine, amc->board);
  326. }
  327. static void aspeed_machine_class_init(ObjectClass *oc, void *data)
  328. {
  329. MachineClass *mc = MACHINE_CLASS(oc);
  330. AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
  331. const AspeedBoardConfig *board = data;
  332. mc->desc = board->desc;
  333. mc->init = aspeed_machine_init;
  334. mc->max_cpus = ASPEED_CPUS_NUM;
  335. mc->no_floppy = 1;
  336. mc->no_cdrom = 1;
  337. mc->no_parallel = 1;
  338. if (board->ram) {
  339. mc->default_ram_size = board->ram;
  340. }
  341. amc->board = board;
  342. }
  343. static const TypeInfo aspeed_machine_type = {
  344. .name = TYPE_ASPEED_MACHINE,
  345. .parent = TYPE_MACHINE,
  346. .instance_size = sizeof(AspeedMachine),
  347. .class_size = sizeof(AspeedMachineClass),
  348. .abstract = true,
  349. };
  350. static const AspeedBoardConfig aspeed_boards[] = {
  351. {
  352. .name = MACHINE_TYPE_NAME("palmetto-bmc"),
  353. .desc = "OpenPOWER Palmetto BMC (ARM926EJ-S)",
  354. .soc_name = "ast2400-a1",
  355. .hw_strap1 = PALMETTO_BMC_HW_STRAP1,
  356. .fmc_model = "n25q256a",
  357. .spi_model = "mx25l25635e",
  358. .num_cs = 1,
  359. .i2c_init = palmetto_bmc_i2c_init,
  360. .ram = 256 * MiB,
  361. }, {
  362. .name = MACHINE_TYPE_NAME("ast2500-evb"),
  363. .desc = "Aspeed AST2500 EVB (ARM1176)",
  364. .soc_name = "ast2500-a1",
  365. .hw_strap1 = AST2500_EVB_HW_STRAP1,
  366. .fmc_model = "w25q256",
  367. .spi_model = "mx25l25635e",
  368. .num_cs = 1,
  369. .i2c_init = ast2500_evb_i2c_init,
  370. .ram = 512 * MiB,
  371. }, {
  372. .name = MACHINE_TYPE_NAME("romulus-bmc"),
  373. .desc = "OpenPOWER Romulus BMC (ARM1176)",
  374. .soc_name = "ast2500-a1",
  375. .hw_strap1 = ROMULUS_BMC_HW_STRAP1,
  376. .fmc_model = "n25q256a",
  377. .spi_model = "mx66l1g45g",
  378. .num_cs = 2,
  379. .i2c_init = romulus_bmc_i2c_init,
  380. .ram = 512 * MiB,
  381. }, {
  382. .name = MACHINE_TYPE_NAME("swift-bmc"),
  383. .desc = "OpenPOWER Swift BMC (ARM1176)",
  384. .soc_name = "ast2500-a1",
  385. .hw_strap1 = SWIFT_BMC_HW_STRAP1,
  386. .fmc_model = "mx66l1g45g",
  387. .spi_model = "mx66l1g45g",
  388. .num_cs = 2,
  389. .i2c_init = swift_bmc_i2c_init,
  390. .ram = 512 * MiB,
  391. }, {
  392. .name = MACHINE_TYPE_NAME("witherspoon-bmc"),
  393. .desc = "OpenPOWER Witherspoon BMC (ARM1176)",
  394. .soc_name = "ast2500-a1",
  395. .hw_strap1 = WITHERSPOON_BMC_HW_STRAP1,
  396. .fmc_model = "mx25l25635e",
  397. .spi_model = "mx66l1g45g",
  398. .num_cs = 2,
  399. .i2c_init = witherspoon_bmc_i2c_init,
  400. .ram = 512 * MiB,
  401. }, {
  402. .name = MACHINE_TYPE_NAME("ast2600-evb"),
  403. .desc = "Aspeed AST2600 EVB (Cortex A7)",
  404. .soc_name = "ast2600-a0",
  405. .hw_strap1 = AST2600_EVB_HW_STRAP1,
  406. .hw_strap2 = AST2600_EVB_HW_STRAP2,
  407. .fmc_model = "w25q512jv",
  408. .spi_model = "mx66u51235f",
  409. .num_cs = 1,
  410. .i2c_init = ast2600_evb_i2c_init,
  411. .ram = 1 * GiB,
  412. },
  413. };
  414. static void aspeed_machine_types(void)
  415. {
  416. int i;
  417. type_register_static(&aspeed_machine_type);
  418. for (i = 0; i < ARRAY_SIZE(aspeed_boards); ++i) {
  419. TypeInfo ti = {
  420. .name = aspeed_boards[i].name,
  421. .parent = TYPE_ASPEED_MACHINE,
  422. .class_init = aspeed_machine_class_init,
  423. .class_data = (void *)&aspeed_boards[i],
  424. };
  425. type_register(&ti);
  426. }
  427. }
  428. type_init(aspeed_machine_types)