Skip to contentSkip to conversation

Use the mvebu PCIe driver on Kirkwood

PATCH Superseded Thomas Petazzoni 4 participants 25 messages Apr 10, 2013 – Apr 13, 2013

Subsystems (7)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Use the mvebu PCIe driver on Kirkwood

Hello,

Here is a set of patches that migrates adds support for Kirkwood platforms to use the mvebu PCIe driver. All the Kirkwood platforms that have already been converted to the Device Tree are converted to use the new driver, and the DB-88F6281 evaluation board from Marvell is also converted to the Device Tree and the usage of the new PCIe driver.

Only non-DT platforms continue to use the legacy code in arch/arm/mach-kirkwood/pcie.c.

This branch depends on the mvebu-mbus driver and the mvebu-pcie driver. I have pushed this branch to the following Git repository for easier testing:

https://github.com/MISL-EBU-System-SW/mainline-public/tree/kirkwood-dt

# /usr/sbin/lspci
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 7846
00:02.0 PCI bridge: Marvell Technology Group Ltd. Device 7846
01:00.0 SCSI storage controller: Marvell Technology Group Ltd. 88SX7042 PCI-e 4-port SATA-II (rev 02)
02:00.0 Ethernet controller: Intel Corporation 82572EI Gigabit Ethernet Controller (Copper) (rev 06)
# cat /proc/cpuinfo | grep ^Hardware
Hardware	: Marvell Kirkwood (Flattened Device Tree)

I've tested both the e1000e NIC card and the SATA 4 ports card and they work fine.

Changes between v1 and v2:

* Remove the 'needs_pcie_win' logic, and instead move the static initialization of PCIe windows into the legacy PCIe code, for the platforms that will still be using it. Platforms that will use the new PCIe driver benefit directly from dynamic allocation of PCIe windows.

* Move the PCIe interface definitions from kirkwood.dtsi to kirkwood-6281.dtsi and kirkwood-6282.dtsi to take into account the fact that the 6281 has one PCIe interface, and the 6282 has two of them.

* Convert all DT-platforms that were initializing PCIe using the legacy driver to use the DT to initialize the PCIe interface. This includes the Iomega Iconnect, the MPL CEC4, the ZyXEL NSA310and the QNAP TS219.

* Fix the conversion to the Device Tree of the DB-88F6181/6282 board. We now have two Device Trees, one for the 6281 variant of the board (one PCIe interface) and another for the 6282 variant of the board (two PCIe interfaces).

* Update the defconfig with PCIe driver enabled and some board updates.

Best regards,

Thomas

Thomas Petazzoni (10):
pci: mvebu: enable driver usage on Kirkwood
bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood
arm: kirkwood: move PCIe window init to legacy driver
arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces
arm: kirkwood: convert Iomega Iconnect to use DT for the PCIe
interface
arm: kirkwood: convert MPL CEC4 to use DT for the PCIe interface
arm: kirkwood: convert ZyXEL NSA310 to use DT for the PCIe interface
arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface
arm: kirkwood: convert db-88f6281 to the Device Tree
arm: kirkwood: update defconfig with PCIe driver and board updates

 .../devicetree/bindings/pci/mvebu-pci.txt          |    1 +
 arch/arm/boot/dts/Makefile                         |    5 +-
 arch/arm/boot/dts/kirkwood-6281.dtsi               |   31 ++++++
 arch/arm/boot/dts/kirkwood-6282.dtsi               |   48 +++++++++
 arch/arm/boot/dts/kirkwood-db-88f6281.dts          |   30 ++++++
 arch/arm/boot/dts/kirkwood-db-88f6282.dts          |   34 ++++++
 arch/arm/boot/dts/kirkwood-db.dtsi                 |   89 ++++++++++++++++
 arch/arm/boot/dts/kirkwood-iconnect.dts            |    8 ++
 arch/arm/boot/dts/kirkwood-mplcec4.dts             |    8 ++
 arch/arm/boot/dts/kirkwood-nsa310.dts              |    8 ++
 arch/arm/boot/dts/kirkwood-ts219.dtsi              |    7 ++
 arch/arm/boot/dts/kirkwood.dtsi                    |    1 +
 arch/arm/configs/kirkwood_defconfig                |    6 +-
 arch/arm/mach-kirkwood/Kconfig                     |   21 ++--
 arch/arm/mach-kirkwood/Makefile                    |    3 +-
 arch/arm/mach-kirkwood/board-db88f6281-bp.c        |   26 +++++
 arch/arm/mach-kirkwood/board-dt.c                  |    2 +
 arch/arm/mach-kirkwood/board-iconnect.c            |    8 --
 arch/arm/mach-kirkwood/board-mplcec4.c             |    1 -
 arch/arm/mach-kirkwood/board-nsa310.c              |   25 -----
 arch/arm/mach-kirkwood/board-ts219.c               |   10 --
 arch/arm/mach-kirkwood/common.c                    |   24 -----
 arch/arm/mach-kirkwood/common.h                    |    6 ++
 arch/arm/mach-kirkwood/db88f6281-bp-setup.c        |  108 --------------------
 arch/arm/mach-kirkwood/pcie.c                      |   22 ++++
 drivers/bus/mvebu-mbus.c                           |    2 +-
 drivers/pci/host/Kconfig                           |    2 +-
 drivers/pci/host/pci-mvebu.c                       |    1 +
 28 files changed, 339 insertions(+), 198 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6281.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6282.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-db.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-db88f6281-bp.c
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
 delete mode 100644 arch/arm/mach-kirkwood/db88f6281-bp-setup.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/10 pci: mvebu: enable driver usage on Kirkwood

We allow the pci-mvebu driver to be compiled on the Kirkwood platform, and add the 'marvell,kirkwood-pcie' as a compatible string supported by the driver.

---
 .../devicetree/bindings/pci/mvebu-pci.txt          |    1 +
 drivers/pci/host/Kconfig                           |    2 +-
 drivers/pci/host/pci-mvebu.c                       |    1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pci/mvebu-pci.txt +1 -0
index eb69d92..f8d4058 100644
@@ -4,6 +4,7 @@ Mandatory properties:
 - compatible: one of the following values:
     marvell,armada-370-pcie
     marvell,armada-xp-pcie
+    marvell,kirkwood-pcie
 - #address-cells, set to <3>
 - #size-cells, set to <2>
 - #interrupt-cells, set to <1>
