Skip to contentSkip to conversation

Altera PCIe host controller driver with MSI support

PATCH Superseded Ley Foon Tan 4 participants 20 messages Sep 21, 2015 – Oct 5, 2015

Subsystems (4)

v7 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v7 cover Altera PCIe host controller driver with MSI support

This is the 7th version of patch set to add support for Altera PCIe host controller with MSI feature on Altera FPGA device families. This patchset mainly resolve comments from Lorenzo Pieralisi in v6 and minor fixes.

This patchset is based on v4.3-rc1.

v6->v7 changes:
-pcie-altera: add pcie_bus_configure_settings()
-pcie-altera: update comment
-pcie-altera: merge tlp_write_packet_unaligned and tlp_write_packet_aligned -pcie-altera: pass in NULL for iobase for of_pci_get_host_bridge_resources -pcie-altera: remove pcie->root_bus_nr = 0

History:
-------
[v1]: https://lkml.org/lkml/2015/7/28/395
[v2]: https://lkml.org/lkml/2015/7/31/267
[v3]: http://www.kernelhub.org/?msg=811940&p=2
[v4]: https://lkml.org/lkml/2015/8/17/141
[v5]: https://lkml.org/lkml/2015/8/25/238
[v6]: https://lkml.org/lkml/2015/9/1/177

Ley Foon Tan (6):
arm: add msi.h to Kbuild
pci: add Altera PCI vendor ID
pci:host: Add Altera PCIe host controller driver
pci: altera: Add Altera PCIe MSI driver
Documentation: dt-bindings: pci: altera pcie device tree binding
MAINTAINERS: Add Altera PCIe and MSI drivers maintainer

 .../devicetree/bindings/pci/altera-pcie-msi.txt    |  28 +
 .../devicetree/bindings/pci/altera-pcie.txt        |  49 ++
 MAINTAINERS                                        |  16 +
 arch/arm/include/asm/Kbuild                        |   1 +
 drivers/pci/host/Kconfig                           |  16 +
 drivers/pci/host/Makefile                          |   2 +
 drivers/pci/host/pcie-altera-msi.c                 | 310 +++++++++++
 drivers/pci/host/pcie-altera.c                     | 591 +++++++++++++++++++++
 include/linux/pci_ids.h                            |   2 +
 9 files changed, 1015 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
 create mode 100644 drivers/pci/host/pcie-altera-msi.c
 create mode 100644 drivers/pci/host/pcie-altera.c
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH v7 1/6 arm: add msi.h to Kbuild

Include asm-generic/msi.h to support CONFIG_GENERIC_MSI_IRQ_DOMAIN. This to fix compilation error:
"include/linux/msi.h:123:21: fatal error: asm/msi.h:
No such file or directory"

---
 arch/arm/include/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)
arch/arm/include/asm/Kbuild +1 -0
index be648eb..bd42530 100644
@@ -14,6 +14,7 @@ generic-y += local.h
 generic-y += local64.h
 generic-y += mm-arch-hooks.h
 generic-y += msgbuf.h
+generic-y += msi.h
 generic-y += param.h
 generic-y += parport.h
 generic-y += poll.h
Signature · 1 line
1.8.2.1
Acked-by on v7 1/6
#2 lore raw

Re: [PATCH v7 1/6] arm: add msi.h to Kbuild

Quoted 6 lines · On Mon, 21 Sep 2015 10:13:02 +0800 Ley Foon Tan <[email protected]> wrote:

Include asm-generic/msi.h to support CONFIG_GENERIC_MSI_IRQ_DOMAIN. This to fix compilation error:
"include/linux/msi.h:123:21: fatal error: asm/msi.h:
No such file or directory"

	M.
Signature · 1 line
Jazz is not dead. It just smells funny.
#3 lore raw

PATCH v7 2/6 pci: add Altera PCI vendor ID

In reply to Ley Foon Tan
---
 include/linux/pci_ids.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
