2018-11-02 16:19:12 +03:00
|
|
|
/*
|
|
|
|
* Model of the Xilinx Versal
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 Xilinx Inc.
|
|
|
|
* Written by Edgar E. Iglesias
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XLNX_VERSAL_H
|
|
|
|
#define XLNX_VERSAL_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
2019-05-23 16:47:43 +03:00
|
|
|
#include "hw/arm/boot.h"
|
2022-04-06 20:43:00 +03:00
|
|
|
#include "hw/cpu/cluster.h"
|
2021-03-09 01:46:37 +03:00
|
|
|
#include "hw/or-irq.h"
|
2020-04-27 21:16:46 +03:00
|
|
|
#include "hw/sd/sdhci.h"
|
2018-11-02 16:19:12 +03:00
|
|
|
#include "hw/intc/arm_gicv3.h"
|
2020-04-27 21:16:42 +03:00
|
|
|
#include "hw/char/pl011.h"
|
2020-04-27 21:16:44 +03:00
|
|
|
#include "hw/dma/xlnx-zdma.h"
|
2020-04-27 21:16:43 +03:00
|
|
|
#include "hw/net/cadence_gem.h"
|
2020-04-27 21:16:47 +03:00
|
|
|
#include "hw/rtc/xlnx-zynqmp-rtc.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2020-12-03 22:22:37 +03:00
|
|
|
#include "hw/usb/xlnx-usb-subsystem.h"
|
2021-03-09 01:46:37 +03:00
|
|
|
#include "hw/misc/xlnx-versal-xramc.h"
|
2021-09-17 08:23:56 +03:00
|
|
|
#include "hw/nvram/xlnx-bbram.h"
|
2021-09-17 08:23:57 +03:00
|
|
|
#include "hw/nvram/xlnx-versal-efuse.h"
|
2022-01-21 19:11:38 +03:00
|
|
|
#include "hw/ssi/xlnx-versal-ospi.h"
|
|
|
|
#include "hw/dma/xlnx_csu_dma.h"
|
2022-04-06 20:43:03 +03:00
|
|
|
#include "hw/misc/xlnx-versal-crl.h"
|
2022-01-21 19:11:34 +03:00
|
|
|
#include "hw/misc/xlnx-versal-pmc-iou-slcr.h"
|
2023-06-06 12:19:30 +03:00
|
|
|
#include "hw/net/xlnx-versal-canfd.h"
|
2018-11-02 16:19:12 +03:00
|
|
|
|
|
|
|
#define TYPE_XLNX_VERSAL "xlnx-versal"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL)
|
2018-11-02 16:19:12 +03:00
|
|
|
|
|
|
|
#define XLNX_VERSAL_NR_ACPUS 2
|
2022-04-06 20:43:01 +03:00
|
|
|
#define XLNX_VERSAL_NR_RCPUS 2
|
2018-11-02 16:19:12 +03:00
|
|
|
#define XLNX_VERSAL_NR_UARTS 2
|
|
|
|
#define XLNX_VERSAL_NR_GEMS 2
|
2020-03-05 19:09:13 +03:00
|
|
|
#define XLNX_VERSAL_NR_ADMAS 8
|
2020-04-27 21:16:46 +03:00
|
|
|
#define XLNX_VERSAL_NR_SDS 2
|
2021-03-09 01:46:37 +03:00
|
|
|
#define XLNX_VERSAL_NR_XRAM 4
|
2018-12-13 16:48:04 +03:00
|
|
|
#define XLNX_VERSAL_NR_IRQS 192
|
2023-06-06 12:19:30 +03:00
|
|
|
#define XLNX_VERSAL_NR_CANFD 2
|
|
|
|
#define XLNX_VERSAL_CANFD_REF_CLK (24 * 1000 * 1000)
|
2018-11-02 16:19:12 +03:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct Versal {
|
2018-11-02 16:19:12 +03:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
MemoryRegion mr;
|
2022-04-06 20:43:00 +03:00
|
|
|
CPUClusterState cluster;
|
2020-04-27 21:16:45 +03:00
|
|
|
ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
|
2018-11-02 16:19:12 +03:00
|
|
|
GICv3State gic;
|
|
|
|
} apu;
|
|
|
|
} fpd;
|
|
|
|
|
|
|
|
MemoryRegion mr_ps;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
/* 4 ranges to access DDR. */
|
|
|
|
MemoryRegion mr_ddr_ranges[4];
|
|
|
|
} noc;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
MemoryRegion mr_ocm;
|
|
|
|
|
|
|
|
struct {
|
2020-04-27 21:16:42 +03:00
|
|
|
PL011State uart[XLNX_VERSAL_NR_UARTS];
|
2020-04-27 21:16:43 +03:00
|
|
|
CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
|
2020-04-27 21:16:44 +03:00
|
|
|
XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
|
2020-12-03 22:22:37 +03:00
|
|
|
VersalUsb2 usb;
|
2023-06-06 12:19:30 +03:00
|
|
|
CanBusState *canbus[XLNX_VERSAL_NR_CANFD];
|
|
|
|
XlnxVersalCANFDState canfd[XLNX_VERSAL_NR_CANFD];
|
2018-11-02 16:19:12 +03:00
|
|
|
} iou;
|
2021-03-09 01:46:37 +03:00
|
|
|
|
2022-04-06 20:43:01 +03:00
|
|
|
/* Real-time Processing Unit. */
|
|
|
|
struct {
|
|
|
|
MemoryRegion mr;
|
|
|
|
MemoryRegion mr_ps_alias;
|
|
|
|
|
|
|
|
CPUClusterState cluster;
|
|
|
|
ARMCPU cpu[XLNX_VERSAL_NR_RCPUS];
|
|
|
|
} rpu;
|
|
|
|
|
2021-03-09 01:46:37 +03:00
|
|
|
struct {
|
2023-01-13 23:01:38 +03:00
|
|
|
OrIRQState irq_orgate;
|
2021-03-09 01:46:37 +03:00
|
|
|
XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM];
|
|
|
|
} xram;
|
2022-04-06 20:43:03 +03:00
|
|
|
|
|
|
|
XlnxVersalCRL crl;
|
2018-11-02 16:19:12 +03:00
|
|
|
} lpd;
|
|
|
|
|
2020-04-27 21:16:46 +03:00
|
|
|
/* The Platform Management Controller subsystem. */
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
SDHCIState sd[XLNX_VERSAL_NR_SDS];
|
2022-01-21 19:11:34 +03:00
|
|
|
XlnxVersalPmcIouSlcr slcr;
|
2022-01-21 19:11:38 +03:00
|
|
|
|
|
|
|
struct {
|
|
|
|
XlnxVersalOspi ospi;
|
|
|
|
XlnxCSUDMA dma_src;
|
|
|
|
XlnxCSUDMA dma_dst;
|
|
|
|
MemoryRegion linear_mr;
|
2023-01-13 23:01:38 +03:00
|
|
|
OrIRQState irq_orgate;
|
2022-01-21 19:11:38 +03:00
|
|
|
} ospi;
|
2020-04-27 21:16:46 +03:00
|
|
|
} iou;
|
2020-04-27 21:16:47 +03:00
|
|
|
|
|
|
|
XlnxZynqMPRTC rtc;
|
2021-09-17 08:23:56 +03:00
|
|
|
XlnxBBRam bbram;
|
2021-09-17 08:23:57 +03:00
|
|
|
XlnxEFuse efuse;
|
|
|
|
XlnxVersalEFuseCtrl efuse_ctrl;
|
|
|
|
XlnxVersalEFuseCache efuse_cache;
|
2022-01-21 19:11:33 +03:00
|
|
|
|
2023-01-13 23:01:38 +03:00
|
|
|
OrIRQState apb_irq_orgate;
|
2020-04-27 21:16:46 +03:00
|
|
|
} pmc;
|
|
|
|
|
2018-11-02 16:19:12 +03:00
|
|
|
struct {
|
|
|
|
MemoryRegion *mr_ddr;
|
|
|
|
} cfg;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2018-11-02 16:19:12 +03:00
|
|
|
|
|
|
|
/* Memory-map and IRQ definitions. Copied a subset from
|
|
|
|
* auto-generated files. */
|
|
|
|
|
|
|
|
#define VERSAL_GIC_MAINT_IRQ 9
|
|
|
|
#define VERSAL_TIMER_VIRT_IRQ 11
|
|
|
|
#define VERSAL_TIMER_S_EL1_IRQ 13
|
|
|
|
#define VERSAL_TIMER_NS_EL1_IRQ 14
|
|
|
|
#define VERSAL_TIMER_NS_EL2_IRQ 10
|
|
|
|
|
2022-04-06 20:43:03 +03:00
|
|
|
#define VERSAL_CRL_IRQ 10
|
2018-11-02 16:19:12 +03:00
|
|
|
#define VERSAL_UART0_IRQ_0 18
|
|
|
|
#define VERSAL_UART1_IRQ_0 19
|
2023-06-06 12:19:30 +03:00
|
|
|
#define VERSAL_CANFD0_IRQ_0 20
|
|
|
|
#define VERSAL_CANFD1_IRQ_0 21
|
2020-12-03 22:22:37 +03:00
|
|
|
#define VERSAL_USB0_IRQ_0 22
|
2018-11-02 16:19:12 +03:00
|
|
|
#define VERSAL_GEM0_IRQ_0 56
|
|
|
|
#define VERSAL_GEM0_WAKE_IRQ_0 57
|
|
|
|
#define VERSAL_GEM1_IRQ_0 58
|
|
|
|
#define VERSAL_GEM1_WAKE_IRQ_0 59
|
2020-03-05 19:09:13 +03:00
|
|
|
#define VERSAL_ADMA_IRQ_0 60
|
2021-03-09 01:46:37 +03:00
|
|
|
#define VERSAL_XRAM_IRQ_0 79
|
2022-01-21 19:11:33 +03:00
|
|
|
#define VERSAL_PMC_APB_IRQ 121
|
2022-01-21 19:11:38 +03:00
|
|
|
#define VERSAL_OSPI_IRQ 124
|
2020-04-27 21:16:46 +03:00
|
|
|
#define VERSAL_SD0_IRQ_0 126
|
2021-09-17 08:23:57 +03:00
|
|
|
#define VERSAL_EFUSE_IRQ 139
|
2020-04-27 21:16:47 +03:00
|
|
|
#define VERSAL_RTC_ALARM_IRQ 142
|
|
|
|
#define VERSAL_RTC_SECONDS_IRQ 143
|
2018-11-02 16:19:12 +03:00
|
|
|
|
2018-12-13 16:48:03 +03:00
|
|
|
/* Architecturally reserved IRQs suitable for virtualization. */
|
|
|
|
#define VERSAL_RSVD_IRQ_FIRST 111
|
|
|
|
#define VERSAL_RSVD_IRQ_LAST 118
|
2018-11-02 16:19:12 +03:00
|
|
|
|
|
|
|
#define MM_TOP_RSVD 0xa0000000U
|
|
|
|
#define MM_TOP_RSVD_SIZE 0x4000000
|
|
|
|
#define MM_GIC_APU_DIST_MAIN 0xf9000000U
|
|
|
|
#define MM_GIC_APU_DIST_MAIN_SIZE 0x10000
|
|
|
|
#define MM_GIC_APU_REDIST_0 0xf9080000U
|
|
|
|
#define MM_GIC_APU_REDIST_0_SIZE 0x80000
|
|
|
|
|
|
|
|
#define MM_UART0 0xff000000U
|
|
|
|
#define MM_UART0_SIZE 0x10000
|
|
|
|
#define MM_UART1 0xff010000U
|
|
|
|
#define MM_UART1_SIZE 0x10000
|
|
|
|
|
2023-06-06 12:19:30 +03:00
|
|
|
#define MM_CANFD0 0xff060000U
|
|
|
|
#define MM_CANFD0_SIZE 0x10000
|
|
|
|
#define MM_CANFD1 0xff070000U
|
|
|
|
#define MM_CANFD1_SIZE 0x10000
|
|
|
|
|
2018-11-02 16:19:12 +03:00
|
|
|
#define MM_GEM0 0xff0c0000U
|
|
|
|
#define MM_GEM0_SIZE 0x10000
|
|
|
|
#define MM_GEM1 0xff0d0000U
|
|
|
|
#define MM_GEM1_SIZE 0x10000
|
|
|
|
|
2020-03-05 19:09:13 +03:00
|
|
|
#define MM_ADMA_CH0 0xffa80000U
|
|
|
|
#define MM_ADMA_CH0_SIZE 0x10000
|
|
|
|
|
2018-11-02 16:19:12 +03:00
|
|
|
#define MM_OCM 0xfffc0000U
|
|
|
|
#define MM_OCM_SIZE 0x40000
|
|
|
|
|
2021-03-09 01:46:37 +03:00
|
|
|
#define MM_XRAM 0xfe800000
|
|
|
|
#define MM_XRAMC 0xff8e0000
|
|
|
|
#define MM_XRAMC_SIZE 0x10000
|
|
|
|
|
2020-12-03 22:22:37 +03:00
|
|
|
#define MM_USB2_CTRL_REGS 0xFF9D0000
|
|
|
|
#define MM_USB2_CTRL_REGS_SIZE 0x10000
|
|
|
|
|
|
|
|
#define MM_USB_0 0xFE200000
|
|
|
|
#define MM_USB_0_SIZE 0x10000
|
|
|
|
|
2018-11-02 16:19:12 +03:00
|
|
|
#define MM_TOP_DDR 0x0
|
|
|
|
#define MM_TOP_DDR_SIZE 0x80000000U
|
|
|
|
#define MM_TOP_DDR_2 0x800000000ULL
|
|
|
|
#define MM_TOP_DDR_2_SIZE 0x800000000ULL
|
|
|
|
#define MM_TOP_DDR_3 0xc000000000ULL
|
|
|
|
#define MM_TOP_DDR_3_SIZE 0x4000000000ULL
|
|
|
|
#define MM_TOP_DDR_4 0x10000000000ULL
|
|
|
|
#define MM_TOP_DDR_4_SIZE 0xb780000000ULL
|
|
|
|
|
|
|
|
#define MM_PSM_START 0xffc80000U
|
|
|
|
#define MM_PSM_END 0xffcf0000U
|
|
|
|
|
|
|
|
#define MM_CRL 0xff5e0000U
|
|
|
|
#define MM_CRL_SIZE 0x300000
|
|
|
|
#define MM_IOU_SCNTR 0xff130000U
|
|
|
|
#define MM_IOU_SCNTR_SIZE 0x10000
|
|
|
|
#define MM_IOU_SCNTRS 0xff140000U
|
|
|
|
#define MM_IOU_SCNTRS_SIZE 0x10000
|
|
|
|
#define MM_FPD_CRF 0xfd1a0000U
|
|
|
|
#define MM_FPD_CRF_SIZE 0x140000
|
2021-08-23 20:38:17 +03:00
|
|
|
#define MM_FPD_FPD_APU 0xfd5c0000
|
|
|
|
#define MM_FPD_FPD_APU_SIZE 0x100
|
2019-11-26 16:55:36 +03:00
|
|
|
|
2022-01-21 19:11:34 +03:00
|
|
|
#define MM_PMC_PMC_IOU_SLCR 0xf1060000
|
|
|
|
#define MM_PMC_PMC_IOU_SLCR_SIZE 0x10000
|
|
|
|
|
2022-01-21 19:11:38 +03:00
|
|
|
#define MM_PMC_OSPI 0xf1010000
|
|
|
|
#define MM_PMC_OSPI_SIZE 0x10000
|
|
|
|
|
|
|
|
#define MM_PMC_OSPI_DAC 0xc0000000
|
|
|
|
#define MM_PMC_OSPI_DAC_SIZE 0x20000000
|
|
|
|
|
|
|
|
#define MM_PMC_OSPI_DMA_DST 0xf1011800
|
|
|
|
#define MM_PMC_OSPI_DMA_SRC 0xf1011000
|
|
|
|
|
2020-04-27 21:16:46 +03:00
|
|
|
#define MM_PMC_SD0 0xf1040000U
|
|
|
|
#define MM_PMC_SD0_SIZE 0x10000
|
2021-09-17 08:23:56 +03:00
|
|
|
#define MM_PMC_BBRAM_CTRL 0xf11f0000
|
|
|
|
#define MM_PMC_BBRAM_CTRL_SIZE 0x00050
|
2021-09-17 08:23:57 +03:00
|
|
|
#define MM_PMC_EFUSE_CTRL 0xf1240000
|
|
|
|
#define MM_PMC_EFUSE_CTRL_SIZE 0x00104
|
|
|
|
#define MM_PMC_EFUSE_CACHE 0xf1250000
|
|
|
|
#define MM_PMC_EFUSE_CACHE_SIZE 0x00C00
|
|
|
|
|
2019-11-26 16:55:36 +03:00
|
|
|
#define MM_PMC_CRP 0xf1260000U
|
|
|
|
#define MM_PMC_CRP_SIZE 0x10000
|
2020-04-27 21:16:47 +03:00
|
|
|
#define MM_PMC_RTC 0xf12a0000
|
|
|
|
#define MM_PMC_RTC_SIZE 0x10000
|
2018-11-02 16:19:12 +03:00
|
|
|
#endif
|