linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] dra7xx: get pcie working in mainline
@ 2016-01-13  6:47 Kishon Vijay Abraham I
  2016-01-13  6:47 ` [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-13  6:47 UTC (permalink / raw)
  To: Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, Suman Anna, linux-omap, linux-arm-kernel,
	linux-kernel, kishon, nsekhar

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.

Changes from v1:
*) Removed 'HACK' from $subject
*) removed reviewed-by Suman

Kishon Vijay Abraham I (3):
  ARM: DRA7: hwmod: Add reset data for PCIe
  ARM: DRA7: add pdata-quirks to do reset of PCIe
  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] 11+ messages in thread

* [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
  2016-01-13  6:47 [PATCH v2 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
@ 2016-01-13  6:47 ` Kishon Vijay Abraham I
  2016-01-13 17:13   ` Tony Lindgren
  2016-01-13  6:47 ` [PATCH v2 2/3] ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
  2016-01-13  6:47 ` [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
  2 siblings, 1 reply; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-13  6:47 UTC (permalink / raw)
  To: Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, Suman Anna, linux-omap, linux-arm-kernel,
	linux-kernel, kishon, nsekhar

Add PCIe reset data to PCIe hwmods on DRA7x.

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] 11+ messages in thread

* [PATCH v2 2/3] ARM: DRA7: add pdata-quirks to do reset of PCIe
  2016-01-13  6:47 [PATCH v2 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
  2016-01-13  6:47 ` [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
@ 2016-01-13  6:47 ` Kishon Vijay Abraham I
  2016-01-13 17:35   ` Suman Anna
  2016-01-13  6:47 ` [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
  2 siblings, 1 reply; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-13  6:47 UTC (permalink / raw)
  To: Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, Suman Anna, linux-omap, linux-arm-kernel,
	linux-kernel, kishon, nsekhar

Use pdata-quirks to reset PCIe IP. This is to be used until
a drivers/reset/ interface is available for this purpose.

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] 11+ messages in thread

* [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
  2016-01-13  6:47 [PATCH v2 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
  2016-01-13  6:47 ` [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
  2016-01-13  6:47 ` [PATCH v2 2/3] ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
@ 2016-01-13  6:47 ` Kishon Vijay Abraham I
  2016-01-13 17:19   ` Tony Lindgren
  2016-01-13 17:51   ` Suman Anna
  2 siblings, 2 replies; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-13  6:47 UTC (permalink / raw)
  To: Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, Suman Anna, linux-omap, linux-arm-kernel,
	linux-kernel, kishon, nsekhar

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.

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] 11+ messages in thread

* Re: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
  2016-01-13  6:47 ` [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
@ 2016-01-13 17:13   ` Tony Lindgren
  2016-01-13 17:46     ` Suman Anna
  0 siblings, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2016-01-13 17:13 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Bjorn Helgaas, richardcochran, Russell King, Suman Anna,
	linux-omap, linux-arm-kernel, linux-kernel, nsekhar,
	Paul Walmsley, Tero Kristo

* Kishon Vijay Abraham I <kishon@ti.com> [160112 22:48]:
> Add PCIe reset data to PCIe hwmods on DRA7x.

Adding Paul and Tero to Cc. I don't see other solution to get
the PCI driver working until the reset driver is available.

Regards,

Tony



> 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	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
  2016-01-13  6:47 ` [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
@ 2016-01-13 17:19   ` Tony Lindgren
  2016-01-13 17:51   ` Suman Anna
  1 sibling, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2016-01-13 17:19 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Bjorn Helgaas, richardcochran, Russell King, Suman Anna,
	linux-omap, linux-arm-kernel, linux-kernel, nsekhar

* Kishon Vijay Abraham I <kishon@ti.com> [160112 22:48]:
> 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.

This one has a dependency to the second patch for the platform
data.

Bjorn, how do you prefer to merge this once there are no more
comments?

How about I set up an immutable branch against v4.5-rc1 with
just these three patches that we can both then merge in?

My preference is to add this to linux next after the merge
window for v4.6. Bjorn, if you want it merged as fixes, I'm
fine with that too naturally.

Regards,

Tony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/3] ARM: DRA7: add pdata-quirks to do reset of PCIe
  2016-01-13  6:47 ` [PATCH v2 2/3] ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
@ 2016-01-13 17:35   ` Suman Anna
  0 siblings, 0 replies; 11+ messages in thread
From: Suman Anna @ 2016-01-13 17:35 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, linux-omap, linux-arm-kernel, linux-kernel, nsekhar

Hi Kishon,

On 01/13/2016 12:47 AM, Kishon Vijay Abraham I wrote:
> Use pdata-quirks to reset PCIe IP. 

This can do with some clarity. The patch adds the platform data, doesn't
do reset.

This is to be used until
> a drivers/reset/ interface is available for this purpose.
> 
> 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 {

can you add kernel-doc comments for the structure?

> +	const char *reset_name;
> +
> +	int (*assert_reset)(struct platform_device *pdev, const char *name);
> +	int (*deassert_reset)(struct platform_device *pdev, const char *name);
> +};

nit, would like to see a blank line here

regards
Suman

> +#endif /* __PCI_DRA7XX_H */
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
  2016-01-13 17:13   ` Tony Lindgren
@ 2016-01-13 17:46     ` Suman Anna
  0 siblings, 0 replies; 11+ messages in thread
From: Suman Anna @ 2016-01-13 17:46 UTC (permalink / raw)
  To: Tony Lindgren, Kishon Vijay Abraham I
  Cc: Bjorn Helgaas, richardcochran, Russell King, linux-omap,
	linux-arm-kernel, linux-kernel, nsekhar, Paul Walmsley,
	Tero Kristo

On 01/13/2016 11:13 AM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon@ti.com> [160112 22:48]:
>> Add PCIe reset data to PCIe hwmods on DRA7x.
> 
> Adding Paul and Tero to Cc. I don't see other solution to get
> the PCI driver working until the reset driver is available.
> 
> Regards,
> 
> Tony
> 
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Reviewed-by: Suman Anna <s-anna@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	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
  2016-01-13  6:47 ` [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
  2016-01-13 17:19   ` Tony Lindgren
@ 2016-01-13 17:51   ` Suman Anna
  2016-01-14  8:37     ` Kishon Vijay Abraham I
  1 sibling, 1 reply; 11+ messages in thread
From: Suman Anna @ 2016-01-13 17:51 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, linux-omap, linux-arm-kernel, linux-kernel, nsekhar

On 01/13/2016 12:47 AM, Kishon Vijay Abraham I wrote:
> 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.
> 
> 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;
> +	}