index d9ba49c..08e4462 100644
@@ -1550,6 +1550,8 @@
 #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
 #define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408
 
+#define PCI_VENDOR_ID_ALTERA		0x1172
+
 #define PCI_VENDOR_ID_SBE		0x1176
 #define PCI_DEVICE_ID_SBE_WANXL100	0x0301
 #define PCI_DEVICE_ID_SBE_WANXL200	0x0302
Signature · 1 line
1.8.2.1
#4 lore raw

PATCH v7 3/6 pci:host: Add Altera PCIe host controller driver

In reply to Ley Foon Tan

This patch adds the Altera PCIe host controller driver.

---
 drivers/pci/host/Kconfig       |   8 +
 drivers/pci/host/Makefile      |   1 +
 drivers/pci/host/pcie-altera.c | 591 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 600 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera.c
drivers/pci/host/Kconfig +8 -0
index d5e58ba..df9ed4f 100644
@@ -145,4 +145,12 @@ config PCIE_IPROC_BCMA
 	  Say Y here if you want to use the Broadcom iProc PCIe controller
 	  through the BCMA bus interface
 
+config PCIE_ALTERA
+	tristate "Altera PCIe controller"
+	depends on ARCH_SOCFPGA || NIOS2
+	select PCI_DOMAINS
+	help
+	  Say Y here if you want to enable PCIe controller support for Altera
+	  SoCFPGA family of SoCs.
+
 endmenu
drivers/pci/host/Makefile +1 -0
index 140d66f..6954f76 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
 obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
 obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
 obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o
+obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
drivers/pci/host/pcie-altera.c new file +591 -0

591 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#5 lore raw

Re: [PATCH v7 3/6] pci:host: Add Altera PCIe host controller driver

Quoted 16 lines · On Mon, 21 Sep 2015 10:13:04 +0800 Ley Foon Tan <[email protected]> wrote:

This patch adds the Altera PCIe host controller driver.

---
 drivers/pci/host/Kconfig       |   8 +
 drivers/pci/host/Makefile      |   1 +
 drivers/pci/host/pcie-altera.c | 591 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 600 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera.c
drivers/pci/host/Kconfig +0 -0
index d5e58ba..df9ed4f 100644
@@ -145,4 +145,12 @@ config PCIE_IPROC_BCMA
 	  Say Y here if you want to use the Broadcom iProc PCIe controller

drivers/pci/host/Kconfig config PCIE_IPROC_BCMA · line 155

Quoted 10 lines
drivers/pci/host/Kconfig +8 -0
 	  through the BCMA bus interface
 
+config PCIE_ALTERA
+	tristate "Altera PCIe controller"
+	depends on ARCH_SOCFPGA || NIOS2
+	select PCI_DOMAINS
+	help
+	  Say Y here if you want to enable PCIe controller support for Altera
+	  SoCFPGA family of SoCs.
+

Is there anything in this driver that is actually specific to any of these two platforms/architectures? I'd don't think we should restrict if we can avoid it (hint: the companion MSI driver is not restricted to any architecture).

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny.
#6 lore raw

Re: [PATCH v7 3/6] pci:host: Add Altera PCIe host controller driver

Quoted 21 lines · Marc Zyngier
Quoted 18 lines · On Mon, 21 Sep 2015 10:13:04 +0800 Ley Foon Tan <[email protected]> wrote:

This patch adds the Altera PCIe host controller driver.

---
 drivers/pci/host/Kconfig       |   8 +
 drivers/pci/host/Makefile      |   1 +
 drivers/pci/host/pcie-altera.c | 591 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 600 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera.c
drivers/pci/host/Kconfig +0 -0
index d5e58ba..df9ed4f 100644
@@ -145,4 +145,12 @@ config PCIE_IPROC_BCMA
        Say Y here if you want to use the Broadcom iProc PCIe controller
        through the BCMA bus interface
 
Quoted 13 lines

