* [PATCH 1/8] PCI: iproc: Fix code comment
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-16 0:39 ` [PATCH 2/8] PCI: iproc: Remove unused code Ray Jui
` (7 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
Fix code comment in pcie-iproc.h so it matches the code
Signed-off-by: Ray Jui <rjui@broadcom.com>
---
drivers/pci/host/pcie-iproc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h
index c9e4c10..4880b09 100644
--- a/drivers/pci/host/pcie-iproc.h
+++ b/drivers/pci/host/pcie-iproc.h
@@ -20,11 +20,11 @@
* iProc PCIe device
* @dev: pointer to device data structure
* @base: PCIe host controller I/O register base
- * @resources: linked list of all PCI resources
* @sysdata: Per PCI controller data (ARM-specific)
* @root_bus: pointer to root bus
* @phy: optional PHY device that controls the Serdes
* @irqs: interrupt IDs
+ * @map_irq: function callback to map interrupts
*/
struct iproc_pcie {
struct device *dev;
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/8] PCI: iproc: Remove unused code
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
2015-09-16 0:39 ` [PATCH 1/8] PCI: iproc: Fix code comment Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-16 0:39 ` [PATCH 3/8] PCI: iproc: Remove ARCH specific flag Ray Jui
` (6 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
Remove unused struct iproc_pcie member irqs and #define
IPROC_PCIE_MAX_NUM_IRQS
Signed-off-by: Ray Jui <rjui@broadcom.com>
---
drivers/pci/host/pcie-iproc.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h
index 4880b09..ecaad57 100644
--- a/drivers/pci/host/pcie-iproc.h
+++ b/drivers/pci/host/pcie-iproc.h
@@ -14,8 +14,6 @@
#ifndef _PCIE_IPROC_H
#define _PCIE_IPROC_H
-#define IPROC_PCIE_MAX_NUM_IRQS 6
-
/**
* iProc PCIe device
* @dev: pointer to device data structure
@@ -34,7 +32,6 @@ struct iproc_pcie {
#endif
struct pci_bus *root_bus;
struct phy *phy;
- int irqs[IPROC_PCIE_MAX_NUM_IRQS];
int (*map_irq)(const struct pci_dev *, u8, u8);
};
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 3/8] PCI: iproc: Remove ARCH specific flag
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
2015-09-16 0:39 ` [PATCH 1/8] PCI: iproc: Fix code comment Ray Jui
2015-09-16 0:39 ` [PATCH 2/8] PCI: iproc: Remove unused code Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-16 0:39 ` [PATCH 4/8] PCI: iproc: Fix PCIe reset logic Ray Jui
` (5 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
Now setup-irq.o is built for arm64, in 'commit 459a07721c11
("PCI: Build setup-irq.o for arm64")' by Jayachandran, pci_fixup_irqs
can be referenced. We no longer need the CONFIG_ARM flag to wrap
around call to pci_fixup_irqs
Signed-off-by: Ray Jui <rjui@broadcom.com>
---
drivers/pci/host/pcie-iproc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index fe2efb1..52e7ff2 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -238,9 +238,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
-#ifdef CONFIG_ARM
pci_fixup_irqs(pci_common_swizzle, pcie->map_irq);
-#endif
pci_bus_add_devices(bus);
return 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 4/8] PCI: iproc: Fix PCIe reset logic
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
` (2 preceding siblings ...)
2015-09-16 0:39 ` [PATCH 3/8] PCI: iproc: Remove ARCH specific flag Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-16 0:39 ` [PATCH 5/8] PCI: iproc: Improve link detection logic Ray Jui
` (4 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
The current iProc PCIe reset logic does not always properly reset the
device. For example, in the case when the perst_b signal is already
de-asserted in the bootloader, the current reset logic fails to trigger
a proper asssert -> de-assert reset sequence. This patch fixes the issue
by always triggering the proper reset sequence
This patch also explicitly selects the desired reset source, i.e.,
perst_b and reduces the wait time after the device comes out of reset
from 250 ms to 100 ms, based on recommendation from the ASIC team
Signed-off-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Vladimir Dreizin <vdreizin@broadcom.com>
Reviewed-by: Trac Hoang <trhoang@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Tested-by: Vladimir Dreizin <vdreizin@broadcom.com>
Tested-by: Darren Edamura <dedamura@broadcom.com>
---
drivers/pci/host/pcie-iproc.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 52e7ff2..80e0541 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -31,6 +31,8 @@
#include "pcie-iproc.h"
#define CLK_CONTROL_OFFSET 0x000
+#define EP_PERST_SOURCE_SELECT_SHIFT 2
+#define EP_PERST_SOURCE_SELECT BIT(EP_PERST_SOURCE_SELECT_SHIFT)
#define EP_MODE_SURVIVE_PERST_SHIFT 1
#define EP_MODE_SURVIVE_PERST BIT(EP_MODE_SURVIVE_PERST_SHIFT)
#define RC_PCIE_RST_OUTPUT_SHIFT 0
@@ -119,15 +121,18 @@ static void iproc_pcie_reset(struct iproc_pcie *pcie)
u32 val;
/*
- * Configure the PCIe controller as root complex and send a downstream
- * reset
+ * Select perst_b signal as reset source. Put the device into reset,
+ * and then bring it out of reset
*/
- val = EP_MODE_SURVIVE_PERST | RC_PCIE_RST_OUTPUT;
+ val = readl(pcie->base + CLK_CONTROL_OFFSET);
+ val &= ~EP_PERST_SOURCE_SELECT & ~EP_MODE_SURVIVE_PERST &
+ ~RC_PCIE_RST_OUTPUT;
writel(val, pcie->base + CLK_CONTROL_OFFSET);
udelay(250);
- val &= ~EP_MODE_SURVIVE_PERST;
+
+ val |= RC_PCIE_RST_OUTPUT;
writel(val, pcie->base + CLK_CONTROL_OFFSET);
- msleep(250);
+ msleep(100);
}
static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus)
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 5/8] PCI: iproc: Improve link detection logic
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
` (3 preceding siblings ...)
2015-09-16 0:39 ` [PATCH 4/8] PCI: iproc: Fix PCIe reset logic Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-16 0:39 ` [PATCH 6/8] PCI: iproc: Update iProc PCIe device tree bindings Ray Jui
` (3 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
This patch further improves the iProc PCIe link detection logic by
explicitly querying the link status register to ensure link is active
It also forces class to PCI_CLASS_BRIDGE_PCI (0x0604) through the host
configuration space register
Signed-off-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
drivers/pci/host/pcie-iproc.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 80e0541..62e8085 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -60,6 +60,12 @@
#define SYS_RC_INTX_EN 0x330
#define SYS_RC_INTX_MASK 0xf
+#define PCIE_LINK_STATUS_OFFSET 0xf0c
+#define PCIE_PHYLINKUP_SHIFT 3
+#define PCIE_PHYLINKUP BIT(PCIE_PHYLINKUP_SHIFT)
+#define PCIE_DL_ACTIVE_SHIFT 2
+#define PCIE_DL_ACTIVE BIT(PCIE_DL_ACTIVE_SHIFT)
+
static inline struct iproc_pcie *iproc_data(struct pci_bus *bus)
{
struct iproc_pcie *pcie;
@@ -138,9 +144,15 @@ static void iproc_pcie_reset(struct iproc_pcie *pcie)
static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus)
{
u8 hdr_type;
- u32 link_ctrl;
+ u32 link_ctrl, class, val;
u16 pos, link_status;
- int link_is_active = 0;
+ bool link_is_active = false;
+
+ val = readl(pcie->base + PCIE_LINK_STATUS_OFFSET);
+ if (!(val & PCIE_PHYLINKUP) || !(val & PCIE_DL_ACTIVE)) {
+ dev_err(pcie->dev, "PHY or data link is INACTIVE!\n");
+ return -ENODEV;
+ }
/* make sure we are not in EP mode */
pci_bus_read_config_byte(bus, 0, PCI_HEADER_TYPE, &hdr_type);
@@ -150,14 +162,19 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus)
}
/* force class to PCI_CLASS_BRIDGE_PCI (0x0604) */
- pci_bus_write_config_word(bus, 0, PCI_CLASS_DEVICE,
- PCI_CLASS_BRIDGE_PCI);
+#define PCI_BRIDGE_CTRL_REG_OFFSET 0x43c
+#define PCI_CLASS_BRIDGE_MASK 0xffff00
+#define PCI_CLASS_BRIDGE_SHIFT 8
+ pci_bus_read_config_dword(bus, 0, PCI_BRIDGE_CTRL_REG_OFFSET, &class);
+ class &= ~PCI_CLASS_BRIDGE_MASK;
+ class |= (PCI_CLASS_BRIDGE_PCI << PCI_CLASS_BRIDGE_SHIFT);
+ pci_bus_write_config_dword(bus, 0, PCI_BRIDGE_CTRL_REG_OFFSET, class);
/* check link status to see if link is active */
pos = pci_bus_find_capability(bus, 0, PCI_CAP_ID_EXP);
pci_bus_read_config_word(bus, 0, pos + PCI_EXP_LNKSTA, &link_status);
if (link_status & PCI_EXP_LNKSTA_NLW)
- link_is_active = 1;
+ link_is_active = true;
if (!link_is_active) {
/* try GEN 1 link speed */
@@ -181,7 +198,7 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus)
pci_bus_read_config_word(bus, 0, pos + PCI_EXP_LNKSTA,
&link_status);
if (link_status & PCI_EXP_LNKSTA_NLW)
- link_is_active = 1;
+ link_is_active = true;
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 6/8] PCI: iproc: Update iProc PCIe device tree bindings
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
` (4 preceding siblings ...)
2015-09-16 0:39 ` [PATCH 5/8] PCI: iproc: Improve link detection logic Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-16 0:39 ` [PATCH 7/8] PCI: iproc: Add outbound mapping support Ray Jui
` (2 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
This patch updates the iProc PCIe device tree bindings with added
support for outbound mapping configurations
Signed-off-by: Ray Jui <rjui@broadcom.com>
---
.../devicetree/bindings/pci/brcm,iproc-pcie.txt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
index f7ce50e..45c2a80 100644
--- a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
@@ -17,6 +17,21 @@ Optional properties:
- phys: phandle of the PCIe PHY device
- phy-names: must be "pcie-phy"
+- 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
+
+If the brcm,pcie-ob property is present, the following properties become
+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
+
Example:
pcie0: pcie@18012000 {
compatible = "brcm,iproc-pcie";
@@ -38,6 +53,11 @@ Example:
phys = <&phy 0 5>;
phy-names = "pcie-phy";
+
+ brcm,pcie-ob;
+ brcm,pcie-ob-oarr-size;
+ brcm,pcie-ob-axi-offset = <0x00000000>;
+ brcm,pcie-ob-window-size = <256>;
};
pcie1: pcie@18013000 {
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 7/8] PCI: iproc: Add outbound mapping support
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
` (5 preceding siblings ...)
2015-09-16 0:39 ` [PATCH 6/8] PCI: iproc: Update iProc PCIe device tree bindings Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-10-13 17:58 ` Kevin Hilman
2015-09-16 0:39 ` [PATCH 8/8] PCI: iproc: Fix compile warnings Ray Jui
2015-09-25 23:21 ` [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Bjorn Helgaas
8 siblings, 1 reply; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui
Certain iProc SoCs require the PCIe outbound mapping to be configured in
SW. This patch adds support for those chips
Signed-off-by: Ray Jui <rjui@broadcom.com>
---
drivers/pci/host/pcie-iproc-platform.c | 27 ++++++++
drivers/pci/host/pcie-iproc.c | 113 +++++++++++++++++++++++++++++++++
drivers/pci/host/pcie-iproc.h | 17 +++++
3 files changed, 157 insertions(+)
diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c
index 9aedc8e..c9550dc 100644
--- a/drivers/pci/host/pcie-iproc-platform.c
+++ b/drivers/pci/host/pcie-iproc-platform.c
@@ -54,6 +54,33 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ if (of_property_read_bool(np, "brcm,pcie-ob")) {
+ u32 val;
+
+ ret = of_property_read_u32(np, "brcm,pcie-ob-axi-offset",
+ &val);
+ if (ret) {
+ dev_err(pcie->dev,
+ "missing brcm,pcie-ob-axi-offset property\n");
+ return ret;
+ }
+ pcie->ob.axi_offset = val;
+
+ ret = of_property_read_u32(np, "brcm,pcie-ob-window-size",
+ &val);
+ if (ret) {
+ dev_err(pcie->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;
+ }
+
/* PHY use is optional */
pcie->phy = devm_phy_get(&pdev->dev, "pcie-phy");
if (IS_ERR(pcie->phy)) {
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 62e8085..2ba3c4b 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -66,6 +66,18 @@
#define PCIE_DL_ACTIVE_SHIFT 2
#define PCIE_DL_ACTIVE BIT(PCIE_DL_ACTIVE_SHIFT)
+#define OARR_VALID_SHIFT 0
+#define OARR_VALID BIT(OARR_VALID_SHIFT)
+#define OARR_SIZE_CFG_SHIFT 1
+#define OARR_SIZE_CFG BIT(OARR_SIZE_CFG_SHIFT)
+
+#define OARR_LO(window) (0xd20 + (window) * 8)
+#define OARR_HI(window) (0xd24 + (window) * 8)
+#define OMAP_LO(window) (0xd40 + (window) * 8)
+#define OMAP_HI(window) (0xd44 + (window) * 8)
+
+#define MAX_NUM_OB_WINDOWS 2
+
static inline struct iproc_pcie *iproc_data(struct pci_bus *bus)
{
struct iproc_pcie *pcie;
@@ -212,6 +224,99 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
writel(SYS_RC_INTX_MASK, pcie->base + SYS_RC_INTX_EN);
}
+/**
+ * Some iProc SoCs require the SW to configure the outbound address mapping
+ *
+ * Outbound address translation:
+ *
+ * iproc_pcie_address = axi_address - axi_offset
+ * OARR = iproc_pcie_address
+ * OMAP = pci_addr
+ *
+ * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
+ */
+static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
+ u64 pci_addr, resource_size_t size)
+{
+ struct iproc_pcie_ob *ob = &pcie->ob;
+ unsigned i;
+ u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
+
+ if (size > max_size) {
+ dev_err(pcie->dev,
+ "res size 0x%llx exceeds max supported size 0x%llx\n",
+ (u64)size, max_size);
+ return -EINVAL;
+ }
+
+ if (size % ob->window_size) {
+ dev_err(pcie->dev,
+ "res size 0x%llx needs to be multiple of "
+ "window size 0x%llx\n", (u64)size, ob->window_size);
+ return -EINVAL;
+ }
+
+ if (axi_addr < ob->axi_offset) {
+ dev_err(pcie->dev,
+ "axi address %pap less than offset %pap\n",
+ &axi_addr, &ob->axi_offset);
+ return -EINVAL;
+ }
+
+ /*
+ * Translate the AXI address to the internal address used by the iProc
+ * PCIe core before programming the OARR
+ */
+ axi_addr -= ob->axi_offset;
+
+ for (i = 0; i < MAX_NUM_OB_WINDOWS; i++) {
+ writel(lower_32_bits(axi_addr) | OARR_VALID |
+ (ob->set_oarr_size ? 1 : 0), pcie->base + OARR_LO(i));
+ writel(upper_32_bits(axi_addr), pcie->base + OARR_HI(i));
+ writel(lower_32_bits(pci_addr), pcie->base + OMAP_LO(i));
+ writel(upper_32_bits(pci_addr), pcie->base + OMAP_HI(i));
+
+ size -= ob->window_size;
+ if (size == 0)
+ break;
+
+ axi_addr += ob->window_size;
+ pci_addr += ob->window_size;
+ }
+
+ return 0;
+}
+
+static int iproc_pcie_map_ranges(struct iproc_pcie *pcie,
+ struct list_head *resources)
+{
+ struct resource_entry *window;
+ int ret;
+
+ resource_list_for_each_entry(window, resources) {
+ struct resource *res = window->res;
+ u64 res_type = resource_type(res);
+
+ switch (res_type) {
+ case IORESOURCE_IO:
+ case IORESOURCE_BUS:
+ break;
+ case IORESOURCE_MEM:
+ ret = iproc_pcie_setup_ob(pcie, res->start,
+ res->start - window->offset,
+ resource_size(res));
+ if (ret)
+ return ret;
+ break;
+ default:
+ dev_err(pcie->dev, "invalid resource %pR\n", res);
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
{
int ret;
@@ -235,6 +340,14 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
iproc_pcie_reset(pcie);
+ if (pcie->need_ob_cfg) {
+ ret = iproc_pcie_map_ranges(pcie, res);
+ if (ret) {
+ dev_err(pcie->dev, "map failed\n");
+ goto err_power_off_phy;
+ }
+ }
+
#ifdef CONFIG_ARM
pcie->sysdata.private_data = pcie;
sysdata = &pcie->sysdata;
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h
index ecaad57..d3dc940 100644
--- a/drivers/pci/host/pcie-iproc.h
+++ b/drivers/pci/host/pcie-iproc.h
@@ -15,6 +15,19 @@
#define _PCIE_IPROC_H
/**
+ * 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
+ */
+struct iproc_pcie_ob {
+ bool set_oarr_size;
+ resource_size_t axi_offset;
+ resource_size_t window_size;
+};
+
+/**
* iProc PCIe device
* @dev: pointer to device data structure
* @base: PCIe host controller I/O register base
@@ -23,6 +36,8 @@
* @phy: optional PHY device that controls the Serdes
* @irqs: interrupt IDs
* @map_irq: function callback to map interrupts
+ * @need_ob_cfg: indidates SW needs to configure the outbound mapping window
+ * @ob: outbound mapping parameters
*/
struct iproc_pcie {
struct device *dev;
@@ -33,6 +48,8 @@ struct iproc_pcie {
struct pci_bus *root_bus;
struct phy *phy;
int (*map_irq)(const struct pci_dev *, u8, u8);
+ bool need_ob_cfg;
+ struct iproc_pcie_ob ob;
};
int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 7/8] PCI: iproc: Add outbound mapping support
2015-09-16 0:39 ` [PATCH 7/8] PCI: iproc: Add outbound mapping support Ray Jui
@ 2015-10-13 17:58 ` Kevin Hilman
2015-10-13 20:02 ` [PATCH] PCI: iproc: fix 32-bit build error Arnd Bergmann
0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2015-10-13 17:58 UTC (permalink / raw)
To: Ray Jui
Cc: Bjorn Helgaas, Hauke Mehrtens, Linux PCI, lkml,
linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list,
Tyler Baker, Mark Brown, Olof Johansson
On Tue, Sep 15, 2015 at 5:39 PM, Ray Jui <rjui@broadcom.com> wrote:
> Certain iProc SoCs require the PCIe outbound mapping to be configured in
> SW. This patch adds support for those chips
>
> Signed-off-by: Ray Jui <rjui@broadcom.com>
kernelci.org bot found a new build failure in linux-next[1] and it was
bisected down to this patch, which landed in linux-next in the form of
90e4032eeaf2 PCI: iproc: Add outbound mapping support.
The build fails on arm[1] with multi_v7_defconfig and CONFIG_ARM_LPAE=y with:
drivers/built-in.o: In function `iproc_pcie_setup':
:(.text+0x6d874): undefined reference to `__aeabi_uldivmod'
Kevin
[1] http://storage.kernelci.org/next/next-20151013/arm-multi_v7_defconfig+CONFIG_ARM_LPAE=y/build.log
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] PCI: iproc: fix 32-bit build error
2015-10-13 17:58 ` Kevin Hilman
@ 2015-10-13 20:02 ` Arnd Bergmann
2015-10-13 20:06 ` Hauke Mehrtens
2015-10-13 21:21 ` [PATCH] " Kevin Hilman
0 siblings, 2 replies; 23+ messages in thread
From: Arnd Bergmann @ 2015-10-13 20:02 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Kevin Hilman, Ray Jui, Hauke Mehrtens, Tyler Baker, lkml,
Olof Johansson, Mark Brown, bcm-kernel-feedback-list, Linux PCI,
Bjorn Helgaas
The iproc PCI driver tries to figure out whether the MMIO window has
a valid size, but does this using a 64-bit modulo operation, which
is not allowed on 32-bit kernels and leads to a link error:
drivers/built-in.o: In function `iproc_pcie_setup':
:(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
This works around that error by using the div64_u64() function
provided by the kernel. While this is an expensive operation,
it is harmless because we only call it during the probing
of the driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index f3481ddff344..abcb4be2ee19 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
*
* axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
*/
-static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
+int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
u64 pci_addr, resource_size_t size)
{
struct iproc_pcie_ob *ob = &pcie->ob;
unsigned i;
u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
+ u64 remainder;
if (size > max_size) {
dev_err(pcie->dev,
@@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
return -EINVAL;
}
- if (size % ob->window_size) {
+ div64_u64_rem(size, ob->window_size, &remainder);
+ if (remainder) {
dev_err(pcie->dev,
"res size %pap needs to be multiple of window size %pap\n",
&size, &ob->window_size);
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH] PCI: iproc: fix 32-bit build error
2015-10-13 20:02 ` [PATCH] PCI: iproc: fix 32-bit build error Arnd Bergmann
@ 2015-10-13 20:06 ` Hauke Mehrtens
2015-10-13 20:11 ` Ray Jui
2015-10-13 21:21 ` [PATCH] " Kevin Hilman
1 sibling, 1 reply; 23+ messages in thread
From: Hauke Mehrtens @ 2015-10-13 20:06 UTC (permalink / raw)
To: Arnd Bergmann, linux-arm-kernel
Cc: Kevin Hilman, Ray Jui, Tyler Baker, lkml, Olof Johansson,
Mark Brown, bcm-kernel-feedback-list, Linux PCI, Bjorn Helgaas
On 10/13/2015 10:02 PM, Arnd Bergmann wrote:
> The iproc PCI driver tries to figure out whether the MMIO window has
> a valid size, but does this using a 64-bit modulo operation, which
> is not allowed on 32-bit kernels and leads to a link error:
>
> drivers/built-in.o: In function `iproc_pcie_setup':
> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
>
> This works around that error by using the div64_u64() function
> provided by the kernel. While this is an expensive operation,
> it is harmless because we only call it during the probing
> of the driver.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
>
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index f3481ddff344..abcb4be2ee19 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
> *
> * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
> */
> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
Why are you removing the static here?
> u64 pci_addr, resource_size_t size)
> {
> struct iproc_pcie_ob *ob = &pcie->ob;
> unsigned i;
> u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
> + u64 remainder;
>
> if (size > max_size) {
> dev_err(pcie->dev,
> @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> return -EINVAL;
> }
>
> - if (size % ob->window_size) {
> + div64_u64_rem(size, ob->window_size, &remainder);
> + if (remainder) {
> dev_err(pcie->dev,
> "res size %pap needs to be multiple of window size %pap\n",
> &size, &ob->window_size);
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] PCI: iproc: fix 32-bit build error
2015-10-13 20:06 ` Hauke Mehrtens
@ 2015-10-13 20:11 ` Ray Jui
2015-10-13 21:00 ` Arnd Bergmann
0 siblings, 1 reply; 23+ messages in thread
From: Ray Jui @ 2015-10-13 20:11 UTC (permalink / raw)
To: Hauke Mehrtens, Arnd Bergmann, linux-arm-kernel
Cc: Kevin Hilman, Tyler Baker, lkml, Olof Johansson, Mark Brown,
bcm-kernel-feedback-list, Linux PCI, Bjorn Helgaas
On 10/13/2015 1:06 PM, Hauke Mehrtens wrote:
> On 10/13/2015 10:02 PM, Arnd Bergmann wrote:
>> The iproc PCI driver tries to figure out whether the MMIO window has
>> a valid size, but does this using a 64-bit modulo operation, which
>> is not allowed on 32-bit kernels and leads to a link error:
>>
>> drivers/built-in.o: In function `iproc_pcie_setup':
>> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
>>
>> This works around that error by using the div64_u64() function
>> provided by the kernel. While this is an expensive operation,
>> it is harmless because we only call it during the probing
>> of the driver.
>>
Thanks, Arnd. Guess I did not see this issue when running on ARM32 based
platforms like Cygnus, because LAPE was not enabled by default for
multi_v7_defconfig. When LAPE is enabled, resource_size_t becomes 64-bit.
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
>>
>> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
>> index f3481ddff344..abcb4be2ee19 100644
>> --- a/drivers/pci/host/pcie-iproc.c
>> +++ b/drivers/pci/host/pcie-iproc.c
>> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
>> *
>> * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
>> */
>> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>
> Why are you removing the static here?
>
Yeah we should keep this function as static. The rest of this change
looks good!
>> u64 pci_addr, resource_size_t size)
>> {
>> struct iproc_pcie_ob *ob = &pcie->ob;
>> unsigned i;
>> u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
>> + u64 remainder;
>>
>> if (size > max_size) {
>> dev_err(pcie->dev,
>> @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>> return -EINVAL;
>> }
>>
>> - if (size % ob->window_size) {
>> + div64_u64_rem(size, ob->window_size, &remainder);
>> + if (remainder) {
>> dev_err(pcie->dev,
>> "res size %pap needs to be multiple of window size %pap\n",
>> &size, &ob->window_size);
>>
>
Thanks,
Ray
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] PCI: iproc: fix 32-bit build error
2015-10-13 20:11 ` Ray Jui
@ 2015-10-13 21:00 ` Arnd Bergmann
2015-10-15 16:00 ` Bjorn Helgaas
0 siblings, 1 reply; 23+ messages in thread
From: Arnd Bergmann @ 2015-10-13 21:00 UTC (permalink / raw)
To: Ray Jui
Cc: Hauke Mehrtens, linux-arm-kernel, Kevin Hilman, Tyler Baker, lkml,
Olof Johansson, Mark Brown, bcm-kernel-feedback-list, Linux PCI,
Bjorn Helgaas
On Tuesday 13 October 2015 13:11:34 Ray Jui wrote:
> >> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> >> index f3481ddff344..abcb4be2ee19 100644
> >> --- a/drivers/pci/host/pcie-iproc.c
> >> +++ b/drivers/pci/host/pcie-iproc.c
> >> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
> >> *
> >> * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
> >> */
> >> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> >> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> >
> > Why are you removing the static here?
> >
>
> Yeah we should keep this function as static. The rest of this change
> looks good!
>
Sorry, this accidentally ended up in the patch when I marked the
function as global to track down how the division got called.
I'll send a new version.
Arnd
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] PCI: iproc: fix 32-bit build error
2015-10-13 21:00 ` Arnd Bergmann
@ 2015-10-15 16:00 ` Bjorn Helgaas
2015-10-15 16:19 ` Ray Jui
0 siblings, 1 reply; 23+ messages in thread
From: Bjorn Helgaas @ 2015-10-15 16:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Ray Jui, Hauke Mehrtens, linux-arm-kernel, Kevin Hilman,
Tyler Baker, lkml, Olof Johansson, Mark Brown,
bcm-kernel-feedback-list, Linux PCI, Bjorn Helgaas
On Tue, Oct 13, 2015 at 11:00:31PM +0200, Arnd Bergmann wrote:
> On Tuesday 13 October 2015 13:11:34 Ray Jui wrote:
> > >> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> > >> index f3481ddff344..abcb4be2ee19 100644
> > >> --- a/drivers/pci/host/pcie-iproc.c
> > >> +++ b/drivers/pci/host/pcie-iproc.c
> > >> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
> > >> *
> > >> * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
> > >> */
> > >> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> > >> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> > >
> > > Why are you removing the static here?
> > >
> >
> > Yeah we should keep this function as static. The rest of this change
> > looks good!
> >
>
> Sorry, this accidentally ended up in the patch when I marked the
> function as global to track down how the division got called.
>
> I'll send a new version.
Ping; I can easily fix up the static, but it'd be nice to have real acks
from Ray and Hauke.
Bjorn
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] PCI: iproc: fix 32-bit build error
2015-10-15 16:00 ` Bjorn Helgaas
@ 2015-10-15 16:19 ` Ray Jui
2015-10-15 19:40 ` [PATCH v2] " Arnd Bergmann
0 siblings, 1 reply; 23+ messages in thread
From: Ray Jui @ 2015-10-15 16:19 UTC (permalink / raw)
To: Bjorn Helgaas, Arnd Bergmann
Cc: Hauke Mehrtens, linux-arm-kernel, Kevin Hilman, Tyler Baker, lkml,
Olof Johansson, Mark Brown, bcm-kernel-feedback-list, Linux PCI,
Bjorn Helgaas
On 10/15/2015 9:00 AM, Bjorn Helgaas wrote:
> On Tue, Oct 13, 2015 at 11:00:31PM +0200, Arnd Bergmann wrote:
>> On Tuesday 13 October 2015 13:11:34 Ray Jui wrote:
>>>>> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
>>>>> index f3481ddff344..abcb4be2ee19 100644
>>>>> --- a/drivers/pci/host/pcie-iproc.c
>>>>> +++ b/drivers/pci/host/pcie-iproc.c
>>>>> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
>>>>> *
>>>>> * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
>>>>> */
>>>>> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>>>>> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>>>>
>>>> Why are you removing the static here?
>>>>
>>>
>>> Yeah we should keep this function as static. The rest of this change
>>> looks good!
>>>
>>
>> Sorry, this accidentally ended up in the patch when I marked the
>> function as global to track down how the division got called.
>>
>> I'll send a new version.
>
> Ping; I can easily fix up the static, but it'd be nice to have real acks
> from Ray and Hauke.
>
> Bjorn
>
The current patch looks good to me except that iproc_pcie_setup_ob
should be kept static.
With static added back:
Acked-by: Ray Jui <rjui@broadcom.com>
Thanks,
Ray
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2] PCI: iproc: fix 32-bit build error
2015-10-15 16:19 ` Ray Jui
@ 2015-10-15 19:40 ` Arnd Bergmann
2015-10-15 20:57 ` Hauke Mehrtens
2015-10-15 21:01 ` Bjorn Helgaas
0 siblings, 2 replies; 23+ messages in thread
From: Arnd Bergmann @ 2015-10-15 19:40 UTC (permalink / raw)
To: Ray Jui
Cc: Bjorn Helgaas, Hauke Mehrtens, linux-arm-kernel, Kevin Hilman,
Tyler Baker, lkml, Olof Johansson, Mark Brown,
bcm-kernel-feedback-list, Linux PCI, Bjorn Helgaas
The iproc PCI driver tries to figure out whether the MMIO window has
a valid size, but does this using a 64-bit modulo operation, which
is not allowed on 32-bit kernels and leads to a link error:
drivers/built-in.o: In function `iproc_pcie_setup':
:(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
This works around that error by using the div64_u64() function
provided by the kernel. While this is an expensive operation,
it is harmless because we only call it during the probing
of the driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ray Jui <rjui@broadcom.com>
Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
---
On Thursday 15 October 2015 09:19:27 Ray Jui wrote:
> On 10/15/2015 9:00 AM, Bjorn Helgaas wrote:
> >
> > Ping; I can easily fix up the static, but it'd be nice to have real acks
> > from Ray and Hauke.
Argh, I knew there was one patch from my build fixes that I needed to
redo, I just couldn't find it again. Thanks for the reminder.
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index f3481ddff344..9193951ae861 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -241,6 +241,7 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
struct iproc_pcie_ob *ob = &pcie->ob;
unsigned i;
u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
+ u64 remainder;
if (size > max_size) {
dev_err(pcie->dev,
@@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
return -EINVAL;
}
- if (size % ob->window_size) {
+ div64_u64_rem(size, ob->window_size, &remainder);
+ if (remainder) {
dev_err(pcie->dev,
"res size %pap needs to be multiple of window size %pap\n",
&size, &ob->window_size);
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v2] PCI: iproc: fix 32-bit build error
2015-10-15 19:40 ` [PATCH v2] " Arnd Bergmann
@ 2015-10-15 20:57 ` Hauke Mehrtens
2015-10-15 21:01 ` Bjorn Helgaas
1 sibling, 0 replies; 23+ messages in thread
From: Hauke Mehrtens @ 2015-10-15 20:57 UTC (permalink / raw)
To: Arnd Bergmann, Ray Jui
Cc: Bjorn Helgaas, linux-arm-kernel, Kevin Hilman, Tyler Baker, lkml,
Olof Johansson, Mark Brown, bcm-kernel-feedback-list, Linux PCI,
Bjorn Helgaas
On 10/15/2015 09:40 PM, Arnd Bergmann wrote:
> The iproc PCI driver tries to figure out whether the MMIO window has
> a valid size, but does this using a 64-bit modulo operation, which
> is not allowed on 32-bit kernels and leads to a link error:
>
> drivers/built-in.o: In function `iproc_pcie_setup':
> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
>
> This works around that error by using the div64_u64() function
> provided by the kernel. While this is an expensive operation,
> it is harmless because we only call it during the probing
> of the driver.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Ray Jui <rjui@broadcom.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
>
> ---
> On Thursday 15 October 2015 09:19:27 Ray Jui wrote:
>> On 10/15/2015 9:00 AM, Bjorn Helgaas wrote:
>>>
>>> Ping; I can easily fix up the static, but it'd be nice to have real acks
>>> from Ray and Hauke.
>
>
> Argh, I knew there was one patch from my build fixes that I needed to
> redo, I just couldn't find it again. Thanks for the reminder.
>
>
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index f3481ddff344..9193951ae861 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -241,6 +241,7 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> struct iproc_pcie_ob *ob = &pcie->ob;
> unsigned i;
> u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
> + u64 remainder;
>
> if (size > max_size) {
> dev_err(pcie->dev,
> @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> return -EINVAL;
> }
>
> - if (size % ob->window_size) {
> + div64_u64_rem(size, ob->window_size, &remainder);
> + if (remainder) {
> dev_err(pcie->dev,
> "res size %pap needs to be multiple of window size %pap\n",
> &size, &ob->window_size);
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2] PCI: iproc: fix 32-bit build error
2015-10-15 19:40 ` [PATCH v2] " Arnd Bergmann
2015-10-15 20:57 ` Hauke Mehrtens
@ 2015-10-15 21:01 ` Bjorn Helgaas
2015-10-16 9:47 ` Arnd Bergmann
1 sibling, 1 reply; 23+ messages in thread
From: Bjorn Helgaas @ 2015-10-15 21:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Ray Jui, Hauke Mehrtens, linux-arm-kernel, Kevin Hilman,
Tyler Baker, lkml, Olof Johansson, Mark Brown,
bcm-kernel-feedback-list, Linux PCI, Bjorn Helgaas
On Thu, Oct 15, 2015 at 09:40:45PM +0200, Arnd Bergmann wrote:
> The iproc PCI driver tries to figure out whether the MMIO window has
> a valid size, but does this using a 64-bit modulo operation, which
> is not allowed on 32-bit kernels and leads to a link error:
>
> drivers/built-in.o: In function `iproc_pcie_setup':
> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
>
> This works around that error by using the div64_u64() function
> provided by the kernel. While this is an expensive operation,
> it is harmless because we only call it during the probing
> of the driver.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Ray Jui <rjui@broadcom.com>
> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
This *looks* like it should be fixing 90e4032eeaf2 ("PCI: iproc: Add
outbound mapping support"), not 0ab99ca8eb6c.
90e4032eeaf2 added the "if (size % ob->window_size)".
Is this more subtle than that?
> ---
> On Thursday 15 October 2015 09:19:27 Ray Jui wrote:
> > On 10/15/2015 9:00 AM, Bjorn Helgaas wrote:
> > >
> > > Ping; I can easily fix up the static, but it'd be nice to have real acks
> > > from Ray and Hauke.
>
>
> Argh, I knew there was one patch from my build fixes that I needed to
> redo, I just couldn't find it again. Thanks for the reminder.
>
>
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index f3481ddff344..9193951ae861 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -241,6 +241,7 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> struct iproc_pcie_ob *ob = &pcie->ob;
> unsigned i;
> u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
> + u64 remainder;
>
> if (size > max_size) {
> dev_err(pcie->dev,
> @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> return -EINVAL;
> }
>
> - if (size % ob->window_size) {
> + div64_u64_rem(size, ob->window_size, &remainder);
> + if (remainder) {
> dev_err(pcie->dev,
> "res size %pap needs to be multiple of window size %pap\n",
> &size, &ob->window_size);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2] PCI: iproc: fix 32-bit build error
2015-10-15 21:01 ` Bjorn Helgaas
@ 2015-10-16 9:47 ` Arnd Bergmann
2015-10-16 13:23 ` Bjorn Helgaas
0 siblings, 1 reply; 23+ messages in thread
From: Arnd Bergmann @ 2015-10-16 9:47 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Bjorn Helgaas, Kevin Hilman, Linux PCI, Ray Jui, Tyler Baker,
lkml, Bjorn Helgaas, Mark Brown, bcm-kernel-feedback-list,
Hauke Mehrtens, Olof Johansson
On Thursday 15 October 2015 16:01:13 Bjorn Helgaas wrote:
> On Thu, Oct 15, 2015 at 09:40:45PM +0200, Arnd Bergmann wrote:
> > The iproc PCI driver tries to figure out whether the MMIO window has
> > a valid size, but does this using a 64-bit modulo operation, which
> > is not allowed on 32-bit kernels and leads to a link error:
> >
> > drivers/built-in.o: In function `iproc_pcie_setup':
> > :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
> >
> > This works around that error by using the div64_u64() function
> > provided by the kernel. While this is an expensive operation,
> > it is harmless because we only call it during the probing
> > of the driver.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Acked-by: Ray Jui <rjui@broadcom.com>
> > Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
>
> This *looks* like it should be fixing 90e4032eeaf2 ("PCI: iproc: Add
> outbound mapping support"), not 0ab99ca8eb6c.
>
> 90e4032eeaf2 added the "if (size % ob->window_size)".
>
> Is this more subtle than that?
>
>
You are absolutely right, I must have copy-pasted the wrong entry.
Do you want me to resend this? I guess you can just remove the
line as this commit has not appeared in any release anyway.
Arnd
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2] PCI: iproc: fix 32-bit build error
2015-10-16 9:47 ` Arnd Bergmann
@ 2015-10-16 13:23 ` Bjorn Helgaas
0 siblings, 0 replies; 23+ messages in thread
From: Bjorn Helgaas @ 2015-10-16 13:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, Kevin Hilman, Linux PCI, Ray Jui, Tyler Baker,
lkml, Bjorn Helgaas, Mark Brown, bcm-kernel-feedback-list,
Hauke Mehrtens, Olof Johansson, Jon Mason
On Fri, Oct 16, 2015 at 11:47:42AM +0200, Arnd Bergmann wrote:
> On Thursday 15 October 2015 16:01:13 Bjorn Helgaas wrote:
> > On Thu, Oct 15, 2015 at 09:40:45PM +0200, Arnd Bergmann wrote:
> > > The iproc PCI driver tries to figure out whether the MMIO window has
> > > a valid size, but does this using a 64-bit modulo operation, which
> > > is not allowed on 32-bit kernels and leads to a link error:
> > >
> > > drivers/built-in.o: In function `iproc_pcie_setup':
> > > :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
> > >
> > > This works around that error by using the div64_u64() function
> > > provided by the kernel. While this is an expensive operation,
> > > it is harmless because we only call it during the probing
> > > of the driver.
> > >
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > Acked-by: Ray Jui <rjui@broadcom.com>
> > > Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
> >
> > This *looks* like it should be fixing 90e4032eeaf2 ("PCI: iproc: Add
> > outbound mapping support"), not 0ab99ca8eb6c.
> >
> > 90e4032eeaf2 added the "if (size % ob->window_size)".
> >
> > Is this more subtle than that?
>
> You are absolutely right, I must have copy-pasted the wrong entry.
> Do you want me to resend this? I guess you can just remove the
> line as this commit has not appeared in any release anyway.
I squashed this fix and Jon's %pap fix into Ray's original "Add outbound
mapping support" patch and re-did the merge. Thanks!
Bjorn
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] PCI: iproc: fix 32-bit build error
2015-10-13 20:02 ` [PATCH] PCI: iproc: fix 32-bit build error Arnd Bergmann
2015-10-13 20:06 ` Hauke Mehrtens
@ 2015-10-13 21:21 ` Kevin Hilman
1 sibling, 0 replies; 23+ messages in thread
From: Kevin Hilman @ 2015-10-13 21:21 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, Ray Jui, Hauke Mehrtens, Tyler Baker, lkml,
Olof Johansson, Mark Brown, bcm-kernel-feedback-list, Linux PCI,
Bjorn Helgaas
Arnd Bergmann <arnd@arndb.de> writes:
> The iproc PCI driver tries to figure out whether the MMIO window has
> a valid size, but does this using a 64-bit modulo operation, which
> is not allowed on 32-bit kernels and leads to a link error:
>
> drivers/built-in.o: In function `iproc_pcie_setup':
> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
>
> This works around that error by using the div64_u64() function
> provided by the kernel. While this is an expensive operation,
> it is harmless because we only call it during the probing
> of the driver.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
Tested-by: Kevin Hilman <khilman@linaro.org>
Verified that this fixes the build failure on arm multi_v7_defconfig +
CONFIG_ARM_LPAE=y on top of next-20151013.
Kevin
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 8/8] PCI: iproc: Fix compile warnings
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
` (6 preceding siblings ...)
2015-09-16 0:39 ` [PATCH 7/8] PCI: iproc: Add outbound mapping support Ray Jui
@ 2015-09-16 0:39 ` Ray Jui
2015-09-25 23:21 ` [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Bjorn Helgaas
8 siblings, 0 replies; 23+ messages in thread
From: Ray Jui @ 2015-09-16 0:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Hauke Mehrtens, linux-pci, linux-kernel, linux-arm-kernel,
bcm-kernel-feedback-list, Ray Jui, Jon Mason
There are several compile warnings in pcie-iproc.c related to the
printing of a size_t value. This is a 32bit value on arm, and 64bit on
arm64. However, the printks are for 64bit values (thus the warning).
Using the %pap printk for these values (per
Documentation/printk-formats.txt) corrects the issue.
Signed-off-by: Jon Mason <jonmason@broadcom.com>
---
drivers/pci/host/pcie-iproc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 2ba3c4b..f3481dd 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -244,15 +244,15 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
if (size > max_size) {
dev_err(pcie->dev,
- "res size 0x%llx exceeds max supported size 0x%llx\n",
- (u64)size, max_size);
+ "res size 0x%pap exceeds max supported size 0x%llx\n",
+ &size, max_size);
return -EINVAL;
}
if (size % ob->window_size) {
dev_err(pcie->dev,
- "res size 0x%llx needs to be multiple of "
- "window size 0x%llx\n", (u64)size, ob->window_size);
+ "res size %pap needs to be multiple of window size %pap\n",
+ &size, &ob->window_size);
return -EINVAL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support
2015-09-16 0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
` (7 preceding siblings ...)
2015-09-16 0:39 ` [PATCH 8/8] PCI: iproc: Fix compile warnings Ray Jui
@ 2015-09-25 23:21 ` Bjorn Helgaas
8 siblings, 0 replies; 23+ messages in thread
From: Bjorn Helgaas @ 2015-09-25 23:21 UTC (permalink / raw)
To: Ray Jui
Cc: Bjorn Helgaas, Hauke Mehrtens, linux-pci, linux-kernel,
linux-arm-kernel, bcm-kernel-feedback-list
On Tue, Sep 15, 2015 at 05:39:14PM -0700, Ray Jui wrote:
> This patch series contains various fixes and outbound mapping support for
> the Broadcom iProc PCIe driver. Some of the critical fixes include 1) fix of
> PCIe core reset logic and therefore remove its dependency on the bootloader;
> 2) improved link detection logic that works for more iProc based SoCs.
>
> This patch series also adds the outbound address mapping support. While
> outbound address mapping support is not required on chips like North Star,
> Cygnus, and etc., some of the newer iProc based chips like North Star 2 require
> this support to properly map the AXI address into the address used in the iProc
> PCIe core
>
> This patch series is constructed based on Linux v4.3-rc1 (with workaround to
> disable calls to pci_read_bridge_bases in pci/probe.c that breaks some of the
> ARM based PCIe devices including iProc)
>
> This patch series is tested on the following platforms with an Intel e1000e
> based PCIe x1 NIC card:
> - ARM32 based Cygnus BCM958305K Wireless Audio board
> - ARM64 based North Star 2 SVK board
>
> code available at GITHUB:
> https://github.com/Broadcom/cygnus-linux/tree/iproc-pcie-fix-v1
>
> Ray Jui (8):
> PCI: iproc: Fix code comment
> PCI: iproc: Remove unused code
> PCI: iproc: Remove ARCH specific flag
> PCI: iproc: Fix PCIe reset logic
> PCI: iproc: Improve link detection logic
> PCI: iproc: Update iProc PCIe device tree bindings
> PCI: iproc: Add outbound mapping support
> PCI: iproc: Fix compile warnings
>
> .../devicetree/bindings/pci/brcm,iproc-pcie.txt | 20 +++
> drivers/pci/host/pcie-iproc-platform.c | 27 ++++
> drivers/pci/host/pcie-iproc.c | 159 +++++++++++++++++++--
> drivers/pci/host/pcie-iproc.h | 20 ++-
> 4 files changed, 210 insertions(+), 16 deletions(-)
Applied to pci/host-iproc for v4.4, thanks!
^ permalink raw reply [flat|nested] 23+ messages in thread