Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1293888 > unrolled thread
| Started by | Phil Edworthy <phil.edworthy@renesas.com> |
|---|---|
| First post | 2015-12-17 14:30 +0100 |
| Last post | 2015-12-17 14:30 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4] Various R-Car PCIe patches Phil Edworthy <phil.edworthy@renesas.com> - 2015-12-17 14:30 +0100
[PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar Phil Edworthy <phil.edworthy@renesas.com> - 2015-12-17 14:30 +0100
[PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar Phil Edworthy <phil.edworthy@renesas.com> - 2015-12-17 14:30 +0100
Re: [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar Wolfram Sang <wsa@the-dreams.de> - 2015-12-17 14:40 +0100
RE: [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar Phil Edworthy <phil.edworthy@renesas.com> - 2015-12-18 14:50 +0100
[PATCH 3/4] PCI: rcar: Add runtime PM support to pcie-rcar Phil Edworthy <phil.edworthy@renesas.com> - 2015-12-17 14:30 +0100
| From | Phil Edworthy <phil.edworthy@renesas.com> |
|---|---|
| Date | 2015-12-17 14:30 +0100 |
| Subject | [PATCH 0/4] Various R-Car PCIe patches |
| Message-ID | <qGGN4-8nL-15@gated-at.bofh.it> |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Phil Edworthy <phil.edworthy@renesas.com> |
|---|---|
| Date | 2015-12-17 14:30 +0100 |
| Subject | [PATCH 1/4] PCI: rcar: remove unused pci_sys_data structure in pcie-rcar |
| Message-ID | <qGGN4-8nL-23@gated-at.bofh.it> |
| In reply to | #1293888 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Phil Edworthy <phil.edworthy@renesas.com> |
|---|---|
| Date | 2015-12-17 14:30 +0100 |
| Subject | [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar |
| Message-ID | <qGGN5-8nL-39@gated-at.bofh.it> |
| In reply to | #1293888 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Date | 2015-12-17 14:40 +0100 |
| Subject | Re: [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar |
| Message-ID | <qGGWJ-8qU-13@gated-at.bofh.it> |
| In reply to | #1293895 |
[Multipart message — attachments visible in raw view] — view raw
> + 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...
[toc] | [prev] | [next] | [standalone]
| From | Phil Edworthy <phil.edworthy@renesas.com> |
|---|---|
| Date | 2015-12-18 14:50 +0100 |
| Subject | RE: [PATCH 4/4] PCI: rcar: Add Gen2 PHY setup to pcie-rcar |
| Message-ID | <qH3zX-6ie-15@gated-at.bofh.it> |
| In reply to | #1293903 |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Phil Edworthy <phil.edworthy@renesas.com> |
|---|---|
| Date | 2015-12-17 14:30 +0100 |
| Subject | [PATCH 3/4] PCI: rcar: Add runtime PM support to pcie-rcar |
| Message-ID | <qGGN5-8nL-45@gated-at.bofh.it> |
| In reply to | #1293888 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web