drivers/pci/host/Kconfig config PCIE_IPROC_BCMA · line 155

Quoted 8 lines
drivers/pci/host/Kconfig +8 -0
+config PCIE_ALTERA
+     tristate "Altera PCIe controller"
+     depends on ARCH_SOCFPGA || NIOS2
+     select PCI_DOMAINS
+     help
+       Say Y here if you want to enable PCIe controller support for Altera
+       SoCFPGA family of SoCs.
+

Is there anything in this driver that is actually specific to any of these two platforms/architectures? I'd don't think we should restrict if we can avoid it (hint: the companion MSI driver is not restricted to any architecture).

No specific dependency on these 2 architectures. Then I will remove this.

Thanks.

Regards
Ley Foon

Reviewed-by
#7 lore raw

Re: [PATCH v7 3/6] pci:host: Add Altera PCIe host controller driver

Quoted 35 lines · On Wed, 23 Sep 2015 17:33:09 +0800 Ley Foon Tan <[email protected]> wrote:
Quoted 21 lines · Marc Zyngier
Quoted 18 lines · On Mon, 21 Sep 2015 10:13:04 +0800 Ley Foon Tan <[email protected]> wrote:

This patch adds the Altera PCIe host controller driver.

---
 drivers/pci/host/Kconfig       |   8 +
 drivers/pci/host/Makefile      |   1 +
 drivers/pci/host/pcie-altera.c | 591 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 600 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera.c
drivers/pci/host/Kconfig +0 -0
index d5e58ba..df9ed4f 100644
@@ -145,4 +145,12 @@ config PCIE_IPROC_BCMA
        Say Y here if you want to use the Broadcom iProc PCIe controller
        through the BCMA bus interface
 
Quoted 13 lines

drivers/pci/host/Kconfig config PCIE_IPROC_BCMA · line 155

Quoted 8 lines
drivers/pci/host/Kconfig +8 -0
+config PCIE_ALTERA
+     tristate "Altera PCIe controller"
+     depends on ARCH_SOCFPGA || NIOS2
+     select PCI_DOMAINS
+     help
+       Say Y here if you want to enable PCIe controller support for Altera
+       SoCFPGA family of SoCs.
+

Is there anything in this driver that is actually specific to any of these two platforms/architectures? I'd don't think we should restrict if we can avoid it (hint: the companion MSI driver is not restricted to any architecture).

Quoted 1 line

No specific dependency on these 2 architectures. Then I will remove this.

OK. If you fix this, you can put my

on this patch.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny.
#8 lore raw

PATCH v7 4/6 pci: altera: Add Altera PCIe MSI driver

In reply to Ley Foon Tan

This patch adds Altera PCIe MSI driver. This soft IP supports configurable number of vectors, which is a dts parameter.

---
 drivers/pci/host/Kconfig           |   8 +
 drivers/pci/host/Makefile          |   1 +
 drivers/pci/host/pcie-altera-msi.c | 310 +++++++++++++++++++++++++++++++++++++
 3 files changed, 319 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera-msi.c
drivers/pci/host/Kconfig +8 -0
index df9ed4f..0da697e 100644
@@ -153,4 +153,12 @@ config PCIE_ALTERA
 	  Say Y here if you want to enable PCIe controller support for Altera
 	  SoCFPGA family of SoCs.
 
+config PCIE_ALTERA_MSI
+	bool "Altera PCIe MSI feature"
+	depends on PCI_MSI
+	select PCI_MSI_IRQ_DOMAIN
+	help
+	  Say Y here if you want PCIe MSI support for the Altera SocFPGA SoC.
+	  This MSI driver supports Altera MSI to GIC controller IP.
+
 endmenu
drivers/pci/host/Makefile +1 -0
index 6954f76..6c4913d 100644
@@ -18,3 +18,4 @@ obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
 obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
 obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o
 obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
+obj-$(CONFIG_PCIE_ALTERA_MSI) += pcie-altera-msi.o
drivers/pci/host/pcie-altera-msi.c new file +310 -0

