Skip to contentSkip to conversation

Use the mvebu PCIe driver on Kirkwood

RFC PATCH New Thomas Petazzoni 4 participants 14 messages Mar 27, 2013 – Apr 3, 2013

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover Use the mvebu PCIe driver on Kirkwood

Hello,

Here is a set of five patches that demonstrate that the mvebu PCIe driver can be used on Kirkwood with no modification at all. Those patches are not meant to be applied yet, the Device Trees are not completely correct yet (they don't take into account the fact that 6281 has one PCIe interface and 6282 has two PCIe interface).

It took less than two hours to enable PCIe on Kirkwood (and in those two hours, the conversion of the DB-88F6281 board to the Device Tree has been done as well), and the result works fine:

# /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.

Best regards,

Thomas

Thomas Petazzoni (5):
pci: mvebu: enable driver usage on Kirkwood
bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood
arm: mach-kirkwood: seperate PCIe window init from other windows
arm: kirkwood: add SoC-level Device Tree data for PCIe interfaces
arm: kirkwood: convert db-88f6281 to the Device Tree

 .../devicetree/bindings/pci/mvebu-pci.txt          |    1 +
 arch/arm/boot/dts/Makefile                         |    1 +
 arch/arm/boot/dts/kirkwood-db-88f6281.dts          |   96 +++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi                    |   49 +++++++++
 arch/arm/mach-kirkwood/Kconfig                     |   12 +--
 arch/arm/mach-kirkwood/Makefile                    |    2 +-
 arch/arm/mach-kirkwood/board-db88f6281-bp.c        |   26 +++++
 arch/arm/mach-kirkwood/board-dt.c                  |   11 ++
 arch/arm/mach-kirkwood/common.c                    |    7 +-
 arch/arm/mach-kirkwood/common.h                    |    7 ++
 arch/arm/mach-kirkwood/db88f6281-bp-setup.c        |  108 --------------------
 drivers/bus/mvebu-mbus.c                           |    2 +-
 drivers/pci/host/Kconfig                           |    2 +-
 drivers/pci/host/pci-mvebu.c                       |    1 +
 14 files changed, 207 insertions(+), 118 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6281.dts
 create mode 100644 arch/arm/mach-kirkwood/board-db88f6281-bp.c
 delete mode 100644 arch/arm/mach-kirkwood/db88f6281-bp-setup.c
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/5 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 289babd..8d6b5ea 100644
@@ -901,6 +901,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

RFC PATCH 2/5 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
#3 lore raw

RFC PATCH 2/5 bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood

Jason (Cooper),

Do you mind taking this patch in your mvebu/drivers branch, next to the patch adding the mvebu-mbus driver? Or do you want a new mvebu-mbus driver patch that contains this fix and would replace the one you have already merged in mvebu/drivers?

Thanks!

Thomas

Quoted 23 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(-)
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 · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

RFC PATCH 2/5 bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood

Thomas,

Quoted 6 lines · Thomas Petazzoni

Jason (Cooper),

Do you mind taking this patch in your mvebu/drivers branch, next to the patch adding the mvebu-mbus driver? Or do you want a new mvebu-mbus driver patch that contains this fix and would replace the one you have already merged in mvebu/drivers?

Thanks for pointing this out. I'll put it in mvebu/drivers as you suggested. I'll need to rebase mvebu/soc on it. But I haven't done the PR yet, so not a big deal.

thx,

Jason.

Quoted 24 lines · Thomas Petazzoni
Quoted 23 lines

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),
 	{},
#5 lore raw

RFC PATCH 2/5 bus: mvebu: fix mistake in PCIe window target attribute for Kirkwood

Dear Jason Cooper,

Quoted 3 lines · Jason Cooper

Thanks for pointing this out. I'll put it in mvebu/drivers as you suggested. I'll need to rebase mvebu/soc on it. But I haven't done the PR yet, so not a big deal.

Ok, thanks. I'll finalize the cleanup of the kirkwood PCIe branch in order to be able to submit a version that hopefully should be acceptable.

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
#6 lore raw

RFC PATCH 3/5 arm: mach-kirkwood: seperate PCIe window init from other windows

