Re: [PATCH] PCI: designware: bail out if host_init failed

2015-12-07 Thread Jisheng Zhang
Dear Bjorn,

On Wed, 25 Nov 2015 14:01:03 -0600
Bjorn Helgaas wrote:

> Hi Jisheng,
> 
> On Thu, Nov 12, 2015 at 09:48:45PM +0800, Jisheng Zhang wrote:
> > There's no reason to continue the initialization such as configure
> > register, scan root bus etc. if customized host_init() failed. This
> > patch tries to check the host_init result, bail out if failed.  
> 
> This patch changes the (*host_init) return type and adds "return 0" to
> the host_init() implementations of ten different drivers, all to
> support a possible error in one driver.
> 
> Is there any way to detect and handle the error in
> ls1021_pcie_host_init() earlier, maybe by doing the syscon_regmap
> lookup in ls_pcie_probe() instead of in the host_init() function?
> 
> That would be even better because you wouldn't have to touch any of
> the other drivers, and you'd detect the error even earlier, before
> we've done any of the designware setup.

Sorry for being late. Got your point. The reason I made this patch is that:
I want to clk gate the pcie host to save power if the customized host_init()
report link training failure etc. For example: there's no pcie device in the
slot at all. But today, I have a different idea: the PCIE support hotplug,
so link training failure doesn't mean we should bail out, in fact we should
continue the initialization as current code does. So I think Jingoo made the
correct decision when implement the pcie designware interface. I want to drop
this patch.

Only one problem need your suggestions: how to save power when there's no device
, I.E clk gate the host, shutdown the pcie phy etc.

Any suggestions are appreciated!

Thanks in advance,
Jisheng


> 
> Bjorn
> 
> > Signed-off-by: Jisheng Zhang <jszh...@marvell.com>
> > ---
> >  drivers/pci/host/pci-dra7xx.c  |  4 +++-
> >  drivers/pci/host/pci-exynos.c  |  4 +++-
> >  drivers/pci/host/pci-imx6.c|  4 +++-
> >  drivers/pci/host/pci-keystone.c|  4 +++-
> >  drivers/pci/host/pci-layerscape.c  | 25 -
> >  drivers/pci/host/pcie-designware.c |  7 +--
> >  drivers/pci/host/pcie-designware.h |  2 +-
> >  drivers/pci/host/pcie-spear13xx.c  |  4 +++-
> >  8 files changed, 37 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c
> > index 8c36880..b3160a1 100644
> > --- a/drivers/pci/host/pci-dra7xx.c
> > +++ b/drivers/pci/host/pci-dra7xx.c
> > @@ -149,7 +149,7 @@ static void dra7xx_pcie_enable_interrupts(struct 
> > pcie_port *pp)
> >LEG_EP_INTERRUPTS);
> >  }
> >  
> > -static void dra7xx_pcie_host_init(struct pcie_port *pp)
> > +static int dra7xx_pcie_host_init(struct pcie_port *pp)
> >  {
> > dw_pcie_setup_rc(pp);
> >  
> > @@ -162,6 +162,8 @@ static void dra7xx_pcie_host_init(struct pcie_port *pp)
> > if (IS_ENABLED(CONFIG_PCI_MSI))
> > dw_pcie_msi_init(pp);
> > dra7xx_pcie_enable_interrupts(pp);
> > +
> > +   return 0;
> >  }
> >  
> >  static struct pcie_host_ops dra7xx_pcie_host_ops = {
> > diff --git a/drivers/pci/host/pci-exynos.c b/drivers/pci/host/pci-exynos.c
> > index 01095e1..57f370b 100644
> > --- a/drivers/pci/host/pci-exynos.c
> > +++ b/drivers/pci/host/pci-exynos.c
> > @@ -481,10 +481,12 @@ static int exynos_pcie_link_up(struct pcie_port *pp)
> > return 0;
> >  }
> >  
> > -static void exynos_pcie_host_init(struct pcie_port *pp)
> > +static int exynos_pcie_host_init(struct pcie_port *pp)
> >  {
> > exynos_pcie_establish_link(pp);
> > exynos_pcie_enable_interrupts(pp);
> > +
> > +   return 0;
> >  }
> >  
> >  static struct pcie_host_ops exynos_pcie_host_ops = {
> > diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> > index 22e8224..9a46680 100644
> > --- a/drivers/pci/host/pci-imx6.c
> > +++ b/drivers/pci/host/pci-imx6.c
> > @@ -425,7 +425,7 @@ static int imx6_pcie_establish_link(struct pcie_port 
> > *pp)
> > return 0;
> >  }
> >  
> > -static void imx6_pcie_host_init(struct pcie_port *pp)
> > +static int imx6_pcie_host_init(struct pcie_port *pp)
> >  {
> > imx6_pcie_assert_core_reset(pp);
> >  
> > @@ -439,6 +439,8 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
> >  
> > if (IS_ENABLED(CONFIG_PCI_MSI))
> > dw_pcie_msi_init(pp);
> > +
> > +   return 0;
> >  }
> >  
> >  static void imx6_pcie_reset_phy(struct pcie_port *pp)
> > diff --git a/drivers/pci/host/pci-keystone.c 
> >

