Skip to contentSkip to conversation

Additional iProc PCIe host support/fixes

PATCH Superseded Ray Jui 3 participants 19 messages Oct 24, 2016

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ray Jui

author
#0 lore raw

cover Additional iProc PCIe host support/fixes

This patch series contains various changes and fixes to the iProc PCIe host driver. It also adds support for the next generation of PAXB and PAXC based host controllers

This patch series was developed based on v4.9-rc1 and tested on both NS2 SVK and Cygnus wireless audio platform

repo: https://github.com/Broadcom/arm64-linux.git
branch: iproc-pcie-v1

Ray Jui (12):
PCI: iproc: Improve core register population
PCI: iproc: Do not reset PAXC when initializing the driver
PCI: iproc: Add BCMA type
PCI: iproc: Fix exception with multi-function devices
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add PAXC v2 support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Making outbound mapping code more generic
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add inbound DMA mapping support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add support for the next-gen PAXB controller

 .../devicetree/bindings/pci/brcm,iproc-pcie.txt    |  43 +-
 drivers/pci/host/pcie-iproc-bcma.c                 |   1 +
 drivers/pci/host/pcie-iproc-msi.c                  |   1 +
 drivers/pci/host/pcie-iproc-platform.c             |  19 +-
 drivers/pci/host/pcie-iproc.c                      | 942 ++++++++++++++++++---
 drivers/pci/host/pcie-iproc.h                      |  45 +-
 6 files changed, 916 insertions(+), 135 deletions(-)
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH 1/12 PCI: iproc: Improve core register population

As the number of iProc PCIe core registers starts to grow and differ between different revisions of the iProc PCIe controllers, the current way of populating each individual unsupported register with value 'IPROC_PCIE_REG_INVALID' with a table entry has become a bit messy and is difficult to scale up in the future

This patch improves the current driver by populating the invalid entries with code instead of through individual table entries. This helps to avoid a significant number of invalid table entries when support for the next revision of the iProc controller is added

---
 drivers/pci/host/pcie-iproc.c | 83 +++++++++++++++++++++++++++++++------------
 drivers/pci/host/pcie-iproc.h |  4 ++-
 2 files changed, 64 insertions(+), 23 deletions(-)
drivers/pci/host/pcie-iproc.c +61 -22
index 0b999a9..a9b9cd8 100644
@@ -69,18 +69,35 @@
 
 #define IPROC_PCIE_REG_INVALID 0xffff
 
+/*
+ * iProc PCIe host registers
+ */
 enum iproc_pcie_reg {
+	/* clock/reset signal control */
 	IPROC_PCIE_CLK_CTRL = 0,
+
+	/* allow access to root complex configuration space */
 	IPROC_PCIE_CFG_IND_ADDR,
 	IPROC_PCIE_CFG_IND_DATA,
+
+	/* allow access to device configuration space */
 	IPROC_PCIE_CFG_ADDR,
 	IPROC_PCIE_CFG_DATA,
+
+	/* enable INTx */
 	IPROC_PCIE_INTX_EN,
+
+	/* outbound address mapping */
 	IPROC_PCIE_OARR_LO,
 	IPROC_PCIE_OARR_HI,
 	IPROC_PCIE_OMAP_LO,
 	IPROC_PCIE_OMAP_HI,
+
+	/* link status */
 	IPROC_PCIE_LINK_STATUS,
+
+	/* total number of core registers */
+	IPROC_PCIE_MAX_NUM_REG,
 };
 
 /* iProc PCIe PAXB registers */
@@ -105,12 +122,6 @@ static const u16 iproc_pcie_reg_paxc[] = {
 	[IPROC_PCIE_CFG_IND_DATA] = 0x1f4,
 	[IPROC_PCIE_CFG_ADDR]     = 0x1f8,
 	[IPROC_PCIE_CFG_DATA]     = 0x1fc,
-	[IPROC_PCIE_INTX_EN]      = IPROC_PCIE_REG_INVALID,
-	[IPROC_PCIE_OARR_LO]      = IPROC_PCIE_REG_INVALID,
-	[IPROC_PCIE_OARR_HI]      = IPROC_PCIE_REG_INVALID,
-	[IPROC_PCIE_OMAP_LO]      = IPROC_PCIE_REG_INVALID,
-	[IPROC_PCIE_OMAP_HI]      = IPROC_PCIE_REG_INVALID,
-	[IPROC_PCIE_LINK_STATUS]  = IPROC_PCIE_REG_INVALID,
 };
 
 static inline struct iproc_pcie *iproc_data(struct pci_bus *bus)
@@ -204,7 +215,7 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus *bus,
 	 * PAXC is connected to an internally emulated EP within the SoC.  It
 	 * allows only one device.
 	 */
-	if (pcie->type == IPROC_PCIE_PAXC)
+	if (pcie->ep_is_internal)
 		if (slot > 0)
 			return NULL;
 
