Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1308087 > unrolled thread

[PATCH v2 0/3] dra7xx: get pcie working in mainline

Started byKishon Vijay Abraham I <kishon@ti.com>
First post2016-01-13 07:50 +0100
Last post2016-01-14 14:30 +0100
Articles 9 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/3] dra7xx: get pcie working in mainline Kishon Vijay Abraham I <kishon@ti.com> - 2016-01-13 07:50 +0100
    [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Kishon Vijay Abraham I <kishon@ti.com> - 2016-01-13 07:50 +0100
      Re: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Tony Lindgren <tony@atomide.com> - 2016-01-13 18:20 +0100
        Re: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe Suman Anna <s-anna@ti.com> - 2016-01-13 18:50 +0100
    [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I <kishon@ti.com> - 2016-01-13 07:50 +0100
      Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Tony Lindgren <tony@atomide.com> - 2016-01-13 18:20 +0100
      Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Suman Anna <s-anna@ti.com> - 2016-01-13 19:00 +0100
        Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I <kishon@ti.com> - 2016-01-14 09:40 +0100
          Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Kishon Vijay Abraham I <kishon@ti.com> - 2016-01-14 14:30 +0100

#1308087 — [PATCH v2 0/3] dra7xx: get pcie working in mainline

FromKishon Vijay Abraham I <kishon@ti.com>
Date2016-01-13 07:50 +0100
Subject[PATCH v2 0/3] dra7xx: get pcie working in mainline
Message-ID<qQnpL-4eY-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1308088 — [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe

FromKishon Vijay Abraham I <kishon@ti.com>
Date2016-01-13 07:50 +0100
Subject[PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
Message-ID<qQnpL-4eY-9@gated-at.bofh.it>
In reply to#1308087
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

[toc] | [prev] | [next] | [standalone]


#1308646 — Re: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe

FromTony Lindgren <tony@atomide.com>
Date2016-01-13 18:20 +0100
SubjectRe: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
Message-ID<qQxft-2SP-21@gated-at.bofh.it>
In reply to#1308088
* 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
> 

[toc] | [prev] | [next] | [standalone]


#1308683 — Re: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe

FromSuman Anna <s-anna@ti.com>
Date2016-01-13 18:50 +0100
SubjectRe: [PATCH v2 1/3] ARM: DRA7: hwmod: Add reset data for PCIe
Message-ID<qQxIv-34w-13@gated-at.bofh.it>
In reply to#1308646
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
>>

[toc] | [prev] | [next] | [standalone]


#1308090 — [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset

FromKishon Vijay Abraham I <kishon@ti.com>
Date2016-01-13 07:50 +0100
Subject[PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
Message-ID<qQnpL-4eY-11@gated-at.bofh.it>
In reply to#1308087
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

[toc] | [prev] | [next] | [standalone]


#1308649 — Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset

FromTony Lindgren <tony@atomide.com>
Date2016-01-13 18:20 +0100
SubjectRe: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
Message-ID<qQxfu-2SP-27@gated-at.bofh.it>
In reply to#1308090
* 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

[toc] | [prev] | [next] | [standalone]


#1308689 — Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset

FromSuman Anna <s-anna@ti.com>
Date2016-01-13 19:00 +0100
SubjectRe: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
Message-ID<qQxSa-37P-17@gated-at.bofh.it>
In reply to#1308090
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;
> 

[toc] | [prev] | [next] | [standalone]


#1309076 — Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset

FromKishon Vijay Abraham I <kishon@ti.com>
Date2016-01-14 09:40 +0100
SubjectRe: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
Message-ID<qQLBM-4uu-11@gated-at.bofh.it>
In reply to#1308689
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

[toc] | [prev] | [next] | [standalone]


#1309284 — Re: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset

FromKishon Vijay Abraham I <kishon@ti.com>
Date2016-01-14 14:30 +0100
SubjectRe: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset
Message-ID<qQQ8q-7DE-9@gated-at.bofh.it>
In reply to#1309076
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web