310 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#9 lore raw

PATCH v7 5/6 Documentation: dt-bindings: pci: altera pcie device tree binding

In reply to Ley Foon Tan

This patch adds the bindings for Altera PCIe host controller driver and Altera PCIe MSI driver.

---
 .../devicetree/bindings/pci/altera-pcie-msi.txt    | 28 +++++++++++++
 .../devicetree/bindings/pci/altera-pcie.txt        | 49 ++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +28 -0
new file mode 100644
index 0000000..53ad2388
@@ -0,0 +1,28 @@
+* Altera PCIe MSI controller
+
+Required properties:
+- compatible:	should contain "altr,msi-1.0"
+- reg:		specifies the physical base address of the controller and
+		the length of the memory mapped region.
+- reg-names:	must include the following entries:
+		"csr": CSR registers
+		"vector_slave": vectors slave port region
+- interrupt-parent:	interrupt source phandle.
+- interrupts:	specifies the interrupt source of the parent interrupt
+		controller. The format of the interrupt specifier depends on the
+		parent interrupt controller.
+- num-vectors:	number of vectors, range 1 to 32.
+- msi-controller:	indicates that this is MSI controller node
+
+
+Example
+msi0: msi at 0xFF200000 {
+	compatible = "altr,msi-1.0";
+	reg = <0xFF200000 0x00000010
+		0xFF200010 0x00000080>;
+	reg-names = "csr", "vector_slave";
+	interrupt-parent = <&hps_0_arm_gic_0>;
+	interrupts = <0 42 4>;
+	msi-controller = <1>;
+	num-vectors = <32>;
+};
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.8.2.1
maintainer
#10 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 33 lines · Ley Foon Tan

This patch adds the bindings for Altera PCIe host controller driver and Altera PCIe MSI driver.

---
 .../devicetree/bindings/pci/altera-pcie-msi.txt    | 28 +++++++++++++
 .../devicetree/bindings/pci/altera-pcie.txt        | 49 ++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +16 -0
new file mode 100644
index 0000000..53ad2388
@@ -0,0 +1,28 @@
+* Altera PCIe MSI controller
+
+Required properties:
+- compatible:	should contain "altr,msi-1.0"
+- reg:		specifies the physical base address of the controller and
+		the length of the memory mapped region.
+- reg-names:	must include the following entries:
+		"csr": CSR registers
+		"vector_slave": vectors slave port region
+- interrupt-parent:	interrupt source phandle.
+- interrupts:	specifies the interrupt source of the parent interrupt
+		controller. The format of the interrupt specifier depends on the
+		parent interrupt controller.
+- num-vectors:	number of vectors, range 1 to 32.
+- msi-controller:	indicates that this is MSI controller node
+

Documentation/devicetree/bindings/pci/altera-pcie-msi.txt line 26

Quoted 10 lines
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +10 -0
+
+Example
+msi0: msi at 0xFF200000 {
+	compatible = "altr,msi-1.0";
+	reg = <0xFF200000 0x00000010
+		0xFF200010 0x00000080>;
+	reg-names = "csr", "vector_slave";
+	interrupt-parent = <&hps_0_arm_gic_0>;
+	interrupts = <0 42 4>;
+	msi-controller = <1>;

This should not have a value.

Quoted 8 lines
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +2 -0
+	num-vectors = <32>;
+};
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +0 -0
new file mode 100644
index 0000000..4440db1

Documentation/devicetree/bindings/pci/altera-pcie.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +8 -0
@@ -0,0 +1,49 @@
+* Altera PCIe controller
+
+Required properties:
+- compatible :	should contain "altr,pcie-root-port-1.0"
+- reg:		a list of physical base address and length for TXS and CRA.
+- reg-names:	must include the following entries:
+		"Txs" or "txs": TX slave port region
+		"Cra" or "cra": Control register access region

Why both cases? Can we please just have one (or none is better IMO).

