aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepak Pandey <Deepak.Pandey@arm.com>2020-08-28 11:52:31 +0530
committerDeepak Pandey <Deepak.Pandey@arm.com>2020-08-28 11:52:31 +0530
commit04b7e76d0fe6481a803f58e54e008a1489d713a5 (patch)
tree5b4d325d6de5d6db8fad393058f2b93770d4c2e6
parent70e895ef84cbea5d662c160efd1644827b601a21 (diff)
n1sdp: update quirk to support remote PCIeHEADN1SDP-2020.12.15master
Signed-off-by: Deepak Pandey <Deepak.Pandey@arm.com>
-rw-r--r--linux/0005-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch127
1 files changed, 127 insertions, 0 deletions
diff --git a/linux/0005-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch b/linux/0005-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
new file mode 100644
index 0000000..f39cb73
--- /dev/null
+++ b/linux/0005-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
@@ -0,0 +1,127 @@
+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
+