2016-03-16 18:06:00 +01:00
|
|
|
/*
|
2016-09-22 19:13:05 +02:00
|
|
|
* ASPEED SoC family
|
2016-03-16 18:06:00 +01:00
|
|
|
*
|
|
|
|
* Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
*
|
|
|
|
* Copyright 2016 IBM Corp.
|
|
|
|
*
|
|
|
|
* This code is licensed under the GPL version 2 or later. See
|
|
|
|
* the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
2016-09-22 19:13:05 +02:00
|
|
|
#ifndef ASPEED_SOC_H
|
|
|
|
#define ASPEED_SOC_H
|
2016-03-16 18:06:00 +01:00
|
|
|
|
2019-09-25 16:32:43 +02:00
|
|
|
#include "hw/cpu/a15mpcore.h"
|
2022-05-02 17:03:03 +02:00
|
|
|
#include "hw/arm/armv7m.h"
|
2016-03-16 18:06:00 +01:00
|
|
|
#include "hw/intc/aspeed_vic.h"
|
2016-06-27 16:37:33 +02:00
|
|
|
#include "hw/misc/aspeed_scu.h"
|
2021-10-12 08:20:08 +02:00
|
|
|
#include "hw/adc/aspeed_adc.h"
|
2016-09-06 20:52:17 +02:00
|
|
|
#include "hw/misc/aspeed_sdmc.h"
|
2019-07-01 18:26:18 +02:00
|
|
|
#include "hw/misc/aspeed_xdma.h"
|
2016-03-16 18:06:00 +01:00
|
|
|
#include "hw/timer/aspeed_timer.h"
|
2019-10-04 01:04:01 +02:00
|
|
|
#include "hw/rtc/aspeed_rtc.h"
|
2016-06-06 17:59:29 +02:00
|
|
|
#include "hw/i2c/aspeed_i2c.h"
|
2022-01-11 09:45:46 +01:00
|
|
|
#include "hw/misc/aspeed_i3c.h"
|
2016-07-04 14:06:37 +02:00
|
|
|
#include "hw/ssi/aspeed_smc.h"
|
2021-05-01 10:03:51 +02:00
|
|
|
#include "hw/misc/aspeed_hace.h"
|
2022-02-18 09:18:10 +01:00
|
|
|
#include "hw/misc/aspeed_sbc.h"
|
2017-02-07 19:29:59 +01:00
|
|
|
#include "hw/watchdog/wdt_aspeed.h"
|
2017-04-14 10:35:02 +02:00
|
|
|
#include "hw/net/ftgmac100.h"
|
2019-08-12 07:23:31 +02:00
|
|
|
#include "target/arm/cpu.h"
|
2019-09-04 09:04:58 +02:00
|
|
|
#include "hw/gpio/aspeed_gpio.h"
|
2019-09-25 16:32:27 +02:00
|
|
|
#include "hw/sd/aspeed_sdhci.h"
|
2020-02-06 19:34:37 +01:00
|
|
|
#include "hw/usb/hcd-ehci.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2021-03-09 12:01:28 +01:00
|
|
|
#include "hw/misc/aspeed_lpc.h"
|
2022-06-30 09:21:13 +02:00
|
|
|
#include "hw/misc/unimp.h"
|
2022-06-30 09:21:14 +02:00
|
|
|
#include "hw/misc/aspeed_peci.h"
|
aspeed: Refactor UART init for multi-SoC machines
This change moves the code that connects the SoC UART's to serial_hd's
to the machine.
It makes each UART a proper child member of the SoC, and then allows the
machine to selectively initialize the chardev for each UART with a
serial_hd.
This should preserve backwards compatibility, but also allow multi-SoC
boards to completely change the wiring of serial devices from the
command line to specific SoC UART's.
This also removes the uart-default property from the SoC, since the SoC
doesn't need to know what UART is the "default" on the machine anymore.
I tested this using the images and commands from the previous
refactoring, and another test image for the ast1030:
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/fuji.mtd
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/wedge100.mtd
wget https://github.com/peterdelevoryas/OpenBIC/releases/download/oby35-cl-2022.13.01/Y35BCL.elf
Fuji uses UART1:
qemu-system-arm -machine fuji-bmc \
-drive file=fuji.mtd,format=raw,if=mtd \
-nographic
ast2600-evb uses uart-default=UART5:
qemu-system-arm -machine ast2600-evb \
-drive file=fuji.mtd,format=raw,if=mtd \
-serial null -serial mon:stdio -display none
Wedge100 uses UART3:
qemu-system-arm -machine palmetto-bmc \
-drive file=wedge100.mtd,format=raw,if=mtd \
-serial null -serial null -serial null \
-serial mon:stdio -display none
AST1030 EVB uses UART5:
qemu-system-arm -machine ast1030-evb \
-kernel Y35BCL.elf -nographic
Fixes: 6827ff20b2975 ("hw: aspeed: Init all UART's with serial devices")
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220705191400.41632-4-peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-07-14 16:24:38 +02:00
|
|
|
#include "hw/char/serial.h"
|
2016-03-16 18:06:00 +01:00
|
|
|
|
2016-10-17 20:22:16 +02:00
|
|
|
#define ASPEED_SPIS_NUM 2
|
2020-02-06 19:34:37 +01:00
|
|
|
#define ASPEED_EHCIS_NUM 2
|
2019-09-25 16:32:36 +02:00
|
|
|
#define ASPEED_WDTS_NUM 4
|
2019-07-01 18:26:16 +02:00
|
|
|
#define ASPEED_CPUS_NUM 2
|
2019-09-25 16:32:46 +02:00
|
|
|
#define ASPEED_MACS_NUM 4
|
aspeed: Refactor UART init for multi-SoC machines
This change moves the code that connects the SoC UART's to serial_hd's
to the machine.
It makes each UART a proper child member of the SoC, and then allows the
machine to selectively initialize the chardev for each UART with a
serial_hd.
This should preserve backwards compatibility, but also allow multi-SoC
boards to completely change the wiring of serial devices from the
command line to specific SoC UART's.
This also removes the uart-default property from the SoC, since the SoC
doesn't need to know what UART is the "default" on the machine anymore.
I tested this using the images and commands from the previous
refactoring, and another test image for the ast1030:
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/fuji.mtd
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/wedge100.mtd
wget https://github.com/peterdelevoryas/OpenBIC/releases/download/oby35-cl-2022.13.01/Y35BCL.elf
Fuji uses UART1:
qemu-system-arm -machine fuji-bmc \
-drive file=fuji.mtd,format=raw,if=mtd \
-nographic
ast2600-evb uses uart-default=UART5:
qemu-system-arm -machine ast2600-evb \
-drive file=fuji.mtd,format=raw,if=mtd \
-serial null -serial mon:stdio -display none
Wedge100 uses UART3:
qemu-system-arm -machine palmetto-bmc \
-drive file=wedge100.mtd,format=raw,if=mtd \
-serial null -serial null -serial null \
-serial mon:stdio -display none
AST1030 EVB uses UART5:
qemu-system-arm -machine ast1030-evb \
-kernel Y35BCL.elf -nographic
Fixes: 6827ff20b2975 ("hw: aspeed: Init all UART's with serial devices")
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220705191400.41632-4-peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-07-14 16:24:38 +02:00
|
|
|
#define ASPEED_UARTS_NUM 13
|
2016-10-17 20:22:16 +02:00
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct AspeedSoCState {
|
2016-03-16 18:06:00 +01:00
|
|
|
/*< private >*/
|
|
|
|
DeviceState parent;
|
|
|
|
|
|
|
|
/*< public >*/
|
2019-07-01 18:26:16 +02:00
|
|
|
ARMCPU cpu[ASPEED_CPUS_NUM];
|
2019-09-25 16:32:43 +02:00
|
|
|
A15MPPrivState a7mpcore;
|
2022-05-02 17:03:03 +02:00
|
|
|
ARMv7MState armv7m;
|
2022-06-30 09:21:13 +02:00
|
|
|
MemoryRegion *memory;
|
2019-11-19 15:11:57 +01:00
|
|
|
MemoryRegion *dram_mr;
|
2022-06-30 09:21:13 +02:00
|
|
|
MemoryRegion dram_container;
|
2016-12-27 15:59:27 +01:00
|
|
|
MemoryRegion sram;
|
2016-03-16 18:06:00 +01:00
|
|
|
AspeedVICState vic;
|
2019-07-01 18:26:16 +02:00
|
|
|
AspeedRtcState rtc;
|
2016-03-16 18:06:00 +01:00
|
|
|
AspeedTimerCtrlState timerctrl;
|
2016-06-06 17:59:29 +02:00
|
|
|
AspeedI2CState i2c;
|
2022-01-11 09:45:46 +01:00
|
|
|
AspeedI3CState i3c;
|
2016-06-27 16:37:33 +02:00
|
|
|
AspeedSCUState scu;
|
2021-05-01 10:03:51 +02:00
|
|
|
AspeedHACEState hace;
|
2019-07-01 18:26:18 +02:00
|
|
|
AspeedXDMAState xdma;
|
2021-10-12 08:20:08 +02:00
|
|
|
AspeedADCState adc;
|
2016-10-17 20:22:16 +02:00
|
|
|
AspeedSMCState fmc;
|
2016-10-17 20:22:16 +02:00
|
|
|
AspeedSMCState spi[ASPEED_SPIS_NUM];
|
2020-02-06 19:34:37 +01:00
|
|
|
EHCISysBusState ehci[ASPEED_EHCIS_NUM];
|
2022-02-18 09:18:10 +01:00
|
|
|
AspeedSBCState sbc;
|
2022-06-30 09:21:13 +02:00
|
|
|
UnimplementedDeviceState sbc_unimplemented;
|
2016-09-06 20:52:17 +02:00
|
|
|
AspeedSDMCState sdmc;
|
2017-07-11 12:21:26 +02:00
|
|
|
AspeedWDTState wdt[ASPEED_WDTS_NUM];
|
2019-07-01 18:26:16 +02:00
|
|
|
FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
|
2019-09-25 16:32:47 +02:00
|
|
|
AspeedMiiState mii[ASPEED_MACS_NUM];
|
2019-09-04 09:04:58 +02:00
|
|
|
AspeedGPIOState gpio;
|
2019-09-25 16:32:43 +02:00
|
|
|
AspeedGPIOState gpio_1_8v;
|
2019-09-25 16:32:27 +02:00
|
|
|
AspeedSDHCIState sdhci;
|
2020-01-30 17:02:02 +01:00
|
|
|
AspeedSDHCIState emmc;
|
2021-03-09 12:01:28 +01:00
|
|
|
AspeedLPCState lpc;
|
2022-06-30 09:21:14 +02:00
|
|
|
AspeedPECIState peci;
|
aspeed: Refactor UART init for multi-SoC machines
This change moves the code that connects the SoC UART's to serial_hd's
to the machine.
It makes each UART a proper child member of the SoC, and then allows the
machine to selectively initialize the chardev for each UART with a
serial_hd.
This should preserve backwards compatibility, but also allow multi-SoC
boards to completely change the wiring of serial devices from the
command line to specific SoC UART's.
This also removes the uart-default property from the SoC, since the SoC
doesn't need to know what UART is the "default" on the machine anymore.
I tested this using the images and commands from the previous
refactoring, and another test image for the ast1030:
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/fuji.mtd
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/wedge100.mtd
wget https://github.com/peterdelevoryas/OpenBIC/releases/download/oby35-cl-2022.13.01/Y35BCL.elf
Fuji uses UART1:
qemu-system-arm -machine fuji-bmc \
-drive file=fuji.mtd,format=raw,if=mtd \
-nographic
ast2600-evb uses uart-default=UART5:
qemu-system-arm -machine ast2600-evb \
-drive file=fuji.mtd,format=raw,if=mtd \
-serial null -serial mon:stdio -display none
Wedge100 uses UART3:
qemu-system-arm -machine palmetto-bmc \
-drive file=wedge100.mtd,format=raw,if=mtd \
-serial null -serial null -serial null \
-serial mon:stdio -display none
AST1030 EVB uses UART5:
qemu-system-arm -machine ast1030-evb \
-kernel Y35BCL.elf -nographic
Fixes: 6827ff20b2975 ("hw: aspeed: Init all UART's with serial devices")
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220705191400.41632-4-peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-07-14 16:24:38 +02:00
|
|
|
SerialMM uart[ASPEED_UARTS_NUM];
|
2022-05-02 17:03:03 +02:00
|
|
|
Clock *sysclk;
|
2022-06-30 09:21:13 +02:00
|
|
|
UnimplementedDeviceState iomem;
|
|
|
|
UnimplementedDeviceState video;
|
|
|
|
UnimplementedDeviceState emmc_boot_controller;
|
|
|
|
UnimplementedDeviceState dpmcu;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2016-03-16 18:06:00 +01:00
|
|
|
|
2016-09-22 19:13:05 +02:00
|
|
|
#define TYPE_ASPEED_SOC "aspeed-soc"
|
2020-09-16 20:25:18 +02:00
|
|
|
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
|
2016-03-16 18:06:00 +01:00
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct AspeedSoCClass {
|
2019-09-25 16:32:42 +02:00
|
|
|
DeviceClass parent_class;
|
|
|
|
|
2016-09-22 19:13:05 +02:00
|
|
|
const char *name;
|
2017-09-13 18:04:57 +02:00
|
|
|
const char *cpu_type;
|
2016-09-22 19:13:05 +02:00
|
|
|
uint32_t silicon_rev;
|
2016-12-27 15:59:27 +01:00
|
|
|
uint64_t sram_size;
|
2016-10-17 20:22:16 +02:00
|
|
|
int spis_num;
|
2020-02-06 19:34:37 +01:00
|
|
|
int ehcis_num;
|
2017-07-11 12:21:26 +02:00
|
|
|
int wdts_num;
|
2019-09-25 16:32:46 +02:00
|
|
|
int macs_num;
|
2022-05-25 10:31:33 +02:00
|
|
|
int uarts_num;
|
2019-07-01 18:26:15 +02:00
|
|
|
const int *irqmap;
|
2019-07-01 18:26:15 +02:00
|
|
|
const hwaddr *memmap;
|
2019-07-01 18:26:16 +02:00
|
|
|
uint32_t num_cpus;
|
2022-05-25 10:31:33 +02:00
|
|
|
qemu_irq (*get_irq)(AspeedSoCState *s, int dev);
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2016-09-22 19:13:05 +02:00
|
|
|
|
2016-03-16 18:06:00 +01:00
|
|
|
|
2019-07-01 18:26:15 +02:00
|
|
|
enum {
|
2020-08-25 21:20:02 +02:00
|
|
|
ASPEED_DEV_IOMEM,
|
|
|
|
ASPEED_DEV_UART1,
|
|
|
|
ASPEED_DEV_UART2,
|
|
|
|
ASPEED_DEV_UART3,
|
|
|
|
ASPEED_DEV_UART4,
|
|
|
|
ASPEED_DEV_UART5,
|
2022-05-25 10:31:33 +02:00
|
|
|
ASPEED_DEV_UART6,
|
|
|
|
ASPEED_DEV_UART7,
|
|
|
|
ASPEED_DEV_UART8,
|
|
|
|
ASPEED_DEV_UART9,
|
|
|
|
ASPEED_DEV_UART10,
|
|
|
|
ASPEED_DEV_UART11,
|
|
|
|
ASPEED_DEV_UART12,
|
|
|
|
ASPEED_DEV_UART13,
|
2020-08-25 21:20:02 +02:00
|
|
|
ASPEED_DEV_VUART,
|
|
|
|
ASPEED_DEV_FMC,
|
|
|
|
ASPEED_DEV_SPI1,
|
|
|
|
AS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|
|
|
ASPEED_DEV_EMMC,
|
2021-03-09 12:01:28 +01:00
|
|
|
ASPEED_DEV_KCS,
|
2021-05-01 10:03:51 +02:00
|
|
|
ASPEED_DEV_HACE,
|
2022-01-07 18:07:57 +01:00
|
|
|
ASPEED_DEV_DPMCU,
|
|
|
|
ASPEED_DEV_DP,
|
2022-01-11 09:45:46 +01:00
|
|
|
ASPEED_DEV_I3C,
|
2019-07-01 18:26:15 +02:00
|
|
|
};
|
|
|
|
|
2022-05-25 10:31:33 +02:00
|
|
|
qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
|
aspeed: Refactor UART init for multi-SoC machines
This change moves the code that connects the SoC UART's to serial_hd's
to the machine.
It makes each UART a proper child member of the SoC, and then allows the
machine to selectively initialize the chardev for each UART with a
serial_hd.
This should preserve backwards compatibility, but also allow multi-SoC
boards to completely change the wiring of serial devices from the
command line to specific SoC UART's.
This also removes the uart-default property from the SoC, since the SoC
doesn't need to know what UART is the "default" on the machine anymore.
I tested this using the images and commands from the previous
refactoring, and another test image for the ast1030:
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/fuji.mtd
wget https://github.com/facebook/openbmc/releases/download/v2021.49.0/wedge100.mtd
wget https://github.com/peterdelevoryas/OpenBIC/releases/download/oby35-cl-2022.13.01/Y35BCL.elf
Fuji uses UART1:
qemu-system-arm -machine fuji-bmc \
-drive file=fuji.mtd,format=raw,if=mtd \
-nographic
ast2600-evb uses uart-default=UART5:
qemu-system-arm -machine ast2600-evb \
-drive file=fuji.mtd,format=raw,if=mtd \
-serial null -serial mon:stdio -display none
Wedge100 uses UART3:
qemu-system-arm -machine palmetto-bmc \
-drive file=wedge100.mtd,format=raw,if=mtd \
-serial null -serial null -serial null \
-serial mon:stdio -display none
AST1030 EVB uses UART5:
qemu-system-arm -machine ast1030-evb \
-kernel Y35BCL.elf -nographic
Fixes: 6827ff20b2975 ("hw: aspeed: Init all UART's with serial devices")
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220705191400.41632-4-peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-07-14 16:24:38 +02:00
|
|
|
bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp);
|
|
|
|
void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr);
|
2022-06-30 09:21:13 +02:00
|
|
|
bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp);
|
2022-06-30 09:21:13 +02:00
|
|
|
void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr);
|
2022-06-30 09:21:13 +02:00
|
|
|
void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
|
|
|
|
const char *name, hwaddr addr,
|
|
|
|
uint64_t size);
|
2022-07-14 16:24:38 +02:00
|
|
|
void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
|
|
|
|
unsigned int count, int unit0);
|
2022-05-25 10:31:33 +02:00
|
|
|
|
2016-09-22 19:13:05 +02:00
|
|
|
#endif /* ASPEED_SOC_H */
|