txs contains the config space?

Quoted 42 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +41 -0
+- interrupt-parent:	interrupt source phandle.
+- interrupts:	specifies the interrupt source of the parent interrupt controller.
+		The format of the interrupt specifier depends on the parent interrupt
+		controller.
+- device_type:	must be "pci"
+- #address-cells:	set to <3>
+- #size-cells:	set to <2>
+- #interrupt-cells:	set to <1>
+- ranges:		describes the translation of addresses for root ports and standard
+		PCI regions.
+- interrupt-map-mask and interrupt-map: standard PCI properties to define the
+		mapping of the PCIe interface to interrupt numbers.
+
+Optional properties:
+- msi-parent:	Link to the hardware entity that serves as the MSI controller for this PCIe
+		controller.
+- bus-range:	PCI bus numbers covered
+
+Example
+	pcie_0: pcie at 0xc00000000 {
+		compatible = "altr,pcie-root-port-1.0";
+		reg = <0xc0000000 0x20000000>,
+			<0xff220000 0x00004000>;
+		reg-names = "Txs", "Cra";
+		interrupt-parent = <&hps_0_arm_gic_0>;
+		interrupts = <0 40 4>;
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		bus-range = <0x0 0xFF>;
+		device_type = "pci";
+		msi-parent = <&msi_to_gic_gen_0>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie_0 1>,
+			            <0 0 0 2 &pcie_0 2>,
+			            <0 0 0 3 &pcie_0 3>,
+			            <0 0 0 4 &pcie_0 4>;
+		ranges = <0x82000000 0x00000000 0x00000000 0xc0000000 0x00000000 0x10000000
+			    0x82000000 0x00000000 0x10000000 0xd0000000 0x00000000 0x10000000>;
+	};
#11 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 39 lines · Rob Herring
Quoted 37 lines · Ley Foon Tan

This patch adds the bindings for Altera PCIe host controller driver and Altera PCIe MSI driver.

---
 .../devicetree/bindings/pci/altera-pcie-msi.txt    | 28 +++++++++++++
 .../devicetree/bindings/pci/altera-pcie.txt        | 49 ++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +20 -0
new file mode 100644
index 0000000..53ad2388
@@ -0,0 +1,28 @@
+* Altera PCIe MSI controller
+
+Required properties:
+- compatible:        should contain "altr,msi-1.0"
+- reg:               specifies the physical base address of the controller and
+             the length of the memory mapped region.
+- reg-names: must include the following entries:
+             "csr": CSR registers
+             "vector_slave": vectors slave port region
+- interrupt-parent:  interrupt source phandle.
+- interrupts:        specifies the interrupt source of the parent interrupt
+             controller. The format of the interrupt specifier depends on the
+             parent interrupt controller.
+- num-vectors:       number of vectors, range 1 to 32.
+- msi-controller:    indicates that this is MSI controller node
+
+
+Example
+msi0: msi at 0xFF200000 {
+     compatible = "altr,msi-1.0";
Quoted 8 lines

Documentation/devicetree/bindings/pci/altera-pcie-msi.txt line 26

Quoted 6 lines
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +6 -0
+     reg = <0xFF200000 0x00000010
+             0xFF200010 0x00000080>;
+     reg-names = "csr", "vector_slave";
+     interrupt-parent = <&hps_0_arm_gic_0>;
+     interrupts = <0 42 4>;
+     msi-controller = <1>;

This should not have a value.

Okay.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +2 -0
+     num-vectors = <32>;
+};
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +2 -0
new file mode 100644
index 0000000..4440db1
@@ -0,0 +1,49 @@
+* Altera PCIe controller
+
Quoted 8 lines

Documentation/devicetree/bindings/pci/altera-pcie.txt line 8

Quoted 6 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +6 -0
+Required properties:
+- compatible :       should contain "altr,pcie-root-port-1.0"
+- reg:               a list of physical base address and length for TXS and CRA.
+- reg-names: must include the following entries:
+             "Txs" or "txs": TX slave port region
+             "Cra" or "cra": Control register access region