Re: PCIe regression with DRA7xx in 4.4-rc1

2015-11-24 Thread Jisheng Zhang


On Tue, 24 Nov 2015 17:31:07 +0530
Kishon Vijay Abraham I wrote:

> Hi,
> 
> I'm seeing a regression with ("PCI:
> designware: Make driver arch-agnostic").
> 
> Logs using a SATA PCIe card [1]. The PCIe card enumerates fine but after that 
> I
> observe "ata3.00: qc timeout (cmd 0xec), ata3.00: failed to IDENTIFY (I/O
> error, err_mask=0x4)"
> 
> Logs using a Ethenet PCIe card [2]. Again here the PCIe card enumerates fine
> but when I give ifconfig up, it fails.
> 
> If I just revert commit , the PCIe
> cards starts to work fine again

FYI, maybe the patch can fix the regression.
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-November/387362.html

> 
> Logs using a SATA PCIe card [3]. Here the KINGSTON SSD gets detected fine.
> Logs using a Ethernet PCIe card [4]. I'm able to do ping tests now.
> 
> Actually I'm not able to find any obvious problems with the patch and the irq
> number and the memory resource also looks fine. Any idea what could be the 
> problem?
> 
> [1] -> http://pastebin.ubuntu.com/13491456/
> [2] -> http://pastebin.ubuntu.com/13491526/
> 
> [3] -> http://pastebin.ubuntu.com/13491658/
> [4] -> http://pastebin.ubuntu.com/13491593/
> 
> Thanks
> Kishon
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND] ARM: OMAP2+: PM: Denote the cpuidle tracepoints as _rcuidle()

2015-11-16 Thread Jisheng Zhang
The cpuidle tracepoints are called within a rcu_idle_exit() section, and
must be denoted with the _rcuidle() version of the tracepoint.

Signed-off-by: Jisheng Zhang <jszh...@marvell.com>
Acked-by: Kevin Hilman <khil...@linaro.org>
---
 arch/arm/mach-omap2/pm34xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 87b98bf9..2dbd378 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -301,11 +301,11 @@ static void omap3_pm_idle(void)
if (omap_irq_pending())
return;
 
-   trace_cpu_idle(1, smp_processor_id());
+   trace_cpu_idle_rcuidle(1, smp_processor_id());
 
omap_sram_idle();
 
-   trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+   trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_SUSPEND
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] PCI: designware: bail out if host_init failed

2015-11-12 Thread Jisheng Zhang
There's no reason to continue the initialization such as configure
register, scan root bus etc. if customized host_init() failed. This
patch tries to check the host_init result, bail out if failed.

Signed-off-by: Jisheng Zhang <jszh...@marvell.com>
---
 drivers/pci/host/pci-dra7xx.c  |  4 +++-
 drivers/pci/host/pci-exynos.c  |  4 +++-
 drivers/pci/host/pci-imx6.c|  4 +++-
 drivers/pci/host/pci-keystone.c|  4 +++-
 drivers/pci/host/pci-layerscape.c  | 25 -
 drivers/pci/host/pcie-designware.c |  7 +--
 drivers/pci/host/pcie-designware.h |  2 +-
 drivers/pci/host/pcie-spear13xx.c  |  4 +++-
 8 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c
