Skip to contentSkip to conversation

Add Stratix10 PCIe Root Port support

PATCH Superseded Ley Foon Tan 2 participants 8 messages Dec 31, 2018 – Jan 2, 2019

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add Stratix10 PCIe Root Port support

Add PCIe Root Port support for Stratix10 device and also update device tree binding documentation.

v1 -> v2:
---------
- Add define S10_TLP_FMTTYPE_* macros.
- Remove initialize structure members to NULL/zero.
- Rename *_funcs to *_data.
- Update comment and fix coding style warning from checkpatch.pl.
- Rename StratixXX to stratix10.

History:
--------
[v1]: https://lkml.org/lkml/2018/12/26/68

Ley Foon Tan (2):
pci: altera: Add Stratix10 PCIe support
Documentation: dt-bindings: pci: altera: Add altr,pcie-root-port-2.0

 .../devicetree/bindings/pci/altera-pcie.txt        |    4 +-
 drivers/pci/controller/Kconfig                     |    2 +-
 drivers/pci/controller/pcie-altera.c               |  240 ++++++++++++++++++--
 3 files changed, 220 insertions(+), 26 deletions(-)
#1 lore raw

PATCH v2 1/2 pci: altera: Add Stratix10 PCIe support

Add PCIe Root Port support for Stratix10 device.

Main differences:
- HIP interface to access Root Port configuration register.
- TLP programming flow:
- One REG0 register
- Don't need to check alignment

---
 drivers/pci/controller/Kconfig       |    2 +-
 drivers/pci/controller/pcie-altera.c |  240 ++++++++++++++++++++++++++++++----
 2 files changed, 217 insertions(+), 25 deletions(-)
drivers/pci/controller/Kconfig +1 -1
index 6671946..6012f30 100644
@@ -175,7 +175,7 @@ config PCIE_IPROC_MSI
 
 config PCIE_ALTERA
 	bool "Altera PCIe controller"
-	depends on ARM || NIOS2 || COMPILE_TEST
+	depends on ARM || NIOS2 || ARM64 || COMPILE_TEST
 	help
 	  Say Y here if you want to enable PCIe controller support on Altera
 	  FPGA.
drivers/pci/controller/pcie-altera.c +216 -24

398 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH v2 1/2] pci: altera: Add Stratix10 PCIe support

Run "git log --oneline --follow drivers/pci/controller/pcie-altera.c" and make your subject line match in style, phrasing, and capitalization.

Hint:

............ pci: altera: Add Stratix10 PCIe support ef75369a5b9a PCI: altera: Fix platform_get_irq() error handling bfdbbf0e3c2a PCI: altera: Use size=4 IRQ domain for legacy INTx 6ab380957838 PCI: altera: Drop pci_fixup_irqs()
9815791319a0 PCI: altera: Convert PCI scan API to pci_scan_root_bus_bridge() 2a7275a3d867 PCI: altera: Fix TLP_CFG_DW0 for TLP write

One of these is not like the others.

On Mon, Dec 31, 2018 at 04:24:52PM +0800, Ley Foon Tan wrote:
...

drivers/pci/controller/pcie-altera.c line 105