drivers/pci/host/Kconfig +1 -1
index 6918fbc..1f1d67f 100644
@@ -3,6 +3,6 @@ menu "PCI host controller drivers"
 
 config PCI_MVEBU
 	bool "Marvell EBU PCIe controller"
-	depends on ARCH_MVEBU
+	depends on ARCH_MVEBU || ARCH_KIRKWOOD
 
 endmenu
drivers/pci/host/pci-mvebu.c +1 -0
index 9c15a25..a083d19 100644
@@ -853,6 +853,7 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
 static const struct of_device_id mvebu_pcie_of_match_table[] = {
 	{ .compatible = "marvell,armada-xp-pcie", },
 	{ .compatible = "marvell,armada-370-pcie", },
+	{ .compatible = "marvell,kirkwood-pcie", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/10 bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood

In reply to Thomas Petazzoni

The target and attributes for the PCIe address decoding windows were not correct on Kirkwood for the second PCIe interface.

---
Note: this patch should be merged with the existing mvebu-mbus driver.

---
 drivers/bus/mvebu-mbus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mvebu-mbus.c +1 -1
index 586d03e..4de2c6b 100644
@@ -626,7 +626,7 @@ static const struct mvebu_mbus_soc_data armada_xp_mbus_data = {
 
 static const struct mvebu_mbus_mapping kirkwood_map[] = {
 	MAPDEF("pcie0.0", 4, 0xe0, MAPDEF_PCIMASK),
-	MAPDEF("pcie1.0", 8, 0xe0, MAPDEF_PCIMASK),
+	MAPDEF("pcie1.0", 4, 0xd0, MAPDEF_PCIMASK),
 	MAPDEF("sram",    3, 0x01, MAPDEF_NOMASK),
 	MAPDEF("nand",    1, 0x2f, MAPDEF_NOMASK),
 	{},
Signature · 1 line
1.7.9.5
Applied
#3 lore raw

PATCH v2 2/10 bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood

Quoted 9 lines · Thomas Petazzoni

The target and attributes for the PCIe address decoding windows were not correct on Kirkwood for the second PCIe interface.

---
Note: this patch should be merged with the existing mvebu-mbus driver.

---
 drivers/bus/mvebu-mbus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to mvebu/drivers

thx,

Jason.

#4 lore raw

PATCH v2 3/10 arm: kirkwood: move PCIe window init to legacy driver

In reply to Thomas Petazzoni

Since we are going to enable the usage of the mvebu PCIe driver on Kirkwood, we don't want the PCIe windows to be unconditionally created by kirkwood_setup_wins(). Therefore, we move the PCIe window initialization into the legacy PCIe driver (arch/arm/mach-kirkwood/pcie.c).

The platforms using the legacy driver will see their windows statically allocated by arch/arm/mach-kirkwood/pcie.c:kirkwood_pcie_init(). The platforms using the new driver in drivers/pci/ will see their windows dynamically allocated directly by the driver.

---
 arch/arm/mach-kirkwood/common.c |   24 ------------------------
 arch/arm/mach-kirkwood/pcie.c   |   22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 24 deletions(-)
arch/arm/mach-kirkwood/common.c +0 -24
index c2cae69..9b0b901 100644
@@ -654,30 +654,6 @@ char * __init kirkwood_id(void)
 
 void __init kirkwood_setup_wins(void)
 {
-	/*
-	 * The PCIe windows will no longer be statically allocated
-	 * here once Kirkwood is migrated to the pci-mvebu driver.
-	 */
-	mvebu_mbus_add_window_remap_flags("pcie0.0",
-					  KIRKWOOD_PCIE_IO_PHYS_BASE,
-					  KIRKWOOD_PCIE_IO_SIZE,
-					  KIRKWOOD_PCIE_IO_BUS_BASE,
-					  MVEBU_MBUS_PCI_IO);
-	mvebu_mbus_add_window_remap_flags("pcie0.0",
-					  KIRKWOOD_PCIE_MEM_PHYS_BASE,
-					  KIRKWOOD_PCIE_MEM_SIZE,
-					  MVEBU_MBUS_NO_REMAP,
-					  MVEBU_MBUS_PCI_MEM);
-	mvebu_mbus_add_window_remap_flags("pcie1.0",
-					  KIRKWOOD_PCIE1_IO_PHYS_BASE,
-					  KIRKWOOD_PCIE1_IO_SIZE,
-					  KIRKWOOD_PCIE1_IO_BUS_BASE,
-					  MVEBU_MBUS_PCI_IO);
-	mvebu_mbus_add_window_remap_flags("pcie1.0",
-					  KIRKWOOD_PCIE1_MEM_PHYS_BASE,
-					  KIRKWOOD_PCIE1_MEM_SIZE,
-					  MVEBU_MBUS_NO_REMAP,
-					  MVEBU_MBUS_PCI_MEM);
 	mvebu_mbus_add_window("nand", KIRKWOOD_NAND_MEM_PHYS_BASE,
 			      KIRKWOOD_NAND_MEM_SIZE);
 	mvebu_mbus_add_window("sram", KIRKWOOD_SRAM_PHYS_BASE,
arch/arm/mach-kirkwood/pcie.c +22 -0
index 7f43e6c..ddcb09f 100644
@@ -12,6 +12,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/clk.h>
+#include <linux/mbus.h>
 #include <video/vga.h>
 #include <asm/irq.h>
 #include <asm/mach/pci.h>
@@ -253,6 +254,27 @@ static void __init add_pcie_port(int index, void __iomem *base)
 
 void __init kirkwood_pcie_init(unsigned int portmask)
 {
+	mvebu_mbus_add_window_remap_flags("pcie0.0",
+					  KIRKWOOD_PCIE_IO_PHYS_BASE,
+					  KIRKWOOD_PCIE_IO_SIZE,
+					  KIRKWOOD_PCIE_IO_BUS_BASE,
+					  MVEBU_MBUS_PCI_IO);
+	mvebu_mbus_add_window_remap_flags("pcie0.0",
+					  KIRKWOOD_PCIE_MEM_PHYS_BASE,
+					  KIRKWOOD_PCIE_MEM_SIZE,
+					  MVEBU_MBUS_NO_REMAP,
+					  MVEBU_MBUS_PCI_MEM);
+	mvebu_mbus_add_window_remap_flags("pcie1.0",
+					  KIRKWOOD_PCIE1_IO_PHYS_BASE,
+					  KIRKWOOD_PCIE1_IO_SIZE,
+					  KIRKWOOD_PCIE1_IO_BUS_BASE,
+					  MVEBU_MBUS_PCI_IO);
+	mvebu_mbus_add_window_remap_flags("pcie1.0",
+					  KIRKWOOD_PCIE1_MEM_PHYS_BASE,
+					  KIRKWOOD_PCIE1_MEM_SIZE,
+					  MVEBU_MBUS_NO_REMAP,
+					  MVEBU_MBUS_PCI_MEM);
+
 	vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE;
 
 	if (portmask & KW_PCIE0)
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v2 4/10 arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces

In reply to Thomas Petazzoni

This commit adds Device Tree details to enable the PCIe interfaces on Kirkwood. The 6281 has one PCIe interface, the 6282 has two PCIe interfaces.

---
 arch/arm/boot/dts/kirkwood-6281.dtsi |   31 ++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-6282.dtsi |   48 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi      |    1 +
 3 files changed, 80 insertions(+)
arch/arm/boot/dts/kirkwood-6281.dtsi +31 -0
index d6c9d65..5137668 100644
@@ -40,5 +40,36 @@
 				marvell,function = "sdio";
 			};
 		};
+
+		pcie-controller {
+			compatible = "marvell,kirkwood-pcie";
+			status = "disabled";
+			device_type = "pci";
+
+			#address-cells = <3>;
+			#size-cells = <2>;
+
+			bus-range = <0x00 0xff>;
+
+			ranges = <0x82000000 0 0x00040000 0x00040000 0 0x00002000   /* Port 0.0 registers */
+				  0x82000000 0 0xe0000000 0xe0000000 0 0x08000000   /* non-prefetchable memory */
+			          0x81000000 0 0          0xe8000000 0 0x00100000>; /* downstream I/O */
+
+			pcie at 1,0 {
+				device_type = "pci";
+				assigned-addresses = <0x82000800 0 0x00040000 0 0x2000>;
+				reg = <0x0800 0 0 0 0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				#interrupt-cells = <1>;
+				ranges;
+				interrupt-map-mask = <0 0 0 0>;
+				interrupt-map = <0 0 0 0 &intc 9>;
+				marvell,pcie-port = <0>;
+				marvell,pcie-lane = <0>;
+				clocks = <&gate_clk 2>;
+				status = "disabled";
+			};
+		};
 	};
 };
arch/arm/boot/dts/kirkwood-6282.dtsi +48 -0

53 lines not on this page · raw message

arch/arm/boot/dts/kirkwood.dtsi +1 -0
index 2c738d9..8aae1cf 100644
@@ -19,6 +19,7 @@
 	ocp at f1000000 {
 		compatible = "simple-bus";
 		ranges = <0x00000000 0xf1000000 0x4000000
+		          0xe0000000 0xe0000000 0x8100000 /* PCIE */
 		          0xf5000000 0xf5000000 0x0000400>;
 		#address-cells = <1>;
 		#size-cells = <1>;
Signature · 1 line
1.7.9.5
maintainer
#6 lore raw

PATCH v2 4/10 arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces

Quoted 16 lines · Thomas Petazzoni

This commit adds Device Tree details to enable the PCIe interfaces on Kirkwood. The 6281 has one PCIe interface, the 6282 has two PCIe interfaces.

---
 arch/arm/boot/dts/kirkwood-6281.dtsi |   31 ++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-6282.dtsi |   48 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi      |    1 +
 3 files changed, 80 insertions(+)
arch/arm/boot/dts/kirkwood-6281.dtsi +0 -0
index d6c9d65..5137668 100644

arch/arm/boot/dts/kirkwood-6281.dtsi line 44

Quoted 5 lines
arch/arm/boot/dts/kirkwood-6281.dtsi +2 -0
@@ -40,5 +40,36 @@
 				marvell,function = "sdio";
 			};
 		};
+
+		pcie-controller {

Hi Thomas

Convention seems to be to use _ not - in these names.

Andrew

#7 lore raw

PATCH v2 4/10 arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces

Dear Andrew Lunn,

Quoted 13 lines · Andrew Lunn

arch/arm/boot/dts/kirkwood-6281.dtsi line 44

Quoted 10 lines
(quoted diff) +0 -0

b/arch/arm/boot/dts/kirkwood-6281.dtsi index d6c9d65..5137668 100644

arch/arm/boot/dts/kirkwood-6281.dtsi +2 -0
@@ -40,5 +40,36 @@
 				marvell,function = "sdio";
 			};
 		};
+
+		pcie-controller {

Hi Thomas

Quoted 1 line

Convention seems to be to use _ not - in these names.

As we discussed on IRC, there are quite a number of .dts/.dtsi files that use '-' in DT node names. Also, the PCIe DT patches for Armada 370/XP have already been merged by Jason with this exact node name. I'm fine changing it specifically for Kirkwood, but that would make it inconsistent with what we have for Armada 370/XP.

Jason, what do you think?

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#8 lore raw

PATCH v2 4/10 arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces

Quoted 18 lines · Thomas Petazzoni

Dear Andrew Lunn,

Quoted 13 lines · Andrew Lunn

arch/arm/boot/dts/kirkwood-6281.dtsi line 44

Quoted 10 lines
(quoted diff) +0 -0

b/arch/arm/boot/dts/kirkwood-6281.dtsi index d6c9d65..5137668 100644

arch/arm/boot/dts/kirkwood-6281.dtsi +2 -0
@@ -40,5 +40,36 @@
 				marvell,function = "sdio";
 			};
 		};