Why both cases? Can we please just have one (or none is better IMO).

The PCIe IP on different device families use different register names. And our device tree generator will auto generate the register names based on the hardware description name. Too bad we can't change the hardware description names now.

Quoted 2 lines

txs contains the config space?

It is not the config space, but a memory slave port.

Quoted 44 lines
Quoted 43 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +41 -0
+- interrupt-parent:  interrupt source phandle.
+- interrupts:        specifies the interrupt source of the parent interrupt controller.
+             The format of the interrupt specifier depends on the parent interrupt
+             controller.
+- device_type:       must be "pci"
+- #address-cells:    set to <3>
+- #size-cells:       set to <2>
+- #interrupt-cells:  set to <1>
+- ranges:            describes the translation of addresses for root ports and standard
+             PCI regions.
+- interrupt-map-mask and interrupt-map: standard PCI properties to define the
+             mapping of the PCIe interface to interrupt numbers.
+
+Optional properties:
+- msi-parent:        Link to the hardware entity that serves as the MSI controller for this PCIe
+             controller.
+- bus-range: PCI bus numbers covered
+
+Example
+     pcie_0: pcie at 0xc00000000 {
+             compatible = "altr,pcie-root-port-1.0";
+             reg = <0xc0000000 0x20000000>,
+                     <0xff220000 0x00004000>;
+             reg-names = "Txs", "Cra";
+             interrupt-parent = <&hps_0_arm_gic_0>;
+             interrupts = <0 40 4>;
+             interrupt-controller;
+             #interrupt-cells = <1>;
+             bus-range = <0x0 0xFF>;
+             device_type = "pci";
+             msi-parent = <&msi_to_gic_gen_0>;
+             #address-cells = <3>;
+             #size-cells = <2>;
+             interrupt-map-mask = <0 0 0 7>;
+             interrupt-map = <0 0 0 1 &pcie_0 1>,
+                                 <0 0 0 2 &pcie_0 2>,
+                                 <0 0 0 3 &pcie_0 3>,
+                                 <0 0 0 4 &pcie_0 4>;
+             ranges = <0x82000000 0x00000000 0x00000000 0xc0000000 0x00000000 0x10000000
+                         0x82000000 0x00000000 0x10000000 0xd0000000 0x00000000 0x10000000>;
+     };
maintainer
#12 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 5 lines · Ley Foon Tan
Quoted 4 lines · Rob Herring
Quoted 2 lines · Ley Foon Tan

This patch adds the bindings for Altera PCIe host controller driver and Altera PCIe MSI driver.

[...]

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +2 -0
+     num-vectors = <32>;
+};
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +2 -0
new file mode 100644
index 0000000..4440db1
@@ -0,0 +1,49 @@
+* Altera PCIe controller
+
Quoted 8 lines

Documentation/devicetree/bindings/pci/altera-pcie.txt line 8

Quoted 6 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +6 -0
+Required properties:
+- compatible :       should contain "altr,pcie-root-port-1.0"
+- reg:               a list of physical base address and length for TXS and CRA.
+- reg-names: must include the following entries:
+             "Txs" or "txs": TX slave port region
+             "Cra" or "cra": Control register access region

Why both cases? Can we please just have one (or none is better IMO).

Quoted 4 lines

The PCIe IP on different device families use different register names. And our device tree generator will auto generate the register names based on the hardware description name. Too bad we can't change the hardware description names now.

Okay, your problem to maintain. Hopefully the driver just goes by index then.

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Quoted 2 lines
Quoted 1 line

txs contains the config space?

It is not the config space, but a memory slave port.

Then where is the config space? It should not be part of "ranges" is all I care about.

Rob

#13 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 14 lines · On Monday 28 September 2015 12:31:36 Rob Herring wrote:
Quoted 9 lines
Quoted 9 lines