In reply to Thomas Petazzoni

Since we are going to enable the usage of the mvebu PCIe driver on Kirkwood, we need a way to disable the static addition of address decoding windows currently done by the Kirkwood code. In order to do this, we split the initialization of windows in two functions: one function for the PCIe windows, and a second function for the other windows.

Then, we have three cases:

* non-DT platforms: PCIe windows are always initialized statically, by a call to kirkwood_setup_pcie_wins() in mach-kirkwood/commonc:kirkwood_init().

* DT platforms that don't yet use the mvebu PCIe driver (example:
board-iconnect.c). The kirkwood_setup_pcie_wins() function is called from mach-kirkwood/board-dt.c:kirkwood_dt_init(), because needs_pcie_wins is true.

* DT platforms that use the mvebu PCIe driver (none as of this patch). They will set needs_pcie_wins to false in mach-kirkwood/board-dt.c:kirkwood_dt_init().

---
 arch/arm/mach-kirkwood/board-dt.c |    5 +++++
 arch/arm/mach-kirkwood/common.c   |    7 ++++++-
 arch/arm/mach-kirkwood/common.h   |    1 +
 3 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/mach-kirkwood/board-dt.c +5 -0
index ea49476..1b4675f 100644
@@ -72,6 +72,8 @@ static void __init kirkwood_of_clk_init(void)
 
 static void __init kirkwood_dt_init(void)
 {
+	int needs_pcie_wins = 1;
+
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
 
 	/*
@@ -144,6 +146,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
+	if (needs_pcie_wins)
+		kirkwood_setup_pcie_wins();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
arch/arm/mach-kirkwood/common.c +6 -1
index c2cae69..9a5d65a 100644
@@ -652,7 +652,7 @@ char * __init kirkwood_id(void)
 	}
 }
 
-void __init kirkwood_setup_wins(void)
+void __init kirkwood_setup_pcie_wins(void)
 {
 	/*
 	 * The PCIe windows will no longer be statically allocated
@@ -678,6 +678,10 @@ void __init kirkwood_setup_wins(void)
 					  KIRKWOOD_PCIE1_MEM_SIZE,
 					  MVEBU_MBUS_NO_REMAP,
 					  MVEBU_MBUS_PCI_MEM);
+}
+
+void __init kirkwood_setup_wins(void)
+{
 	mvebu_mbus_add_window("nand", KIRKWOOD_NAND_MEM_PHYS_BASE,
 			      KIRKWOOD_NAND_MEM_SIZE);
 	mvebu_mbus_add_window("sram", KIRKWOOD_SRAM_PHYS_BASE,
@@ -710,6 +714,7 @@ void __init kirkwood_init(void)
 	writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
 
 	kirkwood_setup_wins();
+	kirkwood_setup_pcie_wins();
 
 	kirkwood_l2_init();
 
arch/arm/mach-kirkwood/common.h +1 -0
index e24f743..de280f5 100644
@@ -31,6 +31,7 @@ void kirkwood_init_early(void);
 void kirkwood_init_irq(void);
 
 void kirkwood_setup_wins(void);
+void kirkwood_setup_pcie_wins(void);
 
 void kirkwood_enable_pcie(void);
 void kirkwood_pcie_id(u32 *dev, u32 *rev);
Signature · 1 line
1.7.9.5
#7 lore raw

RFC PATCH 3/5 arm: mach-kirkwood: seperate PCIe window init from other windows

On Wed, Mar 27, 2013 at 07:05:02PM +0100, Thomas Petazzoni wrote:

This all looks really great to me, I hope to try it as well when I get time. But just one small suggestion:

Quoted 13 lines
arch/arm/mach-kirkwood/board-dt.c +3 -0
index ea49476..1b4675f 100644
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -72,6 +72,8 @@ static void __init kirkwood_of_clk_init(void)
 
 static void __init kirkwood_dt_init(void)
 {
+	int needs_pcie_wins = 1;
+
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
 
 	/*

arch/arm/mach-kirkwood/board-dt.c static void __init kirkwood_dt_init(void) · line 153

Quoted 8 lines
arch/arm/mach-kirkwood/board-dt.c +3 -0
@@ -144,6 +146,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
+	if (needs_pcie_wins)
+		kirkwood_setup_pcie_wins();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }

Moving the window setup into mach-kirkwood/pcie.c:kirkwood_pcie_init would avoid this needs_pcie_wins thing since kirkwood_pcie_init will naturally never be called once the other patches are applied.

Cheers,
Jason

#8 lore raw

RFC PATCH 3/5 arm: mach-kirkwood: seperate PCIe window init from other windows

Dear Jason Gunthorpe,

Quoted 21 lines · Jason Gunthorpe

On Wed, Mar 27, 2013 at 07:05:02PM +0100, Thomas Petazzoni wrote:

This all looks really great to me, I hope to try it as well when I get time. But just one small suggestion:

Quoted 16 lines
arch/arm/mach-kirkwood/board-dt.c +3 -0
index ea49476..1b4675f 100644
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -72,6 +72,8 @@ static void __init kirkwood_of_clk_init(void)
 
 static void __init kirkwood_dt_init(void)
 {
+	int needs_pcie_wins = 1;
+
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
 
 	/*
@@ -144,6 +146,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
Quoted 9 lines

arch/arm/mach-kirkwood/board-dt.c static void __init kirkwood_dt_init(void) · line 153

Quoted 5 lines
arch/arm/mach-kirkwood/board-dt.c +3 -0
+	if (needs_pcie_wins)
+		kirkwood_setup_pcie_wins();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }

Moving the window setup into mach-kirkwood/pcie.c:kirkwood_pcie_init would avoid this needs_pcie_wins thing since kirkwood_pcie_init will naturally never be called once the other patches are applied.

Ah, yes, right. I now remember you made this suggestion when reviewing the mvebu-mbus patch set, and I replied that I would do it when I'll start working on using the pci-mvebu driver on Kirkwood. It looks like it's time for me to honor this commitment :-)

Thanks for the feedback,

Thomas

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

RFC PATCH 4/5 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.

Note: this commit is not correct. The 6281 Kirkwood has only one PCIe interface, and the 6282 has two PCIe interfaces, so this Device Tree change will require some modifications to take this into account.

---
 arch/arm/boot/dts/kirkwood.dtsi |   49 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/arm/boot/dts/kirkwood.dtsi +49 -0
index 2c738d9..3d2cb12 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>;
@@ -201,5 +202,53 @@
 			clocks = <&gate_clk 4>;
 			status = "disabled";
 		};
+
+		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 0x00044000 0x00044000 0 0x00002000   /* Port 1.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";
+			};
+
+			pcie at 2,0 {
+				device_type = "pci";
+				assigned-addresses = <0x82001000 0 0x00044000 0 0x2000>;
+				reg = <0x1000 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 10>;
+				marvell,pcie-port = <1>;
+				marvell,pcie-lane = <0>;
+				clocks = <&gate_clk 18>;
+				status = "disabled";
+			};
+		};
 	};
 };
Signature · 1 line
1.7.9.5
#10 lore raw

RFC PATCH 5/5 arm: kirkwood: convert db-88f6281 to the Device Tree

In reply to Thomas Petazzoni

This commit converts the db-88f6281 board to the Device Tree.

Note: this commit is not entirely correct. The db-88f6281 code was in fact handling both the case of a board having the 6281 (one PCIe interface) and the 6282 (two PCIe interfaces). For now, we make the assumption that we have two PCIe interfaces (because that's the board I have in my hands). We'll probably have to create two separate Device Trees to distinguish between those two boards.

---
 arch/arm/boot/dts/Makefile                  |    1 +
 arch/arm/boot/dts/kirkwood-db-88f6281.dts   |   96 ++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig              |   12 +--
 arch/arm/mach-kirkwood/Makefile             |    2 +-
 arch/arm/mach-kirkwood/board-db88f6281-bp.c |   26 +++++++
 arch/arm/mach-kirkwood/board-dt.c           |    6 ++
 arch/arm/mach-kirkwood/common.h             |    6 ++
 arch/arm/mach-kirkwood/db88f6281-bp-setup.c |  108 ---------------------------
 8 files changed, 142 insertions(+), 115 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6281.dts
 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 +1 -0
index 9c62558..07ae76d 100644
@@ -64,6 +64,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-km_kirkwood.dtb \
 	kirkwood-lschlv2.dtb \
 	kirkwood-lsxhl.dtb \
+	kirkwood-db-88f6281.dtb \
 	kirkwood-mplcec4.dtb \
 	kirkwood-ns2.dtb \
 	kirkwood-ns2lite.dtb \
arch/arm/boot/dts/kirkwood-db-88f6281.dts new file +96 -0

96 lines not on this page · raw message

arch/arm/mach-kirkwood/Kconfig +6 -6
index 7b6a64b..56bbeb0 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,12 @@ 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 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 d805f80..ea5a2f8 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 +6 -0
index 1b4675f..fbc0d8b 100644
@@ -137,6 +137,11 @@ static void __init kirkwood_dt_init(void)
 	    of_machine_is_compatible("lacie,netspace_mini_v2"))
 		ns2_init();
 
+	if (of_machine_is_compatible("marvell,db-88f6281-bp")) {
+		needs_pcie_wins = 0;
+		db88f6281_init();
+	}
+
 	if (of_machine_is_compatible("mpl,cec4"))
 		mplcec4_init();
 
@@ -170,6 +175,7 @@ static const char * const kirkwood_dt_board_compat[] = {
 	"lacie,netspace_v2",
 	"lacie,netspace_lite_v2",
 	"lacie,netspace_mini_v2",
+	"marvell,db-88f6281-bp",
 	"mpl,cec4",
 	"plathome,openblocks-a6",
 	"usi,topkick",
arch/arm/mach-kirkwood/common.h +6 -0
index de280f5..410b1ff 100644
@@ -120,6 +120,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
maintainer
#11 lore raw

cover Use the mvebu PCIe driver on Kirkwood

In reply to Thomas Petazzoni
Quoted 10 lines · Thomas Petazzoni

Here is a set of five patches that demonstrate that the mvebu PCIe driver can be used on Kirkwood with no modification at all. Those patches are not meant to be applied yet, the Device Trees are not completely correct yet (they don't take into account the fact that 6281 has one PCIe interface and 6282 has two PCIe interface).

It took less than two hours to enable PCIe on Kirkwood (and in those two hours, the conversion of the DB-88F6281 board to the Device Tree has been done as well), and the result works fine:

Quoted 8 lines
# /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)

Very nice!

Quoted 2 lines

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

I assume it works with PIO, but does the SATA card use the I/O space registers, or just memory space?

Arnd

#12 lore raw

cover Use the mvebu PCIe driver on Kirkwood

Dear Arnd Bergmann,

Quoted 10 lines · Arnd Bergmann
Quoted 8 lines
# /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)

Very nice!

Yeah, I find it quite nice too :)

Quoted 5 lines
Quoted 2 lines

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

I assume it works with PIO, but does the SATA card use the I/O space registers, or just memory space?

Both cards only use memory space. I have a quick and dirty patch for the e1000e driver that makes it read/write one particular register from the I/O space to test that it works, but I haven't checked this yet on Kirkwood. I don't expect much troubles, but who knows.

As I said, this patch set is for now just to show that it works, there are some adjustments to be made here and there before those patches are ready to be merged.

Best regards,

Thomas

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

cover Use the mvebu PCIe driver on Kirkwood

Arnd,

Quoted 7 lines · Thomas Petazzoni
Quoted 2 lines

I assume it works with PIO, but does the SATA card use the I/O space registers, or just memory space?

Both cards only use memory space. I have a quick and dirty patch for the e1000e driver that makes it read/write one particular register from the I/O space to test that it works, but I haven't checked this yet on Kirkwood. I don't expect much troubles, but who knows.

Just to let you know, I've tested the e1000e with my small changes that does one I/O access, and it seems to work properly. At least, I read from the register the value I should be reading (and therefore writing works, because the I/O space of the e1000e essentially has two
registers: one address register, and one data register, so you must write one address in the address register before being able to read something from the data register).

Best regards,

Thomas

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