+
+		pcie-controller {

Hi Thomas

Quoted 1 line

Convention seems to be to use _ not - in these names.

Quoted 7 lines

As we discussed on IRC, there are quite a number of .dts/.dtsi files that use '-' in DT node names. Also, the PCIe DT patches for Armada 370/XP have already been merged by Jason with this exact node name. I'm fine changing it specifically for Kirkwood, but that would make it inconsistent with what we have for Armada 370/XP.

Jason, what do you think?

I say leave it alone. If it's that offensive to somebody, we can patch it up during the -rc cycle. I'd rather not get into *another* lengthy discussion regarding this patch-set. We need to be doing PRs today/tomorrow.

thx,

Jason.

#9 lore raw

PATCH v2 5/10 arm: kirkwood: convert Iomega Iconnect to use DT for the PCIe interface

In reply to Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-iconnect.dts |    8 ++++++++
 arch/arm/mach-kirkwood/board-iconnect.c |    8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/boot/dts/kirkwood-iconnect.dts +8 -0
index 504f16b..4c8f0df 100644
@@ -110,6 +110,14 @@
 				reg = <0x980000 0x1f400000>;
 			};
 		};
+
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-iconnect.c +0 -8
index c8ebde4..98b5ad1 100644
@@ -22,11 +22,3 @@ void __init iconnect_init(void)
 {
 	kirkwood_ge00_init(&iconnect_ge00_data);
 }