index 8c36880..b3160a1 100644
--- a/drivers/pci/host/pci-dra7xx.c
+++ b/drivers/pci/host/pci-dra7xx.c
@@ -149,7 +149,7 @@ static void dra7xx_pcie_enable_interrupts(struct pcie_port 
*pp)
   LEG_EP_INTERRUPTS);
 }
 
-static void dra7xx_pcie_host_init(struct pcie_port *pp)
+static int dra7xx_pcie_host_init(struct pcie_port *pp)
 {
dw_pcie_setup_rc(pp);
 
@@ -162,6 +162,8 @@ static void dra7xx_pcie_host_init(struct pcie_port *pp)
if (IS_ENABLED(CONFIG_PCI_MSI))
dw_pcie_msi_init(pp);
dra7xx_pcie_enable_interrupts(pp);
+
+   return 0;
 }
 
 static struct pcie_host_ops dra7xx_pcie_host_ops = {
diff --git a/drivers/pci/host/pci-exynos.c b/drivers/pci/host/pci-exynos.c
index 01095e1..57f370b 100644
--- a/drivers/pci/host/pci-exynos.c
+++ b/drivers/pci/host/pci-exynos.c
@@ -481,10 +481,12 @@ static int exynos_pcie_link_up(struct pcie_port *pp)
return 0;
 }
 
-static void exynos_pcie_host_init(struct pcie_port *pp)
+static int exynos_pcie_host_init(struct pcie_port *pp)
 {
exynos_pcie_establish_link(pp);
exynos_pcie_enable_interrupts(pp);
+
+   return 0;
 }
 
 static struct pcie_host_ops exynos_pcie_host_ops = {
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 22e8224..9a46680 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -425,7 +425,7 @@ static int imx6_pcie_establish_link(struct pcie_port *pp)
return 0;
 }
 
-static void imx6_pcie_host_init(struct pcie_port *pp)
+static int imx6_pcie_host_init(struct pcie_port *pp)
 {
imx6_pcie_assert_core_reset(pp);
 
@@ -439,6 +439,8 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
 
if (IS_ENABLED(CONFIG_PCI_MSI))
dw_pcie_msi_init(pp);
+
+   return 0;
 }
 
 static void imx6_pcie_reset_phy(struct pcie_port *pp)
diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 0aa81bd..2604571 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -250,7 +250,7 @@ static int keystone_pcie_fault(unsigned long addr, unsigned 
int fsr,
return 0;
 }
 
-static void __init ks_pcie_host_init(struct pcie_port *pp)
+static int __init ks_pcie_host_init(struct pcie_port *pp)
 {
struct keystone_pcie *ks_pcie = to_keystone_pcie(pp);
u32 val;
@@ -277,6 +277,8 @@ static void __init ks_pcie_host_init(struct pcie_port *pp)
 */
hook_fault_code(17, keystone_pcie_fault, SIGBUS, 0,
"Asynchronous external abort");
+
+   return 0;
 }
 
 static struct pcie_host_ops keystone_pcie_host_ops = {
diff --git a/drivers/pci/host/pci-layerscape.c 
b/drivers/pci/host/pci-layerscape.c
index 3923bed..a6e9070 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -94,8 +94,9 @@ static int ls1021_pcie_link_up(struct pcie_port *pp)
return 1;
 }
 
-static void ls1021_pcie_host_init(struct pcie_port *pp)
+static int ls1021_pcie_host_init(struct pcie_port *pp)
 {
+   int ret;
struct ls_pcie *pcie = to_ls_pcie(pp);
u32 val, index[2];
 
@@ -103,15 +104,14 @@ static void ls1021_pcie_host_init(struct pcie_port *pp)
 "fsl,pcie-scfg");
if (IS_ERR(pcie->scfg)) {
dev_err(pp->dev, "No syscfg phandle specified\n");
-   pcie->scfg = NULL;
-   return;
+   ret = PTR_ERR(pcie->scfg);
+   goto err;
}
 
-   if (of_property_read_u32_array(pp->dev->of_node,
-  "fsl,pcie-scfg", index, 2)) {
-   pcie->scfg = NULL;
-   return;
-   }
+   ret = of_property_read_u32_array(pp->dev->of_node,
+"fsl,pcie-scfg", index, 2);
+   if (ret)
+   goto err;
pcie->index = index[1];
 