Documentation/devicetree/bindings/pci/altera-pcie.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +7 -0
+
+Required properties:
+- compatible :       should contain "altr,pcie-root-port-1.0"
+- reg:               a list of physical base address and length for TXS and CRA.
+- reg-names: must include the following entries:
+             "Txs" or "txs": TX slave port region
+             "Cra" or "cra": Control register access region

Why both cases? Can we please just have one (or none is better IMO).

Quoted 4 lines

The PCIe IP on different device families use different register names. And our device tree generator will auto generate the register names based on the hardware description name. Too bad we can't change the hardware description names now.

Quoted 5 lines

Okay, your problem to maintain. Hopefully the driver just goes by index then.

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Are they always in the same order? If you don't mandate any names for the registers in the binding but just use them by index, we can keep that bit of ugliness out of the binding and the driver and still be compatible with all the devices.

Arnd

#14 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 17 lines · Arnd Bergmann
Quoted 16 lines · On Monday 28 September 2015 12:31:36 Rob Herring wrote:
Quoted 9 lines
Quoted 9 lines

Documentation/devicetree/bindings/pci/altera-pcie.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +7 -0
+
+Required properties:
+- compatible :       should contain "altr,pcie-root-port-1.0"
+- reg:               a list of physical base address and length for TXS and CRA.
+- reg-names: must include the following entries:
+             "Txs" or "txs": TX slave port region
+             "Cra" or "cra": Control register access region

Why both cases? Can we please just have one (or none is better IMO).

Quoted 4 lines

The PCIe IP on different device families use different register names. And our device tree generator will auto generate the register names based on the hardware description name. Too bad we can't change the hardware description names now.

Okay, your problem to maintain. Hopefully the driver just goes by index then.

Quoted 8 lines
Quoted 3 lines

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Are they always in the same order? If you don't mandate any names for the registers in the binding but just use them by index, we can keep that bit of ugliness out of the binding and the driver and still be compatible with all the devices.

Too bad the order might change in future devices. We will fix the tool, so only have one reg-name case.

Regards
Ley Foon

#15 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

In reply to Rob Herring
Quoted 27 lines · Rob Herring
Quoted 5 lines · Ley Foon Tan
Quoted 4 lines · Rob Herring
Quoted 2 lines · Ley Foon Tan

This patch adds the bindings for Altera PCIe host controller driver and Altera PCIe MSI driver.

[...]

Quoted 18 lines
Quoted 18 lines
Quoted 8 lines
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +2 -0
+     num-vectors = <32>;
+};
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +0 -0
new file mode 100644
index 0000000..4440db1

Documentation/devicetree/bindings/pci/altera-pcie.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +8 -0
@@ -0,0 +1,49 @@
+* Altera PCIe controller
+
+Required properties:
+- compatible :       should contain "altr,pcie-root-port-1.0"
+- reg:               a list of physical base address and length for TXS and CRA.
+- reg-names: must include the following entries:
+             "Txs" or "txs": TX slave port region
+             "Cra" or "cra": Control register access region

Why both cases? Can we please just have one (or none is better IMO).

Quoted 6 lines
Quoted 4 lines

The PCIe IP on different device families use different register names. And our device tree generator will auto generate the register names based on the hardware description name. Too bad we can't change the hardware description names now.

Okay, your problem to maintain. Hopefully the driver just goes by index then.

Okay, we will fix our generator tool to standardize one reg-name case and driver just use one reg-name case as well.

Quoted 10 lines

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Quoted 2 lines
Quoted 1 line

txs contains the config space?

It is not the config space, but a memory slave port.

Then where is the config space? It should not be part of "ranges" is all I care about.

The config space is not part of "ranges". Our IP uses TLP packet to access config space.

Regards
Ley Foon

#16 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 4 lines · On Friday 02 October 2015 15:53:44 Ley Foon Tan wrote:
Quoted 4 lines

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

txs contains the config space?

It is not the config space, but a memory slave port.