-
-static int __init iconnect_pci_init(void)
-{
-	if (of_machine_is_compatible("iom,iconnect"))
-		kirkwood_pcie_init(KW_PCIE0);
-	return 0;
-}
-subsys_initcall(iconnect_pci_init);
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v2 6/10 arm: kirkwood: convert MPL CEC4 to use DT for the PCIe interface

In reply to Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-mplcec4.dts |    8 ++++++++
 arch/arm/mach-kirkwood/board-mplcec4.c |    1 -
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/arm/boot/dts/kirkwood-mplcec4.dts +8 -0
index 662dfd8..080f28e 100644
@@ -140,6 +140,14 @@
 			cd-gpios = <&gpio1 15 0>;
 			/* No WP GPIO */
 		};
+
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-mplcec4.c +0 -1
index 7d6dc66..938712e 100644
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
 	 */
 	kirkwood_ge00_init(&mplcec4_ge00_data);
 	kirkwood_ge01_init(&mplcec4_ge01_data);
-	kirkwood_pcie_init(KW_PCIE0);
 }
 
 
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH v2 7/10 arm: kirkwood: convert ZyXEL NSA310 to use DT for the PCIe interface

In reply to Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

Since it was the only device left that prevented this platform to use the Device Tree only, we remove the board-nsa310.c file and the related Kconfig/Makefile bits.

---
 arch/arm/boot/dts/kirkwood-nsa310.dts |    8 ++++++++
 arch/arm/mach-kirkwood/Kconfig        |    8 --------
 arch/arm/mach-kirkwood/Makefile       |    1 -
 arch/arm/mach-kirkwood/board-nsa310.c |   25 -------------------------
 4 files changed, 8 insertions(+), 34 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
arch/arm/boot/dts/kirkwood-nsa310.dts +8 -0
index 3a178cf..1cd15ba 100644
@@ -177,6 +177,14 @@
 				reg = <0x5040000 0x2fc0000>;
 			};
 		};
+
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 
 	gpio_keys {
arch/arm/mach-kirkwood/Kconfig +0 -8
index 7b6a64b..1fe5f2f 100644
@@ -287,14 +287,6 @@ config MACH_T5325
 	  Say 'Y' here if you want your kernel to support the
 	  HP t5325 Thin Client.
 
-config MACH_NSA310_DT
-	bool "ZyXEL NSA-310 (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	select ARM_ATAG_DTB_COMPAT
-	help
-	  Say 'Y' here if you want your kernel to support the
-	  ZyXEL NSA-310 board (Flattened Device Tree).
-
 endmenu
 
 endif
arch/arm/mach-kirkwood/Makefile +0 -1
index d805f80..0e5ccad 100644
@@ -37,6 +37,5 @@ obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NSA310_DT)		+= board-nsa310.o
 obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
 obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-nsa310.c deleted +0 -25
deleted file mode 100644
index 55ade93..0000000
@@ -1,25 +0,0 @@
-/*
- * arch/arm/mach-kirkwood/nsa-310-setup.c
- *
- * ZyXEL NSA-310 Setup
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <mach/kirkwood.h>
-#include <linux/of.h>
-#include "common.h"
-
-static int __init nsa310_pci_init(void)
-{
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-
-subsys_initcall(nsa310_pci_init);
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

In reply to Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-ts219.dtsi |    7 +++++++
 arch/arm/mach-kirkwood/board-ts219.c  |   10 ----------
 2 files changed, 7 insertions(+), 10 deletions(-)
arch/arm/boot/dts/kirkwood-ts219.dtsi +7 -0
index 64ea27c..341e1d8 100644
@@ -74,5 +74,12 @@
 			status = "okay";
 			nr-ports = <2>;
 		};
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 };
arch/arm/mach-kirkwood/board-ts219.c +0 -10
index acb0187..4695d5f 100644
@@ -41,13 +41,3 @@ void __init qnap_dt_ts219_init(void)
 
 	pm_power_off = qnap_tsx1x_power_off;
 }
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

Quoted 35 lines · Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-ts219.dtsi |    7 +++++++
 arch/arm/mach-kirkwood/board-ts219.c  |   10 ----------
 2 files changed, 7 insertions(+), 10 deletions(-)
arch/arm/boot/dts/kirkwood-ts219.dtsi +7 -0
index 64ea27c..341e1d8 100644
@@ -74,5 +74,12 @@
 			status = "okay";
 			nr-ports = <2>;
 		};
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 };
arch/arm/mach-kirkwood/board-ts219.c +0 -0
index acb0187..4695d5f 100644
@@ -41,13 +41,3 @@ void __init qnap_dt_ts219_init(void)
 
 	pm_power_off = qnap_tsx1x_power_off;
 }

arch/arm/mach-kirkwood/board-ts219.c void __init qnap_dt_ts219_init(void) · line 53

Quoted 10 lines
arch/arm/mach-kirkwood/board-ts219.c +0 -10
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);

This doesn't look right. There are two dts files, one for 6281, and one for 6282...

thx,

Jason.

maintainer
#14 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

Quoted 50 lines · Jason Cooper
Quoted 35 lines · Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-ts219.dtsi |    7 +++++++
 arch/arm/mach-kirkwood/board-ts219.c  |   10 ----------
 2 files changed, 7 insertions(+), 10 deletions(-)
arch/arm/boot/dts/kirkwood-ts219.dtsi +7 -0
index 64ea27c..341e1d8 100644
@@ -74,5 +74,12 @@
 			status = "okay";
 			nr-ports = <2>;
 		};
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 };
arch/arm/mach-kirkwood/board-ts219.c +0 -0
index acb0187..4695d5f 100644
@@ -41,13 +41,3 @@ void __init qnap_dt_ts219_init(void)
 
 	pm_power_off = qnap_tsx1x_power_off;
 }

arch/arm/mach-kirkwood/board-ts219.c void __init qnap_dt_ts219_init(void) · line 53

Quoted 10 lines
arch/arm/mach-kirkwood/board-ts219.c +0 -10
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);

This doesn't look right. There are two dts files, one for 6281, and one for 6282...

Quoted 3 lines

thx,

Jason.

Hi Jason

It has been broken for a while, hence the FIXME!

Looking at the old style code, only a machine whos bootloader passed the machine ID ts219 has PCI. This is the only difference between ts219 and all other similar devices that use this DT description.

The FIXME comment is referring to a comment in the code:

        MPP44_GPIO,             /* Board ID: 0: TS-11x, 1: TS-21x */