Quoted 10 lines
drivers/pci/controller/pcie-altera.c +10 -0
+struct altera_pcie_data {
+	int (*tlp_read_pkt)(struct altera_pcie *pcie, u32 *value);
+	void (*tlp_write_pkt)(struct altera_pcie *pcie, u32 *headers,
+			      u32 data, bool align);
+	bool (*get_link_status)(struct altera_pcie *pcie);
+	int (*rp_read_cfg)(struct altera_pcie *pcie, int where,
+			   int size, u32 *value);
+	int (*rp_write_cfg)(struct altera_pcie *pcie, u8 bus, int where,
+			    int size, u32 value);
+	bool s10_flag;		/* Stratix 10 */

This is OK if you only ever have two programming models (the original and Stratix 10). But if there's a possibility of more, an int model type that can be tested with a switch is more extensible.

Personally I prefer bitfields over bool in structures, but ultimately Lorenzo will take this and I don't know whether he has a preference.

https://lkml.kernel.org/r/CA+55aFxnePDimkVKVtv3gNmRGcwc8KQ5mHYvUxY8sAQg6yvVYg@mail.gmail.com
https://lkml.kernel.org/r/CA+55aFzKQ6Pj18TB8p4Yr0M4t+S+BsiHH=BJNmn=76-NcjTj-g@mail.gmail.com

Bjorn

#3 lore raw

Re: [PATCH v2 1/2] pci: altera: Add Stratix10 PCIe support

Quoted 14 lines · Bjorn Helgaas

Run "git log --oneline --follow drivers/pci/controller/pcie-altera.c" and
make your subject line match in style, phrasing, and capitalization.

Hint:

  ............ pci: altera: Add Stratix10 PCIe support ef75369a5b9a PCI: altera: Fix platform_get_irq() error handling bfdbbf0e3c2a PCI: altera: Use size=4 IRQ domain for legacy INTx 6ab380957838 PCI: altera: Drop pci_fixup_irqs() 9815791319a0 PCI: altera: Convert PCI scan API to pci_scan_root_bus_bridge()
  2a7275a3d867 PCI: altera: Fix TLP_CFG_DW0 for TLP write

Quoted 1 line

One of these is not like the others.

Okay, will change it.

Quoted 20 lines · Ley Foon Tan

...

drivers/pci/controller/pcie-altera.c line 105

Quoted 13 lines
drivers/pci/controller/pcie-altera.c +3 -0
+struct altera_pcie_data {
+	int (*tlp_read_pkt)(struct altera_pcie *pcie, u32 *value);
+	void (*tlp_write_pkt)(struct altera_pcie *pcie, u32

*headers,

drivers/pci/controller/pcie-altera.c +5 -0
+			      u32 data, bool align);
+	bool (*get_link_status)(struct altera_pcie *pcie);
+	int (*rp_read_cfg)(struct altera_pcie *pcie, int where,
+			   int size, u32 *value);
+	int (*rp_write_cfg)(struct altera_pcie *pcie, u8 bus, int

where,

drivers/pci/controller/pcie-altera.c +2 -0
+			    int size, u32 value);
+	bool s10_flag;		/* Stratix 10 */

This is OK if you only ever have two programming models (the original and Stratix 10).  But if there's a possibility of more, an int model type that can be tested with a switch is more extensible.

Quoted 7 lines

Personally I prefer bitfields over bool in structures, but ultimately Lorenzo will take this and I don't know whether he has a preference.

https://lkml.kernel.org/r/CA+55aFxnePDimkVKVtv3gNmRGcwc8KQ5mHYvUxY8sA
[email protected]
https://lkml.kernel.org/r/CA+55aFzKQ6Pj18TB8p4Yr0M4t+S+BsiHH=BJNmn=76
[email protected]

Yes, you are right. Will change it to something like "version type".

Regards
Ley Foon

#4 lore raw

Re: [PATCH v2 1/2] pci: altera: Add Stratix10 PCIe support

In reply to Bjorn Helgaas
Quoted 14 lines · Bjorn Helgaas

Run "git log --oneline --follow drivers/pci/controller/pcie-altera.c" and
make your subject line match in style, phrasing, and capitalization.

Hint:

  ............ pci: altera: Add Stratix10 PCIe support ef75369a5b9a PCI: altera: Fix platform_get_irq() error handling bfdbbf0e3c2a PCI: altera: Use size=4 IRQ domain for legacy INTx 6ab380957838 PCI: altera: Drop pci_fixup_irqs() 9815791319a0 PCI: altera: Convert PCI scan API to pci_scan_root_bus_bridge()
  2a7275a3d867 PCI: altera: Fix TLP_CFG_DW0 for TLP write

Quoted 1 line

One of these is not like the others.

Okay, will change it.

Quoted 20 lines · Ley Foon Tan

...

drivers/pci/controller/pcie-altera.c line 105

Quoted 13 lines
drivers/pci/controller/pcie-altera.c +3 -0
+struct altera_pcie_data {
+	int (*tlp_read_pkt)(struct altera_pcie *pcie, u32 *value);
+	void (*tlp_write_pkt)(struct altera_pcie *pcie, u32

*headers,

drivers/pci/controller/pcie-altera.c +5 -0
+			      u32 data, bool align);
+	bool (*get_link_status)(struct altera_pcie *pcie);
+	int (*rp_read_cfg)(struct altera_pcie *pcie, int where,
+			   int size, u32 *value);
+	int (*rp_write_cfg)(struct altera_pcie *pcie, u8 bus, int

where,

drivers/pci/controller/pcie-altera.c +2 -0
+			    int size, u32 value);
+	bool s10_flag;		/* Stratix 10 */

This is OK if you only ever have two programming models (the original and Stratix 10).  But if there's a possibility of more, an int model type that can be tested with a switch is more extensible.

Quoted 7 lines

Personally I prefer bitfields over bool in structures, but ultimately Lorenzo will take this and I don't know whether he has a preference.

https://lkml.kernel.org/r/CA+55aFxnePDimkVKVtv3gNmRGcwc8KQ5mHYvUxY8sA
[email protected]
https://lkml.kernel.org/r/CA+55aFzKQ6Pj18TB8p4Yr0M4t+S+BsiHH=BJNmn=76
[email protected]

Yes, you are right. Will change it to something like "version type".

Regards
Ley Foon

#5 lore raw

PATCH v2 2/2 Documentation: dt-bindings: pci: altera: Add altr,pcie-root-port-2.0

In reply to Ley Foon Tan

Add support for altr,pcie-root-port-2.0.

---
 .../devicetree/bindings/pci/altera-pcie.txt        |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Documentation/devicetree/bindings/pci/altera-pcie.txt +3 -1
index 6c396f1..816b244 100644
@@ -1,11 +1,13 @@
 * Altera PCIe controller
 
 Required properties:
-- compatible :	should contain "altr,pcie-root-port-1.0"
+- compatible :	should contain "altr,pcie-root-port-1.0" or "altr,pcie-root-port-2.0"
 - reg:		a list of physical base address and length for TXS and CRA.
+		For "altr,pcie-root-port-2.0", additional HIP base address and length.
 - reg-names:	must include the following entries:
 		"Txs": TX slave port region
 		"Cra": Control register access region
+		"Hip": Hard IP region (if "altr,pcie-root-port-2.0")
 - interrupts:	specifies the interrupt source of the parent interrupt
 		controller.  The format of the interrupt specifier depends
 		on the parent interrupt controller.
Signature · 1 line
1.7.1
#6 lore raw
In reply to Ley Foon Tan
Quoted 1 line · Ley Foon Tan

Add PCIe Root Port support for Stratix10 device and also update

"Stratix10" is a big step better than "StratixXX" because a web search for the latter finds nothing, while the former does find useful things.

Intel materials on the web seem to use "Stratix 10". You might as well include the space in English text.

#7 lore raw
Quoted 10 lines · Bjorn Helgaas
Quoted 2 lines · Ley Foon Tan

Add PCIe Root Port support for Stratix10 device and also update

"Stratix10" is a big step better than "StratixXX" because a web search
for the latter finds nothing, while the former does find useful things.

Intel materials on the web seem to use "Stratix 10".  You might as well include the space in English text.

Okay, will change to Stratix 10.

Regards
Ley Foon