Add TI K3 PCIe Controller support for J7200
cover Add TI K3 PCIe Controller support for J7200
Hello,
This series adds support for the Cadence PCIe controller on TI's K3 family of SoCs which J7200 belongs to. The driver is an adaptation of the Linux driver (drivers/pci/controller/cadence/pci-j721e.c) and has been implemented specifically for Root-Complex mode of operation on J7200. A minor set of changes will be sufficient to support other K3 SoCs as well, which has been indicated with "TODO"s added in the driver code.
Series is based on commitd2067c3ea5 Merge tag 'u-boot-dfu-next-20240820' of https://source.denx.de/u-boot/custodians/u-boot-dfu into next of the next branch of U-Boot.
I have posted this series as an RFC for feedback regarding the implementation. I plan to implement the remaining changes to truly support all K3 SoCs that are currently supported by the pci-j721e.c driver in Linux in Root-Complex mode of operation. I have tested this series with the following changes made to the device-tree for J7200:
https://gist.github.com/Siddharth-Vadapalli-at-TI/1a498722ebb332da6f88abe05a43f2c4
The device-tree changes are required since the "reg-mux" driver is not currently implemented in U-Boot. I will work on porting the "reg-mux" driver support from Linux.
The logs corresponding to validating PCI Root-Complex functionality with an NVMe SSD connected to the PCIe Connector on J7200-EVM, with this series and the aforementioned device-tree changes applied are:
https://gist.github.com/Siddharth-Vadapalli-at-TI/bbcbfa0b7d593795726c81fb41272823
Regards,
Siddharth.
Siddharth Vadapalli (2):
pci: Add TI K3 Cadence PCIe Controller
configs: j7200_evm_a72_defconfig: Enable configs for PCI support
configs/j7200_evm_a72_defconfig | 4 + drivers/pci/Kconfig | 6 + drivers/pci/Makefile | 1 + drivers/pci/pcie_cdns_ti.c | 645 ++++++++++++++++++++++++++++++++ 4 files changed, 656 insertions(+) create mode 100644 drivers/pci/pcie_cdns_ti.c
Signature · 1 line
2.40.1
RFC PATCH 1/2 pci: Add TI K3 Cadence PCIe Controller
Add support for the Cadence PCIe Controller present on TI's K3 SoCs. This driver is an adaptation of the Linux driver.
--- drivers/pci/Kconfig | 6 + drivers/pci/Makefile | 1 + drivers/pci/pcie_cdns_ti.c | 645 +++++++++++++++++++++++++++++++++++++ 3 files changed, 652 insertions(+) create mode 100644 drivers/pci/pcie_cdns_ti.c
drivers/pci/Kconfig +6 -0
@@ -137,6 +137,12 @@ config PCI_GT64120 bool "GT64120 PCI support" depends on MIPS +config PCIE_CDNS_TI + bool "TI K3 PCIe support" + help + Say Y here to enable support for the Cadence PCIe Controller + on TI's K3 SoCs. + config PCI_PHYTIUM bool "Phytium PCIe support" help
drivers/pci/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_PCI) += pci_auto_common.o pci_common.o obj-$(CONFIG_PCIE_ECAM_GENERIC) += pcie_ecam_generic.o obj-$(CONFIG_PCIE_ECAM_SYNQUACER) += pcie_ecam_synquacer.o obj-$(CONFIG_PCIE_APPLE) += pcie_apple.o +obj-$(CONFIG_PCIE_CDNS_TI) += pcie_cdns_ti.o obj-$(CONFIG_PCI_FTPCI100) += pci_ftpci100.o obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o obj-$(CONFIG_PCI_MPC85XX) += pci_mpc85xx.o
drivers/pci/pcie_cdns_ti.c new file +645 -0
645 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [RFC PATCH 1/2] pci: Add TI K3 Cadence PCIe Controller
Quoted 4 lines · Siddharth Vadapalli
Add support for the Cadence PCIe Controller present on TI's K3 SoCs. This driver is an adaptation of the Linux driver.
Signed-off-by Siddharth Vadapalli <[email protected]>
[snip]
Quoted 24 lines
drivers/pci/pcie_cdns_ti.c new file +18
-0@@ -0,0 +1,645 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT +/* +* Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com +* +* PCIe controller driver for TI's K3 SoCs with Cadence PCIe controller +* +* Ported from the Linux driver - drivers/pci/controller/cadence/pci-j721e.c +* +* Author: Siddharth Vadapalli <[email protected]> +* +*/ + +#include <asm/global_data.h> +#include <asm/gpio.h> +#include <clk-uclass.h> +#include <dm.h> +#include <dm/device_compat.h> +#include <generic-phy.h>
drivers/pci/pcie_cdns_ti.c line 28
Quoted 10 lines
drivers/pci/pcie_cdns_ti.c new file +10
-0+#include <linux/bitops.h> +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/log2.h> +#include <log.h> +#include <pci.h> +#include <power-domain.h> +#include <regmap.h> +#include <syscon.h>
Please audit this list to make sure you need everything because..
drivers/pci/pcie_cdns_ti.c line 30
Quoted 2 lines
drivers/pci/pcie_cdns_ti.c new file +2
-0+ +DECLARE_GLOBAL_DATA_PTR ;
You don't reference gd in this code at all, so don't need this.
So please also make sure the giant list of defines is needed.
drivers/pci/pcie_cdns_ti.c line 137
Quoted 1 line
drivers/pci/pcie_cdns_ti.c new file +1
-0+#define usleep_range (a, b) udelay((b))
Per checkpatch.pl.conf:
# Not Linux, so we don't recommend usleep_range() over udelay()
Signature · 1 line
Tom
Re: [RFC PATCH 1/2] pci: Add TI K3 Cadence PCIe Controller
Quoted 2 lines · Tom Rini
On Wed, Aug 21, 2024 at 08:29:07PM +0530, Siddharth Vadapalli wrote:
[...]
Quoted 20 lines
Quoted 7 lines
drivers/pci/pcie_cdns_ti.c new file +7
-0+ +#include <asm/global_data.h> +#include <asm/gpio.h> +#include <clk-uclass.h> +#include <dm.h> +#include <dm/device_compat.h> +#include <generic-phy.h> drivers/pci/pcie_cdns_ti.c line 28
Quoted 10 lines
drivers/pci/pcie_cdns_ti.c new file +10
-0+#include <linux/bitops.h> +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/log2.h> +#include <log.h> +#include <pci.h> +#include <power-domain.h> +#include <regmap.h> +#include <syscon.h> Please audit this list to make sure you need everything because..
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ +DECLARE_GLOBAL_DATA_PTR;You don't reference gd in this code at all, so don't need this.
I missed dropping this. I had checked that the rest of the includes are required, but I will re-check when I post the v2 patch.
Quoted 2 lines
So please also make sure the giant list of defines is needed.
During the development of this driver, I had committed the changes with around 15 commits that had the defines added only when needed. Therefore I am positive that they are required. I squashed those commits into a single one which is this patch. Nevertheless, I will double check before posting the v2 patch.
Quoted 4 lines
Quoted 1 line
+#define
usleep_range(a, b)udelay((b))Per checkpatch.pl.conf:
# Not Linux, so we don't recommendusleep_range()overudelay()
Sure, I will switch to udelay().
Thank you for reviewing this patch and providing feedback. I will implement your suggestions in the v2 patch.
Regards,
Siddharth.
RFC PATCH 2/2 configs: j7200_evm_a72_defconfig: Enable configs for PCI support
In reply to Siddharth VadapalliTI's J7200 SoC has a single instance of PCIe Controller namely PCIe1 which is a Cadence PCIe Controller. To support PCI functionality with the PCIe1 instance of PCIe, enable the corresponding configs.
--- configs/j7200_evm_a72_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
configs/j7200_evm_a72_defconfig +4 -0
@@ -32,6 +32,7 @@ CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y # CONFIG_PSCI_RESET is not set +CONFIG_PCI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
@@ -72,6 +73,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_MTD=y +CONFIG_CMD_PCI=y CONFIG_CMD_REMOTEPROC=y CONFIG_CMD_UFS=y CONFIG_CMD_USB=y
@@ -154,6 +156,8 @@ CONFIG_MUX_MMIO=y CONFIG_PHY_TI_DP83869=y CONFIG_PHY_FIXED=y CONFIG_TI_AM65_CPSW_NUSS=y +CONFIG_PCI_CONFIG_HOST_BRIDGE=y +CONFIG_PCIE_CDNS_TI=y CONFIG_PHY=y CONFIG_SPL_PHY=y CONFIG_PHY_CADENCE_TORRENT=y
Signature · 1 line
2.40.1