The only comment I have on this is the symmetry (assert_reset invocation
in driver remove). If you install and remove the module once, then the
reset stays deasserted. On Power-On-Reset, the resets by default will be
in asserted state.

regards
SUman

> +
> +	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;
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
  2016-01-13 17:51   ` Suman Anna
@ 2016-01-14  8:37     ` Kishon Vijay Abraham I
  2016-01-14 13:28       ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-14  8:37 UTC (permalink / raw)
  To: Suman Anna, Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, linux-omap, linux-arm-kernel, linux-kernel, nsekhar

Hi Suman,

On Wednesday 13 January 2016 11:21 PM, Suman Anna wrote:
> On 01/13/2016 12:47 AM, Kishon Vijay Abraham I wrote:
>> 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.
>>
>> 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;
>> +	}
> 
> The only comment I have on this is the symmetry (assert_reset invocation
> in driver remove). If you install and remove the module once, then the
> reset stays deasserted. On Power-On-Reset, the resets by default will be
> in asserted state.

hmm.. not sure of the benefits of leaving the reset lines de-asserted during
remove. The idea is irrespective of the initial sate or power-on state, during
probe the driver should assert and de-assert the reset lines.

Thanks
Kishon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
  2016-01-14  8:37     ` Kishon Vijay Abraham I
@ 2016-01-14 13:28       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2016-01-14 13:28 UTC (permalink / raw)
  To: Suman Anna, Tony Lindgren, Bjorn Helgaas, richardcochran
  Cc: Russell King, linux-omap, linux-arm-kernel, linux-kernel, nsekhar

Hi,

On Thursday 14 January 2016 02:07 PM, Kishon Vijay Abraham I wrote:
> Hi Suman,
> 
> On Wednesday 13 January 2016 11:21 PM, Suman Anna wrote:
>> On 01/13/2016 12:47 AM, Kishon Vijay Abraham I wrote:
>>> 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.
>>>
>>> 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;
>>> +	}
>>
>> The only comment I have on this is the symmetry (assert_reset invocation
>> in driver remove). If you install and remove the module once, then the
>> reset stays deasserted. On Power-On-Reset, the resets by default will be
>> in asserted state.
> 
> hmm.. not sure of the benefits of leaving the reset lines de-asserted during
> remove. The idea is irrespective of the initial sate or power-on state, during
> probe the driver should assert and de-assert the reset lines.

Also right now the pci-dra7xx can't be inserted as a module. However since that
might be added in the future, I'll add assert_reset in the remove path of this
driver.

Thanks
Kishon

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-01-14 13:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13  6:47 [PATCH v2 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I
2016-01-13  6:47 ` [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I
2016-01-13 17:13   ` Tony Lindgren
2016-01-13 17:46     ` Suman Anna
2016-01-13  6:47 ` [PATCH v2 2/3] ARM: DRA7: add pdata-quirks to do reset of PCIe Kishon Vijay Abraham I
2016-01-13 17:35   ` Suman Anna
2016-01-13  6:47 ` [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I
2016-01-13 17:19   ` Tony Lindgren
2016-01-13 17:51   ` Suman Anna
2016-01-14  8:37     ` Kishon Vijay Abraham I
2016-01-14 13:28       ` 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).