Then where is the config space? It should not be part of "ranges" is all I care about.

The config space is not part of "ranges". Our IP uses TLP packet to access config space.

It took me a bit to figure out what you mean here. To save others from reading the source, here is what I found:

* The config space is accessed indirectly through registers from the "cra" register range, which is the right approach according to the point that Rob made.
* hardware-wise this basically looks like bit-banged PCIe, which is both awesome and scary ;-)

Arnd

#17 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

Quoted 14 lines · On Fri, 2 Oct 2015 23:56:37 +0200 Arnd Bergmann <[email protected]> wrote:
Quoted 4 lines · On Friday 02 October 2015 15:53:44 Ley Foon Tan wrote:
Quoted 4 lines

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

txs contains the config space?

It is not the config space, but a memory slave port.

Then where is the config space? It should not be part of "ranges" is all I care about.

The config space is not part of "ranges". Our IP uses TLP packet to access config space.

Quoted 8 lines

It took me a bit to figure out what you mean here. To save others from reading the source, here is what I found:

* The config space is accessed indirectly through registers from the "cra" register range, which is the right approach according to the point that Rob made.
* hardware-wise this basically looks like bit-banged PCIe, which is both awesome and scary ;-)

drivers/pcie/host/pcie-host-gpio.c anyone? ;-)

	M.
Signature · 1 line
Jazz is not dead. It just smells funny.
#18 lore raw

Re: [PATCH v7 5/6] Documentation: dt-bindings: pci: altera pcie device tree binding

In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann
Quoted 4 lines · On Friday 02 October 2015 15:53:44 Ley Foon Tan wrote:
Quoted 4 lines

Strictly speaking, if you have undocumented bindings downstream that is your problem and we don't have to accept them as-is upstream. I'm not going to worry about that here.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

txs contains the config space?

It is not the config space, but a memory slave port.

Then where is the config space? It should not be part of "ranges" is all I care about.

The config space is not part of "ranges". Our IP uses TLP packet to access config space.

Quoted 6 lines

It took me a bit to figure out what you mean here. To save others from reading the source, here is what I found:

* The config space is accessed indirectly through registers from the "cra" register range, which is the right approach according to the point that Rob made.

You are right.

Quoted 2 lines

* hardware-wise this basically looks like bit-banged PCIe, which is both awesome and scary ;-)

#19 lore raw

PATCH v7 6/6 MAINTAINERS: Add Altera PCIe and MSI drivers maintainer

In reply to Ley Foon Tan
---
 MAINTAINERS | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
MAINTAINERS +16 -0
index 7ba7ab7..eeb9ec9 100644
@@ -7938,6 +7938,14 @@ F:	include/linux/pci*
 F:	arch/x86/pci/
 F:	arch/x86/kernel/quirks.c
 
+PCI DRIVER FOR ALTERA PCIE IP
+M:	Ley Foon Tan <[email protected]>
+L:	rfi at lists.rocketboards.org (moderated for non-subscribers)
+L:	linux-pci at vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/pci/altera-pcie.txt
+F:	drivers/pci/host/pcie-altera.c
+
 PCI DRIVER FOR ARM VERSATILE PLATFORM
 M:	Rob Herring <[email protected]>
 L:	linux-pci at vger.kernel.org
@@ -8039,6 +8047,14 @@ L:	linux-pci at vger.kernel.org
 S:	Maintained
 F:	drivers/pci/host/*spear*
 
+PCI MSI DRIVER FOR ALTERA MSI IP
+M:	Ley Foon Tan <[email protected]>
+L:	rfi at lists.rocketboards.org (moderated for non-subscribers)
+L:	linux-pci at vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
+F:	drivers/pci/host/pcie-altera-msi.c
+
 PCI MSI DRIVER FOR APPLIEDMICRO XGENE
 M:	Duc Dang <[email protected]>
 L:	linux-pci at vger.kernel.org
Signature · 1 line
1.8.2.1