so it seems like you can read this gpio line but strictly, this tells you how many disks bays the box has, and not if its a ts219.

I've hacked around with PCI driver on my QNAP TS119P+, which does not have any PCI devices, and never had any problems with the driver enabled and finding two empty PCI busses. PCI does not share any pins with anything else. So i think it is safe to just enable it for all devices.

I will test it out on my device and report back.

Andrew

#15 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

Quoted 5 lines · Andrew Lunn

I've hacked around with PCI driver on my QNAP TS119P+, which does not have any PCI devices, and never had any problems with the driver enabled and finding two empty PCI busses. PCI does not share any pins with anything else. So i think it is safe to just enable it for all devices.

In the general case, this is probably only safe if the board has configured the PEX to have the PHY clock. Marvell has guidelines for unused PEX's that would result in the PHY clock being permanently inactive.

Register 10030 tells what the strap for the PHY clock is. I expect in many cases the PEX driver should not be loaded if the PHY clock is not internally derived. Maybe checking this register will tell your QNAPs apart?

Jason

maintainer
#16 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

Quoted 13 lines · Jason Gunthorpe
Quoted 5 lines · Andrew Lunn

I've hacked around with PCI driver on my QNAP TS119P+, which does not have any PCI devices, and never had any problems with the driver enabled and finding two empty PCI busses. PCI does not share any pins with anything else. So i think it is safe to just enable it for all devices.

In the general case, this is probably only safe if the board has configured the PEX to have the PHY clock. Marvell has guidelines for unused PEX's that would result in the PHY clock being permanently inactive.

Quoted 4 lines

Register 10030 tells what the strap for the PHY clock is. I expect in many cases the PEX driver should not be loaded if the PHY clock is not internally derived. Maybe checking this register will tell your QNAPs apart?

Hi Jason

I did a bit of experimentation and reading of documents.

My QNAP, which has nothing on the PCI bus, has bit 14 of register 10030, the Sample At Reset, set. This indicates it should derive the PCIe clock from the internal clock.

I also played with Topkick. It also has bit 14 set, and is quite happy having the PCI driver loaded, even though there is nothing on the bus, and USI website makes no reference to PCIe, so i don't think there is an hardware support for PCIe devices.

The hardware manual says that this strapping pin has an internal pullup, so it will default to one, internal clock.

So, to have a problem, it would mean the hardware designed has deliberately pulled the strapping pin low to indicate external clock, and not actually applied an external clock. Is this likely? Given my QNAP board is not designed to have active PCIe, i kind of expect if QNAP where to do such a thing, it would be so on my board....

So i'm tempted to go with Thomas's patch, once fixed, so enabling loading of the PCI driver for all QNAP devices. If we get reports of issues, we can then look at the specific hardware and decide what to do.

Andrew

#17 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

Dear Andrew Lunn,

Quoted 4 lines · Andrew Lunn

So i'm tempted to go with Thomas's patch, once fixed, so enabling loading of the PCI driver for all QNAP devices. If we get reports of issues, we can then look at the specific hardware and decide what to do.

So to conclude, which fix should I apply to my patch set?

Thanks a lot for all your investigations!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
maintainer
#18 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

In reply to Andrew Lunn
Quoted 15 lines

Hi Jason

It has been broken for a while, hence the FIXME!

Looking at the old style code, only a machine whos bootloader passed the machine ID ts219 has PCI. This is the only difference between ts219 and all other similar devices that use this DT description.

The FIXME comment is referring to a comment in the code:

        MPP44_GPIO,             /* Board ID: 0: TS-11x, 1: TS-21x */

so it seems like you can read this gpio line but strictly, this tells you how many disks bays the box has, and not if its a ts219.

Quoted 7 lines

I've hacked around with PCI driver on my QNAP TS119P+, which does not have any PCI devices, and never had any problems with the driver enabled and finding two empty PCI busses. PCI does not share any pins with anything else. So i think it is safe to just enable it for all devices.

I will test it out on my device and report back.

Hi Jason

Once i hacked around the DT issue, i have it booting and detecting the PCI:

root at qnap:~# lspci -v
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 7846 (prog-if 00 [Norm)
Flags: bus master, 66MHz, user-definable features, ?? devsel, latency 0
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
Capabilities: [fc] <chain broken>

As expected, nothing on the bus.

In the kernel log is:

mvebu-pcie pcie-controller.1: PCIe0.0: link up
mvebu-pcie pcie-controller.1: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [io 0x1000-0xfffff]
pci_bus 0000:00: root bus resource [mem 0xe0000000-0xe7ffffff] pci_bus 0000:00: root bus resource [bus 00-ff]
pci 0000:00:01.0: [11ab:7846] type 01 class 0x060400
PCI: bus0: Fast back to back transfers disabled
pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
PCI: bus1: Fast back to back transfers enabled
pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
pci 0000:00:01.0: PCI bridge to [bus 01]
PCI: enabling device 0000:00:01.0 (0140 -> 0143)

root at qnap:/debug/mvebu-mbus# cat devices
[00] disabled
[01] disabled
[02] disabled
[03] disabled
[04] 00000000f4000000 - 00000000f4010000 : nand
[05] 00000000f5000000 - 00000000f5010000 : sram
[06] disabled
[07] disabled

So i guess that means its not allocated any windows either.

I will go investigate the PEX clock strapping as suggested by Jason.

Andrew

maintainer
#19 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

In reply to Thomas Petazzoni
Quoted 17 lines · Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-ts219.dtsi |    7 +++++++
 arch/arm/mach-kirkwood/board-ts219.c  |   10 ----------
 2 files changed, 7 insertions(+), 10 deletions(-)
arch/arm/boot/dts/kirkwood-ts219.dtsi +0 -0
index 64ea27c..341e1d8 100644
@@ -74,5 +74,12 @@
 			status = "okay";
 			nr-ports = <2>;

arch/arm/boot/dts/kirkwood-ts219.dtsi line 85

Quoted 10 lines
arch/arm/boot/dts/kirkwood-ts219.dtsi +7 -0
 		};
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 };

