linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Various R-Car PCIe patches
@ 2015-12-17 13:22 Phil Edworthy
  2015-12-17 13:22 ` [PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar Phil Edworthy
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Phil Edworthy @ 2015-12-17 13:22 UTC (permalink / raw)
  To: Simon Horman, Bjorn Helgaas
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-kernel, linux-pci,
	linux-sh, Phil Edworthy

The first patch removes code that is no longer used. The next two allow us to
use runtim PM. The last patch is for PHY setup in order to get PCIe compliance
apparently. For that last patch, I've been told that this is what I must set.

Phil Edworthy (4):
  PCI: rcar: remove unused pci_sys_data structure in pcie-rcar
  PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  PCI: rcar: Add runtime PM support to pcie-rcar
  PCI: rcar: Add Gen2 PHY setup to pcie-rcar

 drivers/pci/host/pcie-rcar.c | 105 +++++++++++++++++++++++++++++++++----------
 1 file changed, 81 insertions(+), 24 deletions(-)

-- 
2.5.0


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

* [PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar
  2015-12-17 13:22 [PATCH 0/4] Various R-Car PCIe patches Phil Edworthy
@ 2015-12-17 13:22 ` Phil Edworthy
  2015-12-17 13:22 ` [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling " Phil Edworthy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Phil Edworthy @ 2015-12-17 13:22 UTC (permalink / raw)
  To: Simon Horman, Bjorn Helgaas
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-kernel, linux-pci,
	linux-sh, Phil Edworthy

Commit b3a72384fe29 ("ARM/PCI: Replace pci_sys_data->align_resource
with global function pointer") removed the struct pci_sys_data
dependency from the ARM pcibios functions, so remove it from this
driver.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 drivers/pci/host/pcie-rcar.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 5c29626..c72c0ae 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -124,16 +124,7 @@ static inline struct rcar_msi *to_rcar_msi(struct msi_controller *chip)
 }
 
 /* Structure representing the PCIe interface */
-/*
- * ARM pcibios functions expect the ARM struct pci_sys_data as the PCI
- * sysdata.  Add pci_sys_data as the first element in struct gen_pci so
- * that when we use a gen_pci pointer as sysdata, it is also a pointer to
- * a struct pci_sys_data.
- */
 struct rcar_pcie {
-#ifdef CONFIG_ARM
-	struct pci_sys_data	sys;
-#endif
 	struct device		*dev;
 	void __iomem		*base;
 	struct list_head	resources;
-- 
2.5.0


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

* [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-17 13:22 [PATCH 0/4] Various R-Car PCIe patches Phil Edworthy
  2015-12-17 13:22 ` [PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar Phil Edworthy
@ 2015-12-17 13:22 ` Phil Edworthy
  2015-12-17 13:30   ` Wolfram Sang
  2015-12-17 13:22 ` [PATCH 3/4] PCI: rcar: Add runtime PM support to pcie-rcar Phil Edworthy
  2015-12-17 13:22 ` [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup " Phil Edworthy
  3 siblings, 1 reply; 17+ messages in thread
From: Phil Edworthy @ 2015-12-17 13:22 UTC (permalink / raw)
  To: Simon Horman, Bjorn Helgaas
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-kernel, linux-pci,
	linux-sh, Phil Edworthy

The R-Car PCIe host controller does not handle L1 ASPM. Instead, the
hardware needs assistance to transition to L1. When the controller
has received a PM_ENTER_L1 DLLP, we can't access a card's config regs
until we have got it out of L1 link state. The host controller will
handle this as long as it has also been transitioned to L1 link state.

So, when attempting a config access, check to see if the card has gone
into L1, and if so, do the same for the host controller.

This is based on a patch by Hien Dang <hien.dang.eb@rvc.renesas.com>

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 drivers/pci/host/pcie-rcar.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index c72c0ae..4a4f8e1 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -83,6 +83,14 @@
 #define MACSR			0x011054
 #define MACCTLR			0x011058
 #define  SCRAMBLE_DISABLE	(1 << 27)
+#define PMSR			0x01105c
+#define  L1FAEG			(1 << 31)
+#define  PM_ENTER_L1RX		(1 << 23)
+#define  PMSTATE		(7 << 16)
+#define  PMSTATE_L1		(3 << 16)
+#define PMCTLR			0x011060
+#define  L1_INIT		(1 << 31)
+
 
 /* R-Car H1 PHY */
 #define H1_PCIEPHYADRR		0x04000c
@@ -175,6 +183,7 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
 		unsigned int devfn, int where, u32 *data)
 {
 	int dev, func, reg, index;
+	u32 val;
 
 	dev = PCI_SLOT(devfn);
 	func = PCI_FUNC(devfn);
@@ -216,6 +225,22 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
 	if (pcie->root_bus_nr < 0)
 		return PCIBIOS_DEVICE_NOT_FOUND;
 
+	/*
+	 * If we are not in L1 link state but have received PM_ENTER_L1 DLLP,
+	 * transition to L1 link state. The HW will handle coming out of L1.
+	 */
+	val = rcar_pci_read_reg(pcie, PMSR);
+	if ((val & PM_ENTER_L1RX) && ((val & PMSTATE) != PMSTATE_L1)) {
+		rcar_pci_write_reg(pcie, L1_INIT, PMCTLR);
+
+		/* Wait until we are in L1 */
+		while (!(val & L1FAEG))
+			val = rcar_pci_read_reg(pcie, PMSR);
+
+		/* Clear flags indicating link has transitioned to L1 */
+		rcar_pci_write_reg(pcie, L1FAEG | PM_ENTER_L1RX, PMSR);
+	}
+
 	/* Clear errors */
 	rcar_pci_write_reg(pcie, rcar_pci_read_reg(pcie, PCIEERRFR), PCIEERRFR);
 
-- 
2.5.0


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

* [PATCH 3/4] PCI: rcar: Add runtime PM support to pcie-rcar
  2015-12-17 13:22 [PATCH 0/4] Various R-Car PCIe patches Phil Edworthy
  2015-12-17 13:22 ` [PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar Phil Edworthy
  2015-12-17 13:22 ` [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling " Phil Edworthy
@ 2015-12-17 13:22 ` Phil Edworthy
  2015-12-17 13:22 ` [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup " Phil Edworthy
  3 siblings, 0 replies; 17+ messages in thread
From: Phil Edworthy @ 2015-12-17 13:22 UTC (permalink / raw)
  To: Simon Horman, Bjorn Helgaas
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-kernel, linux-pci,
	linux-sh, Phil Edworthy

If runtime PM is enabled in the kernel config, simply enable the
clocks once during probe.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 drivers/pci/host/pcie-rcar.c | 44 ++++++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 4a4f8e1..02a5993 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -26,6 +26,7 @@
 #include <linux/of_platform.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/slab.h>
 
 #define DRV_NAME "rcar-pcie"
@@ -1019,32 +1020,51 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 	 if (err)
 		return err;
 
-	if (IS_ENABLED(CONFIG_PCI_MSI)) {
-		err = rcar_pcie_enable_msi(pcie);
-		if (err < 0) {
-			dev_err(&pdev->dev,
-				"failed to enable MSI support: %d\n",
-				err);
-			return err;
-		}
-	}
-
 	of_id = of_match_device(rcar_pcie_of_match, pcie->dev);
 	if (!of_id || !of_id->data)
 		return -EINVAL;
 	hw_init_fn = of_id->data;
 
+	pm_runtime_enable(pcie->dev);
+	err = pm_runtime_get_sync(pcie->dev);
+	if (err < 0) {
+		dev_err(pcie->dev, "pm_runtime_get_sync failed\n");
+		goto err_pm_disable;
+	}
+
 	/* Failure to get a link might just be that no cards are inserted */
 	err = hw_init_fn(pcie);
 	if (err) {
 		dev_info(&pdev->dev, "PCIe link down\n");
-		return 0;
+		err = 0;
+		goto err_pm_put;
 	}
 
 	data = rcar_pci_read_reg(pcie, MACSR);
 	dev_info(&pdev->dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f);
 
-	return rcar_pcie_enable(pcie);
+	if (IS_ENABLED(CONFIG_PCI_MSI)) {
+		err = rcar_pcie_enable_msi(pcie);
+		if (err < 0) {
+			dev_err(&pdev->dev,
+				"failed to enable MSI support: %d\n",
+				err);
+			goto err_pm_put;
+		}
+	}
+
+	err = rcar_pcie_enable(pcie);
+	if (err)
+		goto err_pm_put;
+
+	return 0;
+
+err_pm_put:
+	pm_runtime_put(pcie->dev);
+
+err_pm_disable:
+	pm_runtime_disable(pcie->dev);
+	return err;
 }
 
 static struct platform_driver rcar_pcie_driver = {
-- 
2.5.0


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

* [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar
  2015-12-17 13:22 [PATCH 0/4] Various R-Car PCIe patches Phil Edworthy
                   ` (2 preceding siblings ...)
  2015-12-17 13:22 ` [PATCH 3/4] PCI: rcar: Add runtime PM support to pcie-rcar Phil Edworthy
@ 2015-12-17 13:22 ` Phil Edworthy
  2015-12-17 13:33   ` Wolfram Sang
  3 siblings, 1 reply; 17+ messages in thread
From: Phil Edworthy @ 2015-12-17 13:22 UTC (permalink / raw)
  To: Simon Horman, Bjorn Helgaas
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-kernel, linux-pci,
	linux-sh, Phil Edworthy

For PCIe compliance, the PHY registers need setting as per the
manual.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 drivers/pci/host/pcie-rcar.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 02a5993..61e112e 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -103,6 +103,11 @@
 #define H1_PCIEPHYDOUTR		0x040014
 #define H1_PCIEPHYSR		0x040018
 
+/* R-Car Gen2 PHY */
+#define GEN2_PCIEPHYADDR	0x780
+#define GEN2_PCIEPHYDATA	0x784
+#define GEN2_PCIEPHYCTRL	0x78c
+
 #define INT_PCI_MSI_NR	32
 
 #define RCONF(x)	(PCICONF(0)+(x))
@@ -593,6 +598,22 @@ static int rcar_pcie_hw_init_h1(struct rcar_pcie *pcie)
 	return -ETIMEDOUT;
 }
 
+static int rcar_pcie_hw_init_gen2(struct rcar_pcie *pcie)
+{
+	rcar_pci_write_reg(pcie, 0x000f0030, GEN2_PCIEPHYADDR);
+	rcar_pci_write_reg(pcie, 0x00381203, GEN2_PCIEPHYDATA);
+	rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
+	rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
+
+	rcar_pci_write_reg(pcie, 0x000f0054, GEN2_PCIEPHYADDR);
+	/* The following value is for DC connection, no termination resistor */
+	rcar_pci_write_reg(pcie, 0x13802007, GEN2_PCIEPHYDATA);
+	rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
+	rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
+
+	return rcar_pcie_hw_init(pcie);
+}
+
 static int rcar_msi_alloc(struct rcar_msi *chip)
 {
 	int msi;
@@ -932,9 +953,9 @@ static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie,
 
 static const struct of_device_id rcar_pcie_of_match[] = {
 	{ .compatible = "renesas,pcie-r8a7779", .data = rcar_pcie_hw_init_h1 },
-	{ .compatible = "renesas,pcie-rcar-gen2", .data = rcar_pcie_hw_init },
-	{ .compatible = "renesas,pcie-r8a7790", .data = rcar_pcie_hw_init },
-	{ .compatible = "renesas,pcie-r8a7791", .data = rcar_pcie_hw_init },
+	{ .compatible = "renesas,pcie-rcar-gen2", .data = rcar_pcie_hw_init_gen2 },
+	{ .compatible = "renesas,pcie-r8a7790", .data = rcar_pcie_hw_init_gen2 },
+	{ .compatible = "renesas,pcie-r8a7791", .data = rcar_pcie_hw_init_gen2 },
 	{ .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
 	{},
 };
-- 
2.5.0


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

* Re: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-17 13:22 ` [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling " Phil Edworthy
@ 2015-12-17 13:30   ` Wolfram Sang
  2015-12-17 13:41     ` Geert Uytterhoeven
  2015-12-18 13:42     ` Phil Edworthy
  0 siblings, 2 replies; 17+ messages in thread
From: Wolfram Sang @ 2015-12-17 13:30 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

Hi Phil,

> +		/* Wait until we are in L1 */
> +		while (!(val & L1FAEG))
> +			val = rcar_pci_read_reg(pcie, PMSR);

No timeout?

Regards,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar
  2015-12-17 13:22 ` [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup " Phil Edworthy
@ 2015-12-17 13:33   ` Wolfram Sang
  2015-12-18 13:43     ` Phil Edworthy
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2015-12-17 13:33 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

[-- Attachment #1: Type: text/plain, Size: 670 bytes --]


> +	rcar_pci_write_reg(pcie, 0x000f0030, GEN2_PCIEPHYADDR);
> +	rcar_pci_write_reg(pcie, 0x00381203, GEN2_PCIEPHYDATA);
> +	rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
> +	rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
> +
> +	rcar_pci_write_reg(pcie, 0x000f0054, GEN2_PCIEPHYADDR);
> +	/* The following value is for DC connection, no termination resistor */
> +	rcar_pci_write_reg(pcie, 0x13802007, GEN2_PCIEPHYDATA);
> +	rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
> +	rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);

I'd vote for a comment saying where these magic values come from, i.e.
which manual, which chapter, etc...


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-17 13:30   ` Wolfram Sang
@ 2015-12-17 13:41     ` Geert Uytterhoeven
  2015-12-18 13:44       ` Phil Edworthy
  2015-12-18 13:42     ` Phil Edworthy
  1 sibling, 1 reply; 17+ messages in thread
From: Geert Uytterhoeven @ 2015-12-17 13:41 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Phil Edworthy, Simon Horman, Bjorn Helgaas, linux-kernel,
	linux-pci, Linux-sh list

On Thu, Dec 17, 2015 at 2:30 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
>> +             /* Wait until we are in L1 */
>> +             while (!(val & L1FAEG))
>> +                     val = rcar_pci_read_reg(pcie, PMSR);
>
> No timeout?

And no cpu_relax() in each iteration.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* RE: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-17 13:30   ` Wolfram Sang
  2015-12-17 13:41     ` Geert Uytterhoeven
@ 2015-12-18 13:42     ` Phil Edworthy
  2015-12-18 14:04       ` Wolfram Sang
  1 sibling, 1 reply; 17+ messages in thread
From: Phil Edworthy @ 2015-12-18 13:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

Hi Wolfram,

On 17 December 2015 13:31, Wolfram Sang wrote:
> Hi Phil,
> 
> > +		/* Wait until we are in L1 */
> > +		while (!(val & L1FAEG))
> > +			val = rcar_pci_read_reg(pcie, PMSR);
> 
> No timeout?
Since the hardware doesn't support hot plug, I believe this loop will
always exit very quickly. Unless someone has taken a hammer to the HW
of course.
However, point taken. I'll add a timeout.

> Regards,
> 
>    Wolfram


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

* RE: [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar
  2015-12-17 13:33   ` Wolfram Sang
@ 2015-12-18 13:43     ` Phil Edworthy
  0 siblings, 0 replies; 17+ messages in thread
From: Phil Edworthy @ 2015-12-18 13:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

Hi Wolfram,

On 17 December 2015 13:33, Wolfram Sang wrote:
> > +	rcar_pci_write_reg(pcie, 0x000f0030, GEN2_PCIEPHYADDR);
> > +	rcar_pci_write_reg(pcie, 0x00381203, GEN2_PCIEPHYDATA);
> > +	rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
> > +	rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
> > +
> > +	rcar_pci_write_reg(pcie, 0x000f0054, GEN2_PCIEPHYADDR);
> > +	/* The following value is for DC connection, no termination resistor */
> > +	rcar_pci_write_reg(pcie, 0x13802007, GEN2_PCIEPHYDATA);
> > +	rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
> > +	rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
> 
> I'd vote for a comment saying where these magic values come from, i.e.
> which manual, which chapter, etc...
Ok, will do.

Thanks
Phil

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

* RE: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-17 13:41     ` Geert Uytterhoeven
@ 2015-12-18 13:44       ` Phil Edworthy
  0 siblings, 0 replies; 17+ messages in thread
From: Phil Edworthy @ 2015-12-18 13:44 UTC (permalink / raw)
  To: Geert Uytterhoeven, Wolfram Sang
  Cc: Simon Horman, Bjorn Helgaas, linux-kernel, linux-pci, Linux-sh list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 906 bytes --]

On 17 December 2015 13:41, Geert Uytterhoeven wrote:
> On Thu, Dec 17, 2015 at 2:30 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> >> +             /* Wait until we are in L1 */
> >> +             while (!(val & L1FAEG))
> >> +                     val = rcar_pci_read_reg(pcie, PMSR);
> >
> > No timeout?
> 
> And no cpu_relax() in each iteration.
Sure, I'll fix that.

Thanks
Phil

 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-18 13:42     ` Phil Edworthy
@ 2015-12-18 14:04       ` Wolfram Sang
  2015-12-18 15:25         ` Phil Edworthy
  2015-12-21 10:52         ` Phil Edworthy
  0 siblings, 2 replies; 17+ messages in thread
From: Wolfram Sang @ 2015-12-18 14:04 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]


> Since the hardware doesn't support hot plug, I believe this loop will
> always exit very quickly. Unless someone has taken a hammer to the HW
> of course.

I know what you mean. But since readl_poll_timeout() makes it easy, we
should better be safe than sorry.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* RE: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-18 14:04       ` Wolfram Sang
@ 2015-12-18 15:25         ` Phil Edworthy
  2015-12-21 10:52         ` Phil Edworthy
  1 sibling, 0 replies; 17+ messages in thread
From: Phil Edworthy @ 2015-12-18 15:25 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

Hi Wolfram,

On 18 December 2015 14:04, Wolfram Sang wrote:
> > Since the hardware doesn't support hot plug, I believe this loop will
> > always exit very quickly. Unless someone has taken a hammer to the HW
> > of course.
> 
> I know what you mean. But since readl_poll_timeout() makes it easy, we
> should better be safe than sorry.
I haven't see that one before, very handy!

Thanks
Phil

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

* RE: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-18 14:04       ` Wolfram Sang
  2015-12-18 15:25         ` Phil Edworthy
@ 2015-12-21 10:52         ` Phil Edworthy
  2015-12-21 13:16           ` Geert Uytterhoeven
  1 sibling, 1 reply; 17+ messages in thread
From: Phil Edworthy @ 2015-12-21 10:52 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Simon Horman, Bjorn Helgaas, Geert Uytterhoeven, linux-kernel,
	linux-pci, linux-sh

Hi Wolfram,

On 18 December 2015 14:04, Wolfram Sang wrote:
> > Since the hardware doesn't support hot plug, I believe this loop will
> > always exit very quickly. Unless someone has taken a hammer to the HW
> > of course.
> 
> I know what you mean. But since readl_poll_timeout() makes it easy, we
> should better be safe than sorry.
Hmm, I changed the code, but now it doesn't come out of suspend unless
sleep_us passed to readl_poll_timeout is 0. Any reason you can think of?

To test, I am just using:
Build the kernel with CONFIG_PM_DEBUG. 
echo platform > /sys/power/pm_test
echo N > /sys/module/printk/parameters/console_suspend
echo mem > /sys/power/state

Thanks
Phil

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

* Re: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-21 10:52         ` Phil Edworthy
@ 2015-12-21 13:16           ` Geert Uytterhoeven
  2016-01-04 14:18             ` Phil Edworthy
  0 siblings, 1 reply; 17+ messages in thread
From: Geert Uytterhoeven @ 2015-12-21 13:16 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Wolfram Sang, Simon Horman, Bjorn Helgaas, linux-kernel,
	linux-pci, linux-sh

Hi Phil,

(this time with full CC list)

On Mon, Dec 21, 2015 at 11:52 AM, Phil Edworthy
<phil.edworthy@renesas.com> wrote:
> On 18 December 2015 14:04, Wolfram Sang wrote:
>> > Since the hardware doesn't support hot plug, I believe this loop will
>> > always exit very quickly. Unless someone has taken a hammer to the HW
>> > of course.
>>
>> I know what you mean. But since readl_poll_timeout() makes it easy, we
>> should better be safe than sorry.
> Hmm, I changed the code, but now it doesn't come out of suspend unless
> sleep_us passed to readl_poll_timeout is 0. Any reason you can think of?

Timers or interrupts disabled?

Does the might_sleep_if() scream if CONFIG_DEBUG_ATOMIC_SLEEP=y?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* RE: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2015-12-21 13:16           ` Geert Uytterhoeven
@ 2016-01-04 14:18             ` Phil Edworthy
  2016-01-04 14:56               ` Geert Uytterhoeven
  0 siblings, 1 reply; 17+ messages in thread
From: Phil Edworthy @ 2016-01-04 14:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfram Sang, Simon Horman, Bjorn Helgaas, linux-kernel,
	linux-pci, linux-sh

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1029 bytes --]

Hi Geert,

On 21 December 2015 13:17, Geert Uytterhoeven wrote:
> On Mon, Dec 21, 2015 at 11:52 AM, Phil Edworthy
> <phil.edworthy@renesas.com> wrote:
> > On 18 December 2015 14:04, Wolfram Sang wrote:
> >> > Since the hardware doesn't support hot plug, I believe this loop will
> >> > always exit very quickly. Unless someone has taken a hammer to the HW
> >> > of course.
> >>
> >> I know what you mean. But since readl_poll_timeout() makes it easy, we
> >> should better be safe than sorry.
> > Hmm, I changed the code, but now it doesn't come out of suspend unless
> > sleep_us passed to readl_poll_timeout is 0. Any reason you can think of?
> 
> Timers or interrupts disabled?
> 
> Does the might_sleep_if() scream if CONFIG_DEBUG_ATOMIC_SLEEP=y?
Yes, it does indeed scream. Would you recommend to still use readl_poll_timeout
with sleep_us set to 0?

Thanks
Phil
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling in pcie-rcar
  2016-01-04 14:18             ` Phil Edworthy
@ 2016-01-04 14:56               ` Geert Uytterhoeven
  0 siblings, 0 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2016-01-04 14:56 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Wolfram Sang, Simon Horman, Bjorn Helgaas, linux-kernel,
	linux-pci, linux-sh

Hi Phil,

On Mon, Jan 4, 2016 at 3:18 PM, Phil Edworthy <phil.edworthy@renesas.com> wrote:
> On 21 December 2015 13:17, Geert Uytterhoeven wrote:
>> On Mon, Dec 21, 2015 at 11:52 AM, Phil Edworthy
>> <phil.edworthy@renesas.com> wrote:
>> > On 18 December 2015 14:04, Wolfram Sang wrote:
>> >> > Since the hardware doesn't support hot plug, I believe this loop will
>> >> > always exit very quickly. Unless someone has taken a hammer to the HW
>> >> > of course.
>> >>
>> >> I know what you mean. But since readl_poll_timeout() makes it easy, we
>> >> should better be safe than sorry.
>> > Hmm, I changed the code, but now it doesn't come out of suspend unless
>> > sleep_us passed to readl_poll_timeout is 0. Any reason you can think of?
>>
>> Timers or interrupts disabled?
>>
>> Does the might_sleep_if() scream if CONFIG_DEBUG_ATOMIC_SLEEP=y?
> Yes, it does indeed scream. Would you recommend to still use readl_poll_timeout
> with sleep_us set to 0?

Seems like people hit this before: use readl_poll_timeout_atomic().

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-17 13:22 [PATCH 0/4] Various R-Car PCIe patches Phil Edworthy
2015-12-17 13:22 ` [PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar Phil Edworthy
2015-12-17 13:22 ` [PATCH 2/4] PCI: rcar: Support runtime PM link state L1 handling " Phil Edworthy
2015-12-17 13:30   ` Wolfram Sang
2015-12-17 13:41     ` Geert Uytterhoeven
2015-12-18 13:44       ` Phil Edworthy
2015-12-18 13:42     ` Phil Edworthy
2015-12-18 14:04       ` Wolfram Sang
2015-12-18 15:25         ` Phil Edworthy
2015-12-21 10:52         ` Phil Edworthy
2015-12-21 13:16           ` Geert Uytterhoeven
2016-01-04 14:18             ` Phil Edworthy
2016-01-04 14:56               ` Geert Uytterhoeven
2015-12-17 13:22 ` [PATCH 3/4] PCI: rcar: Add runtime PM support to pcie-rcar Phil Edworthy
2015-12-17 13:22 ` [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup " Phil Edworthy
2015-12-17 13:33   ` Wolfram Sang
2015-12-18 13:43     ` Phil Edworthy

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).