* [RFC PATCH 00/12] PCIe support for DRA7xx
@ 2014-03-26 13:57 Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 01/12] phy: phy-omap-pipe3: Add support for PCIe PHY Kishon Vijay Abraham I
` (11 more replies)
0 siblings, 12 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
This patch series adds support for PCIe in DRA7xx including drivers and dt
data. PCIe in DRA7xx uses desingware IP and hence this re-uses the
pcie desingware driver (pcie-designware.c) by Jingoo.
This patch series depends on a few patches that is already in -next.
Tested broadcom PCIe card and XIO2000 bridge along with DGE530T ethernet
card.
Keerthy (2):
ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to
dpll_pcie_ref_m2ldo_ck
Kishon Vijay Abraham I (10):
phy: phy-omap-pipe3: Add support for PCIe PHY
pci: host: pcie-dra7xx: add support for pcie-dra7xx controller
pci: host: pcie-designware: Use *base-mask* for configuring the iATU
arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy
arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems
ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
ARM: dts: dra7: Add dt data for PCIe PHY control module
ARM: dts: dra7: Add dt data for PCIe PHY
ARM: dts: dra7: Add dt data for PCIe controller
ARM: OMAP: Enable PCI for DRA7
.../devicetree/bindings/pci/designware-pcie.txt | 1 +
Documentation/devicetree/bindings/pci/ti-pci.txt | 35 ++
Documentation/devicetree/bindings/phy/ti-phy.txt | 8 +-
arch/arm/boot/dts/dra7.dtsi | 48 +++
arch/arm/boot/dts/dra7xx-clocks.dtsi | 11 +-
arch/arm/mach-omap2/Kconfig | 2 +
arch/arm/mach-omap2/cm2_7xx.h | 4 +
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 112 ++++++
arch/arm/mach-omap2/prm7xx.h | 4 +
drivers/pci/host/Kconfig | 10 +
drivers/pci/host/Makefile | 1 +
drivers/pci/host/pcie-designware.c | 39 +-
drivers/pci/host/pcie-designware.h | 1 +
drivers/pci/host/pcie-dra7xx.c | 411 ++++++++++++++++++++
drivers/phy/phy-ti-pipe3.c | 99 ++++-
15 files changed, 750 insertions(+), 36 deletions(-)
create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
create mode 100644 drivers/pci/host/pcie-dra7xx.c
--
1.7.9.5
^ permalink raw reply [flat|nested] 20+ messages in thread
* [RFC PATCH 01/12] phy: phy-omap-pipe3: Add support for PCIe PHY
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller Kishon Vijay Abraham I
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
PCIe PHY uses an external pll instead of the internal pll used by SATA
and USB3. So added support in pipe3 PHY to use external pll
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 8 +-
drivers/phy/phy-ti-pipe3.c | 99 +++++++++++++++++-----
2 files changed, 84 insertions(+), 23 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 788fb0f..e628a23 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -49,8 +49,8 @@ usb2phy@4a0ad080 {
TI PIPE3 PHY
Required properties:
- - compatible: Should be "ti,phy-usb3" or "ti,phy-pipe3-sata".
- "ti,omap-usb3" is deprecated.
+ - compatible: Should be "ti,phy-usb3", "ti,phy-pipe3-sata" or
+ "ti,phy-pipe3-pcie. "ti,omap-usb3" is deprecated.
- reg : Address and length of the register set for the device.
- reg-names: The names of the register addresses corresponding to the registers
filled in "reg".
@@ -62,6 +62,10 @@ Required properties:
* "wkupclk" - wakeup clock.
* "sysclk" - system clock.
* "refclk" - reference clock.
+ * "dpll_ref" - external dpll ref clk
+ * "dpll_ref_m2" - external dpll ref clk
+ * "phy-div" - divider for apll
+ * "div-clk" - apll clock
Optional properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 5913676..d43019d 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -80,6 +80,7 @@ struct ti_pipe3 {
struct clk *wkupclk;
struct clk *sys_clk;
struct clk *refclk;
+ struct clk *div_clk;
struct pipe3_dpll_map *dpll_map;
};
@@ -215,6 +216,9 @@ static int ti_pipe3_init(struct phy *x)
u32 val;
int ret = 0;
+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie"))
+ return 0;
+
/* Bring it out of IDLE if it is IDLE */
val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);
if (val & PLL_IDLE) {
@@ -238,8 +242,11 @@ static int ti_pipe3_exit(struct phy *x)
u32 val;
unsigned long timeout;
- /* SATA DPLL can't be powered down due to Errata i783 */
- if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))
+ /* SATA DPLL can't be powered down due to Errata i783 and PCIe
+ * does not have internal DPLL
+ */
+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") ||
+ of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie"))
return 0;
/* Put DPLL in IDLE mode */
@@ -286,32 +293,41 @@ static int ti_pipe3_probe(struct platform_device *pdev)
struct device_node *control_node;
struct platform_device *control_pdev;
const struct of_device_id *match;
-
- match = of_match_device(of_match_ptr(ti_pipe3_id_table), &pdev->dev);
- if (!match)
- return -EINVAL;
+ struct clk *clk;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
dev_err(&pdev->dev, "unable to alloc mem for TI PIPE3 PHY\n");
return -ENOMEM;
}
+ phy->dev = &pdev->dev;
- phy->dpll_map = (struct pipe3_dpll_map *)match->data;
- if (!phy->dpll_map) {
- dev_err(&pdev->dev, "no DPLL data\n");
- return -EINVAL;
- }
+ if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {
+ match = of_match_device(of_match_ptr(ti_pipe3_id_table),
+ &pdev->dev);
+ if (!match)
+ return -EINVAL;
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl");
- phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(phy->pll_ctrl_base))
- return PTR_ERR(phy->pll_ctrl_base);
+ phy->dpll_map = (struct pipe3_dpll_map *)match->data;
+ if (!phy->dpll_map) {
+ dev_err(&pdev->dev, "no DPLL data\n");
+ return -EINVAL;
+ }
- phy->dev = &pdev->dev;
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "pll_ctrl");
+ phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(phy->pll_ctrl_base))
+ return PTR_ERR(phy->pll_ctrl_base);
- if (!of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
+ phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
+ if (IS_ERR(phy->sys_clk)) {
+ dev_err(&pdev->dev, "unable to get sysclk\n");
+ return -EINVAL;
+ }
+ }
+ if (!of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
if (IS_ERR(phy->wkupclk)) {
dev_err(&pdev->dev, "unable to get wkupclk\n");
@@ -328,10 +344,35 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->refclk = ERR_PTR(-ENODEV);
}
- phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
- if (IS_ERR(phy->sys_clk)) {
- dev_err(&pdev->dev, "unable to get sysclk\n");
- return -EINVAL;
+ if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {
+ clk = devm_clk_get(phy->dev, "dpll_ref");
+ if (IS_ERR(clk)) {
+ dev_err(&pdev->dev, "unable to get dpll ref clk\n");
+ return PTR_ERR(clk);
+ }
+ clk_set_rate(clk, 1500000000);
+
+ clk = devm_clk_get(phy->dev, "dpll_ref_m2");
+ if (IS_ERR(clk)) {
+ dev_err(&pdev->dev, "unable to get dpll ref m2 clk\n");
+ return PTR_ERR(clk);
+ }
+ clk_set_rate(clk, 100000000);
+
+ clk = devm_clk_get(phy->dev, "phy-div");
+ if (IS_ERR(clk)) {
+ dev_err(&pdev->dev, "unable to get phy-div clk\n");
+ return PTR_ERR(clk);
+ }
+ clk_set_rate(clk, 100000000);
+
+ phy->div_clk = devm_clk_get(phy->dev, "div-clk");
+ if (IS_ERR(phy->div_clk)) {
+ dev_err(&pdev->dev, "unable to get div-clk\n");
+ return PTR_ERR(phy->div_clk);
+ }
+ } else {
+ phy->div_clk = ERR_PTR(-ENODEV);
}
control_node = of_parse_phandle(node, "ctrl-module", 0);
@@ -387,6 +428,8 @@ static int ti_pipe3_runtime_suspend(struct device *dev)
clk_disable_unprepare(phy->wkupclk);
if (!IS_ERR(phy->refclk))
clk_disable_unprepare(phy->refclk);
+ if (!IS_ERR(phy->div_clk))
+ clk_disable_unprepare(phy->div_clk);
return 0;
}
@@ -412,8 +455,19 @@ static int ti_pipe3_runtime_resume(struct device *dev)
}
}
+ if (!IS_ERR(phy->div_clk)) {
+ ret = clk_prepare_enable(phy->div_clk);
+ if (ret) {
+ dev_err(phy->dev, "Failed to enable div_clk %d\n", ret);
+ goto err3;
+ }
+ }
return 0;
+err3:
+ if (!IS_ERR(phy->wkupclk))
+ clk_disable_unprepare(phy->wkupclk);
+
err2:
if (!IS_ERR(phy->refclk))
clk_disable_unprepare(phy->refclk);
@@ -446,6 +500,9 @@ static const struct of_device_id ti_pipe3_id_table[] = {
.compatible = "ti,phy-pipe3-sata",
.data = dpll_map_sata,
},
+ {
+ .compatible = "ti,phy-pipe3-pcie",
+ },
{}
};
MODULE_DEVICE_TABLE(of, ti_pipe3_id_table);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 01/12] phy: phy-omap-pipe3: Add support for PCIe PHY Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 14:45 ` Rob Herring
2014-03-27 3:43 ` Jingoo Han
2014-03-26 13:57 ` [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU Kishon Vijay Abraham I
` (9 subsequent siblings)
11 siblings, 2 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added support for pcie controller in dra7xx. This driver re-uses
the designware core code that is already present in kernel.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Documentation/devicetree/bindings/pci/ti-pci.txt | 35 ++
drivers/pci/host/Kconfig | 10 +
drivers/pci/host/Makefile | 1 +
drivers/pci/host/pcie-dra7xx.c | 411 ++++++++++++++++++++++
4 files changed, 457 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
create mode 100644 drivers/pci/host/pcie-dra7xx.c
diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt
new file mode 100644
index 0000000..0528c47
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/ti-pci.txt
@@ -0,0 +1,35 @@
+TI PCI Controllers
+
+PCIe Designware Controller
+This node should have the properties described in "designware-pcie.txt".
+ - compatible: Should be "ti,dra7xx-pcie""
+ - reg : Address and length of the register set for the device.
+ - phys : the phandle for the PHY device (used by generic PHY framework)
+ - phy-names : the names of the PHY corresponding to the PHYs present in the
+ *phy* phandle.
+ - resets: phandle used if reset is handled be soc
+ - reset-names: name given to the phandle
+ - ti,device-type: Should be 1 - EP TYPE, 2 - LEG EP TYPE OR 3 - RC TYPE
+
+Example:
+pcie@51000000 {
+ compatible = "ti,dra7xx-pcie";
+ reg = <0x51002000 0x14c>, <0x51000000 0x2000>, <0x4A002540 0x1f>, <0x4A003c24 0x4>, <0x4AE07310 0x4>;
+ interrupts = <0 129 0x4>, <0 134 0x4>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ device_type = "pci";
+ ti,device_type = <3>;
+ ranges = <0x00000800 0 0x20001000 0x20001000 0 0x00002000 /* Configuration Space */
+ 0x81000000 0 0 0x20003000 0 0x00010000 /* IO Space */
+ 0x82000000 0 0x20013000 0x20013000 0 0xffed000>; /* MEM Space */
+ #interrupt-cells = <1>;
+ num-lanes = <1>;
+ interrupt-map-mask = <0 0 0 0>;
+ interrupt-map = <0x0 0 &gic 134>;
+ ti,hwmods = "pcie1";
+ phys = <&pcie1_phy>;
+ phy-names = "pcie-phy";
+ resets = <&prm_resets &device_reset>;
+ reset-names = "reset";
+};
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index 47d46c6..5066a3c 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -1,6 +1,16 @@
menu "PCI host controller drivers"
depends on PCI
+config PCIE_DRA7XX
+ bool "TI DRA7xx PCIe controller"
+ select PCIE_DW
+ depends on OF || HAS_IOMEM || TI_PIPE3
+ help
+ Enables support for the PCIE controller present in DRA7xx SoC. There
+ are two instances of PCIE controller in DRA7xx. This controller can
+ act both as EP and RC. This reuses the same Designware core as used
+ by other SoCs.
+
config PCI_MVEBU
bool "Marvell EBU PCIe controller"
depends on ARCH_MVEBU || ARCH_DOVE || ARCH_KIRKWOOD
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
index 13fb333..90a275d 100644
--- a/drivers/pci/host/Makefile
+++ b/drivers/pci/host/Makefile
@@ -1,4 +1,5 @@
obj-$(CONFIG_PCIE_DW) += pcie-designware.o
+obj-$(CONFIG_PCIE_DRA7XX) += pcie-dra7xx.o
obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
diff --git a/drivers/pci/host/pcie-dra7xx.c b/drivers/pci/host/pcie-dra7xx.c
new file mode 100644
index 0000000..69f3720
--- /dev/null
+++ b/drivers/pci/host/pcie-dra7xx.c
@@ -0,0 +1,411 @@
+/*
+ * pcie-dra7xx - PCIe controller driver for TI DRA7xx SoCs
+ *
+ * Copyright (C) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Authors: Kishon Vijay Abraham I <kishon@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/reset.h>
+#include <linux/resource.h>
+#include <linux/types.h>
+
+#include "pcie-designware.h"
+
+/* PCIe controller wrapper TI configuration registers */
+
+#define PCIECTRL_TI_CONF_IRQSTATUS_MAIN 0x0024
+#define PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN 0x0028
+#define ERR_SYS BIT(0)
+#define ERR_FATAL BIT(1)
+#define ERR_NONFATAL BIT(2)
+#define ERR_COR BIT(3)
+#define ERR_AXI BIT(4)
+#define ERR_ECRC BIT(5)
+#define PME_TURN_OFF BIT(8)
+#define PME_TO_ACK BIT(9)
+#define PM_PME BIT(10)
+#define LINK_REQ_RST BIT(11)
+#define LINK_UP_EVT BIT(12)
+#define CFG_BME_EVT BIT(13)
+#define CFG_MSE_EVT BIT(14)
+#define INTERRUPTS (ERR_SYS | ERR_FATAL | ERR_NONFATAL | ERR_COR | ERR_AXI | \
+ ERR_ECRC | PME_TURN_OFF | PME_TO_ACK | PM_PME | \
+ LINK_REQ_RST | LINK_UP_EVT | CFG_BME_EVT | CFG_MSE_EVT)
+
+#define PCIECTRL_TI_CONF_IRQSTATUS_MSI 0x0034
+#define PCIECTRL_TI_CONF_IRQENABLE_SET_MSI 0x0038
+#define INTA BIT(0)
+#define INTB BIT(1)
+#define INTC BIT(2)
+#define INTD BIT(3)
+#define MSI BIT(4)
+#define LEG_EP_INTERRUPTS (INTA | INTB | INTC | INTD)
+
+#define PCIECTRL_TI_CONF_DEVICE_TYPE 0x0100
+#define DEVICE_TYPE_EP 0x0
+#define DEVICE_TYPE_LEG_EP 0x1
+#define DEVICE_TYPE_RC 0x4
+
+#define PCIECTRL_TI_CONF_DEVICE_CMD 0x0104
+#define LTSSM_EN 0x1
+
+#define PCIECTRL_TI_CONF_PHY_CS 0x010C
+#define LINK_UP BIT(16)
+
+struct dra7xx_pcie {
+ void __iomem *base;
+ struct phy *phy;
+ struct device *dev;
+ struct pcie_port pp;
+};
+
+#define to_dra7xx_pcie(x) container_of((x), struct dra7xx_pcie, pp)
+
+enum dra7xx_pcie_device_type {
+ DRA7XX_PCIE_UNKNOWN_TYPE,
+ DRA7XX_PCIE_EP_TYPE,
+ DRA7XX_PCIE_LEG_EP_TYPE,
+ DRA7XX_PCIE_RC_TYPE,
+};
+
+static inline u32 dra7xx_pcie_readl(void __iomem *base, u32 offset)
+{
+ return readl(base + offset);
+}
+
+static inline void dra7xx_pcie_writel(void __iomem *base, u32 offset, u32 value)
+{
+ writel(value, base + offset);
+}
+
+static int dra7xx_pcie_link_up(struct pcie_port *pp)
+{
+ struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp);
+ u32 reg = dra7xx_pcie_readl(dra7xx->base, PCIECTRL_TI_CONF_PHY_CS);
+
+ if (reg & LINK_UP)
+ return true;
+ return false;
+}
+
+static int dra7xx_pcie_establish_link(struct pcie_port *pp)
+{
+ u32 reg;
+ int retries = 1000;
+ struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp);
+
+ if (dw_pcie_link_up(pp)) {
+ dev_err(pp->dev, "link is already up\n");
+ return 0;
+ }
+
+ reg = dra7xx_pcie_readl(dra7xx->base, PCIECTRL_TI_CONF_DEVICE_CMD);
+ reg |= LTSSM_EN;
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_DEVICE_CMD, reg);
+
+ while (--retries) {
+ reg = dra7xx_pcie_readl(dra7xx->base, PCIECTRL_TI_CONF_PHY_CS);
+ if (reg & LINK_UP)
+ break;
+ usleep_range(10, 20);
+ }
+
+ if (retries <= 0) {
+ dev_err(pp->dev, "link is not up\n");
+ return -ETIMEDOUT;
+ }
+
+ return 0;
+}
+
+static void dra7xx_pcie_enable_interrupts(struct pcie_port *pp)
+{
+ struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp);
+
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_IRQSTATUS_MAIN,
+ ~INTERRUPTS);
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN,
+ INTERRUPTS);
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_IRQSTATUS_MSI,
+ ~LEG_EP_INTERRUPTS & ~MSI);
+
+ if (IS_ENABLED(CONFIG_PCI_MSI))
+ dra7xx_pcie_writel(dra7xx->base,
+ PCIECTRL_TI_CONF_IRQENABLE_SET_MSI, MSI);
+ else
+ dra7xx_pcie_writel(dra7xx->base,
+ PCIECTRL_TI_CONF_IRQENABLE_SET_MSI, LEG_EP_INTERRUPTS);
+}
+
+static void dra7xx_pcie_host_init(struct pcie_port *pp)
+{
+ dw_pcie_setup_rc(pp);
+ dra7xx_pcie_establish_link(pp);
+ if (IS_ENABLED(CONFIG_PCI_MSI))
+ dw_pcie_msi_init(pp);
+ dra7xx_pcie_enable_interrupts(pp);
+}
+
+static struct pcie_host_ops dra7xx_pcie_host_ops = {
+ .link_up = dra7xx_pcie_link_up,
+ .host_init = dra7xx_pcie_host_init,
+};
+
+static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg)
+{
+ struct pcie_port *pp = arg;
+ struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp);
+ u32 reg;
+
+ reg = dra7xx_pcie_readl(dra7xx->base, PCIECTRL_TI_CONF_IRQSTATUS_MSI);
+ dw_handle_msi_irq(pp);
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_IRQSTATUS_MSI, reg);
+
+ return IRQ_HANDLED;
+}
+
+
+static irqreturn_t dra7xx_pcie_irq_handler(int irq, void *arg)
+{
+ struct dra7xx_pcie *dra7xx = arg;
+ u32 reg;
+
+ reg = dra7xx_pcie_readl(dra7xx->base, PCIECTRL_TI_CONF_IRQSTATUS_MAIN);
+
+ if (reg & ERR_SYS)
+ dev_dbg(dra7xx->dev, "System Error\n");
+
+ if (reg & ERR_FATAL)
+ dev_dbg(dra7xx->dev, "Fatal Error\n");
+
+ if (reg & ERR_NONFATAL)
+ dev_dbg(dra7xx->dev, "Non Fatal Error\n");
+
+ if (reg & ERR_COR)
+ dev_dbg(dra7xx->dev, "Correctable Error\n");
+
+ if (reg & ERR_AXI)
+ dev_dbg(dra7xx->dev, "AXI tag lookup fatal Error\n");
+
+ if (reg & ERR_ECRC)
+ dev_dbg(dra7xx->dev, "ECRC Error\n");
+
+ if (reg & PME_TURN_OFF)
+ dev_dbg(dra7xx->dev,
+ "Power Management Event Turn-Off message received\n");
+
+ if (reg & PME_TO_ACK)
+ dev_dbg(dra7xx->dev,
+ "Power Management Event Turn-Off Ack message received\n");
+
+ if (reg & PM_PME)
+ dev_dbg(dra7xx->dev,
+ "PM Power Management Event message received\n");
+
+ if (reg & LINK_REQ_RST)
+ dev_dbg(dra7xx->dev, "Link Request Reset\n");
+
+ if (reg & LINK_UP_EVT)
+ dev_dbg(dra7xx->dev, "Link-up state change\n");
+
+ if (reg & CFG_BME_EVT)
+ dev_dbg(dra7xx->dev, "CFG 'Bus Master Enable' change\n");
+
+ if (reg & CFG_MSE_EVT)
+ dev_dbg(dra7xx->dev, "CFG 'Memory Space Enable' change\n");
+
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_IRQSTATUS_MAIN, reg);
+
+ return IRQ_HANDLED;
+}
+
+static int add_pcie_port(struct dra7xx_pcie *dra7xx,
+ struct platform_device *pdev)
+{
+ int ret;
+ struct pcie_port *pp;
+ struct resource *res;
+ struct device *dev = &pdev->dev;
+
+ pp = &dra7xx->pp;
+ pp->dev = dev;
+ pp->ops = &dra7xx_pcie_host_ops;
+
+ spin_lock_init(&pp->conf_lock);
+
+ pp->irq = platform_get_irq(pdev, 1);
+ if (pp->irq < 0) {
+ dev_err(dev, "missing IRQ resource\n");
+ return -EINVAL;
+ }
+
+ if (IS_ENABLED(CONFIG_PCI_MSI)) {
+ ret = devm_request_irq(&pdev->dev, pp->irq,
+ dra7xx_pcie_msi_irq_handler, IRQF_SHARED,
+ "pcie-msi", pp);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to request irq\n");
+ return ret;
+ }
+ }
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rc_dbics");
+ pp->dbi_base = devm_ioremap_nocache(dev, res->start,
+ resource_size(res));
+ if (!pp->dbi_base)
+ return -ENOMEM;
+
+ ret = dw_pcie_host_init(pp);
+ if (ret) {
+ dev_err(dra7xx->dev, "failed to initialize host\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int __init dra7xx_pcie_probe(struct platform_device *pdev)
+{
+ u32 reg;
+ int ret;
+ int irq;
+ struct phy *phy;
+ void __iomem *base;
+ struct resource *res;
+ struct dra7xx_pcie *dra7xx;
+ int device_type = 0;
+ struct device *dev = &pdev->dev;
+ struct device_node *node = pdev->dev.of_node;
+ struct reset_control *rstc;
+
+ dra7xx = devm_kzalloc(&pdev->dev, sizeof(*dra7xx), GFP_KERNEL);
+ if (!dra7xx)
+ return -ENOMEM;
+
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
+ dev_err(dev, "missing IRQ resource\n");
+ return -EINVAL;
+ }
+
+ ret = devm_request_irq(&pdev->dev, irq, dra7xx_pcie_irq_handler,
+ IRQF_SHARED, "pcie-main", dra7xx);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to request irq\n");
+ return ret;
+ }
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ti_conf");
+ base = devm_ioremap_nocache(dev, res->start, resource_size(res));
+ if (!base)
+ return -ENOMEM;
+
+ rstc = devm_reset_control_get(dev, "reset");
+ if (IS_ERR(rstc))
+ return PTR_ERR(rstc);
+
+ ret = reset_control_deassert(rstc);
+ if (ret)
+ return ret;
+
+ phy = devm_phy_get(dev, "pcie-phy");
+ if (IS_ERR(phy))
+ return PTR_ERR(phy);
+
+ ret = phy_init(phy);
+ if (ret < 0)
+ return ret;
+
+ ret = phy_power_on(phy);
+ if (ret < 0) {
+ phy_exit(phy);
+ return ret;
+ }
+
+ dra7xx->base = base;
+ dra7xx->phy = phy;
+ dra7xx->dev = dev;
+
+ pm_runtime_enable(&pdev->dev);
+ ret = pm_runtime_get_sync(&pdev->dev);
+ if (IS_ERR_VALUE(ret)) {
+ dev_err(dev, "pm_runtime_get_sync failed\n");
+ return ret;
+ }
+
+ of_property_read_u32(node, "ti,device-type", &device_type);
+ switch (device_type) {
+ case DRA7XX_PCIE_RC_TYPE:
+ dra7xx_pcie_writel(dra7xx->base,
+ PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_RC);
+ break;
+ case DRA7XX_PCIE_EP_TYPE:
+ dra7xx_pcie_writel(dra7xx->base,
+ PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_EP);
+ break;
+ case DRA7XX_PCIE_LEG_EP_TYPE:
+ dra7xx_pcie_writel(dra7xx->base,
+ PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_LEG_EP);
+ break;
+ default:
+ dev_dbg(dev, "UNKNOWN device type %d\n", device_type);
+ }
+
+ reg = dra7xx_pcie_readl(dra7xx->base, PCIECTRL_TI_CONF_DEVICE_CMD);
+ reg &= ~LTSSM_EN;
+ dra7xx_pcie_writel(dra7xx->base, PCIECTRL_TI_CONF_DEVICE_CMD, reg);
+
+ ret = add_pcie_port(dra7xx, pdev);
+ if (ret < 0)
+ return ret;
+
+ platform_set_drvdata(pdev, dra7xx);
+ return 0;
+}
+
+static int __exit dra7xx_pcie_remove(struct platform_device *pdev)
+{
+ struct dra7xx_pcie *dra7xx = platform_get_drvdata(pdev);
+
+ pm_runtime_put(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ phy_power_off(dra7xx->phy);
+ phy_exit(dra7xx->phy);
+
+ return 0;
+}
+
+static const struct of_device_id of_dra7xx_pcie_match[] = {
+ { .compatible = "ti,dra7xx-pcie", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_dra7xx_pcie_match);
+
+static struct platform_driver dra7xx_pcie_driver = {
+ .remove = __exit_p(dra7xx_pcie_remove),
+ .driver = {
+ .name = "dra7xx-pcie",
+ .owner = THIS_MODULE,
+ .of_match_table = of_dra7xx_pcie_match,
+ },
+};
+
+module_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe);
+
+MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
+MODULE_DESCRIPTION("TI PCIe controller driver");
+MODULE_LICENSE("GPL v2");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 01/12] phy: phy-omap-pipe3: Add support for PCIe PHY Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-27 11:45 ` Jingoo Han
2014-03-26 13:57 ` [RFC PATCH 04/12] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock Kishon Vijay Abraham I
` (8 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
In DRA7, the cpu sees 32bit address, but the pcie controller can see only 28bit
address. So whenever the cpu issues a read/write request, the 4 most
significant bits are used by L3 to determine the target controller.
For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe controller but
the PCIe controller will see only (0x000_0000 - 0xFFF_FFF). So for programming
the outbound translation window the *base* should be programmed as 0x000_0000.
Whenever we try to write to say 0x2000_0000, it will be translated to whatever
we have programmed in the translation window with base as 0x000_0000.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
.../devicetree/bindings/pci/designware-pcie.txt | 1 +
drivers/pci/host/pcie-designware.c | 39 ++++++++++++++------
drivers/pci/host/pcie-designware.h | 1 +
3 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt
index d6fae13..c574dd3 100644
--- a/Documentation/devicetree/bindings/pci/designware-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt
@@ -27,6 +27,7 @@ Optional properties for fsl,imx6q-pcie
- power-on-gpio: gpio pin number of power-enable signal
- wake-up-gpio: gpio pin number of incoming wakeup signal
- disable-gpio: gpio pin number of outgoing rfkill/endpoint disable signal
+- base-mask: address mask for the PCIe controller target port
Example:
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 17ce88f..98b661c 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
return -EINVAL;
}
+ if (of_property_read_u64(np, "base-mask", &pp->base_mask))
+ pp->base_mask = ~(0x0ULL);
+
if (IS_ENABLED(CONFIG_PCI_MSI)) {
pp->irq_domain = irq_domain_add_linear(pp->dev->of_node,
MAX_MSI_IRQS, &msi_domain_ops,
@@ -503,12 +506,15 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev)
{
+ u64 cfg0_base;
+
+ cfg0_base = pp->cfg0_base & pp->base_mask;
/* Program viewport 0 : OUTBOUND : CFG0 */
dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0,
PCIE_ATU_VIEWPORT);
- dw_pcie_writel_rc(pp, pp->cfg0_base, PCIE_ATU_LOWER_BASE);
- dw_pcie_writel_rc(pp, (pp->cfg0_base >> 32), PCIE_ATU_UPPER_BASE);
- dw_pcie_writel_rc(pp, pp->cfg0_base + pp->config.cfg0_size - 1,
+ dw_pcie_writel_rc(pp, cfg0_base, PCIE_ATU_LOWER_BASE);
+ dw_pcie_writel_rc(pp, (cfg0_base >> 32), PCIE_ATU_UPPER_BASE);
+ dw_pcie_writel_rc(pp, cfg0_base + pp->config.cfg0_size - 1,
PCIE_ATU_LIMIT);
dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET);
dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET);
@@ -518,14 +524,17 @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev)
static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev)
{
+ u64 cfg1_base;
+
+ cfg1_base = pp->cfg1_base & pp->base_mask;
/* Program viewport 1 : OUTBOUND : CFG1 */
dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1,
PCIE_ATU_VIEWPORT);
dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1);
dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
- dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE);
- dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE);
- dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1,
+ dw_pcie_writel_rc(pp, cfg1_base, PCIE_ATU_LOWER_BASE);
+ dw_pcie_writel_rc(pp, (cfg1_base >> 32), PCIE_ATU_UPPER_BASE);
+ dw_pcie_writel_rc(pp, cfg1_base + pp->config.cfg1_size - 1,
PCIE_ATU_LIMIT);
dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET);
dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET);
@@ -533,14 +542,17 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev)
static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)
{
+ u64 mem_base;
+
+ mem_base = pp->mem_base & pp->base_mask;
/* Program viewport 0 : OUTBOUND : MEM */
dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0,
PCIE_ATU_VIEWPORT);
dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1);
dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
- dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE);
- dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE);
- dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1,
+ dw_pcie_writel_rc(pp, mem_base, PCIE_ATU_LOWER_BASE);
+ dw_pcie_writel_rc(pp, (mem_base >> 32), PCIE_ATU_UPPER_BASE);
+ dw_pcie_writel_rc(pp, mem_base + pp->config.mem_size - 1,
PCIE_ATU_LIMIT);
dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET);
dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr),
@@ -549,14 +561,17 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)
static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp)
{
+ u64 io_base;
+
+ io_base = pp->io_base & pp->base_mask;
/* Program viewport 1 : OUTBOUND : IO */
dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1,
PCIE_ATU_VIEWPORT);
dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1);
dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
- dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE);
- dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE);
- dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1,
+ dw_pcie_writel_rc(pp, io_base, PCIE_ATU_LOWER_BASE);
+ dw_pcie_writel_rc(pp, (io_base >> 32), PCIE_ATU_UPPER_BASE);
+ dw_pcie_writel_rc(pp, io_base + pp->config.io_size - 1,
PCIE_ATU_LIMIT);
dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET);
dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr),
diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h
index 3063b35..3fa12a6 100644
--- a/drivers/pci/host/pcie-designware.h
+++ b/drivers/pci/host/pcie-designware.h
@@ -35,6 +35,7 @@ struct pcie_port {
struct device *dev;
u8 root_bus_nr;
void __iomem *dbi_base;
+ u64 base_mask;
u64 cfg0_base;
void __iomem *va_cfg0_base;
u64 cfg1_base;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 04/12] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (2 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 05/12] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck Kishon Vijay Abraham I
` (7 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon, Keerthy
From: Keerthy <j-keerthy@ti.com>
Add divider table to optfclk_pciephy_div clock.
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/dra7xx-clocks.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
index e96da9a..d909484 100644
--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -1170,6 +1170,7 @@
clocks = <&apll_pcie_ck>;
#clock-cells = <0>;
reg = <0x021c>;
+ ti,dividers = <2>, <1>;
ti,bit-shift = <8>;
ti,max-div = <2>;
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 05/12] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (3 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 04/12] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 06/12] arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy Kishon Vijay Abraham I
` (6 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon, Keerthy
From: Keerthy <j-keerthy@ti.com>
Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck
from dpll_pcie_ref_ck.
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
index d909484..9e0bb09 100644
--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -1152,7 +1152,7 @@
apll_pcie_in_clk_mux: apll_pcie_in_clk_mux@4ae06118 {
compatible = "ti,mux-clock";
- clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>;
+ clocks = <&dpll_pcie_ref_m2ldo_ck>, <&pciesref_acs_clk_ck>;
#clock-cells = <0>;
reg = <0x021c 0x4>;
ti,bit-shift = <7>;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 06/12] arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (4 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 05/12] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 07/12] arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems Kishon Vijay Abraham I
` (5 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added hwmod data for pcie1 and pcie2 phy present in DRA7xx SOC.
Also added the missing CLKCTRL OFFSET macro and CONTEXT OFFSET macro
for pcie1 phy and pcie2 phy.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/mach-omap2/cm2_7xx.h | 4 ++
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 57 +++++++++++++++++++++++++++++
arch/arm/mach-omap2/prm7xx.h | 4 ++
3 files changed, 65 insertions(+)
diff --git a/arch/arm/mach-omap2/cm2_7xx.h b/arch/arm/mach-omap2/cm2_7xx.h
index 9ad7594..e966e3a 100644
--- a/arch/arm/mach-omap2/cm2_7xx.h
+++ b/arch/arm/mach-omap2/cm2_7xx.h
@@ -357,6 +357,10 @@
#define DRA7XX_CM_L3INIT_SATA_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x0088)
#define DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET 0x00a0
#define DRA7XX_CM_PCIE_STATICDEP_OFFSET 0x00a4
+#define DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET 0x00b0
+#define DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x00b0)
+#define DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET 0x00b8
+#define DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x00b8)
#define DRA7XX_CM_GMAC_CLKSTCTRL_OFFSET 0x00c0
#define DRA7XX_CM_GMAC_STATICDEP_OFFSET 0x00c4
#define DRA7XX_CM_GMAC_DYNAMICDEP_OFFSET 0x00c8
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index befe7ce..9397265 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1290,6 +1290,45 @@ static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
};
/*
+ * 'PCIE PHY' class
+ *
+ */
+
+static struct omap_hwmod_class dra7xx_pcie_phy_hwmod_class = {
+ .name = "pcie-phy",
+};
+
+/* pcie1 phy */
+static struct omap_hwmod dra7xx_pcie1_phy_hwmod = {
+ .name = "pcie1-phy",
+ .class = &dra7xx_pcie_phy_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .main_clk = "l4_root_clk_div",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET,
+ .context_offs = DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET,
+ .modulemode = MODULEMODE_SWCTRL,
+ },
+ },
+};
+
+/* pcie2 phy */
+static struct omap_hwmod dra7xx_pcie2_phy_hwmod = {
+ .name = "pcie2-phy",
+ .class = &dra7xx_pcie_phy_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .main_clk = "l4_root_clk_div",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET,
+ .context_offs = DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET,
+ .modulemode = MODULEMODE_SWCTRL,
+ },
+ },
+};
+
+/*
* 'qspi' class
*
*/
@@ -2420,6 +2459,22 @@ static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp1 = {
.user = OCP_USER_MPU | OCP_USER_SDMA,
};
+/* l4_cfg -> pcie1 phy */
+static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1_phy = {
+ .master = &dra7xx_l4_cfg_hwmod,
+ .slave = &dra7xx_pcie1_phy_hwmod,
+ .clk = "l4_root_clk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* l4_cfg -> pcie2 phy */
+static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie2_phy = {
+ .master = &dra7xx_l4_cfg_hwmod,
+ .slave = &dra7xx_pcie2_phy_hwmod,
+ .clk = "l4_root_clk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
static struct omap_hwmod_addr_space dra7xx_qspi_addrs[] = {
{
.pa_start = 0x4b300000,
@@ -2769,6 +2824,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
&dra7xx_l4_cfg__mpu,
&dra7xx_l4_cfg__ocp2scp1,
&dra7xx_l4_cfg__ocp2scp3,
+ &dra7xx_l4_cfg__pcie1_phy,
+ &dra7xx_l4_cfg__pcie2_phy,
&dra7xx_l3_main_1__qspi,
&dra7xx_l4_cfg__sata,
&dra7xx_l4_cfg__smartreflex_core,
diff --git a/arch/arm/mach-omap2/prm7xx.h b/arch/arm/mach-omap2/prm7xx.h
index d92a840..4bb50fbf 100644
--- a/arch/arm/mach-omap2/prm7xx.h
+++ b/arch/arm/mach-omap2/prm7xx.h
@@ -374,6 +374,10 @@
#define DRA7XX_RM_L3INIT_IEEE1500_2_OCP_CONTEXT_OFFSET 0x007c
#define DRA7XX_PM_L3INIT_SATA_WKDEP_OFFSET 0x0088
#define DRA7XX_RM_L3INIT_SATA_CONTEXT_OFFSET 0x008c
+#define DRA7XX_PM_L3INIT_PCIESS1_WKDEP_OFFSET 0x00b0
+#define DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET 0x00b4
+#define DRA7XX_PM_L3INIT_PCIESS2_WKDEP_OFFSET 0x00b8
+#define DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET 0x00bc
#define DRA7XX_RM_GMAC_GMAC_CONTEXT_OFFSET 0x00d4
#define DRA7XX_RM_L3INIT_OCP2SCP1_CONTEXT_OFFSET 0x00e4
#define DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET 0x00ec
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 07/12] arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (5 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 06/12] arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 08/12] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY Kishon Vijay Abraham I
` (4 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added hwmod data for pcie1 and pcie2 subsystem present in DRA7xx SOC.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 55 +++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 9397265..c789b00 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1290,6 +1290,43 @@ static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
};
/*
+ * 'PCIE' class
+ *
+ */
+
+static struct omap_hwmod_class dra7xx_pcie_hwmod_class = {
+ .name = "pcie",
+};
+
+/* pcie1 */
+static struct omap_hwmod dra7xx_pcie1_hwmod = {
+ .name = "pcie1",
+ .class = &dra7xx_pcie_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .main_clk = "l4_root_clk_div",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET,
+ .modulemode = MODULEMODE_SWCTRL,
+ },
+ },
+};
+
+/* pcie2 */
+static struct omap_hwmod dra7xx_pcie2_hwmod = {
+ .name = "pcie2",
+ .class = &dra7xx_pcie_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .main_clk = "l4_root_clk_div",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET,
+ .modulemode = MODULEMODE_SWCTRL,
+ },
+ },
+};
+
+/*
* 'PCIE PHY' class
*
*/
@@ -2459,6 +2496,22 @@ static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp1 = {
.user = OCP_USER_MPU | OCP_USER_SDMA,
};
+/* l4_cfg -> pcie1 */
+static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1 = {
+ .master = &dra7xx_l4_cfg_hwmod,
+ .slave = &dra7xx_pcie1_hwmod,
+ .clk = "l4_root_clk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* l4_cfg -> pcie2 */
+static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie2 = {
+ .master = &dra7xx_l4_cfg_hwmod,
+ .slave = &dra7xx_pcie2_hwmod,
+ .clk = "l4_root_clk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
/* l4_cfg -> pcie1 phy */
static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1_phy = {
.master = &dra7xx_l4_cfg_hwmod,
@@ -2824,6 +2877,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
&dra7xx_l4_cfg__mpu,
&dra7xx_l4_cfg__ocp2scp1,
&dra7xx_l4_cfg__ocp2scp3,
+ &dra7xx_l4_cfg__pcie1,
+ &dra7xx_l4_cfg__pcie2,
&dra7xx_l4_cfg__pcie1_phy,
&dra7xx_l4_cfg__pcie2_phy,
&dra7xx_l3_main_1__qspi,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 08/12] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (6 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 07/12] arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 09/12] ARM: dts: dra7: Add dt data for PCIe PHY control module Kishon Vijay Abraham I
` (3 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added missing 32khz clock used by PCIe PHY.
The documention for this node can be found @ ../bindings/clock/ti/gate.txt.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/dra7xx-clocks.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
index 9e0bb09..5f13189 100644
--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -1165,6 +1165,14 @@
reg = <0x021c>, <0x0220>;
};
+ optfclk_pciephy_32khz: optfclk_pciephy_32khz@4a0093b0 {
+ compatible = "ti,gate-clock";
+ clocks = <&sys_32k_ck>;
+ #clock-cells = <0>;
+ reg = <0x13b0>;
+ ti,bit-shift = <8>;
+ };
+
optfclk_pciephy_div: optfclk_pciephy_div@4a00821c {
compatible = "ti,divider-clock";
clocks = <&apll_pcie_ck>;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 09/12] ARM: dts: dra7: Add dt data for PCIe PHY control module
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (7 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 08/12] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 10/12] ARM: dts: dra7: Add dt data for PCIe PHY Kishon Vijay Abraham I
` (2 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added dt data for PCIe PHY control module used by PCIe PHY.
The documention for this node can be found @ ../bindings/phy/ti-phy.txt
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/dra7.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index f3565ac..73c61d0 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -656,6 +656,14 @@
clock-names = "sysclk";
};
+ omap_control_pcie1phy: omap-control-pciephy@0x4a003c40 {
+ compatible = "ti,control-phy-pipe3";
+ reg = <0x4a003c40 0x4>;
+ reg-names = "power";
+ clocks = <&sys_clkin1>;
+ clock-names = "sysclk";
+ };
+
/* OCP2SCP3 */
ocp2scp@4a090000 {
compatible = "ti,omap-ocp2scp";
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 10/12] ARM: dts: dra7: Add dt data for PCIe PHY
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (8 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 09/12] ARM: dts: dra7: Add dt data for PCIe PHY control module Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 11/12] ARM: dts: dra7: Add dt data for PCIe controller Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 12/12] ARM: OMAP: Enable PCI for DRA7 Kishon Vijay Abraham I
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added dt data for PCIe PHY as a child node of ocp2scp3.
The documention for this node can be found @ ../bindings/phy/ti-phy.txt.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/dra7.dtsi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 73c61d0..7ac372b 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -683,6 +683,22 @@
clock-names = "sysclk";
#phy-cells = <0>;
};
+
+ pcie1_phy: pciephy@4a094000 {
+ compatible = "ti,phy-pipe3-pcie";
+ ctrl-module = <&omap_control_pcie1phy>;
+ clocks = <&dpll_pcie_ref_ck>,
+ <&dpll_pcie_ref_m2ldo_ck>,
+ <&optfclk_pciephy_32khz>,
+ <&optfclk_pciephy_clk>,
+ <&optfclk_pciephy_div_clk>,
+ <&optfclk_pciephy_div>;
+ clock-names = "dpll_ref", "dpll_ref_m2",
+ "wkupclk", "refclk",
+ "div-clk", "phy-div";
+ #phy-cells = <0>;
+ ti,hwmods = "pcie1-phy";
+ };
};
sata: sata@4a141100 {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 11/12] ARM: dts: dra7: Add dt data for PCIe controller
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (9 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 10/12] ARM: dts: dra7: Add dt data for PCIe PHY Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 12/12] ARM: OMAP: Enable PCI for DRA7 Kishon Vijay Abraham I
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Added dt data for PCIe controller. This node contains dt data for
both the DRA7 part of designware controller and for the designware core.
The documention for this node can be found @ ../bindings/pci/ti-pci.txt.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/boot/dts/dra7.dtsi | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 7ac372b..10def39 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -701,6 +701,30 @@
};
};
+ pcie@51000000 {
+ compatible = "ti,dra7xx-pcie";
+ reg = <0x51002000 0x14c>, <0x51000000 0x2000>, <0x4A002540 0x1f>;
+ reg-names = "ti_conf", "rc_dbics", "mmr_unlock";
+ interrupts = <0 232 0x4>, <0 233 0x4>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ device_type = "pci";
+ ti,device_type = <3>;
+ ranges = <0x00000800 0 0x20001000 0x20001000 0 0x00002000
+ 0x81000000 0 0 0x20003000 0 0x00010000
+ 0x82000000 0 0x20013000 0x20013000 0 0xffed000>;
+ #interrupt-cells = <1>;
+ base-mask = <0x00000000 0x0fffffff>;
+ num-lanes = <1>;
+ interrupt-map-mask = <0 0 0 0>;
+ interrupt-map = <0x0 0 &gic 233>;
+ ti,hwmods = "pcie1";
+ phys = <&pcie1_phy>;
+ phy-names = "pcie-phy";
+ resets = <&prm_resets &device_reset>;
+ reset-names = "reset";
+ };
+
sata: sata@4a141100 {
compatible = "snps,dwc-ahci";
reg = <0x4a140000 0x1100>, <0x4a141100 0x7>;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [RFC PATCH 12/12] ARM: OMAP: Enable PCI for DRA7
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
` (10 preceding siblings ...)
2014-03-26 13:57 ` [RFC PATCH 11/12] ARM: dts: dra7: Add dt data for PCIe controller Kishon Vijay Abraham I
@ 2014-03-26 13:57 ` Kishon Vijay Abraham I
11 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 13:57 UTC (permalink / raw)
To: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, jg1.han
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
linux, tony, rnayak, paul, kishon
Now that we have added PCIe driver for DRA7 SOCs, enable PCI on
DRA7 SOCs.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/mach-omap2/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 46f8c53..352f252 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -86,6 +86,8 @@ config SOC_DRA7XX
select HAVE_SMP
select HAVE_ARM_ARCH_TIMER
select IRQ_CROSSBAR
+ select MIGHT_HAVE_PCI
+ select ARCH_SUPPORTS_MSI
config ARCH_OMAP2PLUS
bool
--
1.7.9.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller
2014-03-26 13:57 ` [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller Kishon Vijay Abraham I
@ 2014-03-26 14:45 ` Rob Herring
2014-03-26 15:19 ` Kishon Vijay Abraham I
2014-03-27 3:43 ` Jingoo Han
1 sibling, 1 reply; 20+ messages in thread
From: Rob Herring @ 2014-03-26 14:45 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-omap,
linux-pci@vger.kernel.org, Bjorn Helgaas, mohit.kumar, Jingoo Han,
Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
Rob Landley, Russell King - ARM Linux, Tony Lindgren, rnayak,
paul@pwsan.com
On Wed, Mar 26, 2014 at 8:57 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Added support for pcie controller in dra7xx. This driver re-uses
> the designware core code that is already present in kernel.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Documentation/devicetree/bindings/pci/ti-pci.txt | 35 ++
> drivers/pci/host/Kconfig | 10 +
> drivers/pci/host/Makefile | 1 +
> drivers/pci/host/pcie-dra7xx.c | 411 ++++++++++++++++++++++
> 4 files changed, 457 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
> create mode 100644 drivers/pci/host/pcie-dra7xx.c
>
> diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt
> new file mode 100644
> index 0000000..0528c47
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pci/ti-pci.txt
> @@ -0,0 +1,35 @@
> +TI PCI Controllers
> +
> +PCIe Designware Controller
> +This node should have the properties described in "designware-pcie.txt".
> + - compatible: Should be "ti,dra7xx-pcie""
> + - reg : Address and length of the register set for the device.
> + - phys : the phandle for the PHY device (used by generic PHY framework)
> + - phy-names : the names of the PHY corresponding to the PHYs present in the
> + *phy* phandle.
> + - resets: phandle used if reset is handled be soc
s/be/by/ ?
> + - reset-names: name given to the phandle
> + - ti,device-type: Should be 1 - EP TYPE, 2 - LEG EP TYPE OR 3 - RC TYPE
I don't think this makes sense. I'd imagine we'd need the binding to
look quite a bit different if endpoint mode was actually supported. I
think I would start defining endpoint mode with a different compatible
string and go from there.
> +
> +Example:
> +pcie@51000000 {
> + compatible = "ti,dra7xx-pcie";
> + reg = <0x51002000 0x14c>, <0x51000000 0x2000>, <0x4A002540 0x1f>, <0x4A003c24 0x4>, <0x4AE07310 0x4>;
This is different number of entries from your actual dts. You need to
define how many reg entries, what they are, and the order.
Rob
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller
2014-03-26 14:45 ` Rob Herring
@ 2014-03-26 15:19 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-26 15:19 UTC (permalink / raw)
To: Rob Herring
Cc: devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-omap,
linux-pci@vger.kernel.org, Bjorn Helgaas, mohit.kumar, Jingoo Han,
Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
Rob Landley, Russell King - ARM Linux, Tony Lindgren, rnayak,
paul@pwsan.com
On Wednesday 26 March 2014 08:15 PM, Rob Herring wrote:
> On Wed, Mar 26, 2014 at 8:57 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>> Added support for pcie controller in dra7xx. This driver re-uses
>> the designware core code that is already present in kernel.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>> Documentation/devicetree/bindings/pci/ti-pci.txt | 35 ++
>> drivers/pci/host/Kconfig | 10 +
>> drivers/pci/host/Makefile | 1 +
>> drivers/pci/host/pcie-dra7xx.c | 411 ++++++++++++++++++++++
>> 4 files changed, 457 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
>> create mode 100644 drivers/pci/host/pcie-dra7xx.c
>>
>> diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt
>> new file mode 100644
>> index 0000000..0528c47
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pci/ti-pci.txt
>> @@ -0,0 +1,35 @@
>> +TI PCI Controllers
>> +
>> +PCIe Designware Controller
>> +This node should have the properties described in "designware-pcie.txt".
>> + - compatible: Should be "ti,dra7xx-pcie""
>> + - reg : Address and length of the register set for the device.
>> + - phys : the phandle for the PHY device (used by generic PHY framework)
>> + - phy-names : the names of the PHY corresponding to the PHYs present in the
>> + *phy* phandle.
>> + - resets: phandle used if reset is handled be soc
>
> s/be/by/ ?
>
>> + - reset-names: name given to the phandle
>> + - ti,device-type: Should be 1 - EP TYPE, 2 - LEG EP TYPE OR 3 - RC TYPE
>
> I don't think this makes sense. I'd imagine we'd need the binding to
> look quite a bit different if endpoint mode was actually supported. I
right, it makes sense to remove the ti,device-type altogether as this driver
only supports RC.
> think I would start defining endpoint mode with a different compatible
> string and go from there.
>
>> +
>> +Example:
>> +pcie@51000000 {
>> + compatible = "ti,dra7xx-pcie";
>> + reg = <0x51002000 0x14c>, <0x51000000 0x2000>, <0x4A002540 0x1f>, <0x4A003c24 0x4>, <0x4AE07310 0x4>;
>
> This is different number of entries from your actual dts. You need to
> define how many reg entries, what they are, and the order.
Ok. Will fix it.
Thanks
Kishon
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller
2014-03-26 13:57 ` [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller Kishon Vijay Abraham I
2014-03-26 14:45 ` Rob Herring
@ 2014-03-27 3:43 ` Jingoo Han
2014-03-27 5:26 ` Kishon Vijay Abraham I
1 sibling, 1 reply; 20+ messages in thread
From: Jingoo Han @ 2014-03-27 3:43 UTC (permalink / raw)
To: 'Kishon Vijay Abraham I'
Cc: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, rob, linux, tony, rnayak,
paul, 'Jingoo Han'
On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
>
> Added support for pcie controller in dra7xx. This driver re-uses
> the designware core code that is already present in kernel.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Hi Kishon,
Long time no see! I added trivial comments.
> ---
> Documentation/devicetree/bindings/pci/ti-pci.txt | 35 ++
> drivers/pci/host/Kconfig | 10 +
> drivers/pci/host/Makefile | 1 +
> drivers/pci/host/pcie-dra7xx.c | 411 ++++++++++++++++++++++
How about using 'pci-' prefix?
As it was discussed earlier, 'pci-' prefix is more proper.
> 4 files changed, 457 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
> create mode 100644 drivers/pci/host/pcie-dra7xx.c
[.....]
> --- /dev/null
> +++ b/drivers/pci/host/pcie-dra7xx.c
[.....]
> +#define PCIECTRL_TI_CONF_IRQSTATUS_MAIN 0x0024
> +#define PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN 0x0028
I don't think that it's good to add vendor names such as TI
to SFR names.
How about adding 'DRA7XX' or just removing 'TI'?
1. PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN
2. PCIECTRL_CONF_IRQSTATUS_MAIN
[.....]
> +enum dra7xx_pcie_device_type {
> + DRA7XX_PCIE_UNKNOWN_TYPE,
> + DRA7XX_PCIE_EP_TYPE,
> + DRA7XX_PCIE_LEG_EP_TYPE,
> + DRA7XX_PCIE_RC_TYPE,
> +};
This driver can support only RC mode, so, these enum can be removed.
[.....]
> + of_property_read_u32(node, "ti,device-type", &device_type);
> + switch (device_type) {
> + case DRA7XX_PCIE_RC_TYPE:
> + dra7xx_pcie_writel(dra7xx->base,
> + PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_RC);
> + break;
> + case DRA7XX_PCIE_EP_TYPE:
> + dra7xx_pcie_writel(dra7xx->base,
> + PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_EP);
> + break;
> + case DRA7XX_PCIE_LEG_EP_TYPE:
> + dra7xx_pcie_writel(dra7xx->base,
> + PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_LEG_EP);
> + break;
> + default:
> + dev_dbg(dev, "UNKNOWN device type %d\n", device_type);
> + }
Thus, this switch can be removed.
Others look good.
Best regards,
Jingoo Han
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller
2014-03-27 3:43 ` Jingoo Han
@ 2014-03-27 5:26 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 20+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-27 5:26 UTC (permalink / raw)
To: Jingoo Han
Cc: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, mohit.kumar, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, rob, linux, tony, rnayak,
paul
On Thursday 27 March 2014 09:13 AM, Jingoo Han wrote:
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
>>
>> Added support for pcie controller in dra7xx. This driver re-uses
>> the designware core code that is already present in kernel.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>
> Hi Kishon,
> Long time no see! I added trivial comments.
yeah, these were in my TODO for a long time. Sorry for it though.
>
>> ---
>> Documentation/devicetree/bindings/pci/ti-pci.txt | 35 ++
>> drivers/pci/host/Kconfig | 10 +
>> drivers/pci/host/Makefile | 1 +
>> drivers/pci/host/pcie-dra7xx.c | 411 ++++++++++++++++++++++
>
> How about using 'pci-' prefix?
> As it was discussed earlier, 'pci-' prefix is more proper.
>
>> 4 files changed, 457 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
>> create mode 100644 drivers/pci/host/pcie-dra7xx.c
>
> [.....]
>
>> --- /dev/null
>> +++ b/drivers/pci/host/pcie-dra7xx.c
>
> [.....]
>
>> +#define PCIECTRL_TI_CONF_IRQSTATUS_MAIN 0x0024
>> +#define PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN 0x0028
>
> I don't think that it's good to add vendor names such as TI
> to SFR names.
>
> How about adding 'DRA7XX' or just removing 'TI'?
>
> 1. PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN
ok.
>
> 2. PCIECTRL_CONF_IRQSTATUS_MAIN
>
> [.....]
>
>> +enum dra7xx_pcie_device_type {
>> + DRA7XX_PCIE_UNKNOWN_TYPE,
>> + DRA7XX_PCIE_EP_TYPE,
>> + DRA7XX_PCIE_LEG_EP_TYPE,
>> + DRA7XX_PCIE_RC_TYPE,
>> +};
>
> This driver can support only RC mode, so, these enum can be removed.
>
> [.....]
>
>> + of_property_read_u32(node, "ti,device-type", &device_type);
>> + switch (device_type) {
>> + case DRA7XX_PCIE_RC_TYPE:
>> + dra7xx_pcie_writel(dra7xx->base,
>> + PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_RC);
>> + break;
>> + case DRA7XX_PCIE_EP_TYPE:
>> + dra7xx_pcie_writel(dra7xx->base,
>> + PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_EP);
>> + break;
>> + case DRA7XX_PCIE_LEG_EP_TYPE:
>> + dra7xx_pcie_writel(dra7xx->base,
>> + PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_LEG_EP);
>> + break;
>> + default:
>> + dev_dbg(dev, "UNKNOWN device type %d\n", device_type);
>> + }
>
> Thus, this switch can be removed.
sure.
Thanks
Kishon
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
2014-03-26 13:57 ` [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU Kishon Vijay Abraham I
@ 2014-03-27 11:45 ` Jingoo Han
2014-03-27 11:53 ` Mohit KUMAR DCG
[not found] ` <000001cf49b1$fcd8a810$f689f830$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
0 siblings, 2 replies; 20+ messages in thread
From: Jingoo Han @ 2014-03-27 11:45 UTC (permalink / raw)
To: 'Kishon Vijay Abraham I', 'Mohit Kumar',
'Pratyush Anand'
Cc: devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
linux-pci, bhelgaas, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, rob, linux, tony, rnayak, paul,
'Marek Vasut', 'Richard Zhu'
On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
>
> In DRA7, the cpu sees 32bit address, but the pcie controller can see only 28bit
> address. So whenever the cpu issues a read/write request, the 4 most
> significant bits are used by L3 to determine the target controller.
> For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe controller but
> the PCIe controller will see only (0x000_0000 - 0xFFF_FFF). So for programming
> the outbound translation window the *base* should be programmed as 0x000_0000.
> Whenever we try to write to say 0x2000_0000, it will be translated to whatever
> we have programmed in the translation window with base as 0x000_0000.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(+cc Pratyush Anand, Marek Vasut, Richard Zhu)
Acked-by: Jingoo Han <jg1.han@samsung.com>
Mohit Kumar, Pratyush Anand,
If you have other opinions, please let us know. :-)
Thank you.
Best regards,
Jingoo Han
> ---
> .../devicetree/bindings/pci/designware-pcie.txt | 1 +
> drivers/pci/host/pcie-designware.c | 39 ++++++++++++++------
> drivers/pci/host/pcie-designware.h | 1 +
> 3 files changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt
> b/Documentation/devicetree/bindings/pci/designware-pcie.txt
> index d6fae13..c574dd3 100644
> --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt
> @@ -27,6 +27,7 @@ Optional properties for fsl,imx6q-pcie
> - power-on-gpio: gpio pin number of power-enable signal
> - wake-up-gpio: gpio pin number of incoming wakeup signal
> - disable-gpio: gpio pin number of outgoing rfkill/endpoint disable signal
> +- base-mask: address mask for the PCIe controller target port
>
> Example:
>
> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index 17ce88f..98b661c 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
> return -EINVAL;
> }
>
> + if (of_property_read_u64(np, "base-mask", &pp->base_mask))
> + pp->base_mask = ~(0x0ULL);
> +
> if (IS_ENABLED(CONFIG_PCI_MSI)) {
> pp->irq_domain = irq_domain_add_linear(pp->dev->of_node,
> MAX_MSI_IRQS, &msi_domain_ops,
> @@ -503,12 +506,15 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
>
> static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev)
> {
> + u64 cfg0_base;
> +
> + cfg0_base = pp->cfg0_base & pp->base_mask;
> /* Program viewport 0 : OUTBOUND : CFG0 */
> dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0,
> PCIE_ATU_VIEWPORT);
> - dw_pcie_writel_rc(pp, pp->cfg0_base, PCIE_ATU_LOWER_BASE);
> - dw_pcie_writel_rc(pp, (pp->cfg0_base >> 32), PCIE_ATU_UPPER_BASE);
> - dw_pcie_writel_rc(pp, pp->cfg0_base + pp->config.cfg0_size - 1,
> + dw_pcie_writel_rc(pp, cfg0_base, PCIE_ATU_LOWER_BASE);
> + dw_pcie_writel_rc(pp, (cfg0_base >> 32), PCIE_ATU_UPPER_BASE);
> + dw_pcie_writel_rc(pp, cfg0_base + pp->config.cfg0_size - 1,
> PCIE_ATU_LIMIT);
> dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET);
> dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET);
> @@ -518,14 +524,17 @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev)
>
> static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev)
> {
> + u64 cfg1_base;
> +
> + cfg1_base = pp->cfg1_base & pp->base_mask;
> /* Program viewport 1 : OUTBOUND : CFG1 */
> dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1,
> PCIE_ATU_VIEWPORT);
> dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1);
> dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> - dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE);
> - dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE);
> - dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1,
> + dw_pcie_writel_rc(pp, cfg1_base, PCIE_ATU_LOWER_BASE);
> + dw_pcie_writel_rc(pp, (cfg1_base >> 32), PCIE_ATU_UPPER_BASE);
> + dw_pcie_writel_rc(pp, cfg1_base + pp->config.cfg1_size - 1,
> PCIE_ATU_LIMIT);
> dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET);
> dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET);
> @@ -533,14 +542,17 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev)
>
> static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)
> {
> + u64 mem_base;
> +
> + mem_base = pp->mem_base & pp->base_mask;
> /* Program viewport 0 : OUTBOUND : MEM */
> dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0,
> PCIE_ATU_VIEWPORT);
> dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1);
> dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> - dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE);
> - dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE);
> - dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1,
> + dw_pcie_writel_rc(pp, mem_base, PCIE_ATU_LOWER_BASE);
> + dw_pcie_writel_rc(pp, (mem_base >> 32), PCIE_ATU_UPPER_BASE);
> + dw_pcie_writel_rc(pp, mem_base + pp->config.mem_size - 1,
> PCIE_ATU_LIMIT);
> dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET);
> dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr),
> @@ -549,14 +561,17 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)
>
> static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp)
> {
> + u64 io_base;
> +
> + io_base = pp->io_base & pp->base_mask;
> /* Program viewport 1 : OUTBOUND : IO */
> dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1,
> PCIE_ATU_VIEWPORT);
> dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1);
> dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> - dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE);
> - dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE);
> - dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1,
> + dw_pcie_writel_rc(pp, io_base, PCIE_ATU_LOWER_BASE);
> + dw_pcie_writel_rc(pp, (io_base >> 32), PCIE_ATU_UPPER_BASE);
> + dw_pcie_writel_rc(pp, io_base + pp->config.io_size - 1,
> PCIE_ATU_LIMIT);
> dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET);
> dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr),
> diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h
> index 3063b35..3fa12a6 100644
> --- a/drivers/pci/host/pcie-designware.h
> +++ b/drivers/pci/host/pcie-designware.h
> @@ -35,6 +35,7 @@ struct pcie_port {
> struct device *dev;
> u8 root_bus_nr;
> void __iomem *dbi_base;
> + u64 base_mask;
> u64 cfg0_base;
> void __iomem *va_cfg0_base;
> u64 cfg1_base;
> --
> 1.7.9.5
^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
2014-03-27 11:45 ` Jingoo Han
@ 2014-03-27 11:53 ` Mohit KUMAR DCG
[not found] ` <000001cf49b1$fcd8a810$f689f830$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
1 sibling, 0 replies; 20+ messages in thread
From: Mohit KUMAR DCG @ 2014-03-27 11:53 UTC (permalink / raw)
To: Jingoo Han, 'Kishon Vijay Abraham I', Pratyush ANAND
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, paul@pwsan.com,
rnayak@ti.com, linux@arm.linux.org.uk, pawel.moll@arm.com,
linux-doc@vger.kernel.org, tony@atomide.com,
linux-pci@vger.kernel.org, ijc+devicetree@hellion.org.uk,
linux-kernel@vger.kernel.org, 'Marek Vasut',
'Richard Zhu', robh+dt@kernel.org, rob@landley.net,
galak@codeaurora.org, bhelgaas@google.com,
linux-omap@vger.kernel.org, linux-arm-kernel
Hello Kishon,
> -----Original Message-----
> From: Jingoo Han [mailto:jg1.han@samsung.com]
> Sent: Thursday, March 27, 2014 5:15 PM
> To: 'Kishon Vijay Abraham I'; Mohit KUMAR DCG; Pratyush ANAND
> Cc: devicetree@vger.kernel.org; linux-doc@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> omap@vger.kernel.org; linux-pci@vger.kernel.org; bhelgaas@google.com;
> robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com;
> ijc+devicetree@hellion.org.uk; galak@codeaurora.org; rob@landley.net;
> linux@arm.linux.org.uk; tony@atomide.com; rnayak@ti.com;
> paul@pwsan.com; 'Marek Vasut'; 'Richard Zhu'
> Subject: Re: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask*
> for configuring the iATU
>
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
> >
> > In DRA7, the cpu sees 32bit address, but the pcie controller can see
> > only 28bit address. So whenever the cpu issues a read/write request,
> > the 4 most significant bits are used by L3 to determine the target controller.
> > For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe
> > controller but the PCIe controller will see only (0x000_0000 -
> > 0xFFF_FFF). So for programming the outbound translation window the
> *base* should be programmed as 0x000_0000.
> > Whenever we try to write to say 0x2000_0000, it will be translated to
> > whatever we have programmed in the translation window with base as
> 0x000_0000.
> >
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>
> (+cc Pratyush Anand, Marek Vasut, Richard Zhu)
>
> Acked-by: Jingoo Han <jg1.han@samsung.com>
>
> Mohit Kumar, Pratyush Anand,
> If you have other opinions, please let us know. :-) Thank you.
>
- Yes, looks more clean now.
Acked-by: Mohit Kumar <mohit.kumar@st.com>
Regards,
Mohit
> Best regards,
> Jingoo Han
>
> > ---
> > .../devicetree/bindings/pci/designware-pcie.txt | 1 +
> > drivers/pci/host/pcie-designware.c | 39 ++++++++++++++------
> > drivers/pci/host/pcie-designware.h | 1 +
> > 3 files changed, 29 insertions(+), 12 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt
> > b/Documentation/devicetree/bindings/pci/designware-pcie.txt
> > index d6fae13..c574dd3 100644
> > --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt
> > +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt
> > @@ -27,6 +27,7 @@ Optional properties for fsl,imx6q-pcie
> > - power-on-gpio: gpio pin number of power-enable signal
> > - wake-up-gpio: gpio pin number of incoming wakeup signal
> > - disable-gpio: gpio pin number of outgoing rfkill/endpoint disable
> > signal
> > +- base-mask: address mask for the PCIe controller target port
> >
> > Example:
> >
> > diff --git a/drivers/pci/host/pcie-designware.c
> > b/drivers/pci/host/pcie-designware.c
> > index 17ce88f..98b661c 100644
> > --- a/drivers/pci/host/pcie-designware.c
> > +++ b/drivers/pci/host/pcie-designware.c
> > @@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
> > return -EINVAL;
> > }
> >
> > + if (of_property_read_u64(np, "base-mask", &pp->base_mask))
> > + pp->base_mask = ~(0x0ULL);
> > +
> > if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > pp->irq_domain = irq_domain_add_linear(pp->dev-
> >of_node,
> > MAX_MSI_IRQS, &msi_domain_ops,
> > @@ -503,12 +506,15 @@ int __init dw_pcie_host_init(struct pcie_port
> > *pp)
> >
> > static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32
> > busdev) {
> > + u64 cfg0_base;
> > +
> > + cfg0_base = pp->cfg0_base & pp->base_mask;
> > /* Program viewport 0 : OUTBOUND : CFG0 */
> > dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND |
> PCIE_ATU_REGION_INDEX0,
> > PCIE_ATU_VIEWPORT);
> > - dw_pcie_writel_rc(pp, pp->cfg0_base, PCIE_ATU_LOWER_BASE);
> > - dw_pcie_writel_rc(pp, (pp->cfg0_base >> 32),
> PCIE_ATU_UPPER_BASE);
> > - dw_pcie_writel_rc(pp, pp->cfg0_base + pp->config.cfg0_size - 1,
> > + dw_pcie_writel_rc(pp, cfg0_base, PCIE_ATU_LOWER_BASE);
> > + dw_pcie_writel_rc(pp, (cfg0_base >> 32), PCIE_ATU_UPPER_BASE);
> > + dw_pcie_writel_rc(pp, cfg0_base + pp->config.cfg0_size - 1,
> > PCIE_ATU_LIMIT);
> > dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET);
> > dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); @@ -518,14
> +524,17
> > @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32
> > busdev)
> >
> > static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32
> > busdev) {
> > + u64 cfg1_base;
> > +
> > + cfg1_base = pp->cfg1_base & pp->base_mask;
> > /* Program viewport 1 : OUTBOUND : CFG1 */
> > dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND |
> PCIE_ATU_REGION_INDEX1,
> > PCIE_ATU_VIEWPORT);
> > dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1);
> > dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> > - dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE);
> > - dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32),
> PCIE_ATU_UPPER_BASE);
> > - dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1,
> > + dw_pcie_writel_rc(pp, cfg1_base, PCIE_ATU_LOWER_BASE);
> > + dw_pcie_writel_rc(pp, (cfg1_base >> 32), PCIE_ATU_UPPER_BASE);
> > + dw_pcie_writel_rc(pp, cfg1_base + pp->config.cfg1_size - 1,
> > PCIE_ATU_LIMIT);
> > dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET);
> > dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); @@ -533,14
> +542,17
> > @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32
> > busdev)
> >
> > static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port
> *pp)
> > {
> > + u64 mem_base;
> > +
> > + mem_base = pp->mem_base & pp->base_mask;
> > /* Program viewport 0 : OUTBOUND : MEM */
> > dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND |
> PCIE_ATU_REGION_INDEX0,
> > PCIE_ATU_VIEWPORT);
> > dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1);
> > dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> > - dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE);
> > - dw_pcie_writel_rc(pp, (pp->mem_base >> 32),
> PCIE_ATU_UPPER_BASE);
> > - dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1,
> > + dw_pcie_writel_rc(pp, mem_base, PCIE_ATU_LOWER_BASE);
> > + dw_pcie_writel_rc(pp, (mem_base >> 32), PCIE_ATU_UPPER_BASE);
> > + dw_pcie_writel_rc(pp, mem_base + pp->config.mem_size - 1,
> > PCIE_ATU_LIMIT);
> > dw_pcie_writel_rc(pp, pp->config.mem_bus_addr,
> PCIE_ATU_LOWER_TARGET);
> > dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr),
> > @@ -549,14 +561,17 @@ static void
> > dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp)
> >
> > static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp)
> > {
> > + u64 io_base;
> > +
> > + io_base = pp->io_base & pp->base_mask;
> > /* Program viewport 1 : OUTBOUND : IO */
> > dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND |
> PCIE_ATU_REGION_INDEX1,
> > PCIE_ATU_VIEWPORT);
> > dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1);
> > dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
> > - dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE);
> > - dw_pcie_writel_rc(pp, (pp->io_base >> 32),
> PCIE_ATU_UPPER_BASE);
> > - dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1,
> > + dw_pcie_writel_rc(pp, io_base, PCIE_ATU_LOWER_BASE);
> > + dw_pcie_writel_rc(pp, (io_base >> 32), PCIE_ATU_UPPER_BASE);
> > + dw_pcie_writel_rc(pp, io_base + pp->config.io_size - 1,
> > PCIE_ATU_LIMIT);
> > dw_pcie_writel_rc(pp, pp->config.io_bus_addr,
> PCIE_ATU_LOWER_TARGET);
> > dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr),
> > diff --git a/drivers/pci/host/pcie-designware.h
> > b/drivers/pci/host/pcie-designware.h
> > index 3063b35..3fa12a6 100644
> > --- a/drivers/pci/host/pcie-designware.h
> > +++ b/drivers/pci/host/pcie-designware.h
> > @@ -35,6 +35,7 @@ struct pcie_port {
> > struct device *dev;
> > u8 root_bus_nr;
> > void __iomem *dbi_base;
> > + u64 base_mask;
> > u64 cfg0_base;
> > void __iomem *va_cfg0_base;
> > u64 cfg1_base;
> > --
> > 1.7.9.5
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU
[not found] ` <000001cf49b1$fcd8a810$f689f830$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2014-03-27 17:32 ` Marek Vasut
0 siblings, 0 replies; 20+ messages in thread
From: Marek Vasut @ 2014-03-27 17:32 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Kishon Vijay Abraham I', 'Mohit Kumar',
'Pratyush Anand', devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-pci-u79uwXL29TY76Z2rM5mHXA, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ,
linux-lFZ/pmaqli7XmaaqVzeoHQ, tony-4v6yS6AI5VpBDgjK7y7TUQ,
rnayak-l0cyMroinI0, paul-DWxLp4Yu+b8AvxtiuMwx3w,
'Richard Zhu'
On Thursday, March 27, 2014 at 12:45:01 PM, Jingoo Han wrote:
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
> > In DRA7, the cpu sees 32bit address, but the pcie controller can see only
> > 28bit address. So whenever the cpu issues a read/write request, the 4
> > most significant bits are used by L3 to determine the target controller.
> > For example, the cpu reserves 0x2000_0000 - 0x2FFF_FFFF for PCIe
> > controller but the PCIe controller will see only (0x000_0000 -
> > 0xFFF_FFF). So for programming the outbound translation window the
> > *base* should be programmed as 0x000_0000. Whenever we try to write to
> > say 0x2000_0000, it will be translated to whatever we have programmed in
> > the translation window with base as 0x000_0000.
> >
> > Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>
> (+cc Pratyush Anand, Marek Vasut, Richard Zhu)
Thanks.
> Acked-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
This patch has no impact on MX6, the mask on MX6 is ~0 . A few comments below
...
[...]
> > diff --git a/drivers/pci/host/pcie-designware.c
> > b/drivers/pci/host/pcie-designware.c index 17ce88f..98b661c 100644
> > --- a/drivers/pci/host/pcie-designware.c
> > +++ b/drivers/pci/host/pcie-designware.c
> > @@ -464,6 +464,9 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
> >
> > return -EINVAL;
> >
> > }
> >
> > + if (of_property_read_u64(np, "base-mask", &pp->base_mask))
> > + pp->base_mask = ~(0x0ULL);
You can just use ~0x0ULL without the () I believe.
[...]
> > diff --git a/drivers/pci/host/pcie-designware.h
> > b/drivers/pci/host/pcie-designware.h index 3063b35..3fa12a6 100644
> > --- a/drivers/pci/host/pcie-designware.h
> > +++ b/drivers/pci/host/pcie-designware.h
> > @@ -35,6 +35,7 @@ struct pcie_port {
> >
> > struct device *dev;
> > u8 root_bus_nr;
> > void __iomem *dbi_base;
> >
> > + u64 base_mask;
> >
> > u64 cfg0_base;
> > void __iomem *va_cfg0_base;
> > u64 cfg1_base;
This structure contains a lot of slop, check [1] please. We really should be
more careful about the structures. I think a separate patch to clean this up
would be fine though.
[1] http://www.catb.org/esr/structure-packing/
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2014-03-27 17:32 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 13:57 [RFC PATCH 00/12] PCIe support for DRA7xx Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 01/12] phy: phy-omap-pipe3: Add support for PCIe PHY Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller Kishon Vijay Abraham I
2014-03-26 14:45 ` Rob Herring
2014-03-26 15:19 ` Kishon Vijay Abraham I
2014-03-27 3:43 ` Jingoo Han
2014-03-27 5:26 ` Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 03/12] pci: host: pcie-designware: Use *base-mask* for configuring the iATU Kishon Vijay Abraham I
2014-03-27 11:45 ` Jingoo Han
2014-03-27 11:53 ` Mohit KUMAR DCG
[not found] ` <000001cf49b1$fcd8a810$f689f830$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-03-27 17:32 ` Marek Vasut
2014-03-26 13:57 ` [RFC PATCH 04/12] ARM: dts: DRA7: Add divider table to optfclk_pciephy_div clock Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 05/12] ARM: dts: DRA7: Change the parent of apll_pcie_in_clk_mux to dpll_pcie_ref_m2ldo_ck Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 06/12] arm: dra7xx: Add hwmod data for pcie1 phy and pcie2 phy Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 07/12] arm: dra7xx: Add hwmod data for pcie1 and pcie2 subsystems Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 08/12] ARM: dts: dra7xx-clocks: Add missing 32khz clocks used for PHY Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 09/12] ARM: dts: dra7: Add dt data for PCIe PHY control module Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 10/12] ARM: dts: dra7: Add dt data for PCIe PHY Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 11/12] ARM: dts: dra7: Add dt data for PCIe controller Kishon Vijay Abraham I
2014-03-26 13:57 ` [RFC PATCH 12/12] ARM: OMAP: Enable PCI for DRA7 Kishon Vijay Abraham I
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).