Hi Thomas

There is some DT weirdness going on here. With that you have above, the .dtb file has both status="disabled" when i convert it back to dts format.

In order to get it to work, i had to move this fragment into the kirkwood-ts219-628[12].dtsi files.

Can some dtc guru comment if this is supposed to work with the arrangement of includes we have?

Thanks
Andrew

maintainer
#20 lore raw

PATCH v2 8/10 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

Quoted 35 lines · Andrew Lunn
Quoted 17 lines · Thomas Petazzoni

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-ts219.dtsi |    7 +++++++
 arch/arm/mach-kirkwood/board-ts219.c  |   10 ----------
 2 files changed, 7 insertions(+), 10 deletions(-)
arch/arm/boot/dts/kirkwood-ts219.dtsi +0 -0
index 64ea27c..341e1d8 100644
@@ -74,5 +74,12 @@
 			status = "okay";
 			nr-ports = <2>;

arch/arm/boot/dts/kirkwood-ts219.dtsi line 85

Quoted 10 lines
arch/arm/boot/dts/kirkwood-ts219.dtsi +7 -0
 		};
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 };

Hi Thomas

There is some DT weirdness going on here. With that you have above, the .dtb file has both status="disabled" when i convert it back to dts format.

Quoted 5 lines

In order to get it to work, i had to move this fragment into the kirkwood-ts219-628[12].dtsi files.

Can some dtc guru comment if this is supposed to work with the arrangement of includes we have?

Hi Thomas

I got my head around what is happening here.

