Add PCIe and NVMe support for AMD Versal Gen 2
Subsystems (3)
cover Add PCIe and NVMe support for AMD Versal Gen 2
This series adds PCIe host controller support for AMD Versal Gen 2 SoCs, enabling NVMe boot on boards such as the VEK385.
Patch 1 introduces the driver (pcie_dw_amd.c), built on the existing pcie_dw_common infrastructure.
Patch 2 adds the required MMU entries for the PCIe DBI registers.
Patch 3 enables the required Kconfig symbols in the defconfig and extends amd_versal2.h to include BOOT_TARGET_DEVICES_NVME in the distro boot target list when CONFIG_NVME is set.
Pranav Sanwal (3):
pci: Add AMD Versal2 DW PCIe host controller driver
arm: versal2: Map PCIe DBI and config regions when PCIe is enabled
amd: versal2: Enable PCIe/NVMe support and add NVMe boot target
MAINTAINERS | 5 + arch/arm/mach-versal2/cpu.c | 16 +- configs/amd_versal2_virt_defconfig | 6 + drivers/pci/Kconfig | 11 ++ drivers/pci/Makefile | 1 + drivers/pci/pcie_dw_amd.c | 250 +++++++++++++++++++++++++++++ include/configs/amd_versal2.h | 7 + 7 files changed, 295 insertions(+), 1 deletion(-) create mode 100644 drivers/pci/pcie_dw_amd.c
Signature · 1 line
2.34.1
PATCH 1/3 pci: Add AMD Versal2 DW PCIe host controller driver
Add support for the DesignWare-based PCIe host controller found in AMD Versal2 SoCs. This enables PCIe functionality (e.g. NVMe storage) on boards such as the VEK385.
The driver builds on the existing pcie_dw_common infrastructure and adds Versal2-specific handling: it maps the SLCR register region to mask and clear TLP interrupt status bits, parses dbi/config/atu/slcr register regions from device tree, and supports an optional PERST# GPIO on child nodes for endpoint reset sequencing. The outbound iATU is programmed for the non-prefetchable memory window from device tree ranges.
--- MAINTAINERS | 5 + drivers/pci/Kconfig | 11 ++ drivers/pci/Makefile | 1 + drivers/pci/pcie_dw_amd.c | 250 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 267 insertions(+) create mode 100644 drivers/pci/pcie_dw_amd.c
MAINTAINERS +5 -0
@@ -65,6 +65,11 @@ F: include/alist.h F: lib/alist.c F: test/lib/alist.c +AMD VERSAL2 PCIE DRIVER +M: Pranav Sanwal <[email protected]> +S: Maintained +F: drivers/pci/pcie_dw_amd.c + ANDROID AB M: Mattijs Korpershoek <[email protected]> R: Igor Opaniuk <[email protected]>
drivers/pci/Kconfig +11 -0
@@ -456,6 +456,17 @@ config PCIE_STARFIVE_JH7110 Say Y here if you want to enable PLDA XpressRich PCIe controller support on StarFive JH7110 SoC. +config PCIE_DW_AMD + bool "AMD Versal2 DW PCIe host controller" + depends on ARCH_VERSAL2 + depends on DM_GPIO + select PCIE_DW_COMMON + select SYS_PCI_64BIT + help + Say Y here to enable support for the AMD Versal Gen 2 PCIe + host controller. This is a DesignWare-based PCIe controller + used in AMD Versal Gen 2 SoCs. + config PCIE_DW_IMX bool "i.MX DW PCIe controller support" depends on ARCH_IMX8M || ARCH_IMX9
drivers/pci/Makefile +1 -0
@@ -56,4 +56,5 @@ obj-$(CONFIG_PCIE_UNIPHIER) += pcie_uniphier.o obj-$(CONFIG_PCIE_XILINX_NWL) += pcie-xilinx-nwl.o obj-$(CONFIG_PCIE_PLDA_COMMON) += pcie_plda_common.o obj-$(CONFIG_PCIE_STARFIVE_JH7110) += pcie_starfive_jh7110.o +obj-$(CONFIG_PCIE_DW_AMD) += pcie_dw_amd.o obj-$(CONFIG_PCIE_DW_IMX) += pcie_dw_imx.o
drivers/pci/pcie_dw_amd.c new file +250 -0
250 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/3 arm: versal2: Map PCIe DBI and config regions when PCIe is enabled
In reply to Pranav SanwalThe AMD Versal Gen 2 PCIe host controller places its DBI registers (0x100000000000, 1 MB) and config space (0x100000100000, 255 MB) above 1 TB. Without MMU entries covering these ranges, U-Boot faults when the PCIe driver accesses them.
The two regions are merged into a single entry as these are contiguous and share identical MMU attributes. Add this entry under a CONFIG_IS_ENABLED(PCIE_DW_AMD) guard so it is only included when the PCIe driver is configured. VERSAL2_MEM_MAP_USED is adjusted from 5 to 6 accordingly, keeping the DRAM bank index correct.
--- arch/arm/mach-versal2/cpu.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/mach-versal2/cpu.c +15 -1
@@ -18,7 +18,11 @@DECLARE_GLOBAL_DATA_PTR ; +#if CONFIG_IS_ENABLED (PCIE_DW_AMD ) +#define VERSAL2_MEM_MAP_USED 6 +#else #define VERSAL2_MEM_MAP_USED 5 +#endif #define DRAM_BANKS CONFIG_NR_DRAM_BANKS
@@ -60,6 +64,16 @@ static struct mm_region versal2_mem_map[VERSAL2_MEM_MAP_MAX] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN +#if CONFIG_IS_ENABLED (PCIE_DW_AMD ) + }, { + /* PCIe DBI (1 MB) and config space (255 MB) are contiguous */ + .virt = 0x100000000000UL, + .phys = 0x100000000000UL, + .size = 0x10000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN +#endif } };
@@ -69,7 +83,7 @@ static struct mm_region versal2_mem_map[VERSAL2_MEM_MAP_MAX] = {* @num_banks: Number of valid DRAM banks in bank_info array * * Copies DRAM bank information into the global versal2_mem_map[] array -* starting at index VERSAL2_MEM_MAP_USED (5), which is after the fixed +* starting at index VERSAL2_MEM_MAP_USED, which is after the fixed * device mappings. This must be called early in boot before MMU * initialization so that get_page_table_size() can calculate the * required page table size based on actual memory configuration.
Signature · 1 line
2.34.1
PATCH 3/3 amd: versal2: Enable PCIe/NVMe support and add NVMe boot target
In reply to Pranav SanwalEnable the AMD Versal Gen 2 DW PCIe host controller and NVMe storage in the virtual platform defconfig:
- CONFIG_PCI / CONFIG_CMD_PCI: core PCI stack and pci command
- CONFIG_PCIE_DW_AMD: AMD Versal Gen 2 PCIe host driver
- CONFIG_NVME_PCI: NVMe-over-PCIe storage driver
- CONFIG_CMD_LSBLK: block device listing command
- CONFIG_DM_PCA953X: GPIO expander driver for PERST# control
Add BOOT_TARGET_DEVICES_NVME to amd_versal2.h so NVMe is included in the distro boot target list when CONFIG_NVME is enabled.
--- configs/amd_versal2_virt_defconfig | 6 ++++++ include/configs/amd_versal2.h | 7 +++++++ 2 files changed, 13 insertions(+)
configs/amd_versal2_virt_defconfig +6 -0
@@ -13,6 +13,7 @@ CONFIG_SYS_BOOTM_LEN=0x6400000 CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_XILINX_OF_BOARD_DTB_ADDR=0x1000000 CONFIG_CMD_FRU=y +CONFIG_PCI=y CONFIG_SYS_MEMTEST_START=0x00000000 CONFIG_SYS_MEMTEST_END=0x00001000 CONFIG_REMAKE_ELF=y
@@ -40,10 +41,12 @@ CONFIG_CMD_CLK=y CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y +CONFIG_CMD_LSBLK=y CONFIG_CMD_MMC=y CONFIG_MMC_SPEED_MODE_SET=y CONFIG_CMD_OPTEE=y CONFIG_CMD_MTD=y +CONFIG_CMD_PCI=y CONFIG_CMD_POWEROFF=y CONFIG_CMD_SF_TEST=y CONFIG_CMD_SPI=y
@@ -83,6 +86,7 @@ CONFIG_ARM_FFA_TRANSPORT=y CONFIG_SCMI_FIRMWARE=y CONFIG_FPGA_XILINX=y CONFIG_FPGA_VERSALPL=y +CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_CADENCE=y CONFIG_I2C_MUX=y
@@ -122,6 +126,8 @@ CONFIG_DM_ETH_PHY=y CONFIG_PHY_GIGE=y CONFIG_XILINX_AXIEMAC=y CONFIG_ZYNQ_GEM=y +CONFIG_NVME_PCI=y +CONFIG_PCIE_DW_AMD=y CONFIG_POWER_DOMAIN=y CONFIG_ZYNQMP_POWER_DOMAIN=y CONFIG_RESET_SCMI=y
include/configs/amd_versal2.h +7 -0
@@ -131,11 +131,18 @@#define BOOT_TARGET_DEVICES_USB (func)#endif +#if defined(CONFIG_NVME ) +# define BOOT_TARGET_DEVICES_NVME (func) func(NVME, nvme, 0) +#else +# define BOOT_TARGET_DEVICES_NVME (func) +#endif +#define BOOT_TARGET_DEVICES (func) \ BOOT_TARGET_DEVICES_JTAG(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_UFS(func) \ BOOT_TARGET_DEVICES_XSPI(func) \ + BOOT_TARGET_DEVICES_NVME(func) \ BOOT_TARGET_DEVICES_DFU_USB(func) \ BOOT_TARGET_DEVICES_USB(func) \ BOOT_TARGET_DEVICES_PXE(func) \
Signature · 1 line
2.34.1
Michal Simek
AppliedQuoted 25 lines · Pranav Sanwal
This series adds PCIe host controller support for AMD Versal Gen 2 SoCs, enabling NVMe boot on boards such as the VEK385.
Patch 1 introduces the driver (
pcie_dw_amd.c), built on the existingpcie_dw_commoninfrastructure.Patch 2 adds the required MMU entries for the PCIe DBI registers.
Patch 3 enables the required
Kconfigsymbols in the defconfig and extendsamd_versal2.hto includeBOOT_TARGET_DEVICES_NVMEin the distro boot target list whenCONFIG_NVMEis set.Pranav Sanwal (3):
pci: Add AMD Versal2 DW PCIe host controller driver
arm: versal2: Map PCIe DBI and config regions when PCIe is enabled
amd: versal2: Enable PCIe/NVMe support and add NVMe boot targetMAINTAINERS | 5 + arch/arm/mach-versal2/cpu.c | 16 +- configs/amd_versal2_virt_defconfig | 6 + drivers/pci/Kconfig | 11 ++ drivers/pci/Makefile | 1 + drivers/pci/pcie_dw_amd.c | 250 +++++++++++++++++++++++++++++ include/configs/amd_versal2.h | 7 + 7 files changed, 295 insertions(+), 1 deletion(-)
Quoted 2 lines
create mode 100644
drivers/pci/pcie_dw_amd.c
Applied.
M