* [PATCH 0/3] dra7xx: get pcie working in mainline
@ 2016-01-10 15:41 Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-10 15:41 UTC (permalink / raw)
To: linux-arm-kernel
This series adds pdata-quirk mechanism to reset PCIe as a temporary
fix till reset controller driver is added in mainline.
Without this series, a stall is observed if pci dra7xx driver
is enabled.
Kishon Vijay Abraham I (3):
ARM: DRA7: hwmod: Add reset data for PCIe
HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe
HACK: pci: dra7xx: use pdata callbacks to perform reset
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 15 ++++++++++++++
arch/arm/mach-omap2/pdata-quirks.c | 11 ++++++++++
arch/arm/mach-omap2/prm7xx.h | 1 +
drivers/pci/host/pci-dra7xx.c | 32 +++++++++++++++++++++++++++++
include/linux/platform_data/pci-dra7xx.h | 22 ++++++++++++++++++++
5 files changed, 81 insertions(+)
create mode 100644 include/linux/platform_data/pci-dra7xx.h
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
2016-01-10 15:41 [PATCH 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
@ 2016-01-10 15:41 ` Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 2/3] HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-10 15:41 UTC (permalink / raw)
To: linux-arm-kernel
Add PCIe reset data to PCIe hwmods on DRA7x.
Reviewed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 15 +++++++++++++++
arch/arm/mach-omap2/prm7xx.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index ee4e044..1281deb 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1532,14 +1532,21 @@ static struct omap_hwmod_class dra7xx_pciess_hwmod_class = {
};
/* pcie1 */
+static struct omap_hwmod_rst_info dra7xx_pciess1_resets[] = {
+ { .name = "pcie", .rst_shift = 0 },
+};
+
static struct omap_hwmod dra7xx_pciess1_hwmod = {
.name = "pcie1",
.class = &dra7xx_pciess_hwmod_class,
.clkdm_name = "pcie_clkdm",
+ .rst_lines = dra7xx_pciess1_resets,
+ .rst_lines_cnt = ARRAY_SIZE(dra7xx_pciess1_resets),
.main_clk = "l4_root_clk_div",
.prcm = {
.omap4 = {
.clkctrl_offs = DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET,
+ .rstctrl_offs = DRA7XX_RM_L3INIT_PCIESS_RSTCTRL_OFFSET,
.context_offs = DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
@@ -1547,14 +1554,22 @@ static struct omap_hwmod dra7xx_pciess1_hwmod = {
};
/* pcie2 */
+static struct omap_hwmod_rst_info dra7xx_pciess2_resets[] = {
+ { .name = "pcie", .rst_shift = 1 },
+};
+
+/* pcie2 */
static struct omap_hwmod dra7xx_pciess2_hwmod = {
.name = "pcie2",
.class = &dra7xx_pciess_hwmod_class,
.clkdm_name = "pcie_clkdm",
+ .rst_lines = dra7xx_pciess2_resets,
+ .rst_lines_cnt = ARRAY_SIZE(dra7xx_pciess2_resets),
.main_clk = "l4_root_clk_div",
.prcm = {
.omap4 = {
.clkctrl_offs = DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET,
+ .rstctrl_offs = DRA7XX_RM_L3INIT_PCIESS_RSTCTRL_OFFSET,
.context_offs = DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET,
.modulemode = MODULEMODE_SWCTRL,
},
diff --git a/arch/arm/mach-omap2/prm7xx.h b/arch/arm/mach-omap2/prm7xx.h
index cc1e6a2..294deed 100644
--- a/arch/arm/mach-omap2/prm7xx.h
+++ b/arch/arm/mach-omap2/prm7xx.h
@@ -360,6 +360,7 @@
/* PRM.L3INIT_PRM register offsets */
#define DRA7XX_PM_L3INIT_PWRSTCTRL_OFFSET 0x0000
#define DRA7XX_PM_L3INIT_PWRSTST_OFFSET 0x0004
+#define DRA7XX_RM_L3INIT_PCIESS_RSTCTRL_OFFSET 0x0010
#define DRA7XX_PM_L3INIT_MMC1_WKDEP_OFFSET 0x0028
#define DRA7XX_RM_L3INIT_MMC1_CONTEXT_OFFSET 0x002c
#define DRA7XX_PM_L3INIT_MMC2_WKDEP_OFFSET 0x0030
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe
2016-01-10 15:41 [PATCH 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
@ 2016-01-10 15:41 ` Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 3/3] HACK: pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
2016-01-11 17:12 ` [PATCH 0/3] dra7xx: get pcie working in mainline Suman Anna
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-10 15:41 UTC (permalink / raw)
To: linux-arm-kernel
Use pdata-quirks to reset PCIe IP. This is to be used until
a drivers/reset/ interface is available for this purpose.
Reviewed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
arch/arm/mach-omap2/pdata-quirks.c | 11 +++++++++++
include/linux/platform_data/pci-dra7xx.h | 22 ++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 include/linux/platform_data/pci-dra7xx.h
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 5814477..f5a65fe 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -23,6 +23,7 @@
#include <linux/platform_data/pinctrl-single.h>
#include <linux/platform_data/iommu-omap.h>
#include <linux/platform_data/wkup_m3.h>
+#include <linux/platform_data/pci-dra7xx.h>
#include "common.h"
#include "common-board-devices.h"
@@ -404,6 +405,14 @@ static void __init omap5_uevm_legacy_init(void)
}
#endif
+#ifdef CONFIG_SOC_DRA7XX
+static struct pci_dra7xx_platform_data dra7xx_pci_pdata = {
+ .reset_name = "pcie",
+ .assert_reset = omap_device_assert_hardreset,
+ .deassert_reset = omap_device_deassert_hardreset,
+};
+#endif
+
static struct pcs_pdata pcs_pdata;
void omap_pcs_legacy_init(int irq, void (*rearm)(void))
@@ -474,6 +483,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
#endif
#ifdef CONFIG_SOC_DRA7XX
OF_DEV_AUXDATA("ti,dra7-padconf", 0x4a003400, "4a003400.pinmux", &pcs_pdata),
+ OF_DEV_AUXDATA("ti,dra7-pcie", 0x51000000, "51000000.pcie", &dra7xx_pci_pdata),
+ OF_DEV_AUXDATA("ti,dra7-pcie", 0x51800000, "51800000.pcie", &dra7xx_pci_pdata),
#endif
#ifdef CONFIG_SOC_AM43XX
OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata),
diff --git a/include/linux/platform_data/pci-dra7xx.h b/include/linux/platform_data/pci-dra7xx.h
new file mode 100644
index 0000000..792c8ed
--- /dev/null
+++ b/include/linux/platform_data/pci-dra7xx.h
@@ -0,0 +1,22 @@
+/*
+ * pcie-dra7xx - Platform data for PCIe controller
+ *
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef __PCI_DRA7XX_H
+#define __PCI_DRA7XX_H
+
+struct pci_dra7xx_platform_data {
+ const char *reset_name;
+
+ int (*assert_reset)(struct platform_device *pdev, const char *name);
+ int (*deassert_reset)(struct platform_device *pdev, const char *name);
+};
+#endif /* __PCI_DRA7XX_H */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] HACK: pci: dra7xx: use pdata callbacks to perform reset
2016-01-10 15:41 [PATCH 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 2/3] HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
@ 2016-01-10 15:41 ` Kishon Vijay Abraham I
2016-01-11 17:12 ` [PATCH 0/3] dra7xx: get pcie working in mainline Suman Anna
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-10 15:41 UTC (permalink / raw)
To: linux-arm-kernel
Use platform populated reset assert and deassert
callbacks to perform reset of PCIe.
Use these callbacks until a reset interface using drivers/reset
is available for the purpose.
Reviewed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
drivers/pci/host/pci-dra7xx.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c
index 8c36880..049083d 100644
--- a/drivers/pci/host/pci-dra7xx.c
+++ b/drivers/pci/host/pci-dra7xx.c
@@ -25,6 +25,8 @@
#include <linux/resource.h>
#include <linux/types.h>
+#include <linux/platform_data/pci-dra7xx.h>
+
#include "pcie-designware.h"
/* PCIe controller wrapper DRA7XX configuration registers */
@@ -329,6 +331,32 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
return 0;
}
+static int dra7xx_pcie_reset(struct platform_device *pdev)
+{
+ int ret;
+ struct device *dev = &pdev->dev;
+ struct pci_dra7xx_platform_data *pdata = pdev->dev.platform_data;
+
+ if (!(pdata && pdata->deassert_reset && pdata->assert_reset)) {
+ dev_err(dev, "platform data for reset not found!\n");
+ return -EINVAL;
+ }
+
+ ret = pdata->assert_reset(pdev, pdata->reset_name);
+ if (ret) {
+ dev_err(dev, "assert_reset failed: %d\n", ret);
+ return ret;
+ }
+
+ ret = pdata->deassert_reset(pdev, pdata->reset_name);
+ if (ret) {
+ dev_err(dev, "deassert_reset failed: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
static int __init dra7xx_pcie_probe(struct platform_device *pdev)
{
u32 reg;
@@ -347,6 +375,10 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
enum of_gpio_flags flags;
unsigned long gpio_flags;
+ ret = dra7xx_pcie_reset(pdev);
+ if (ret)
+ return ret;
+
dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL);
if (!dra7xx)
return -ENOMEM;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 0/3] dra7xx: get pcie working in mainline
2016-01-10 15:41 [PATCH 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
` (2 preceding siblings ...)
2016-01-10 15:41 ` [PATCH 3/3] HACK: pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
@ 2016-01-11 17:12 ` Suman Anna
3 siblings, 0 replies; 5+ messages in thread
From: Suman Anna @ 2016-01-11 17:12 UTC (permalink / raw)
To: linux-arm-kernel
Hi Kishon,
On 01/10/2016 09:41 AM, Kishon Vijay Abraham I wrote:
> This series adds pdata-quirk mechanism to reset PCIe as a temporary
> fix till reset controller driver is added in mainline.
>
> Without this series, a stall is observed if pci dra7xx driver
> is enabled.
>
> Kishon Vijay Abraham I (3):
> ARM: DRA7: hwmod: Add reset data for PCIe
> HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe
> HACK: pci: dra7xx: use pdata callbacks to perform reset
Please drop the HACK: tag from the commit headers, that was an internal
convention/choice made by Sekhar, and we had our differences there as it
is. On the same note, my internal Reviewed-by also mean nothing as they
were done against a different kernel.
regards
Suman
>
> arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 15 ++++++++++++++
> arch/arm/mach-omap2/pdata-quirks.c | 11 ++++++++++
> arch/arm/mach-omap2/prm7xx.h | 1 +
> drivers/pci/host/pci-dra7xx.c | 32 +++++++++++++++++++++++++++++
> include/linux/platform_data/pci-dra7xx.h | 22 ++++++++++++++++++++
> 5 files changed, 81 insertions(+)
> create mode 100644 include/linux/platform_data/pci-dra7xx.h
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-01-11 17:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-10 15:41 [PATCH 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 2/3] HACK: ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
2016-01-10 15:41 ` [PATCH 3/3] HACK: pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
2016-01-11 17:12 ` [PATCH 0/3] dra7xx: get pcie working in mainline Suman Anna
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).