@@ -232,7 +243,7 @@ static void iproc_pcie_reset(struct iproc_pcie *pcie)
 {
 	u32 val;
 
-	if (pcie->type == IPROC_PCIE_PAXC) {
+	if (pcie->ep_is_internal) {
 		val = iproc_pcie_read_reg(pcie, IPROC_PCIE_CLK_CTRL);
 		val &= ~PAXC_RESET_MASK;
 		iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
@@ -270,7 +281,7 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus)
 	 * PAXC connects to emulated endpoint devices directly and does not
 	 * have a Serdes.  Therefore skip the link detection logic here.
 	 */
-	if (pcie->type == IPROC_PCIE_PAXC)
+	if (pcie->ep_is_internal)
 		return 0;
 
 	val = iproc_pcie_read_reg(pcie, IPROC_PCIE_LINK_STATUS);
@@ -454,6 +465,40 @@ static void iproc_pcie_msi_disable(struct iproc_pcie *pcie)
 	iproc_msi_exit(pcie);
 }
 
+static int iproc_pcie_rev_init(struct iproc_pcie *pcie)
+{
+	struct device *dev = pcie->dev;
+	unsigned int reg_idx;
+	const u16 *regs;
+
+	switch (pcie->type) {
+	case IPROC_PCIE_PAXB:
+		regs = iproc_pcie_reg_paxb;
+		break;
+	case IPROC_PCIE_PAXC:
+		regs = iproc_pcie_reg_paxc;
+		pcie->ep_is_internal = true;
+		break;
+	default:
+		dev_err(dev, "incompatible iProc PCIe interface\n");
+		return -EINVAL;
+	}
+
+	pcie->reg_offsets = devm_kcalloc(dev, IPROC_PCIE_MAX_NUM_REG,
+					 sizeof(*pcie->reg_offsets),
+					 GFP_KERNEL);
+	if (!pcie->reg_offsets)
+		return -ENOMEM;
+
+	/* go through the register table and populate all valid registers */
+	pcie->reg_offsets[0] = regs[0];
+	for (reg_idx = 1; reg_idx < IPROC_PCIE_MAX_NUM_REG; reg_idx++)
+		pcie->reg_offsets[reg_idx] = regs[reg_idx] ?
+			regs[reg_idx] : IPROC_PCIE_REG_INVALID;
+
+	return 0;
+}
+
 int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 {
 	struct device *dev;
@@ -462,6 +507,13 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 	struct pci_bus *bus;
 
 	dev = pcie->dev;
+
+	ret = iproc_pcie_rev_init(pcie);
+	if (ret) {
+		dev_err(dev, "unable to initialize controller parameters\n");
+		return ret;
+	}
+
 	ret = devm_request_pci_bus_resources(dev, res);
 	if (ret)
 		return ret;
@@ -478,19 +530,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 		goto err_exit_phy;
 	}
 
-	switch (pcie->type) {
-	case IPROC_PCIE_PAXB:
-		pcie->reg_offsets = iproc_pcie_reg_paxb;
-		break;
-	case IPROC_PCIE_PAXC:
-		pcie->reg_offsets = iproc_pcie_reg_paxc;
-		break;
-	default:
-		dev_err(dev, "incompatible iProc PCIe interface\n");
-		ret = -EINVAL;
-		goto err_power_off_phy;
-	}
-
 	iproc_pcie_reset(pcie);
 
 	if (pcie->need_ob_cfg) {
drivers/pci/host/pcie-iproc.h +3 -1
index e84d93c..83643d5 100644
@@ -55,6 +55,7 @@ struct iproc_msi;
  * @root_bus: pointer to root bus
  * @phy: optional PHY device that controls the Serdes
  * @map_irq: function callback to map interrupts
+ * @ep_is_internal: indicates an internal emulated endpoint device is connected
  * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
  * @ob: outbound mapping parameters
  * @msi: MSI data
@@ -62,7 +63,7 @@ struct iproc_msi;
 struct iproc_pcie {
 	struct device *dev;
 	enum iproc_pcie_type type;
-	const u16 *reg_offsets;
+	u16 *reg_offsets;
 	void __iomem *base;
 	phys_addr_t base_addr;
 #ifdef CONFIG_ARM
@@ -71,6 +72,7 @@ struct iproc_pcie {
 	struct pci_bus *root_bus;
 	struct phy *phy;
 	int (*map_irq)(const struct pci_dev *, u8, u8);
+	bool ep_is_internal;
 	bool need_ob_cfg;
 	struct iproc_pcie_ob ob;
 	struct iproc_msi *msi;
Signature · 1 line
2.1.4
author
#2 lore raw

PATCH 2/12 PCI: iproc: Do not reset PAXC when initializing the driver

In reply to Ray Jui

During initialization, the current iProc PCIe host driver resets PAXC and the downstream internal endpoint device that PAXC connects to. If the endpoint device is already loaded with firmware and has started running from the bootloader stage, this downstream reset causes the endpoint device to stop working

---
 drivers/pci/host/pcie-iproc.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/pci/host/pcie-iproc.c +6 -9
index a9b9cd8..3f4884a 100644
@@ -243,16 +243,13 @@ static void iproc_pcie_reset(struct iproc_pcie *pcie)
 {
 	u32 val;
 
-	if (pcie->ep_is_internal) {
-		val = iproc_pcie_read_reg(pcie, IPROC_PCIE_CLK_CTRL);
-		val &= ~PAXC_RESET_MASK;
-		iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
-		udelay(100);
-		val |= PAXC_RESET_MASK;
-		iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
-		udelay(100);
+	/*
+	 * PAXC and the internal emulated endpoint device downstream should not
+	 * be reset. If firmware has been loaded on the endpoint device at an
+	 * earlier boot stage, reset here causes issues
+	 */
+	if (pcie->ep_is_internal)
 		return;
-	}
 
 	/*
 	 * Select perst_b signal as reset source. Put the device into reset,
Signature · 1 line
2.1.4
author
#3 lore raw

PATCH 3/12 PCI: iproc: Add BCMA type

In reply to Ray Jui

The iProc PCIe driver is currently using type IPROC_PCIE_PAXB for the following SoCs: NS, NSP, Cygnus, NS2, and Pegasus. In fact, the BCMA based NS uses a legacy PAXB controller that is slightly different from the PAXB controller used in the rest of SoCs, e.g., some registers are missing and it does not require software configuration of outbound/inbound address mapping

A new type IPROC_PCIE_PAXB_BCMA is added in this patch to allow us to properly support the BCMA based NS along with other iProc based SoCs going forward

---
 drivers/pci/host/pcie-iproc-bcma.c |  1 +
 drivers/pci/host/pcie-iproc-msi.c  |  1 +
 drivers/pci/host/pcie-iproc.c      | 14 ++++++++++++++
 drivers/pci/host/pcie-iproc.h      |  3 ++-
 4 files changed, 18 insertions(+), 1 deletion(-)
drivers/pci/host/pcie-iproc-bcma.c +1 -0
index 8ce0890..bd4c9ec 100644
@@ -54,6 +54,7 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
 
 	pcie->dev = dev;
 
+	pcie->type = IPROC_PCIE_PAXB_BCMA;
 	pcie->base = bdev->io_addr;
 	if (!pcie->base) {
 		dev_err(dev, "no controller registers\n");
drivers/pci/host/pcie-iproc-msi.c +1 -0
index 9a2973b..9fad791 100644
@@ -563,6 +563,7 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
 	}
 
 	switch (pcie->type) {
+	case IPROC_PCIE_PAXB_BCMA:
 	case IPROC_PCIE_PAXB:
 		msi->reg_offsets = iproc_msi_reg_paxb;
 		msi->nr_eq_region = 1;
drivers/pci/host/pcie-iproc.c +14 -0
index 3f4884a..f3b3340 100644
@@ -100,6 +100,17 @@ enum iproc_pcie_reg {
 	IPROC_PCIE_MAX_NUM_REG,
 };
 
+/* iProc PCIe PAXB BCMA registers */
+static const u16 iproc_pcie_reg_paxb_bcma[] = {
+	[IPROC_PCIE_CLK_CTRL]         = 0x000,
+	[IPROC_PCIE_CFG_IND_ADDR]     = 0x120,
+	[IPROC_PCIE_CFG_IND_DATA]     = 0x124,
+	[IPROC_PCIE_CFG_ADDR]         = 0x1f8,
+	[IPROC_PCIE_CFG_DATA]         = 0x1fc,
+	[IPROC_PCIE_INTX_EN]          = 0x330,
+	[IPROC_PCIE_LINK_STATUS]      = 0xf0c,
+};
+
 /* iProc PCIe PAXB registers */
 static const u16 iproc_pcie_reg_paxb[] = {
 	[IPROC_PCIE_CLK_CTRL]     = 0x000,
@@ -469,6 +480,9 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie)
 	const u16 *regs;
 
 	switch (pcie->type) {
+	case IPROC_PCIE_PAXB_BCMA:
+		regs = iproc_pcie_reg_paxb_bcma;
+		break;
 	case IPROC_PCIE_PAXB:
 		regs = iproc_pcie_reg_paxb;
 		break;
drivers/pci/host/pcie-iproc.h +2 -1
index 83643d5..768be05 100644
@@ -24,7 +24,8 @@
  * endpoint devices.
  */
 enum iproc_pcie_type {
-	IPROC_PCIE_PAXB = 0,
+	IPROC_PCIE_PAXB_BCMA = 0,
+	IPROC_PCIE_PAXB,
 	IPROC_PCIE_PAXC,
 };
 
Signature · 1 line
2.1.4
author
#4 lore raw

PATCH 4/12 PCI: iproc: Fix exception with multi-function devices

In reply to Ray Jui

During enumeration with multi-function EP devices, access to the configuration space of a non-exist function results in an unsupported request being returned as expected. By default the PAXB based iProc PCIe controller forwards this as an APB error to the host system and that causes an exception, which is undesired

This patch disables this undesired behavior and lets the kernel PCI stack deals with an access to the non-exist function, in which case a vendor ID of 0xffff is returned and handled gracefully

---
 drivers/pci/host/pcie-iproc.c | 58 +++++++++++++++++++++++++++++++++++++++++--
 drivers/pci/host/pcie-iproc.h |  3 +++
 2 files changed, 59 insertions(+), 2 deletions(-)
drivers/pci/host/pcie-iproc.c +56 -2
index f3b3340..07ec478 100644
@@ -58,6 +58,9 @@
 #define PCIE_DL_ACTIVE_SHIFT         2
 #define PCIE_DL_ACTIVE               BIT(PCIE_DL_ACTIVE_SHIFT)
 
+#define APB_ERR_EN_SHIFT             0
+#define APB_ERR_EN                   BIT(APB_ERR_EN_SHIFT)
+
 #define OARR_VALID_SHIFT             0
 #define OARR_VALID                   BIT(OARR_VALID_SHIFT)
 #define OARR_SIZE_CFG_SHIFT          1
@@ -96,6 +99,9 @@ enum iproc_pcie_reg {
 	/* link status */
 	IPROC_PCIE_LINK_STATUS,
 
+	/* enable APB error for unsupported requests */
+	IPROC_PCIE_APB_ERR_EN,
+
 	/* total number of core registers */
 	IPROC_PCIE_MAX_NUM_REG,
 };
@@ -124,6 +130,7 @@ static const u16 iproc_pcie_reg_paxb[] = {
 	[IPROC_PCIE_OMAP_LO]      = 0xd40,
 	[IPROC_PCIE_OMAP_HI]      = 0xd44,
 	[IPROC_PCIE_LINK_STATUS]  = 0xf0c,
+	[IPROC_PCIE_APB_ERR_EN]   = 0xf40,
 };
 
 /* iProc PCIe PAXC v1 registers */
@@ -181,6 +188,28 @@ static inline void iproc_pcie_write_reg(struct iproc_pcie *pcie,
 	writel(val, pcie->base + offset);
 }
 
+/**
+ * APB error forwarding can be disabled during access of configuration
+ * registers of the endpoint device, to prevent unsupported requests
+ * (typically seen during enumeration with multi-function devices) from
+ * triggering a system exception
+ */
+static inline void iproc_pcie_apb_err_disable(struct pci_bus *bus,
+					      bool disable)
+{
+	struct iproc_pcie *pcie = iproc_data(bus);
+	u32 val;
+
+	if (bus->number && pcie->has_apb_err_disable) {
+		val = iproc_pcie_read_reg(pcie, IPROC_PCIE_APB_ERR_EN);
+		if (disable)
+			val &= ~APB_ERR_EN;
+		else
+			val |= APB_ERR_EN;
+		iproc_pcie_write_reg(pcie, IPROC_PCIE_APB_ERR_EN, val);
+	}
+}
+
 static inline void iproc_pcie_ob_write(struct iproc_pcie *pcie,
 				       enum iproc_pcie_reg reg,
 				       unsigned window, u32 val)
@@ -244,10 +273,34 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus *bus,
 		return (pcie->base + offset);
 }
 
+static int iproc_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
+				    int where, int size, u32 *val)
+{
+	int ret;
+
+	iproc_pcie_apb_err_disable(bus, true);
+	ret = pci_generic_config_read32(bus, devfn, where, size, val);
+	iproc_pcie_apb_err_disable(bus, false);
+
+	return ret;
+}
+
+static int iproc_pcie_config_write32(struct pci_bus *bus, unsigned int devfn,
+				     int where, int size, u32 val)
+{
+	int ret;
+
+	iproc_pcie_apb_err_disable(bus, true);
+	ret = pci_generic_config_write32(bus, devfn, where, size, val);
+	iproc_pcie_apb_err_disable(bus, false);
+
+	return ret;
+}
+
 static struct pci_ops iproc_pcie_ops = {
 	.map_bus = iproc_pcie_map_cfg_bus,
-	.read = pci_generic_config_read32,
-	.write = pci_generic_config_write32,
+	.read = iproc_pcie_config_read32,
+	.write = iproc_pcie_config_write32,
 };
 
 static void iproc_pcie_reset(struct iproc_pcie *pcie)
@@ -485,6 +538,7 @@ static int iproc_pcie_rev_init(struct iproc_pcie *pcie)
 		break;
 	case IPROC_PCIE_PAXB:
 		regs = iproc_pcie_reg_paxb;
+		pcie->has_apb_err_disable = true;
 		break;
 	case IPROC_PCIE_PAXC:
 		regs = iproc_pcie_reg_paxc;
drivers/pci/host/pcie-iproc.h +3 -0
index 768be05..711dd3a 100644
@@ -57,6 +57,8 @@ struct iproc_msi;
  * @phy: optional PHY device that controls the Serdes
  * @map_irq: function callback to map interrupts
  * @ep_is_internal: indicates an internal emulated endpoint device is connected
+ * @has_apb_err_disable: indicates the controller can be configured to prevent
+ * unsupported request from being forwarded as an APB bus error
  * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
  * @ob: outbound mapping parameters
  * @msi: MSI data
@@ -74,6 +76,7 @@ struct iproc_pcie {
 	struct phy *phy;
 	int (*map_irq)(const struct pci_dev *, u8, u8);
 	bool ep_is_internal;
+	bool has_apb_err_disable;
 	bool need_ob_cfg;
 	struct iproc_pcie_ob ob;
 	struct iproc_msi *msi;
Signature · 1 line
2.1.4
author
#5 lore raw

PATCH 5/12 PCI: iproc: Update iProc PCIe DT binding

In reply to Ray Jui

Add new compatible string "brcm,iproc-pcie-paxc-v2" to the iProc PCIe device tree binding document. "brcm,iproc-pcie-paxc-v2" is for the second generation of the Broadcom iProc PCIe PAXC host controller

Also updated the binding document with more detailed description of each compatible string and compatible SoCs

Finally, added description of optional property "msi-map", for use with MSI controllers with sideband data

---
 .../devicetree/bindings/pci/brcm,iproc-pcie.txt    | 31 ++++++++++++++++------
 1 file changed, 23 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +23 -8
index 01b88f4..071bbc2 100644
@@ -1,10 +1,15 @@
 * Broadcom iProc PCIe controller with the platform bus interface
 
 Required properties:
-- compatible: Must be "brcm,iproc-pcie" for PAXB, or "brcm,iproc-pcie-paxc"
-  for PAXC.  PAXB-based root complex is used for external endpoint devices.
-  PAXC-based root complex is connected to emulated endpoint devices
-  internal to the ASIC
+- compatible:
+      "brcm,iproc-pcie" for the first generation of PAXB based controller,
+used in SoCs including NSP, Cygnus, NS2, and Pegasus
+      "brcm,iproc-pcie-paxc" for the first generation of PAXC based
+controller, used in NS2
+      "brcm,iproc-pcie-paxc-v2" for the second generation of PAXC based
+controller, used in Stingray
+  PAXB-based root complex is used for external endpoint devices. PAXC-based
+root complex is connected to emulated endpoint devices internal to the ASIC
 - reg: base address and length of the PCIe controller I/O register space
 - #interrupt-cells: set to <1>
 - interrupt-map-mask and interrupt-map, standard PCI properties to define the
@@ -19,6 +24,7 @@ Required properties:
 Optional properties:
 - phys: phandle of the PCIe PHY device
 - phy-names: must be "pcie-phy"
+- dma-coherent: present if DMA operations are coherent
 
 - brcm,pcie-ob: Some iProc SoCs do not have the outbound address mapping done
 by the ASIC after power on reset. In this case, SW needs to configure it
@@ -41,10 +47,19 @@ For older platforms without MSI integrated in the GIC, iProc PCIe core provides
 an event queue based MSI support.  The iProc MSI uses host memories to store
 MSI posted writes in the event queues
 
-- msi-parent: Link to the device node of the MSI controller.  On newer iProc
-platforms, the MSI controller may be gicv2m or gicv3-its.  On older iProc
-platforms without MSI support in its interrupt controller, one may use the
-event queue based MSI support integrated within the iProc PCIe core.
+On newer iProc platforms, gicv2m or gicv3-its based MSI support should be used
+
+- msi-map: Maps a Requester ID to an MSI controller and associated MSI
+sideband data
+
+- msi-parent: Link to the device node of the MSI controller, used when no MSI
+sideband data is passed between the iProc PCIe controller and the MSI
+controller
+
+Refer to the following binding documents for more detailed description on
+the use of 'msi-map' and 'msi-parent':
+  Documentation/devicetree/bindings/pci/pci-msi.txt
+  Documentation/devicetree/bindings/interrupt-controller/msi.txt
 
 When the iProc event queue based MSI is used, one needs to define the
 following properties in the MSI device node:
Signature · 1 line
2.1.4
author
#6 lore raw

PATCH 6/12 PCI: iproc: Add PAXC v2 support

In reply to Ray Jui

Add support for the second generation of the iProc PCIe PAXC host controller to the iProc PCIe host driver

---
 drivers/pci/host/pcie-iproc-platform.c |   3 +
 drivers/pci/host/pcie-iproc.c          | 176 ++++++++++++++++++++++++++++++++-
 drivers/pci/host/pcie-iproc.h          |   4 +
 3 files changed, 180 insertions(+), 3 deletions(-)
drivers/pci/host/pcie-iproc-platform.c +3 -0
index a3de087..f243150 100644
@@ -33,6 +33,9 @@ static const struct of_device_id iproc_pcie_of_match_table[] = {
 	}, {
 		.compatible = "brcm,iproc-pcie-paxc",
 		.data = (int *)IPROC_PCIE_PAXC,
+	}, {
+		.compatible = "brcm,iproc-pcie-paxc-v2",
+		.data = (int *)IPROC_PCIE_PAXC_V2,
 	},
 	{ /* sentinel */ }
 };
drivers/pci/host/pcie-iproc.c +173 -3

223 lines not on this page · raw message

drivers/pci/host/pcie-iproc.h +4 -0
index 711dd3a..c2da140 100644
@@ -27,6 +27,7 @@ enum iproc_pcie_type {
 	IPROC_PCIE_PAXB_BCMA = 0,
 	IPROC_PCIE_PAXB,
 	IPROC_PCIE_PAXC,
+	IPROC_PCIE_PAXC_V2,
 };
 
 /**
@@ -61,6 +62,8 @@ struct iproc_msi;
  * unsupported request from being forwarded as an APB bus error
  * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
  * @ob: outbound mapping parameters
+ * @need_msi_steer: indicates additional configuration of the iProc PCIe
+ * controller is required to steer MSI writes to external interrupt controller
  * @msi: MSI data
  */
 struct iproc_pcie {
@@ -79,6 +82,7 @@ struct iproc_pcie {
 	bool has_apb_err_disable;
 	bool need_ob_cfg;
 	struct iproc_pcie_ob ob;
+	bool need_msi_steer;
 	struct iproc_msi *msi;
 };
 
Signature · 1 line
2.1.4
author
#7 lore raw

PATCH 7/12 PCI: iproc: Update iProc PCIe DT binding

In reply to Ray Jui

Remove the following outbound related device tree properties:
brcm,pcie-ob-window-size
brcm,pcie-ob-oarr-size

The above two prperties are a bit duplicated in functions. In addition, the next generation iProc PCIe controller has outbound mapping window that supports more than just two sizes, which cannot be properly supported by these properties

A better solution is to make the driver outbound mapping logic slightly more inteligent so it can figure out how to configure the outbound mapping based on the 'ranges' specified in device tree and the number and sizes of the outbound mapping windows that a particular revision of the iProc PCIe controller can support

---
 Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt | 7 -------
 1 file changed, 7 deletions(-)
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +0 -7
index 071bbc2..f827b8d 100644
@@ -35,11 +35,6 @@ effective:
 Required:
 - brcm,pcie-ob-axi-offset: The offset from the AXI address to the internal
 address used by the iProc PCIe core (not the PCIe address)
-- brcm,pcie-ob-window-size: The outbound address mapping window size (in MB)
-
-Optional:
-- brcm,pcie-ob-oarr-size: Some iProc SoCs need the OARR size bit to be set to
-increase the outbound window size
 
 MSI support (optional):
 
@@ -95,9 +90,7 @@ Example:
 		phy-names = "pcie-phy";
 
 		brcm,pcie-ob;
-		brcm,pcie-ob-oarr-size;
 		brcm,pcie-ob-axi-offset = <0x00000000>;
-		brcm,pcie-ob-window-size = <256>;
 
 		msi-parent = <&msi0>;
 
Signature · 1 line
2.1.4
author
#10 lore raw

PATCH 8/12 PCI: iproc: Making outbound mapping code more generic

In reply to Ray Jui

Improve the iProc PCIe outbound mapping code by making it more generic and removing redundant device tree properties 'brcm,pcie-ob-window-size' and 'brcm,pcie-ob-oarr-size'. The driver is still backward compatible to device tree binaries with the two properties specified

The driver now automatically confgures the correct mapping window size and number of mapping windows based on the value of device tree property 'ranges' and the capability of of the iProc PCIe controller

---
 drivers/pci/host/pcie-iproc-platform.c |  13 --
 drivers/pci/host/pcie-iproc.c          | 247 +++++++++++++++++++++++----------
 drivers/pci/host/pcie-iproc.h          |  15 +-
 3 files changed, 186 insertions(+), 89 deletions(-)
drivers/pci/host/pcie-iproc-platform.c +0 -13
index f243150..47329d3 100644
@@ -87,19 +87,6 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
 			return ret;
 		}
 		pcie->ob.axi_offset = val;
-
-		ret = of_property_read_u32(np, "brcm,pcie-ob-window-size",
-					   &val);
-		if (ret) {
-			dev_err(dev,
-				"missing brcm,pcie-ob-window-size property\n");
-			return ret;
-		}
-		pcie->ob.window_size = (resource_size_t)val * SZ_1M;
-
-		if (of_property_read_bool(np, "brcm,pcie-ob-oarr-size"))
-			pcie->ob.set_oarr_size = true;
-
 		pcie->need_ob_cfg = true;
 	}
 
drivers/pci/host/pcie-iproc.c +176 -71

310 lines not on this page · raw message

drivers/pci/host/pcie-iproc.h +10 -5
index c2da140..861b526 100644
@@ -32,17 +32,16 @@ enum iproc_pcie_type {
 
 /**
  * iProc PCIe outbound mapping
- * @set_oarr_size: indicates the OARR size bit needs to be set
  * @axi_offset: offset from the AXI address to the internal address used by
  * the iProc PCIe core
- * @window_size: outbound window size
+ * @nr_windows: total number of supported outbound mapping windows
  */
 struct iproc_pcie_ob {
-	bool set_oarr_size;
 	resource_size_t axi_offset;
-	resource_size_t window_size;
+	unsigned int nr_windows;
 };
 
+struct iproc_pcie_ob_map;
 struct iproc_msi;
 
 /**
@@ -60,8 +59,11 @@ struct iproc_msi;
  * @ep_is_internal: indicates an internal emulated endpoint device is connected
  * @has_apb_err_disable: indicates the controller can be configured to prevent
  * unsupported request from being forwarded as an APB bus error
+ *
  * @need_ob_cfg: indicates SW needs to configure the outbound mapping window
- * @ob: outbound mapping parameters
+ * @ob: outbound mapping related parameters
+ * @ob_map: outbound mapping related parameters specific to the controller
+ *
  * @need_msi_steer: indicates additional configuration of the iProc PCIe
  * controller is required to steer MSI writes to external interrupt controller
  * @msi: MSI data
@@ -80,8 +82,11 @@ struct iproc_pcie {
 	int (*map_irq)(const struct pci_dev *, u8, u8);
 	bool ep_is_internal;
 	bool has_apb_err_disable;
+
 	bool need_ob_cfg;
 	struct iproc_pcie_ob ob;
+	const struct iproc_pcie_ob_map *ob_map;
+
 	bool need_msi_steer;
 	struct iproc_msi *msi;
 };
Signature · 1 line
2.1.4
author
#11 lore raw

PATCH 9/12 PCI: iproc: Update iProc PCIe DT binding

In reply to Ray Jui

Add description for optional device tree property 'dma-ranges' for inbound mapping

---
 Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +3 -0
index f827b8d..62a0ab9 100644
@@ -25,6 +25,9 @@ Optional properties:
 - phys: phandle of the PCIe PHY device
 - phy-names: must be "pcie-phy"
 - dma-coherent: present if DMA operations are coherent
+- dma-ranges: Some PAXB based root complexes do not have inbound mapping done
+  by the ASIC after power on reset. In this case, SW is required to configure
+the mapping, based on inbound memory regions specified by this property
 
 - brcm,pcie-ob: Some iProc SoCs do not have the outbound address mapping done
 by the ASIC after power on reset. In this case, SW needs to configure it
Signature · 1 line
2.1.4
author
#12 lore raw

PATCH 10/12 PCI: iproc: Add inbound DMA mapping support

In reply to Ray Jui

This patch adds the support of inbound mapping to the iProc PCIe driver. The range of the inbound mapping is configured by the optional device tree property 'dma-ranges'.

While inbound mapping is done automatically in the ASIC on most iProc based SoCs, newer ASIC (e.g., Stingray) requires inbound mapping to be configured explcitly in software

---
 drivers/pci/host/pcie-iproc.c | 235 ++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/host/pcie-iproc.h |  15 +++
 2 files changed, 250 insertions(+)
drivers/pci/host/pcie-iproc.c +235 -0
index b466ba6..c4e2211 100644
@@ -81,6 +81,15 @@
 #define OARR_VALID                   BIT(OARR_VALID_SHIFT)
 #define OARR_SIZE_CFG_SHIFT          1
 
+/*
+ * Maximum number of inbound mapping region sizes that can be supported by an
+ * IARR
+ */
+#define MAX_NUM_IB_REGION_SIZES      9
+
+#define IMAP_VALID_SHIFT             0
+#define IMAP_VALID                   BIT(IMAP_VALID_SHIFT)
+
 #define PCI_EXP_CAP			0xac
 
 #define IPROC_PCIE_REG_INVALID 0xffff
@@ -109,6 +118,44 @@ static const struct iproc_pcie_ob_map paxb_ob_map[] = {
 	},
 };
 
+/**
+ * iProc PCIe inbound mapping type
+ */
+enum iproc_pcie_ib_map_type {
+	/* for DDR memory */
+	IPROC_PCIE_IB_MAP_MEM = 0,
+
+	/* for device I/O memory */
+	IPROC_PCIE_IB_MAP_IO,
+
+	/* invalid or unused */
+	IPROC_PCIE_IB_MAP_INVALID
+};
+
+/**
+ * iProc PCIe inbound mapping controller specific parameters
+ *
+ * @type: inbound mapping region type
+ * @size_unit: inbound mapping region size unit, could be SZ_1K, SZ_1M, or
+ * SZ_1G
+ * @region_sizes: list of supported inbound mapping region sizes in KB, MB, or
+ * GB, depedning on the size unit
+ * @nr_sizes: number of supported inbound mapping region sizes
+ * @nr_windows: number of supported inbound mapping windows for the region
+ * @imap_addr_offset: register offset between the upper and lower 32-bit
+ * IMAP address registers
+ * @imap_window_offset: register offset between each IMAP window
+ */
+struct iproc_pcie_ib_map {
+	enum iproc_pcie_ib_map_type type;
+	unsigned int size_unit;
+	resource_size_t region_sizes[MAX_NUM_IB_REGION_SIZES];
+	unsigned int nr_sizes;
+	unsigned int nr_windows;
+	u16 imap_addr_offset;
+	u16 imap_window_offset;
+};
+
 /*
  * iProc PCIe host registers
  */
@@ -162,6 +209,18 @@ enum iproc_pcie_reg {
 	IPROC_PCIE_OARR3,
 	IPROC_PCIE_OMAP3,
 
+	/* inbound address mapping */
+	IPROC_PCIE_IARR0,
+	IPROC_PCIE_IMAP0,
+	IPROC_PCIE_IARR1,
+	IPROC_PCIE_IMAP1,
+	IPROC_PCIE_IARR2,
+	IPROC_PCIE_IMAP2,
+	IPROC_PCIE_IARR3,
+	IPROC_PCIE_IMAP3,
+	IPROC_PCIE_IARR4,
+	IPROC_PCIE_IMAP4,
+
 	/* link status */
 	IPROC_PCIE_LINK_STATUS,
 
@@ -653,6 +712,178 @@ static int iproc_pcie_map_ranges(struct iproc_pcie *pcie,
 	return 0;
 }
 
+static inline bool iproc_pcie_ib_is_in_use(struct iproc_pcie *pcie,
+					   int region_idx)
+{
+	const struct iproc_pcie_ib_map *ib_map = &pcie->ib_map[region_idx];
+	u32 val;
+
+	val = iproc_pcie_read_reg(pcie, MAP_REG(IPROC_PCIE_IARR0, region_idx));
+
+	return !!(val & (BIT(ib_map->nr_sizes) - 1));
+}
+
+static inline bool iproc_pcie_ib_check_type(const struct iproc_pcie_ib_map *ib_map,
+					    enum iproc_pcie_ib_map_type type)
+{
+	return !!(ib_map->type == type);
+}
+
+static int iproc_pcie_ib_write(struct iproc_pcie *pcie, int region_idx,
+			       int size_idx, int nr_windows, u64 axi_addr,
+			       u64 pci_addr, resource_size_t size)
+{
+	struct device *dev = pcie->dev;
+	const struct iproc_pcie_ib_map *ib_map = &pcie->ib_map[region_idx];
+	u16 iarr_offset, imap_offset;
+	u32 val;
+	int window_idx;
+
+	iarr_offset = iproc_pcie_reg_offset(pcie,
+				MAP_REG(IPROC_PCIE_IARR0, region_idx));
+	imap_offset = iproc_pcie_reg_offset(pcie,
+				MAP_REG(IPROC_PCIE_IMAP0, region_idx));
+	if (iproc_pcie_reg_is_invalid(iarr_offset) ||
+	    iproc_pcie_reg_is_invalid(imap_offset))
+		return -EINVAL;
+
+	dev_info(dev, "ib region [%d]: offset 0x%x axi %pap pci %pap\n",
+		 region_idx, iarr_offset, &axi_addr, &pci_addr);
+
+	/*
+	 * Program the IARR registers. The upper 32-bit IARR register is
+	 * always right after the lower 32-bit IARR register
+	 */
+	writel(lower_32_bits(pci_addr) | BIT(size_idx),
+	       pcie->base + iarr_offset);
+	writel(upper_32_bits(pci_addr), pcie->base + iarr_offset + 4);
+
+	dev_info(dev, "iarr lo 0x%x iarr hi 0x%x\n",
+		 readl(pcie->base + iarr_offset),
+		 readl(pcie->base + iarr_offset + 4));
+
+	/*
+	 * Now program the IMAP registers. Each IARR region may have one or
+	 * more IMAP windows
+	 */
+	size /= nr_windows;
+	for (window_idx = 0; window_idx < nr_windows; window_idx++) {
+		val = readl(pcie->base + imap_offset);
+		val |= lower_32_bits(axi_addr) | IMAP_VALID;
+		writel(val, pcie->base + imap_offset);
+		writel(upper_32_bits(axi_addr),
+		       pcie->base + imap_offset + ib_map->imap_addr_offset);
+
+		dev_info(dev, "imap window [%d] lo 0x%x hi 0x%x\n",
+			 window_idx, readl(pcie->base + imap_offset),
+			 readl(pcie->base + imap_offset +
+			       ib_map->imap_addr_offset));
+
+		imap_offset += ib_map->imap_window_offset;
+		axi_addr += size;
+	}
+
+	return 0;
+}
+
+static int iproc_pcie_setup_ib(struct iproc_pcie *pcie,
+			       struct of_pci_range *range,
+			       enum iproc_pcie_ib_map_type type)
+{
+	struct device *dev = pcie->dev;
+	struct iproc_pcie_ib *ib = &pcie->ib;
+	int ret;
+	unsigned int region_idx, size_idx;
+	u64 axi_addr = range->cpu_addr, pci_addr = range->pci_addr;
+	resource_size_t size = range->size;
+
+	/* iterate through all IARR mapping regions */
+	for (region_idx = 0; region_idx < ib->nr_regions; region_idx++) {
+		const struct iproc_pcie_ib_map *ib_map =
+			&pcie->ib_map[region_idx];
+
+		/*
+		 * If current inbound region is already in use or not a
+		 * compatible type, move on to the next
+		 */
+		if (iproc_pcie_ib_is_in_use(pcie, region_idx) ||
+		    !iproc_pcie_ib_check_type(ib_map, type))
+			continue;
+
+		/* iterate through all supported region sizes to find a match */
+		for (size_idx = 0; size_idx < ib_map->nr_sizes; size_idx++) {
+			resource_size_t region_size =
+			ib_map->region_sizes[size_idx] * ib_map->size_unit;
+
+			if (size != region_size)
+				continue;
+
+			if (!IS_ALIGNED(axi_addr, region_size) ||
+			    !IS_ALIGNED(pci_addr, region_size)) {
+				dev_err(dev,
+					"axi %pap or pci %pap not aligned\n",
+					&axi_addr, &pci_addr);
+				return -EINVAL;
+			}
+
+			/* match found! program IARR and all IMAP windows */
+			ret = iproc_pcie_ib_write(pcie, region_idx, size_idx,
+						  ib_map->nr_windows, axi_addr,
+						  pci_addr, size);
+			if (ret)
+				goto err_ib;
+			else
+				return 0;
+
+		}
+	}
+err_ib:
+	dev_err(dev, "unable to configure inbound mapping\n");
+	dev_err(dev, "axi %pap, pci %pap, res size %pap\n",
+		&axi_addr, &pci_addr, &size);
+
+	return ret;
+}
+
+static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,
+				     struct device_node *node)
+{
+	const int na = 3, ns = 2;
+	int rlen;
+
+	parser->node = node;
+	parser->pna = of_n_addr_cells(node);
+	parser->np = parser->pna + na + ns;
+
+	parser->range = of_get_property(node, "dma-ranges", &rlen);
+	if (!parser->range)
+		return -ENOENT;
+
+	parser->end = parser->range + rlen / sizeof(__be32);
+	return 0;
+}
+
+static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie)
+{
+	struct of_pci_range range;
+	struct of_pci_range_parser parser;
+	int ret;
+
+	/* get the dma-ranges from DT */
+	ret = pci_dma_range_parser_init(&parser, pcie->dev->of_node);
+	if (ret)
+		return ret;
+
+	for_each_of_pci_range(&parser, &range) {
+		/* each range entry corresponds to an inbound mapping region */
+		ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_MEM);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 static int iproce_pcie_get_msi(struct iproc_pcie *pcie,
 			       struct device_node *msi_node,
 			       u64 *msi_addr)
@@ -880,6 +1111,10 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 		}
 	}
 
+	ret = iproc_pcie_map_dma_ranges(pcie);
+	if (ret && ret != -ENOENT)
+		goto err_power_off_phy;
+
 #ifdef CONFIG_ARM
 	pcie->sysdata.private_data = pcie;
 	sysdata = &pcie->sysdata;
drivers/pci/host/pcie-iproc.h +15 -0
index 861b526..3f2709a 100644
@@ -41,7 +41,16 @@ struct iproc_pcie_ob {
 	unsigned int nr_windows;
 };
 
+/**
+ * iProc PCIe inbound mapping
+ * @nr_regions: total number of supported inbound mapping regions
+ */
+struct iproc_pcie_ib {
+	unsigned int nr_regions;
+};
+
 struct iproc_pcie_ob_map;
+struct iproc_pcie_ib_map;
 struct iproc_msi;
 
 /**
@@ -64,6 +73,9 @@ struct iproc_msi;
  * @ob: outbound mapping related parameters
  * @ob_map: outbound mapping related parameters specific to the controller
  *
+ * @ib: inbound mapping related parameters
+ * @ib_map: outbound mapping region related parameters
+ *
  * @need_msi_steer: indicates additional configuration of the iProc PCIe
  * controller is required to steer MSI writes to external interrupt controller
  * @msi: MSI data
@@ -87,6 +99,9 @@ struct iproc_pcie {
 	struct iproc_pcie_ob ob;
 	const struct iproc_pcie_ob_map *ob_map;
 
+	struct iproc_pcie_ib ib;
+	const struct iproc_pcie_ib_map *ib_map;
+
 	bool need_msi_steer;
 	struct iproc_msi *msi;
 };
Signature · 1 line
2.1.4
author
#13 lore raw

PATCH 11/12 PCI: iproc: Update iProc PCIe DT binding

In reply to Ray Jui

Add new compatible string 'brcm,iproc-pcie-paxb-v2', for the next generation of the iProc PAXB PCIe host controller

---
 Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +2 -0
index 62a0ab9..c8d8c1c 100644
@@ -4,6 +4,8 @@ Required properties:
 - compatible:
       "brcm,iproc-pcie" for the first generation of PAXB based controller,
 used in SoCs including NSP, Cygnus, NS2, and Pegasus
+      "brcm,iproc-pcie-paxb-v2" for the second generation of PAXB based
+controller, used in Stingray
       "brcm,iproc-pcie-paxc" for the first generation of PAXC based
 controller, used in NS2
       "brcm,iproc-pcie-paxc-v2" for the second generation of PAXC based
Signature · 1 line
2.1.4
author
#14 lore raw

PATCH 12/12 PCI: iproc: Add support for the next-gen PAXB controller

In reply to Ray Jui

This patch adds the support for the next generation of the iProc PAXB host controller, used in Stingray

---
 drivers/pci/host/pcie-iproc-platform.c |   3 +
 drivers/pci/host/pcie-iproc.c          | 128 +++++++++++++++++++++++++++++++++
 drivers/pci/host/pcie-iproc.h          |   1 +
 3 files changed, 132 insertions(+)
drivers/pci/host/pcie-iproc-platform.c +3 -0
index 47329d3..fd3ed9b 100644
@@ -31,6 +31,9 @@ static const struct of_device_id iproc_pcie_of_match_table[] = {
 		.compatible = "brcm,iproc-pcie",
 		.data = (int *)IPROC_PCIE_PAXB,
 	}, {
+		.compatible = "brcm,iproc-pcie-paxb-v2",
+		.data = (int *)IPROC_PCIE_PAXB_V2,
+	}, {
 		.compatible = "brcm,iproc-pcie-paxc",
 		.data = (int *)IPROC_PCIE_PAXC,
 	}, {
drivers/pci/host/pcie-iproc.c +128 -0

164 lines not on this page · raw message

drivers/pci/host/pcie-iproc.h +1 -0
index 3f2709a..04fed8e 100644
@@ -26,6 +26,7 @@
 enum iproc_pcie_type {
 	IPROC_PCIE_PAXB_BCMA = 0,
 	IPROC_PCIE_PAXB,
+	IPROC_PCIE_PAXB_V2,
 	IPROC_PCIE_PAXC,
 	IPROC_PCIE_PAXC_V2,
 };
Signature · 1 line
2.1.4
#8 lore raw

Re: [PATCH 07/12] PCI: iproc: Update iProc PCIe DT binding

In reply to Ray Jui

2 spelling typos

Quoted 5 lines · Ray Jui

Remove the following outbound related device tree properties:
brcm,pcie-ob-window-size
brcm,pcie-ob-oarr-size

The above two prperties are a bit duplicated in functions. In addition,

properties typo

Quoted 6 lines

the next generation iProc PCIe controller has outbound mapping window that supports more than just two sizes, which cannot be properly supported by these properties

A better solution is to make the driver outbound mapping logic slightly more inteligent so it can figure out how to configure the outbound mapping

intelligent typo

Quoted 37 lines

based on the 'ranges' specified in device tree and the number and sizes of the outbound mapping windows that a particular revision of the iProc PCIe controller can support

---
 Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt | 7 -------
 1 file changed, 7 deletions(-)
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +0 -7
index 071bbc2..f827b8d 100644
@@ -35,11 +35,6 @@ effective:
 Required:
 - brcm,pcie-ob-axi-offset: The offset from the AXI address to the internal
 address used by the iProc PCIe core (not the PCIe address)
-- brcm,pcie-ob-window-size: The outbound address mapping window size (in MB)
-
-Optional:
-- brcm,pcie-ob-oarr-size: Some iProc SoCs need the OARR size bit to be set to
-increase the outbound window size
 
 MSI support (optional):
 
@@ -95,9 +90,7 @@ Example:
 		phy-names = "pcie-phy";
 
 		brcm,pcie-ob;
-		brcm,pcie-ob-oarr-size;
 		brcm,pcie-ob-axi-offset = <0x00000000>;
-		brcm,pcie-ob-window-size = <256>;
 
 		msi-parent = <&msi0>;
 
author
#9 lore raw

Re: [PATCH 07/12] PCI: iproc: Update iProc PCIe DT binding

Thanks! Will address both typos in the next revision. Waiting for feedback from Bjorn before sending out the next revision.

Ray

Quoted 59 lines · Scott Branden

2 spelling typos

Quoted 5 lines · Ray Jui

Remove the following outbound related device tree properties:
brcm,pcie-ob-window-size
brcm,pcie-ob-oarr-size

The above two prperties are a bit duplicated in functions. In addition,

properties typo

Quoted 8 lines

the next generation iProc PCIe controller has outbound mapping window that
supports more than just two sizes, which cannot be properly supported by these properties

A better solution is to make the driver outbound mapping logic slightly more inteligent so it can figure out how to configure the outbound mapping

intelligent typo

Quoted 41 lines

based on the 'ranges' specified in device tree and the number and sizes of the outbound mapping windows that a particular revision of the iProc PCIe controller can support

---
 Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt | 7 -------
 1 file changed, 7 deletions(-)
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +0 -0
index 071bbc2..f827b8d 100644
@@ -35,11 +35,6 @@ effective:
 Required:
 - brcm,pcie-ob-axi-offset: The offset from the AXI address to the

internal
address used by the iProc PCIe core (not the PCIe address)
-- brcm,pcie-ob-window-size: The outbound address mapping window size (in MB)

Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +0 -3
-
-Optional:
-- brcm,pcie-ob-oarr-size: Some iProc SoCs need the OARR size bit to

be set to

Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +0 -3
-increase the outbound window size
 
 MSI support (optional):
@@ -95,9 +90,7 @@ Example:
         phy-names = "pcie-phy";
 
         brcm,pcie-ob;
-        brcm,pcie-ob-oarr-size;
         brcm,pcie-ob-axi-offset = <0x00000000>;
-        brcm,pcie-ob-window-size = <256>;
 
         msi-parent = <&msi0>;
 
Acked-by on the v1 series
#15 lore raw
In reply to Ray Jui

Looks fine other than spelling mistakes in some commit messages.

Quoted 32 lines · Ray Jui

This patch series contains various changes and fixes to the iProc PCIe host driver. It also adds support for the next generation of PAXB and PAXC based host controllers

This patch series was developed based on v4.9-rc1 and tested on both NS2 SVK and Cygnus wireless audio platform

repo: https://github.com/Broadcom/arm64-linux.git
branch: iproc-pcie-v1

Ray Jui (12):
PCI: iproc: Improve core register population
PCI: iproc: Do not reset PAXC when initializing the driver
PCI: iproc: Add BCMA type
PCI: iproc: Fix exception with multi-function devices
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add PAXC v2 support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Making outbound mapping code more generic
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add inbound DMA mapping support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add support for the next-gen PAXB controller

 .../devicetree/bindings/pci/brcm,iproc-pcie.txt    |  43 +-
 drivers/pci/host/pcie-iproc-bcma.c                 |   1 +
 drivers/pci/host/pcie-iproc-msi.c                  |   1 +
 drivers/pci/host/pcie-iproc-platform.c             |  19 +-
 drivers/pci/host/pcie-iproc.c                      | 942 ++++++++++++++++++---
 drivers/pci/host/pcie-iproc.h                      |  45 +-
 6 files changed, 916 insertions(+), 135 deletions(-)
author
#16 lore raw
Quoted 4 lines · Scott Branden

Looks fine other than spelling mistakes in some commit messages.

Thanks, Scott. I will address those in the next revision of patchset. But would like to get some comments from Bjorn before sending out the next patchset.

Quoted 34 lines · Ray Jui
Quoted 33 lines

This patch series contains various changes and fixes to the iProc PCIe host driver. It also adds support for the next generation of PAXB and PAXC based host controllers

This patch series was developed based on v4.9-rc1 and tested on both NS2 SVK and Cygnus wireless audio platform

repo: https://github.com/Broadcom/arm64-linux.git
branch: iproc-pcie-v1

Ray Jui (12):
PCI: iproc: Improve core register population
PCI: iproc: Do not reset PAXC when initializing the driver
PCI: iproc: Add BCMA type
PCI: iproc: Fix exception with multi-function devices
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add PAXC v2 support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Making outbound mapping code more generic
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add inbound DMA mapping support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add support for the next-gen PAXB controller

 .../devicetree/bindings/pci/brcm,iproc-pcie.txt    |  43 +-
 drivers/pci/host/pcie-iproc-bcma.c                 |   1 +
 drivers/pci/host/pcie-iproc-msi.c                  |   1 +
 drivers/pci/host/pcie-iproc-platform.c             |  19 +-
 drivers/pci/host/pcie-iproc.c                      | 942
++++++++++++++++++---
 drivers/pci/host/pcie-iproc.h                      |  45 +-
 6 files changed, 916 insertions(+), 135 deletions(-)
#17 lore raw
In reply to Ray Jui

Hi Ray,

Quoted 10 lines · Ray Jui

This patch series contains various changes and fixes to the iProc PCIe host driver. It also adds support for the next generation of PAXB and PAXC based host controllers

This patch series was developed based on v4.9-rc1 and tested on both NS2 SVK and Cygnus wireless audio platform

repo: https://github.com/Broadcom/arm64-linux.git
branch: iproc-pcie-v1

Quoted 13 lines

Ray Jui (12):
PCI: iproc: Improve core register population
PCI: iproc: Do not reset PAXC when initializing the driver
PCI: iproc: Add BCMA type
PCI: iproc: Fix exception with multi-function devices
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add PAXC v2 support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Making outbound mapping code more generic
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add inbound DMA mapping support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add support for the next-gen PAXB controller

I'll look at these more soon, but there are four patches above with identical titles ("PCI: iproc: Update iProc PCIe DT binding"). The "iProc PCIe" part is a little redundant; can you remove that and instead include a hint about what each patch is about, e.g., "add optional dma-ranges", "remove outbound window properties", etc?

Quoted 11 lines
 .../devicetree/bindings/pci/brcm,iproc-pcie.txt    |  43 +-
 drivers/pci/host/pcie-iproc-bcma.c                 |   1 +
 drivers/pci/host/pcie-iproc-msi.c                  |   1 +
 drivers/pci/host/pcie-iproc-platform.c             |  19 +-
 drivers/pci/host/pcie-iproc.c                      | 942 ++++++++++++++++++---
 drivers/pci/host/pcie-iproc.h                      |  45 +-
 6 files changed, 916 insertions(+), 135 deletions(-)
Signature · 1 line
2.1.4
author
#18 lore raw

Hi Bjorn,

Quoted 27 lines · Bjorn Helgaas

Hi Ray,

Quoted 10 lines · Ray Jui

This patch series contains various changes and fixes to the iProc PCIe host driver. It also adds support for the next generation of PAXB and PAXC based host controllers

This patch series was developed based on v4.9-rc1 and tested on both NS2 SVK and Cygnus wireless audio platform

repo: https://github.com/Broadcom/arm64-linux.git
branch: iproc-pcie-v1

Quoted 13 lines

Ray Jui (12):
PCI: iproc: Improve core register population
PCI: iproc: Do not reset PAXC when initializing the driver
PCI: iproc: Add BCMA type
PCI: iproc: Fix exception with multi-function devices
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add PAXC v2 support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Making outbound mapping code more generic
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add inbound DMA mapping support
PCI: iproc: Update iProc PCIe DT binding
PCI: iproc: Add support for the next-gen PAXB controller

Quoted 6 lines

I'll look at these more soon, but there are four patches above with identical titles ("PCI: iproc: Update iProc PCIe DT binding"). The "iProc PCIe" part is a little redundant; can you remove that and instead include a hint about what each patch is about, e.g., "add optional dma-ranges", "remove outbound window properties", etc?

Yes, I'll certainly do that in the next revision of the patchset.

Thanks,

Ray