When the dtc merges nodes, it replaces an old property value with the new proper value. For this "okay" above to work, is has to be the new property. When in fact, due to the order of the include files, it was actually the old property value. It was reading kirkwood-ts219.dtsi first, and then later merging in kirkwood-6282.dtsi, replacing the status okay with status disabled :-(

I will send an updated version soon.

Andrew

maintainer
#21 lore raw

PATCH 1/1 arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface

In reply to Thomas Petazzoni

From: Thomas Petazzoni <[email protected]>

Now that the PCIe mvebu driver is usable on Kirkwood, use it instead of the legacy PCIe code, since it allows to describe the PCIe interfaces in the Device Tree.

---
 arch/arm/boot/dts/kirkwood-ts219-6281.dts |    3 ++-
 arch/arm/boot/dts/kirkwood-ts219-6282.dts |    3 ++-
 arch/arm/boot/dts/kirkwood-ts219.dtsi     |    9 +++++++--
 arch/arm/mach-kirkwood/board-ts219.c      |   10 ----------
 4 files changed, 11 insertions(+), 14 deletions(-)
arch/arm/boot/dts/kirkwood-ts219-6281.dts +2 -1
index 8295c83..42648ab 100644
@@ -1,7 +1,8 @@
 /dts-v1/;
 
-/include/ "kirkwood-ts219.dtsi"
+/include/ "kirkwood.dtsi"
 /include/ "kirkwood-6281.dtsi"
+/include/ "kirkwood-ts219.dtsi"
 
 / {
 	ocp at f1000000 {
arch/arm/boot/dts/kirkwood-ts219-6282.dts +2 -1
index df3f95d..95ceeb9 100644
@@ -1,7 +1,8 @@
 /dts-v1/;
 
-/include/ "kirkwood-ts219.dtsi"
+/include/ "kirkwood.dtsi"
 /include/ "kirkwood-6282.dtsi"
+/include/ "kirkwood-ts219.dtsi"
 
 / {
 	ocp at f1000000 {
arch/arm/boot/dts/kirkwood-ts219.dtsi +7 -2
index 64ea27c..7c022fd 100644
@@ -1,5 +1,3 @@
-/include/ "kirkwood.dtsi"
-
 / {
 	model = "QNAP TS219 family";
 	compatible = "qnap,ts219", "marvell,kirkwood";
@@ -74,5 +72,12 @@
 			status = "okay";
 			nr-ports = <2>;
 		};
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
 	};
 };
arch/arm/mach-kirkwood/board-ts219.c +0 -10
index acb0187..4695d5f 100644
@@ -41,13 +41,3 @@ void __init qnap_dt_ts219_init(void)
 
 	pm_power_off = qnap_tsx1x_power_off;
 }
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);
Signature · 1 line
1.7.10.4
#22 lore raw

PATCH v2 9/10 arm: kirkwood: convert db-88f6281 to the Device Tree

In reply to Thomas Petazzoni

This commit converts the Marvell DB-88F6281/DB-88F6282 board to the Device Tree. In fact, the code was supporting two different boards:
one with the 6281 SoC variant, and one with the 6282 SoC variant. The difference between the two being that the 6281 has one PCIe interface, and the 6282 has two PCIe interfaces.

In order to handle that with the Device Tree, we create a 'kirkwood-db.dtsi' file that contains the definitions common to both boards, and 'kirkwood-db-88f6281.dts' and 'kirkwood-db-88f6282.dts' for the definitions specific to each board. This is similar to what is done for the QNAP TS219 Kirkwood platform.

We have kept one single Kconfig option, just like it was before.

---
 arch/arm/boot/dts/Makefile                  |    5 +-
 arch/arm/boot/dts/kirkwood-db-88f6281.dts   |   30 ++++++++
 arch/arm/boot/dts/kirkwood-db-88f6282.dts   |   34 +++++++++
 arch/arm/boot/dts/kirkwood-db.dtsi          |   89 ++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig              |   13 ++--
 arch/arm/mach-kirkwood/Makefile             |    2 +-
 arch/arm/mach-kirkwood/board-db88f6281-bp.c |   26 +++++++
 arch/arm/mach-kirkwood/board-dt.c           |    2 +
 arch/arm/mach-kirkwood/common.h             |    6 ++
 arch/arm/mach-kirkwood/db88f6281-bp-setup.c |  108 ---------------------------
 10 files changed, 199 insertions(+), 116 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6281.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6282.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-db.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-db88f6281-bp.c
 delete mode 100644 arch/arm/mach-kirkwood/db88f6281-bp-setup.c
arch/arm/boot/dts/Makefile +4 -1
index 9c62558..f28a23e 100644
@@ -51,7 +51,10 @@ dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
 dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
 	integratorcp.dtb
 dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
-dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
+dtb-$(CONFIG_ARCH_KIRKWOOD) += \
+	kirkwood-db-88f6281.dtb \
+	kirkwood-db-88f6282.dtb \
+	kirkwood-dns320.dtb \
 	kirkwood-dns325.dtb \
 	kirkwood-dockstar.dtb \
 	kirkwood-dreamplug.dtb \
arch/arm/boot/dts/kirkwood-db-88f6281.dts new file +30 -0
new file mode 100644
index 0000000..9d777ed
@@ -0,0 +1,30 @@
+/*
+ * Marvell DB-88F6281-BP Development Board Setup
+ *
+ * Saeed Bishara <[email protected]>
+ * Thomas Petazzoni <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "kirkwood-db.dtsi"
+/include/ "kirkwood-6281.dtsi"
+
+/ {
+	model = "Marvell DB-88F6281-BP Development Board";
+	compatible = "marvell,db-88f6281-bp", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	ocp at f1000000 {
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-db-88f6282.dts new file +34 -0
new file mode 100644
index 0000000..f4c8528
@@ -0,0 +1,34 @@
+/*
+ * Marvell DB-88F6282-BP Development Board Setup
+ *
+ * Saeed Bishara <[email protected]>
+ * Thomas Petazzoni <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "kirkwood-db.dtsi"
+/include/ "kirkwood-6282.dtsi"
+
+/ {
+	model = "Marvell DB-88F6282-BP Development Board";
+	compatible = "marvell,db-88f6282-bp", "marvell,kirkwood-88f6282", "marvell,kirkwood";
+
+	ocp at f1000000 {
+		pcie-controller {
+			status = "okay";
+
+			pcie at 1,0 {
+				status = "okay";
+			};
+
+			pcie at 2,0 {
+				status = "okay";
+			};
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-db.dtsi new file +89 -0

89 lines not on this page · raw message

arch/arm/mach-kirkwood/Kconfig +7 -6
index 1fe5f2f..b09afca 100644
@@ -2,12 +2,6 @@ if ARCH_KIRKWOOD
 
 menu "Marvell Kirkwood Implementations"
 
-config MACH_DB88F6281_BP
-	bool "Marvell DB-88F6281-BP Development Board"
-	help
-	  Say 'Y' here if you want your kernel to support the
-	  Marvell DB-88F6281-BP Development Board.
-
 config MACH_RD88F6192_NAS
 	bool "Marvell RD-88F6192-NAS Reference Board"
 	help
@@ -58,6 +52,13 @@ config ARCH_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Kirkwood using flattened device tree.
 
+config MACH_DB88F6281_BP_DT
+	bool "Marvell DB-88F6281-BP Development Board (Flattened Device Tree)"
+	help
+	  Say 'Y' here if you want your kernel to support the Marvell
+	  DB-88F6281-BP and DB-88F6282-BP Development Board (Flattened
+	  Device Tree).
+
 config MACH_GURUPLUG_DT
 	bool "Marvell GuruPlug Reference Board (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
arch/arm/mach-kirkwood/Makefile +1 -1
index 0e5ccad..e6a88ab 100644
@@ -1,6 +1,5 @@
 obj-y				+= common.o irq.o pcie.o mpp.o
 
-obj-$(CONFIG_MACH_DB88F6281_BP)		+= db88f6281-bp-setup.o
 obj-$(CONFIG_MACH_RD88F6192_NAS)	+= rd88f6192-nas-setup.o
 obj-$(CONFIG_MACH_RD88F6281)		+= rd88f6281-setup.o
 obj-$(CONFIG_MACH_MV88F6281GTW_GE)	+= mv88f6281gtw_ge-setup.o
@@ -20,6 +19,7 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
+obj-$(CONFIG_MACH_DB88F6281_BP_DT)	+= board-db88f6281-bp.o
 obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
 obj-$(CONFIG_MACH_GURUPLUG_DT)		+= board-guruplug.o
 obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
arch/arm/mach-kirkwood/board-db88f6281-bp.c new file +26 -0
new file mode 100644
index 0000000..bffd160
@@ -0,0 +1,26 @@
+/*
+ * arch/arm/mach-kirkwood/db88f6281-bp-setup.c
+ *
+ * Saeed Bishara <[email protected]>
+ *
+ * Marvell DB-88F6281-BP Development Board Setup
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/mv643xx_eth.h>
+#include "common.h"
+
+static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+void __init db88f6281_init(void)
+{
+	kirkwood_ge00_init(&db88f6281_ge00_data);
+}
arch/arm/mach-kirkwood/board-dt.c +2 -0
index ea49476..b6cb807 100644
@@ -165,6 +165,8 @@ static const char * const kirkwood_dt_board_compat[] = {
 	"lacie,netspace_v2",
 	"lacie,netspace_lite_v2",
 	"lacie,netspace_mini_v2",
+	"marvell,db-88f6281-bp",
+	"marvell,db-88f6282-bp",
 	"mpl,cec4",
 	"plathome,openblocks-a6",
 	"usi,topkick",
arch/arm/mach-kirkwood/common.h +6 -0
index e24f743..d174ab5 100644
@@ -119,6 +119,12 @@ void km_kirkwood_init(void);
 static inline void km_kirkwood_init(void) {};
 #endif
 
+#ifdef CONFIG_MACH_DB88F6281_BP_DT
+void db88f6281_init(void);
+#else
+static inline void db88f6281_init(void) {};
+#endif
+
 #ifdef CONFIG_MACH_MPLCEC4_DT
 void mplcec4_init(void);
 #else
arch/arm/mach-kirkwood/db88f6281-bp-setup.c deleted +0 -108

108 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#23 lore raw

PATCH v2 10/10 arm: kirkwood: update defconfig with PCIe driver and board updates

In reply to Thomas Petazzoni

This commit enables the mvebu PCIe driver in kirkwood_defconfig and updates various options related to Kirkwood boards.

---
 arch/arm/configs/kirkwood_defconfig |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/configs/kirkwood_defconfig +3 -3
index 13482ea..c5275ea 100644
@@ -10,13 +10,13 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_ARCH_KIRKWOOD=y
-CONFIG_MACH_DB88F6281_BP=y
 CONFIG_MACH_RD88F6192_NAS=y
 CONFIG_MACH_RD88F6281=y
 CONFIG_MACH_MV88F6281GTW_GE=y
 CONFIG_MACH_SHEEVAPLUG=y
 CONFIG_MACH_ESATA_SHEEVAPLUG=y
-CONFIG_MACH_GURUPLUG=y
+CONFIG_MACH_DB88F6281_BP_DT=y
+CONFIG_MACH_GURUPLUG_DT=y
 CONFIG_MACH_DREAMPLUG_DT=y
 CONFIG_MACH_ICONNECT_DT=y
 CONFIG_MACH_DLINK_KIRKWOOD_DT=y
@@ -48,8 +48,8 @@ CONFIG_MACH_D2NET_V2=y
 CONFIG_MACH_NET2BIG_V2=y
 CONFIG_MACH_NET5BIG_V2=y
 CONFIG_MACH_T5325=y
-CONFIG_MACH_NSA310_DT=y
 # CONFIG_CPU_FEROCEON_OLD_ID is not set
+CONFIG_PCI_MVEBU=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
Signature · 1 line
1.7.9.5
maintainer
#24 lore raw

v2 cover Use the mvebu PCIe driver on Kirkwood

In reply to Thomas Petazzoni
Quoted 100 lines · Thomas Petazzoni

Hello,

Here is a set of patches that migrates adds support for Kirkwood platforms to use the mvebu PCIe driver. All the Kirkwood platforms that have already been converted to the Device Tree are converted to use the new driver, and the DB-88F6281 evaluation board from Marvell is also converted to the Device Tree and the usage of the new PCIe driver.

Only non-DT platforms continue to use the legacy code in arch/arm/mach-kirkwood/pcie.c.

This branch depends on the mvebu-mbus driver and the mvebu-pcie driver. I have pushed this branch to the following Git repository for easier testing:

https://github.com/MISL-EBU-System-SW/mainline-public/tree/kirkwood-dt

# /usr/sbin/lspci
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 7846
00:02.0 PCI bridge: Marvell Technology Group Ltd. Device 7846
01:00.0 SCSI storage controller: Marvell Technology Group Ltd. 88SX7042 PCI-e 4-port SATA-II (rev 02)
02:00.0 Ethernet controller: Intel Corporation 82572EI Gigabit Ethernet Controller (Copper) (rev 06)
# cat /proc/cpuinfo | grep ^Hardware
Hardware	: Marvell Kirkwood (Flattened Device Tree)

I've tested both the e1000e NIC card and the SATA 4 ports card and they work fine.

Changes between v1 and v2:

* Remove the 'needs_pcie_win' logic, and instead move the static initialization of PCIe windows into the legacy PCIe code, for the platforms that will still be using it. Platforms that will use the new PCIe driver benefit directly from dynamic allocation of PCIe windows.

* Move the PCIe interface definitions from kirkwood.dtsi to kirkwood-6281.dtsi and kirkwood-6282.dtsi to take into account the fact that the 6281 has one PCIe interface, and the 6282 has two of them.

* Convert all DT-platforms that were initializing PCIe using the legacy driver to use the DT to initialize the PCIe interface. This includes the Iomega Iconnect, the MPL CEC4, the ZyXEL NSA310and the QNAP TS219.

* Fix the conversion to the Device Tree of the DB-88F6181/6282 board. We now have two Device Trees, one for the 6281 variant of the board (one PCIe interface) and another for the 6282 variant of the board (two PCIe interfaces).

* Update the defconfig with PCIe driver enabled and some board updates.

Best regards,

Thomas

Thomas Petazzoni (10):
pci: mvebu: enable driver usage on Kirkwood
bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood
arm: kirkwood: move PCIe window init to legacy driver
arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces
arm: kirkwood: convert Iomega Iconnect to use DT for the PCIe
interface
arm: kirkwood: convert MPL CEC4 to use DT for the PCIe interface
arm: kirkwood: convert ZyXEL NSA310 to use DT for the PCIe interface
arm: kirkwood: convert QNAP TS219 to use DT for the PCIe interface
arm: kirkwood: convert db-88f6281 to the Device Tree
arm: kirkwood: update defconfig with PCIe driver and board updates

 .../devicetree/bindings/pci/mvebu-pci.txt          |    1 +
 arch/arm/boot/dts/Makefile                         |    5 +-
 arch/arm/boot/dts/kirkwood-6281.dtsi               |   31 ++++++
 arch/arm/boot/dts/kirkwood-6282.dtsi               |   48 +++++++++
 arch/arm/boot/dts/kirkwood-db-88f6281.dts          |   30 ++++++
 arch/arm/boot/dts/kirkwood-db-88f6282.dts          |   34 ++++++
 arch/arm/boot/dts/kirkwood-db.dtsi                 |   89 ++++++++++++++++
 arch/arm/boot/dts/kirkwood-iconnect.dts            |    8 ++
 arch/arm/boot/dts/kirkwood-mplcec4.dts             |    8 ++
 arch/arm/boot/dts/kirkwood-nsa310.dts              |    8 ++
 arch/arm/boot/dts/kirkwood-ts219.dtsi              |    7 ++
 arch/arm/boot/dts/kirkwood.dtsi                    |    1 +
 arch/arm/configs/kirkwood_defconfig                |    6 +-
 arch/arm/mach-kirkwood/Kconfig                     |   21 ++--
 arch/arm/mach-kirkwood/Makefile                    |    3 +-
 arch/arm/mach-kirkwood/board-db88f6281-bp.c        |   26 +++++
 arch/arm/mach-kirkwood/board-dt.c                  |    2 +
 arch/arm/mach-kirkwood/board-iconnect.c            |    8 --
 arch/arm/mach-kirkwood/board-mplcec4.c             |    1 -
 arch/arm/mach-kirkwood/board-nsa310.c              |   25 -----
 arch/arm/mach-kirkwood/board-ts219.c               |   10 --
 arch/arm/mach-kirkwood/common.c                    |   24 -----
 arch/arm/mach-kirkwood/common.h                    |    6 ++
 arch/arm/mach-kirkwood/db88f6281-bp-setup.c        |  108 --------------------
 arch/arm/mach-kirkwood/pcie.c                      |   22 ++++
 drivers/bus/mvebu-mbus.c                           |    2 +-
 drivers/pci/host/Kconfig                           |    2 +-
Quoted 12 lines
 drivers/pci/host/pci-mvebu.c                       |    1 +
 28 files changed, 339 insertions(+), 198 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6281.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6282.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-db.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-db88f6281-bp.c
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
 delete mode 100644 arch/arm/mach-kirkwood/db88f6281-bp-setup.c
Signature · 1 line
1.7.9.5

Hi Thomas

So i tested on QNAP and Topkick. Neither of which actually have any PCI devices on the busses. So you can add my some what worthless:

Andrew