dw_pcie_setup_rc(pp);
@@ -123,6 +123,11 @@ static void ls1021_pcie_host_init(struct pcie_port *pp)
val = ioread32(pcie->dbi + PCIE_STRFMR1);
val &= 0xf

Re: [PATCH] ARM: OMAP2+: PM: Denote the cpuidle tracepoints as _rcuidle()

2015-09-23 Thread Jisheng Zhang
Dear Tony,

On Wed, 23 Sep 2015 11:08:15 -0700
Tony Lindgren <t...@atomide.com> wrote:

> * Kevin Hilman <khil...@kernel.org> [150923 11:03]:
> > Jisheng Zhang <jszh...@marvell.com> writes:
> > 
> > > The cpuidle tracepoints are called within a rcu_idle_exit() section, and
> > > must be denoted with the _rcuidle() version of the tracepoint.
> > >
> > > Signed-off-by: Jisheng Zhang <jszh...@marvell.com>
> >  
> > Acked-by: Kevin Hilman <khil...@linaro.org>
> 
> Hmm is this needed as a fix for the -rc cycle or can this wait
> for v4.4?

IMHO, this is a fix. But it can wait for v4.4 merge window.

Thanks,
Jisheng

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP2+: PM: Denote the cpuidle tracepoints as _rcuidle()

2015-09-17 Thread Jisheng Zhang
The cpuidle tracepoints are called within a rcu_idle_exit() section, and
must be denoted with the _rcuidle() version of the tracepoint.

Signed-off-by: Jisheng Zhang <jszh...@marvell.com>
---
 arch/arm/mach-omap2/pm34xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 87b98bf9..2dbd378 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -301,11 +301,11 @@ static void omap3_pm_idle(void)
if (omap_irq_pending())
return;
 
-   trace_cpu_idle(1, smp_processor_id());
+   trace_cpu_idle_rcuidle(1, smp_processor_id());
 
omap_sram_idle();
 
-   trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+   trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_SUSPEND
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] usb: dwc3: add DWC3_SKIP_USB3PHY and DWC3_SKIP_USB2_PHY quirks

2015-01-08 Thread Jisheng Zhang
Hi Felipe,

On Thu, 8 Jan 2015 09:08:15 -0800
Felipe Balbi ba...@ti.com wrote:

 Hi,
 
 On Mon, Dec 08, 2014 at 09:35:51PM +0800, Jisheng Zhang wrote:
  On platforms which has native usb hosts/phys and pci-dwc3 controller,
  the dwc3 core may get the wrong usb2_phy and usb3_phy by
  devm_usb_get_phy(). It depends on which usb phy driver is initialized
  firstly, the usb_phy_generic or the native/real usb phy driver.
 
 why are you initializing generic PHY if you have a real PHY ?

we have two kind of usb hosts: the native usb hosts which can be probed via. DT
and the usb hosts from pci-dwc3. The former has real phy and the latter doesn't.

 
  Before all old USB phy library usage removed, the solution I can have
  is to add DWC3_SKIP_USB3PHY and DWC3_SKIP_USB2_PHY quirks and set them
  in dwc3-pci.
  Could such modification can be accepted? If not, could you please give
  alternative suggestions?
 
 we will not accept a quirk to skip PHYs, sorry. A better way of handling
 this needs to be found.
 

OK, Got your points. It seems we need to deprecate old usb phy library usage
early.

Thanks,
Jisheng
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] usb: dwc3: add DWC3_SKIP_USB3PHY and DWC3_SKIP_USB2_PHY quirks

2014-12-08 Thread Jisheng Zhang
Hi list,

On platforms which has native usb hosts/phys and pci-dwc3 controller, the dwc3
core may get the wrong usb2_phy and usb3_phy by devm_usb_get_phy(). It depends
on which usb phy driver is initialized firstly, the usb_phy_generic or the
native/real usb phy driver.

Before all old USB phy library usage removed, the solution I can have is to
add DWC3_SKIP_USB3PHY and DWC3_SKIP_USB2_PHY quirks and set them in dwc3-pci.
Could such modification can be accepted? If not, could you please give 
alternative
suggestions?

Thanks,
Jisheng
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html