mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-06-06 14:50:03 +00:00
arm-bsp/linux-linaro-arm-5.4: n1sdp: pcie: add quirk support to enable remote chip PCIe
Base address mapping for remote chip Root PCIe ECAM space. Remote Chip PCIe topology is enumerated in Firmware and current change takes reference of enumerated PCIe hierarchy of Remote chip into the kernel and include in complete PCIe topology for kernel framework. Change-Id: I2bbceb5c89cc8fb4609e646652917cd97d638a27 Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@arm.com> Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
committed by
Jon Mason
parent
2eeea26a51
commit
87e8e14b9a
+134
@@ -0,0 +1,134 @@
|
||||
Upstream-Status: Inappropriate [will not be submitted as its an hack required to fix the hardware issue]
|
||||
|
||||
This patch is picked from the git repository:
|
||||
https://git.linaro.org/landing-teams/working/arm/n1sdp-pcie-quirk.git/patch/?id=04b7e76d0fe6481a803f58e54e008a1489d713a5
|
||||
|
||||
Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
|
||||
|
||||
From 94892f681463908e4a879258dfd6053bbb025447 Mon Sep 17 00:00:00 2001
|
||||
From: Sayanta Pattanayak <sayanta.pattanayak@arm.com>
|
||||
Date: Fri, 31 Jul 2020 15:32:24 +0530
|
||||
Subject: [PATCH 5/5] n1sdp: pcie: add quirk support enabling remote chip PCIe
|
||||
|
||||
Base address mapping for remote chip Root PCIe ECAM space.
|
||||
|
||||
Remote Chip PCIe topology is enumerated in Firmware and current
|
||||
change takes referecne of enumerated PCIe hierarchy of Remote chip into the
|
||||
kernel and include in complete PCIe topology for kernel framework.
|
||||
|
||||
Change-Id: I368e51c535ac66e48bd356bd33da6c49f1a0fb2a
|
||||
Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@arm.com>
|
||||
---
|
||||
drivers/acpi/pci_mcfg.c | 1 +
|
||||
drivers/pci/controller/pcie-n1sdp.c | 34 ++++++++++++++++++++++++++---
|
||||
include/linux/pci-ecam.h | 1 +
|
||||
3 files changed, 33 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c
|
||||
index 7a2b41b9ab57..53d073ef941f 100644
|
||||
--- a/drivers/acpi/pci_mcfg.c
|
||||
+++ b/drivers/acpi/pci_mcfg.c
|
||||
@@ -149,6 +149,7 @@ static struct mcfg_fixup mcfg_quirks[] = {
|
||||
/* N1SDP SoC with v1 PCIe controller */
|
||||
N1SDP_ECAM_MCFG(0x20181101, 0, &pci_n1sdp_pcie_ecam_ops),
|
||||
N1SDP_ECAM_MCFG(0x20181101, 1, &pci_n1sdp_ccix_ecam_ops),
|
||||
+ N1SDP_ECAM_MCFG(0x20181101, 2, &pci_n1sdp_remote_pcie_ecam_ops),
|
||||
};
|
||||
|
||||
static char mcfg_oem_id[ACPI_OEM_ID_SIZE];
|
||||
diff --git a/drivers/pci/controller/pcie-n1sdp.c b/drivers/pci/controller/pcie-n1sdp.c
|
||||
index 04c0de043817..19b573468ac5 100644
|
||||
--- a/drivers/pci/controller/pcie-n1sdp.c
|
||||
+++ b/drivers/pci/controller/pcie-n1sdp.c
|
||||
@@ -28,8 +28,10 @@
|
||||
|
||||
/* Platform specific values as hardcoded in the firmware. */
|
||||
#define AP_NS_SHARED_MEM_BASE 0x06000000
|
||||
-#define MAX_SEGMENTS 2 /* Two PCIe root complexes. */
|
||||
+/* Two PCIe root complexes in One Chip + One PCIe RC in Remote Chip*/
|
||||
+#define MAX_SEGMENTS 3
|
||||
#define BDF_TABLE_SIZE SZ_16K
|
||||
+#define REMOTE_CHIP_ADDR_OFFSET 0x40000000000
|
||||
|
||||
/*
|
||||
* Shared memory layout as written by the SCP upon boot time:
|
||||
@@ -100,7 +102,10 @@ static int pci_n1sdp_init(struct pci_config_window *cfg, unsigned int segment)
|
||||
if (segment >= MAX_SEGMENTS)
|
||||
return -ENODEV;
|
||||
|
||||
- table_base = AP_NS_SHARED_MEM_BASE + segment * BDF_TABLE_SIZE;
|
||||
+ if (segment > 1)
|
||||
+ table_base = AP_NS_SHARED_MEM_BASE + REMOTE_CHIP_ADDR_OFFSET;
|
||||
+ else
|
||||
+ table_base = AP_NS_SHARED_MEM_BASE + segment * BDF_TABLE_SIZE;
|
||||
|
||||
if (!request_mem_region(table_base, BDF_TABLE_SIZE,
|
||||
"PCIe valid BDFs")) {
|
||||
@@ -122,7 +127,13 @@ static int pci_n1sdp_init(struct pci_config_window *cfg, unsigned int segment)
|
||||
|
||||
memcpy_fromio(pcie_discovery_data[segment], shared_data, bdfs_size);
|
||||
|
||||
- rc_remapped_addr[segment] = devm_ioremap_nocache(dev,
|
||||
+
|
||||
+ if (segment > 1)
|
||||
+ rc_remapped_addr[segment] = devm_ioremap_nocache(dev,
|
||||
+ shared_data->rc_base_addr + REMOTE_CHIP_ADDR_OFFSET,
|
||||
+ PCI_CFG_SPACE_EXP_SIZE);
|
||||
+ else
|
||||
+ rc_remapped_addr[segment] = devm_ioremap_nocache(dev,
|
||||
shared_data->rc_base_addr,
|
||||
PCI_CFG_SPACE_EXP_SIZE);
|
||||
if (!rc_remapped_addr[segment]) {
|
||||
@@ -145,6 +156,11 @@ static int pci_n1sdp_ccix_init(struct pci_config_window *cfg)
|
||||
return pci_n1sdp_init(cfg, 1);
|
||||
}
|
||||
|
||||
+static int pci_n1sdp_remote_pcie_init(struct pci_config_window *cfg)
|
||||
+{
|
||||
+ return pci_n1sdp_init(cfg, 2);
|
||||
+}
|
||||
+
|
||||
struct pci_ecam_ops pci_n1sdp_pcie_ecam_ops = {
|
||||
.bus_shift = 20,
|
||||
.init = pci_n1sdp_pcie_init,
|
||||
@@ -165,6 +181,16 @@ struct pci_ecam_ops pci_n1sdp_ccix_ecam_ops = {
|
||||
}
|
||||
};
|
||||
|
||||
+struct pci_ecam_ops pci_n1sdp_remote_pcie_ecam_ops = {
|
||||
+ .bus_shift = 20,
|
||||
+ .init = pci_n1sdp_remote_pcie_init,
|
||||
+ .pci_ops = {
|
||||
+ .map_bus = pci_n1sdp_map_bus,
|
||||
+ .read = pci_generic_config_read32,
|
||||
+ .write = pci_generic_config_write32,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
static const struct of_device_id n1sdp_pcie_of_match[] = {
|
||||
{ .compatible = "arm,n1sdp-pcie" },
|
||||
{ },
|
||||
@@ -186,6 +212,8 @@ static int n1sdp_pcie_probe(struct platform_device *pdev)
|
||||
return pci_host_common_probe(pdev, &pci_n1sdp_pcie_ecam_ops);
|
||||
case 1:
|
||||
return pci_host_common_probe(pdev, &pci_n1sdp_ccix_ecam_ops);
|
||||
+ case 2:
|
||||
+ return pci_host_common_probe(pdev, &pci_n1sdp_remote_pcie_ecam_ops);
|
||||
}
|
||||
|
||||
dev_err(&pdev->dev, "Invalid segment number, must be smaller than %d\n",
|
||||
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
|
||||
index 03cdea69f4e8..2270662428e1 100644
|
||||
--- a/include/linux/pci-ecam.h
|
||||
+++ b/include/linux/pci-ecam.h
|
||||
@@ -59,6 +59,7 @@ extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */
|
||||
extern struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */
|
||||
extern struct pci_ecam_ops pci_n1sdp_pcie_ecam_ops; /* Arm N1SDP PCIe */
|
||||
extern struct pci_ecam_ops pci_n1sdp_ccix_ecam_ops; /* Arm N1SDP PCIe */
|
||||
+extern struct pci_ecam_ops pci_n1sdp_remote_pcie_ecam_ops; /* Arm N1SDP PCIe */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI_HOST_COMMON
|
||||
--
|
||||
2.25.0
|
||||
|
||||
@@ -11,6 +11,7 @@ SRC_URI_append_n1sdp = " \
|
||||
file://0002-pci_quirk-add-acs-override-for-PCI-devices.patch \
|
||||
file://0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch \
|
||||
file://0004-n1sdp-update-n1sdp-pci-quirk-for-SR-IOV-support.patch \
|
||||
file://0005-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch \
|
||||
file://enable-realtek-R8169.cfg \
|
||||
file://scripts-dtc-remove-redundant-YYLOC.patch \
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user