# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_ARM=y
-CONFIG_ARM_APPENDED_DTB=y
-CONFIG_ARM_ATAG_DTB_COMPAT=y
-# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
-CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
+# CONFIG_ARM_APPENDED_DTB is not set
# CONFIG_ARM_CPU_SUSPEND is not set
CONFIG_ARM_L1_CACHE_SHIFT=5
CONFIG_ARM_NR_BANKS=8
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_AOUT=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_HAVE_ARCH_PFN_VALID=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_M25PXX_USE_FAST_READ=y
# CONFIG_MACH_D2NET_V2 is not set
-# CONFIG_MACH_DLINK_KIRKWOOD_DT is not set
+CONFIG_MACH_DLINK_KIRKWOOD_DT=y
# CONFIG_MACH_DOCKSTAR is not set
-CONFIG_MACH_ESATA_SHEEVAPLUG=y
+# CONFIG_MACH_ESATA_SHEEVAPLUG is not set
# CONFIG_MACH_GURUPLUG is not set
# CONFIG_MACH_INETSPACE_V2 is not set
# CONFIG_MACH_MV88F6281GTW_GE is not set
# CONFIG_MACH_NET5BIG_V2 is not set
# CONFIG_MACH_NETSPACE_MAX_V2 is not set
# CONFIG_MACH_NETSPACE_V2 is not set
-CONFIG_MACH_OPENRD=y
-CONFIG_MACH_OPENRD_BASE=y
-CONFIG_MACH_OPENRD_CLIENT=y
+# CONFIG_MACH_OPENRD_BASE is not set
+# CONFIG_MACH_OPENRD_CLIENT is not set
# CONFIG_MACH_OPENRD_ULTIMATE is not set
# CONFIG_MACH_RD88F6192_NAS is not set
# CONFIG_MACH_RD88F6281 is not set
-CONFIG_MACH_SHEEVAPLUG=y
+# CONFIG_MACH_SHEEVAPLUG is not set
# CONFIG_MACH_T5325 is not set
# CONFIG_MACH_TS219 is not set
-# CONFIG_MACH_TS219_DT is not set
# CONFIG_MACH_TS41X is not set
CONFIG_MDIO_BOARDINFO=y
CONFIG_MMC=y
CONFIG_MTD_NAND_ORION=y
CONFIG_MTD_OF_PARTS=y
# CONFIG_MTD_SM_COMMON is not set
-CONFIG_MTD_UIMAGE_SPLIT=y
CONFIG_MV643XX_ETH=y
CONFIG_MVEBU_CLK_CORE=y
CONFIG_MVEBU_CLK_GATING=y
CONFIG_MVEBU_MBUS=y
CONFIG_MVMDIO=y
CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_KUSER_HELPERS=y
CONFIG_NEED_PER_CPU_KM=y
CONFIG_NET_DSA=y
CONFIG_NET_DSA_MV88E6123_61_65=y
CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y
CONFIG_NET_DSA_TAG_DSA=y
CONFIG_NET_DSA_TAG_EDSA=y
-# CONFIG_NET_IP_TUNNEL is not set
CONFIG_NLS=y
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_PCI=y
CONFIG_PCI_MVEBU=y
-# CONFIG_PDA_POWER is not set
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PHYLIB=y
CONFIG_PINCONF=y
-From 6b5917890ada1dc078ee64af2500cd6289fcf9bc Mon Sep 17 00:00:00 2001
+From 3c72277cf2c10e3b7065541b3588f21138efeba2 Mon Sep 17 00:00:00 2001
From: Andrew Murray <Andrew.Murray@arm.com>
-Date: Tue, 7 May 2013 16:31:12 +0100
+Date: Thu, 16 May 2013 17:55:17 +0200
Subject: [PATCH 01/29] of/pci: Provide support for parsing PCI DT ranges
property
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
drivers/of/address.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/of_address.h | 48 +++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
-diff --git a/drivers/of/address.c b/drivers/of/address.c
-index 7c8221d..b55c218 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
-@@ -231,6 +231,73 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
+@@ -231,6 +231,73 @@ int of_pci_address_to_resource(struct de
return __of_address_to_resource(dev, addrp, size, flags, NULL, r);
}
EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
#endif /* CONFIG_PCI */
/*
-diff --git a/include/linux/of_address.h b/include/linux/of_address.h
-index 0506eb5..4c2e6f2 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,6 +4,36 @@
#ifdef CONFIG_OF_ADDRESS
extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
extern bool of_can_translate_address(struct device_node *dev);
-@@ -27,6 +57,11 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
+@@ -27,6 +57,11 @@ static inline unsigned long pci_address_
#define pci_address_to_pio pci_address_to_pio
#endif
#else /* CONFIG_OF_ADDRESS */
#ifndef of_address_to_resource
static inline int of_address_to_resource(struct device_node *dev, int index,
-@@ -53,6 +88,19 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
+@@ -53,6 +88,19 @@ static inline const __be32 *of_get_addre
{
return NULL;
}
#endif /* CONFIG_OF_ADDRESS */
---
-1.8.4.rc1
-
-From 6275a8e0bacac9702350b6a003470a9ce67c9139 Mon Sep 17 00:00:00 2001
+From 389637f9e7f523934acf26c247e4722d761ad966 Mon Sep 17 00:00:00 2001
From: Thierry Reding <thierry.reding@avionic-design.de>
-Date: Mon, 11 Feb 2013 09:22:20 +0100
+Date: Thu, 16 May 2013 17:55:19 +0200
Subject: [PATCH 03/29] of/pci: Add of_pci_parse_bus_range() function
This function can be used to parse a bus-range property as specified by
device nodes representing PCI bridges.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
drivers/of/of_pci.c | 25 +++++++++++++++++++++++++
include/linux/of_pci.h | 1 +
2 files changed, 26 insertions(+)
-diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
-index 4dd7b9b..42c687a 100644
--- a/drivers/of/of_pci.c
+++ b/drivers/of/of_pci.c
-@@ -64,3 +64,28 @@ int of_pci_get_devfn(struct device_node *np)
+@@ -64,3 +64,28 @@ int of_pci_get_devfn(struct device_node
return (be32_to_cpup(reg) >> 8) & 0xff;
}
EXPORT_SYMBOL_GPL(of_pci_get_devfn);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_pci_parse_bus_range);
-diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
-index 91ec484..7a04826 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -11,5 +11,6 @@ struct device_node;
+int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
#endif
---
-1.8.4.rc1
-
-From adebeab033de18cabf880f98d2167095520243f2 Mon Sep 17 00:00:00 2001
+From 72fb19fc4ff89878273799eb38e8d95b0add3c05 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Fri, 7 Dec 2012 20:35:20 +0100
+Date: Thu, 16 May 2013 17:55:20 +0200
Subject: [PATCH 04/29] clk: mvebu: create parent-child relation for PCIe
clocks on Armada 370
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Mike Turquette <mturquette@linaro.org>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
drivers/clk/mvebu/clk-gating-ctrl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
-diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c
-index ebf141d..b35785a 100644
--- a/drivers/clk/mvebu/clk-gating-ctrl.c
+++ b/drivers/clk/mvebu/clk-gating-ctrl.c
-@@ -119,8 +119,8 @@ static const struct mvebu_soc_descr __initconst armada_370_gating_descr[] = {
+@@ -119,8 +119,8 @@ static const struct mvebu_soc_descr __in
{ "pex1_en", NULL, 2 },
{ "ge1", NULL, 3 },
{ "ge0", NULL, 4 },
{ "sata0", NULL, 15 },
{ "sdio", NULL, 17 },
{ "tdm", NULL, 25 },
---
-1.8.4.rc1
-
-From 7bda5e7704872a2f01a6c980bb7616d689520ea5 Mon Sep 17 00:00:00 2001
+From 52a1c4e3aa9027040c1adc69303aaffc3c2cbaab Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Fri, 18 Jan 2013 16:42:01 +0100
+Date: Thu, 16 May 2013 17:55:21 +0200
Subject: [PATCH 05/29] clk: mvebu: add more PCIe clocks for Armada XP
The current revision of the datasheet only mentions the gatable clocks
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Mike Turquette <mturquette@linaro.org>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
drivers/clk/mvebu/clk-gating-ctrl.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
-diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c
-index b35785a..2f03723 100644
--- a/drivers/clk/mvebu/clk-gating-ctrl.c
+++ b/drivers/clk/mvebu/clk-gating-ctrl.c
-@@ -137,10 +137,14 @@ static const struct mvebu_soc_descr __initconst armada_xp_gating_descr[] = {
+@@ -137,10 +137,14 @@ static const struct mvebu_soc_descr __in
{ "ge2", NULL, 2 },
{ "ge1", NULL, 3 },
{ "ge0", NULL, 4 },
{ "bp", NULL, 13 },
{ "sata0lnk", NULL, 14 },
{ "sata0", "sata0lnk", 15 },
-@@ -152,6 +156,8 @@ static const struct mvebu_soc_descr __initconst armada_xp_gating_descr[] = {
+@@ -152,6 +156,8 @@ static const struct mvebu_soc_descr __in
{ "xor0", NULL, 22 },
{ "crypto", NULL, 23 },
{ "tdm", NULL, 25 },
{ "xor1", NULL, 28 },
{ "sata1lnk", NULL, 29 },
{ "sata1", "sata1lnk", 30 },
---
-1.8.4.rc1
-
-From b18ed8465d6c2e3b7057d5bb2fc3da5cb15e3fb1 Mon Sep 17 00:00:00 2001
+From 8a0a335ed5d4f6c8455090f77ac57c0c25800070 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Fri, 18 Jan 2013 17:42:58 +0100
+Date: Thu, 16 May 2013 17:55:22 +0200
Subject: [PATCH 06/29] pci: PCIe driver for Marvell Armada 370/XP systems
This driver implements the support for the PCIe interfaces on the
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
.../devicetree/bindings/pci/mvebu-pci.txt | 220 ++++++
drivers/pci/Kconfig | 2 +
drivers/pci/Makefile | 3 +
drivers/pci/host/Kconfig | 8 +
drivers/pci/host/Makefile | 1 +
- drivers/pci/host/pci-mvebu.c | 879 +++++++++++++++++++++
- 6 files changed, 1113 insertions(+)
+ drivers/pci/host/pci-mvebu.c | 880 +++++++++++++++++++++
+ 6 files changed, 1114 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/mvebu-pci.txt
create mode 100644 drivers/pci/host/Kconfig
create mode 100644 drivers/pci/host/Makefile
create mode 100644 drivers/pci/host/pci-mvebu.c
-diff --git a/Documentation/devicetree/bindings/pci/mvebu-pci.txt b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
-new file mode 100644
-index 0000000..eb69d92
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
@@ -0,0 +1,220 @@
+ status = "disabled";
+ };
+};
-diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
-index 6d51aa6..ac45398 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
-@@ -119,3 +119,5 @@ config PCI_IOAPIC
+@@ -125,3 +125,5 @@ config PCI_IOAPIC
config PCI_LABEL
def_bool y if (DMI || ACPI)
select NLS
+
+source "drivers/pci/host/Kconfig"
-diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
-index 0c3efcf..6ebf5bf 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
-@@ -67,3 +67,6 @@ obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o
+@@ -67,3 +67,6 @@ obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen
obj-$(CONFIG_OF) += of.o
ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
+
+# PCI host controller drivers
+obj-y += host/
-diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
-new file mode 100644
-index 0000000..6918fbc
--- /dev/null
+++ b/drivers/pci/host/Kconfig
@@ -0,0 +1,8 @@
+ depends on ARCH_MVEBU
+
+endmenu
-diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
-new file mode 100644
-index 0000000..5ea2d8b
--- /dev/null
+++ b/drivers/pci/host/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
-diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
-new file mode 100644
-index 0000000..b0ee63b
--- /dev/null
+++ b/drivers/pci/host/pci-mvebu.c
-@@ -0,0 +1,879 @@
+@@ -0,0 +1,880 @@
+/*
+ * PCIe driver for Marvell Armada 370 and Armada XP SoCs
+ *
+ return start;
+}
+
-+static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
++static void __init mvebu_pcie_enable(struct mvebu_pcie *pcie)
+{
+ struct hw_pci hw;
+
+ * <...> property for one that matches the given port/lane. Once
+ * found, maps it.
+ */
-+static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
-+ struct device_node *np,
-+ struct mvebu_pcie_port *port)
++static void __iomem * __init
++mvebu_pcie_map_registers(struct platform_device *pdev,
++ struct device_node *np,
++ struct mvebu_pcie_port *port)
+{
+ struct resource regs;
+ int ret = 0;
+ },
+};
+
-+static int mvebu_pcie_init(void)
++static int __init mvebu_pcie_init(void)
+{
+ return platform_driver_probe(&mvebu_pcie_driver,
+ mvebu_pcie_probe);
+MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
+MODULE_DESCRIPTION("Marvell EBU PCIe driver");
+MODULE_LICENSE("GPLv2");
---
-1.8.4.rc1
-
-From d8bb1510b06f29bb6b63ebafe23656faae60d87f Mon Sep 17 00:00:00 2001
+From 3b475bd86ce4c647a65d218a3014396d4b139fb3 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Fri, 7 Dec 2012 20:56:52 +0100
+Date: Thu, 16 May 2013 17:55:23 +0200
Subject: [PATCH 07/29] arm: mvebu: PCIe support is now available on mvebu
Now that the PCIe driver for mvebu has been integrated and all its
MIGHT_HAVE_PCI, which allows to select the PCI bus support if needed.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
arch/arm/mach-mvebu/Kconfig | 2 ++
1 file changed, 2 insertions(+)
-diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
-index 80a8bca..fb827ac 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -16,6 +16,8 @@ config ARCH_MVEBU
if ARCH_MVEBU
---
-1.8.4.rc1
-
+++ /dev/null
-From 3339170f8adf10c32ad8ba4069f94f1bcd40f46d Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Fri, 7 Dec 2012 22:49:57 +0100
-Subject: [PATCH 08/29] arm: mvebu: update defconfig with PCI and USB support
-
-Now that we have the necessary drivers and Device Tree informations to
-support PCIe on Armada 370 and Armada XP, enable the CONFIG_PCI
-option.
-
-Also, since the Armada 370 Mirabox has a built-in USB XHCI controller
-connected on the PCIe bus, enable the corresponding options as well.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- arch/arm/configs/mvebu_defconfig | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
-index f3e8ae0..966281e 100644
---- a/arch/arm/configs/mvebu_defconfig
-+++ b/arch/arm/configs/mvebu_defconfig
-@@ -13,6 +13,8 @@ CONFIG_MACH_ARMADA_370=y
- CONFIG_MACH_ARMADA_XP=y
- # CONFIG_CACHE_L2X0 is not set
- # CONFIG_SWP_EMULATE is not set
-+CONFIG_PCI=y
-+CONFIG_PCI_MVEBU=y
- CONFIG_SMP=y
- CONFIG_AEABI=y
- CONFIG_HIGHMEM=y
-@@ -60,6 +62,7 @@ CONFIG_USB_SUPPORT=y
- CONFIG_USB=y
- CONFIG_USB_EHCI_HCD=y
- CONFIG_USB_EHCI_ROOT_HUB_TT=y
-+CONFIG_USB_XHCI_HCD=y
- CONFIG_MMC=y
- CONFIG_MMC_MVSDIO=y
- CONFIG_NEW_LEDS=y
---
-1.8.4.rc1
-
--- /dev/null
+From 3ad3d38d36c51b45668708a42f67b07fc87a53e3 Mon Sep 17 00:00:00 2001
+From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
+Date: Mon, 27 May 2013 11:38:41 +0800
+Subject: [PATCH 08/29] pci: mvebu: fix return value check in
+ mvebu_pcie_probe()
+
+In case of error, function of_clk_get_by_name() returns
+ERR_PTR() never returns NULL. The NULL test in the return
+value check should be replaced with IS_ERR().
+
+Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
+Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ drivers/pci/host/pci-mvebu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/pci/host/pci-mvebu.c
++++ b/drivers/pci/host/pci-mvebu.c
+@@ -828,7 +828,7 @@ static int __init mvebu_pcie_probe(struc
+ }
+
+ port->clk = of_clk_get_by_name(child, NULL);
+- if (!port->clk) {
++ if (IS_ERR(port->clk)) {
+ dev_err(&pdev->dev, "PCIe%d.%d: cannot get clock\n",
+ port->port, port->lane);
+ iounmap(port->base);
-From 3b93e75d1b66353b8f8ad7d965e17aad68982c55 Mon Sep 17 00:00:00 2001
+From 79ae3cf2d6c01b4394ea462f1c49a2e9fbcf0521 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 27 Mar 2013 18:48:13 +0100
+Date: Wed, 15 May 2013 15:36:54 +0200
Subject: [PATCH 09/29] pci: mvebu: enable driver usage on Kirkwood
We allow the pci-mvebu driver to be compiled on the Kirkwood platform,
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
Documentation/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(-)
-diff --git a/Documentation/devicetree/bindings/pci/mvebu-pci.txt b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
-index eb69d92..f8d4058 100644
--- a/Documentation/devicetree/bindings/pci/mvebu-pci.txt
+++ b/Documentation/devicetree/bindings/pci/mvebu-pci.txt
@@ -4,6 +4,7 @@ Mandatory properties:
- #address-cells, set to <3>
- #size-cells, set to <2>
- #interrupt-cells, set to <1>
-diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
-index 6918fbc..1f1d67f 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -3,6 +3,6 @@ menu "PCI host controller drivers"
+ depends on ARCH_MVEBU || ARCH_KIRKWOOD
endmenu
-diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
-index b0ee63b..6fe8b90 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
-@@ -853,6 +853,7 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
+@@ -854,6 +854,7 @@ static int __init mvebu_pcie_probe(struc
static const struct of_device_id mvebu_pcie_of_match_table[] = {
{ .compatible = "marvell,armada-xp-pcie", },
{ .compatible = "marvell,armada-370-pcie", },
{},
};
MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
---
-1.8.4.rc1
-
-From 080dc44291ff143d84b63e5ff9fda963d46a7dce Mon Sep 17 00:00:00 2001
+From 722ffe56a78344821877496f5bb28ca95b4cb67c Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 27 Mar 2013 18:51:25 +0100
+Date: Wed, 15 May 2013 15:36:55 +0200
Subject: [PATCH 10/29] arm: kirkwood: move PCIe window init to legacy driver
Since we are going to enable the usage of the mvebu PCIe driver on
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
arch/arm/mach-kirkwood/common.c | 24 ------------------------
arch/arm/mach-kirkwood/pcie.c | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 24 deletions(-)
-diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
-index f389228..41ea98d 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -648,30 +648,6 @@ char * __init kirkwood_id(void)
mvebu_mbus_add_window("nand", KIRKWOOD_NAND_MEM_PHYS_BASE,
KIRKWOOD_NAND_MEM_SIZE);
mvebu_mbus_add_window("sram", KIRKWOOD_SRAM_PHYS_BASE,
-diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
-index 7f43e6c..ddcb09f 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -12,6 +12,7 @@
#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)
+@@ -253,6 +254,27 @@ static void __init add_pcie_port(int ind
void __init kirkwood_pcie_init(unsigned int portmask)
{
vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE;
if (portmask & KW_PCIE0)
---
-1.8.4.rc1
-
-From 8725a4f93dcb242466990261dc2bd78599b0306a Mon Sep 17 00:00:00 2001
+From b2198f4cd8cffdfd5030a176a9ee4d4367526cac Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 27 Mar 2013 18:55:20 +0100
+Date: Wed, 15 May 2013 15:36:56 +0200
Subject: [PATCH 11/29] arm: kirkwood: add SoC-level Device Tree data for PCIe
interfaces
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
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(+)
-diff --git a/arch/arm/boot/dts/kirkwood-6281.dtsi b/arch/arm/boot/dts/kirkwood-6281.dtsi
-index d6c9d65..5137668 100644
--- a/arch/arm/boot/dts/kirkwood-6281.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6281.dtsi
@@ -40,5 +40,36 @@
+ };
};
};
-diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi
-index 23991e4..66a751a 100644
--- a/arch/arm/boot/dts/kirkwood-6282.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6282.dtsi
@@ -65,5 +65,53 @@
+ };
};
};
-diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
-index fada7e6..7eef88f 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -19,6 +19,7 @@
0xf5000000 0xf5000000 0x0000400>;
#address-cells = <1>;
#size-cells = <1>;
---
-1.8.4.rc1
-
-From b7031bd802336c77a6b330f79b275ccbb55fdc96 Mon Sep 17 00:00:00 2001
+From cce41fad080eb7e5f3e3e27bbcc5730d624c5d4b Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 10 Apr 2013 21:22:13 +0200
+Date: Wed, 15 May 2013 15:36:57 +0200
Subject: [PATCH 12/29] arm: kirkwood: convert Iomega Iconnect to use DT for
the PCIe interface
interfaces in the Device Tree.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
arch/arm/boot/dts/kirkwood-iconnect.dts | 8 ++++++++
arch/arm/mach-kirkwood/board-iconnect.c | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)
-diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
-index 12ccf74..e591d5d 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -109,6 +109,14 @@
};
gpio-leds {
-diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
-index c8ebde4..98b5ad1 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -22,11 +22,3 @@ void __init iconnect_init(void)
- return 0;
-}
-subsys_initcall(iconnect_pci_init);
---
-1.8.4.rc1
-
-From b3e3851d461779cd94a2efe4484f01175fcb460e Mon Sep 17 00:00:00 2001
+From b12363b0a393e2751395af002bf9ab192c1140c1 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 10 Apr 2013 23:05:32 +0200
+Date: Wed, 15 May 2013 15:36:58 +0200
Subject: [PATCH 13/29] arm: kirkwood: convert MPL CEC4 to use DT for the PCIe
interface
interfaces in the Device Tree.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
arch/arm/boot/dts/kirkwood-mplcec4.dts | 8 ++++++++
arch/arm/mach-kirkwood/board-mplcec4.c | 1 -
2 files changed, 8 insertions(+), 1 deletion(-)
-diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
-index 7588241..90501cf 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -139,6 +139,14 @@
};
gpio-leds {
-diff --git a/arch/arm/mach-kirkwood/board-mplcec4.c b/arch/arm/mach-kirkwood/board-mplcec4.c
-index 7d6dc66..938712e 100644
--- a/arch/arm/mach-kirkwood/board-mplcec4.c
+++ b/arch/arm/mach-kirkwood/board-mplcec4.c
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
}
---
-1.8.4.rc1
-
-From 86310ed36ec224b248b5169371f44250ce8c2275 Mon Sep 17 00:00:00 2001
+From f56884bb322085c735b027b64fff4d7294a464ee Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 10 Apr 2013 23:07:27 +0200
+Date: Wed, 15 May 2013 15:36:59 +0200
Subject: [PATCH 14/29] arm: kirkwood: convert ZyXEL NSA310 to use DT for the
PCIe interface
related Kconfig/Makefile bits.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
arch/arm/boot/dts/kirkwood-nsa310.dts | 8 ++++++++
arch/arm/mach-kirkwood/Kconfig | 8 --------
4 files changed, 8 insertions(+), 34 deletions(-)
delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
-diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts
-index a7412b9..9ddf218 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310.dts
+++ b/arch/arm/boot/dts/kirkwood-nsa310.dts
@@ -176,6 +176,14 @@
};
gpio_keys {
-diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
-index 7509a89..267ca95 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -272,14 +272,6 @@ config MACH_NETSPACE_V2_DT
config MACH_OPENBLOCKS_A6_DT
bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
select ARCH_KIRKWOOD_DT
-diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
-index e1f3735..794366e 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
-@@ -37,7 +37,6 @@ obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
+@@ -37,7 +37,6 @@ obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) +
obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o
obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
-diff --git a/arch/arm/mach-kirkwood/board-nsa310.c b/arch/arm/mach-kirkwood/board-nsa310.c
-deleted file mode 100644
-index 55ade93..0000000
--- a/arch/arm/mach-kirkwood/board-nsa310.c
+++ /dev/null
@@ -1,25 +0,0 @@
-}
-
-subsys_initcall(nsa310_pci_init);
---
-1.8.4.rc1
-
-From 0f75608615894c9707e40c0dd3383193fb6c09f6 Mon Sep 17 00:00:00 2001
+From c184303509ea2ee9d519db5dbfb2063efca098f7 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Sat, 13 Apr 2013 13:03:56 +0200
+Date: Wed, 15 May 2013 15:37:00 +0200
Subject: [PATCH 15/29] arm: kirkwood: convert QNAP TS219 to use DT for the
PCIe interface
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
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 +++++++--
3 files changed, 11 insertions(+), 4 deletions(-)
-diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
-index 8295c83..42648ab 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -1,7 +1,8 @@
/ {
ocp@f1000000 {
-diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
-index df3f95d..95ceeb9 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -1,7 +1,8 @@
/ {
ocp@f1000000 {
-diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
-index 64ea27c..7c022fd 100644
--- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -1,5 +1,3 @@
+ };
};
};
---
-1.8.4.rc1
-
-From 32f9dd19f7c859205440a8734cb6ab1295c78015 Mon Sep 17 00:00:00 2001
+From 8ad6aa146af6af98bd8e308eb7746a5f4cf267d8 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Wed, 27 Mar 2013 18:56:40 +0100
+Date: Wed, 15 May 2013 15:37:01 +0200
Subject: [PATCH 16/29] arm: kirkwood: convert db-88f6281/db-88f6282 to the
Device Tree
We have kept one single Kconfig option, just like it was before.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
arch/arm/boot/dts/Makefile | 2 +
arch/arm/boot/dts/kirkwood-db-88f6281.dts | 30 ++++++++
create mode 100644 arch/arm/mach-kirkwood/board-db88f628x-bp.c
delete mode 100644 arch/arm/mach-kirkwood/db88f6281-bp-setup.c
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index f0895c5..3844ef2 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
-@@ -64,6 +64,8 @@ dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
+@@ -64,6 +64,8 @@ dtb-$(CONFIG_ARCH_INTEGRATOR) += integra
integratorcp.dtb
dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
kirkwood-dns320.dtb \
kirkwood-dns325.dtb \
kirkwood-dockstar.dtb \
-diff --git a/arch/arm/boot/dts/kirkwood-db-88f6281.dts b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
-new file mode 100644
-index 0000000..9d777ed
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
@@ -0,0 +1,30 @@
+ };
+ };
+};
-diff --git a/arch/arm/boot/dts/kirkwood-db-88f6282.dts b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
-new file mode 100644
-index 0000000..f4c8528
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
@@ -0,0 +1,34 @@
+ };
+ };
+};
-diff --git a/arch/arm/boot/dts/kirkwood-db.dtsi b/arch/arm/boot/dts/kirkwood-db.dtsi
-new file mode 100644
-index 0000000..c87cfb8
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-db.dtsi
@@ -0,0 +1,89 @@
+ };
+ };
+};
-diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
-index 267ca95..b56bd3d 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -8,12 +8,6 @@ config MACH_D2NET_V2
config MACH_DLINK_KIRKWOOD_DT
bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
select ARCH_KIRKWOOD_DT
-diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
-index 794366e..2fdc3a7 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,7 +1,6 @@
obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
-@@ -21,6 +20,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
+@@ -21,6 +20,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup
obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
-diff --git a/arch/arm/mach-kirkwood/board-db88f628x-bp.c b/arch/arm/mach-kirkwood/board-db88f628x-bp.c
-new file mode 100644
-index 0000000..2f574bc
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-db88f628x-bp.c
@@ -0,0 +1,24 @@
+{
+ kirkwood_ge00_init(&db88f628x_ge00_data);
+}
-diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
-index e9647b8..f5aed1f 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
-@@ -147,6 +147,10 @@ static void __init kirkwood_dt_init(void)
+@@ -147,6 +147,10 @@ static void __init kirkwood_dt_init(void
of_machine_is_compatible("lacie,netspace_v2"))
ns2_init();
if (of_machine_is_compatible("mpl,cec4"))
mplcec4_init();
-@@ -181,6 +185,8 @@ static const char * const kirkwood_dt_board_compat[] = {
+@@ -181,6 +185,8 @@ static const char * const kirkwood_dt_bo
"lacie,netspace_max_v2",
"lacie,netspace_mini_v2",
"lacie,netspace_v2",
"mpl,cec4",
"netgear,readynas-duo-v2",
"plathome,openblocks-a6",
-diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
-index 21da3b1..cbbc0b8 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -119,6 +119,12 @@ void km_kirkwood_init(void);
#ifdef CONFIG_MACH_MPLCEC4_DT
void mplcec4_init(void);
#else
-diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
-deleted file mode 100644
-index 5a369fe..0000000
--- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
+++ /dev/null
@@ -1,108 +0,0 @@
- .init_time = kirkwood_timer_init,
- .restart = kirkwood_restart,
-MACHINE_END
---
-1.8.4.rc1
-
+++ /dev/null
-From f53bb70209838ffea1824ba7c4c7935cf200233f Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Thu, 11 Apr 2013 00:18:29 +0200
-Subject: [PATCH 17/29] arm: kirkwood: update defconfig with PCIe driver and
- board updates
-
-This commit enables the mvebu PCIe driver in kirkwood_defconfig and
-updates various options related to Kirkwood boards.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- arch/arm/configs/kirkwood_defconfig | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
-index a1d8252..452adec 100644
---- a/arch/arm/configs/kirkwood_defconfig
-+++ b/arch/arm/configs/kirkwood_defconfig
-@@ -31,6 +31,7 @@ CONFIG_MACH_T5325=y
- CONFIG_MACH_TS219=y
- CONFIG_MACH_TS41X=y
- CONFIG_MACH_CLOUDBOX_DT=y
-+CONFIG_MACH_DB88F628X_BP_DT=y
- CONFIG_MACH_DLINK_KIRKWOOD_DT=y
- CONFIG_MACH_DOCKSTAR_DT=y
- CONFIG_MACH_DREAMPLUG_DT=y
-@@ -53,6 +54,7 @@ CONFIG_MACH_READYNAS_DT=y
- CONFIG_MACH_TOPKICK_DT=y
- CONFIG_MACH_TS219_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
---
-1.8.4.rc1
-
--- /dev/null
+From 5db3b7ccb319679ac9c5791112c7eb42c25331e3 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 23 May 2013 16:32:51 +0200
+Subject: [PATCH 17/29] pci: mvebu: no longer fake the slot location of
+ downstream devices
+
+By default, the Marvell hardware, for each PCIe interface, exhibits
+the following devices:
+
+ * On slot 0, a "Marvell Memory controller", identical on all PCIe
+ interfaces, and which isn't useful when the Marvell SoC is the PCIe
+ root complex (i.e, the normal case when we run Linux on the Marvell
+ SoC).
+
+ * On slot 1, the real PCIe card connected into the PCIe slot of the
+ board.
+
+So, what the Marvell PCIe driver was doing in its PCI-to-PCI bridge
+emulation is that when the Linux PCI core was trying to access the
+device in slot 0, we were in fact forwarding the configuration
+transaction to the device in slot 1. For all other slots, we were
+telling the Linux PCI core that there was no device connected.
+
+However, new versions of bootloaders from Marvell change the default
+PCIe configuration, and make the real device appear in slot 0, and the
+"Marvell Memory controller" in slot 1.
+
+Therefore, this commit modifies the Marvell PCIe driver to adjust the
+PCIe hardware configuration to make sure that this behavior (real
+device in slot 0, "Marvell Memory controller" in slot 1) is the one
+we'll see regardless of what the bootloader has done. It allows to
+remove the little hack that was forwarding configuration transactions
+on slot 0 to slot 1, which is nice.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Acked-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ drivers/pci/host/pci-mvebu.c | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+--- a/drivers/pci/host/pci-mvebu.c
++++ b/drivers/pci/host/pci-mvebu.c
+@@ -51,6 +51,7 @@
+ #define PCIE_CTRL_X1_MODE 0x0001
+ #define PCIE_STAT_OFF 0x1a04
+ #define PCIE_STAT_BUS 0xff00
++#define PCIE_STAT_DEV 0x1f0000
+ #define PCIE_STAT_LINK_DOWN BIT(0)
+ #define PCIE_DEBUG_CTRL 0x1a60
+ #define PCIE_DEBUG_SOFT_RESET BIT(20)
+@@ -148,6 +149,16 @@ static void mvebu_pcie_set_local_bus_nr(
+ writel(stat, port->base + PCIE_STAT_OFF);
+ }
+
++static void mvebu_pcie_set_local_dev_nr(struct mvebu_pcie_port *port, int nr)
++{
++ u32 stat;
++
++ stat = readl(port->base + PCIE_STAT_OFF);
++ stat &= ~PCIE_STAT_DEV;
++ stat |= nr << 16;
++ writel(stat, port->base + PCIE_STAT_OFF);
++}
++
+ /*
+ * Setup PCIE BARs and Address Decode Wins:
+ * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks
+@@ -572,8 +583,7 @@ static int mvebu_pcie_wr_conf(struct pci
+
+ /* Access the real PCIe interface */
+ spin_lock_irqsave(&port->conf_lock, flags);
+- ret = mvebu_pcie_hw_wr_conf(port, bus,
+- PCI_DEVFN(1, PCI_FUNC(devfn)),
++ ret = mvebu_pcie_hw_wr_conf(port, bus, devfn,
+ where, size, val);
+ spin_unlock_irqrestore(&port->conf_lock, flags);
+
+@@ -606,8 +616,7 @@ static int mvebu_pcie_rd_conf(struct pci
+
+ /* Access the real PCIe interface */
+ spin_lock_irqsave(&port->conf_lock, flags);
+- ret = mvebu_pcie_hw_rd_conf(port, bus,
+- PCI_DEVFN(1, PCI_FUNC(devfn)),
++ ret = mvebu_pcie_hw_rd_conf(port, bus, devfn,
+ where, size, val);
+ spin_unlock_irqrestore(&port->conf_lock, flags);
+
+@@ -817,6 +826,8 @@ static int __init mvebu_pcie_probe(struc
+ continue;
+ }
+
++ mvebu_pcie_set_local_dev_nr(port, 1);
++
+ if (mvebu_pcie_link_up(port)) {
+ port->haslink = 1;
+ dev_info(&pdev->dev, "PCIe%d.%d: link up\n",
+++ /dev/null
-From 40a635881d8fedff7242598cd3bf892e4733f7dc Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Wed, 29 May 2013 21:32:43 +0200
-Subject: [PATCH 18/29] net: mv643xx_eth: use phy_disconnect instead of
- phy_detach
-
-Using a separated mdio bus driver with mvmdio, phy_detach on network device
-removal will not stop the phy and finally lead to NULL pointer dereference
-in mvmdio due to non-existent network device. Use phy_disconnect instead
-to properly stop phy device from accessing network device prior removal of
-the network device.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
-index d1cbfb1..748dcd3 100644
---- a/drivers/net/ethernet/marvell/mv643xx_eth.c
-+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
-@@ -2805,7 +2805,7 @@ static int mv643xx_eth_remove(struct platform_device *pdev)
-
- unregister_netdev(mp->dev);
- if (mp->phy != NULL)
-- phy_detach(mp->phy);
-+ phy_disconnect(mp->phy);
- cancel_work_sync(&mp->tx_timeout_task);
-
- if (!IS_ERR(mp->clk))
---
-1.8.4.rc1
-
--- /dev/null
+From ce12bfd48e93b98717a258b8181aed0e19933e1e Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 23 May 2013 16:32:52 +0200
+Subject: [PATCH 18/29] pci: mvebu: allow the enumeration of devices beyond
+ physical bridges
+
+Until now, the Marvell PCIe driver was only allowing the enumeration
+of the devices in the secondary bus of the emulated PCI-to-PCI
+bridge. This works fine when a PCIe device is directly connected into
+a PCIe slot of the Marvell board.
+
+However, when the device connected in the PCIe slot is a physical PCIe
+bridge, beyond which a real PCIe device is connected, it no longer
+worked, as the driver was preventing the Linux PCI core from seeing
+such devices.
+
+This commit fixes that by ensuring that configuration transactions on
+subordinate busses are properly forwarded on the right PCIe interface.
+
+Thanks to this patch, a PCIe card beyond a PCIe bridge, itself beyond
+the emulated PCI-to-PCI bridge is properly detected, with the
+following layout:
+
+-[0000:00]-+-01.0-[01]----00.0
+ +-09.0-[02-07]----00.0-[03-07]--+-01.0-[04]--
+ | +-05.0-[05]--
+ | +-07.0-[06]--
+ | \-09.0-[07]----00.0
+ \-0a.0-[08]----00.0
+
+Where the PCIe interface that sits beyond the emulated PCI-to-PCI
+bridge at 09.0 allows to access the secondary bus 02, on which there
+is a PCIe bridge that allows to access the 3 to 7 busses, that are
+subordinates to this bridge. And on one of this bus (bus 7), there is
+one real PCIe device connected.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Acked-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ drivers/pci/host/pci-mvebu.c | 31 ++++++++++++++++++++++++++++---
+ 1 file changed, 28 insertions(+), 3 deletions(-)
+
+--- a/drivers/pci/host/pci-mvebu.c
++++ b/drivers/pci/host/pci-mvebu.c
+@@ -554,7 +554,8 @@ mvebu_pcie_find_port(struct mvebu_pcie *
+ if (bus->number == 0 && port->devfn == devfn)
+ return port;
+ if (bus->number != 0 &&
+- port->bridge.secondary_bus == bus->number)
++ bus->number >= port->bridge.secondary_bus &&
++ bus->number <= port->bridge.subordinate_bus)
+ return port;
+ }
+
+@@ -578,7 +579,18 @@ static int mvebu_pcie_wr_conf(struct pci
+ if (bus->number == 0)
+ return mvebu_sw_pci_bridge_write(port, where, size, val);
+
+- if (!port->haslink || PCI_SLOT(devfn) != 0)
++ if (!port->haslink)
++ return PCIBIOS_DEVICE_NOT_FOUND;
++
++ /*
++ * On the secondary bus, we don't want to expose any other
++ * device than the device physically connected in the PCIe
++ * slot, visible in slot 0. In slot 1, there's a special
++ * Marvell device that only makes sense when the Armada is
++ * used as a PCIe endpoint.
++ */
++ if (bus->number == port->bridge.secondary_bus &&
++ PCI_SLOT(devfn) != 0)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ /* Access the real PCIe interface */
+@@ -609,7 +621,20 @@ static int mvebu_pcie_rd_conf(struct pci
+ if (bus->number == 0)
+ return mvebu_sw_pci_bridge_read(port, where, size, val);
+
+- if (!port->haslink || PCI_SLOT(devfn) != 0) {
++ if (!port->haslink) {
++ *val = 0xffffffff;
++ return PCIBIOS_DEVICE_NOT_FOUND;
++ }
++
++ /*
++ * On the secondary bus, we don't want to expose any other
++ * device than the device physically connected in the PCIe
++ * slot, visible in slot 0. In slot 1, there's a special
++ * Marvell device that only makes sense when the Armada is
++ * used as a PCIe endpoint.
++ */
++ if (bus->number == port->bridge.secondary_bus &&
++ PCI_SLOT(devfn) != 0) {
+ *val = 0xffffffff;
+ return PCIBIOS_DEVICE_NOT_FOUND;
+ }
+++ /dev/null
-From ba7ccfb6824e89ea6175abcf854e7808597a2c40 Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Wed, 29 May 2013 21:32:44 +0200
-Subject: [PATCH 19/29] net: mv643xx_eth: use managed devm_ioremap for port
- registers
-
-Make use of managed devm_ioremap and remove corresponding iounmap.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- drivers/net/ethernet/marvell/mv643xx_eth.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
-index 748dcd3..0a8c064 100644
---- a/drivers/net/ethernet/marvell/mv643xx_eth.c
-+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
-@@ -2470,7 +2470,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
- if (msp == NULL)
- return -ENOMEM;
-
-- msp->base = ioremap(res->start, resource_size(res));
-+ msp->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (msp->base == NULL)
- return -ENOMEM;
-
-@@ -2498,7 +2498,6 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
- {
- struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev);
-
-- iounmap(msp->base);
- if (!IS_ERR(msp->clk))
- clk_disable_unprepare(msp->clk);
-
---
-1.8.4.rc1
-
--- /dev/null
+From 370c8181fd848948aeae371bbc1124dc0dead22b Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 23 May 2013 16:32:53 +0200
+Subject: [PATCH 19/29] pci: mvebu: fix the emulation of the status register
+
+The status register of the PCI configuration space of PCI-to-PCI
+bridges contain some read-only bits, and so write-1-to-clear bits. So,
+the Linux PCI core sometimes writes 0xffff to this status register,
+and in the current PCI-to-PCI bridge emulation code of the Marvell
+driver, we do take all those 1s being written. Even the read-only bits
+are being overwritten.
+
+For now, all the read-only bits should be emulated to have the zero
+value.
+
+The other bits, that are write-1-to-clear bits are used to report
+various kind of errors, and are never set by the emulated bridge, so
+there is no need to support this write-1-to-clear bits mechanism.
+
+As a conclusion, the easiest solution is to simply emulate this status
+register by returning zero when read, and ignore the writes to it.
+
+This has two visible effects:
+
+ * The devsel is no longer 'unknown' in, i.e
+
+ Flags: bus master, 66MHz, user-definable features, ?? devsel, latency 0
+
+ becomes:
+
+ Flags: bus master, 66MHz, user-definable features, fast devsel, latency 0
+
+ in lspci -v.
+
+ This was caused by a value of 11b being read for devsel, which is
+ an invalid value. This 11b value being read was due to a previous
+ write of 0xffff into the status register.
+
+ * The capability list is no longer broken, because we indicate to the
+ Linux PCI core that we don't have a Capabilities Pointer in the PCI
+ configuration space of this bridge. The following message is
+ therefore no longer visible in lspci -v:
+
+ Capabilities: [fc] <chain broken>
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Acked-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ drivers/pci/host/pci-mvebu.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+--- a/drivers/pci/host/pci-mvebu.c
++++ b/drivers/pci/host/pci-mvebu.c
+@@ -69,7 +69,6 @@ struct mvebu_sw_pci_bridge {
+ u16 vendor;
+ u16 device;
+ u16 command;
+- u16 status;
+ u16 class;
+ u8 interface;
+ u8 revision;
+@@ -359,7 +358,6 @@ static void mvebu_sw_pci_bridge_init(str
+
+ memset(bridge, 0, sizeof(struct mvebu_sw_pci_bridge));
+
+- bridge->status = PCI_STATUS_CAP_LIST;
+ bridge->class = PCI_CLASS_BRIDGE_PCI;
+ bridge->vendor = PCI_VENDOR_ID_MARVELL;
+ bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID;
+@@ -386,7 +384,7 @@ static int mvebu_sw_pci_bridge_read(stru
+ break;
+
+ case PCI_COMMAND:
+- *value = bridge->status << 16 | bridge->command;
++ *value = bridge->command;
+ break;
+
+ case PCI_CLASS_REVISION:
+@@ -479,7 +477,6 @@ static int mvebu_sw_pci_bridge_write(str
+ switch (where & ~3) {
+ case PCI_COMMAND:
+ bridge->command = value & 0xffff;
+- bridge->status = value >> 16;
+ break;
+
+ case PCI_BASE_ADDRESS_0 ... PCI_BASE_ADDRESS_1:
+++ /dev/null
-From 76a09d3052c7c1c5d4a3fcdfee3a12cfc998d58f Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Wed, 29 May 2013 21:32:45 +0200
-Subject: [PATCH 20/29] net: mv643xx_eth: add phy_node to platform_data struct
-
-This adds a struct device_node pointer for a phy passed by phandle
-to mv643xx_eth node.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- include/linux/mv643xx_eth.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
-index 141d395..6e8215b 100644
---- a/include/linux/mv643xx_eth.h
-+++ b/include/linux/mv643xx_eth.h
-@@ -30,6 +30,7 @@ struct mv643xx_eth_shared_platform_data {
- #define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
- #define MV643XX_ETH_PHY_NONE 0xff
-
-+struct device_node;
- struct mv643xx_eth_platform_data {
- /*
- * Pointer back to our parent instance, and our port number.
-@@ -41,6 +42,7 @@ struct mv643xx_eth_platform_data {
- * Whether a PHY is present, and if yes, at which address.
- */
- int phy_addr;
-+ struct device_node *phy_node;
-
- /*
- * Use this MAC address if it is valid, overriding the
---
-1.8.4.rc1
-
--- /dev/null
+From 799e69d38053e344267360a583676eafe2ed8648 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 29 May 2013 09:32:43 +0000
+Subject: [PATCH 20/29] net: mv643xx_eth: use phy_disconnect instead of
+ phy_detach
+
+Using a separated mdio bus driver with mvmdio, phy_detach on network device
+removal will not stop the phy and finally lead to NULL pointer dereference
+in mvmdio due to non-existent network device. Use phy_disconnect instead
+to properly stop phy device from accessing network device prior removal of
+the network device.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -2805,7 +2805,7 @@ static int mv643xx_eth_remove(struct pla
+
+ unregister_netdev(mp->dev);
+ if (mp->phy != NULL)
+- phy_detach(mp->phy);
++ phy_disconnect(mp->phy);
+ cancel_work_sync(&mp->tx_timeout_task);
+
+ if (!IS_ERR(mp->clk))
--- /dev/null
+From 002271ca6718b5dfb8082873fb0a60abc1d9e8d5 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 29 May 2013 09:32:44 +0000
+Subject: [PATCH 21/29] net: mv643xx_eth: use managed devm_ioremap for port
+ registers
+
+Make use of managed devm_ioremap and remove corresponding iounmap.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/marvell/mv643xx_eth.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -2470,7 +2470,7 @@ static int mv643xx_eth_shared_probe(stru
+ if (msp == NULL)
+ return -ENOMEM;
+
+- msp->base = ioremap(res->start, resource_size(res));
++ msp->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+ if (msp->base == NULL)
+ return -ENOMEM;
+
+@@ -2498,7 +2498,6 @@ static int mv643xx_eth_shared_remove(str
+ {
+ struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev);
+
+- iounmap(msp->base);
+ if (!IS_ERR(msp->clk))
+ clk_disable_unprepare(msp->clk);
+
+++ /dev/null
-From 04417da7ac6d1a2a38d4406d899ab92bf6e488e1 Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Wed, 29 May 2013 21:32:46 +0200
-Subject: [PATCH 21/29] net: mv643xx_eth: use of_phy_connect if phy_node
- present
-
-This connects to a phy node passed to the port device instead of probing
-the phy by phy_addr.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- drivers/net/ethernet/marvell/mv643xx_eth.c | 25 ++++++++++++++++++-------
- 1 file changed, 18 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
-index 0a8c064..946033b 100644
---- a/drivers/net/ethernet/marvell/mv643xx_eth.c
-+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
-@@ -60,6 +60,7 @@
- #include <linux/types.h>
- #include <linux/slab.h>
- #include <linux/clk.h>
-+#include <linux/of_mdio.h>
-
- static char mv643xx_eth_driver_name[] = "mv643xx_eth";
- static char mv643xx_eth_driver_version[] = "1.4";
-@@ -2715,17 +2716,27 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
- netif_set_real_num_tx_queues(dev, mp->txq_count);
- netif_set_real_num_rx_queues(dev, mp->rxq_count);
-
-- if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
-+ err = 0;
-+ if (pd->phy_node) {
-+ mp->phy = of_phy_connect(mp->dev, pd->phy_node,
-+ mv643xx_eth_adjust_link, 0,
-+ PHY_INTERFACE_MODE_GMII);
-+ if (!mp->phy)
-+ err = -ENODEV;
-+ } else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
- mp->phy = phy_scan(mp, pd->phy_addr);
-
-- if (IS_ERR(mp->phy)) {
-+ if (IS_ERR(mp->phy))
- err = PTR_ERR(mp->phy);
-- if (err == -ENODEV)
-- err = -EPROBE_DEFER;
-- goto out;
-- }
-- phy_init(mp, pd->speed, pd->duplex);
-+ else
-+ phy_init(mp, pd->speed, pd->duplex);
- }
-+ if (err == -ENODEV) {
-+ err = -EPROBE_DEFER;
-+ goto out;
-+ }
-+ if (err)
-+ goto out;
-
- SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);
-
---
-1.8.4.rc1
-
--- /dev/null
+From 30b19330e175f621b04718bc4e55db75768997aa Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 29 May 2013 09:32:45 +0000
+Subject: [PATCH 22/29] net: mv643xx_eth: add phy_node to platform_data struct
+
+This adds a struct device_node pointer for a phy passed by phandle
+to mv643xx_eth node.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ include/linux/mv643xx_eth.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/include/linux/mv643xx_eth.h
++++ b/include/linux/mv643xx_eth.h
+@@ -30,6 +30,7 @@ struct mv643xx_eth_shared_platform_data
+ #define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
+ #define MV643XX_ETH_PHY_NONE 0xff
+
++struct device_node;
+ struct mv643xx_eth_platform_data {
+ /*
+ * Pointer back to our parent instance, and our port number.
+@@ -41,6 +42,7 @@ struct mv643xx_eth_platform_data {
+ * Whether a PHY is present, and if yes, at which address.
+ */
+ int phy_addr;
++ struct device_node *phy_node;
+
+ /*
+ * Use this MAC address if it is valid, overriding the
+++ /dev/null
-From 3b0f26629fef1b55a71031b4ef4db27d0a66a0be Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Wed, 29 May 2013 21:32:47 +0200
-Subject: [PATCH 22/29] net: mv643xx_eth: proper initialization for Kirkwood
- SoCs
-
-Ethernet controllers found on Kirkwood SoCs not only suffer from loosing
-MAC address register contents on clock gating but also some important
-registers are reset to values that would break ethernet. This patch
-clears the CLK125_BYPASS_EN bit for DT enabled Kirkwood only by using
-of_device_is_compatible() instead of #ifdefs. Non-DT Kirkwood is not
-affected as it installs a clock gating workaround because of the MAC
-address issue above. Other Orion SoCs do not suffer from register reset,
-do not have the bit in question, or do not have the register at all.
-Moreover, system controllers on PPC using this driver should also be
-protected from clearing that bit.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- drivers/net/ethernet/marvell/mv643xx_eth.c | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
-index 946033b..af6bdcc 100644
---- a/drivers/net/ethernet/marvell/mv643xx_eth.c
-+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
-@@ -116,6 +116,8 @@ static char mv643xx_eth_driver_version[] = "1.4";
- #define LINK_UP 0x00000002
- #define TXQ_COMMAND 0x0048
- #define TXQ_FIX_PRIO_CONF 0x004c
-+#define PORT_SERIAL_CONTROL1 0x004c
-+#define CLK125_BYPASS_EN 0x00000010
- #define TX_BW_RATE 0x0050
- #define TX_BW_MTU 0x0058
- #define TX_BW_BURST 0x005c
-@@ -2701,6 +2703,15 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
-
- mp->dev = dev;
-
-+ /* Kirkwood resets some registers on gated clocks. Especially
-+ * CLK125_BYPASS_EN must be cleared but is not available on
-+ * all other SoCs/System Controllers using this driver.
-+ */
-+ if (of_device_is_compatible(pdev->dev.of_node,
-+ "marvell,kirkwood-eth-port"))
-+ wrlp(mp, PORT_SERIAL_CONTROL1,
-+ rdlp(mp, PORT_SERIAL_CONTROL1) & ~CLK125_BYPASS_EN);
-+
- /*
- * Start with a default rate, and if there is a clock, allow
- * it to override the default.
---
-1.8.4.rc1
-
+++ /dev/null
-From dd6cae3b60ee88b301f9325db144e70b5e12482e Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Wed, 29 May 2013 21:32:48 +0200
-Subject: [PATCH 23/29] net: mv643xx_eth: add DT parsing support
-
-This adds device tree parsing support for the shared driver of mv643xx_eth.
-As the bindings are slightly different from current PPC bindings new binding
-documentation is also added. Following PPC-style device setup, the shared
-driver now also adds port platform_devices and sets up port platform_data.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- .../devicetree/bindings/net/marvell-orion-net.txt | 85 ++++++++++++
- drivers/net/ethernet/marvell/mv643xx_eth.c | 153 ++++++++++++++++++++-
- 2 files changed, 234 insertions(+), 4 deletions(-)
- create mode 100644 Documentation/devicetree/bindings/net/marvell-orion-net.txt
-
-diff --git a/Documentation/devicetree/bindings/net/marvell-orion-net.txt b/Documentation/devicetree/bindings/net/marvell-orion-net.txt
-new file mode 100644
-index 0000000..a73b79f
---- /dev/null
-+++ b/Documentation/devicetree/bindings/net/marvell-orion-net.txt
-@@ -0,0 +1,85 @@
-+Marvell Orion/Discovery ethernet controller
-+=============================================
-+
-+The Marvell Discovery ethernet controller can be found on Marvell Orion SoCs
-+(Kirkwood, Dove, Orion5x, and Discovery Innovation) and as part of Marvell
-+Discovery system controller chips (mv64[345]60).
-+
-+The Discovery ethernet controller is described with two levels of nodes. The
-+first level describes the ethernet controller itself and the second level
-+describes up to 3 ethernet port nodes within that controller. The reason for
-+the multiple levels is that the port registers are interleaved within a single
-+set of controller registers. Each port node describes port-specific properties.
-+
-+Note: The above separation is only true for Discovery system controllers.
-+For Orion SoCs we stick to the separation, although there each controller has
-+only one port associated. Multiple ports are implemented as multiple single-port
-+controllers. As Kirkwood has some issues with proper initialization after reset,
-+an extra compatible string is added for it.
-+
-+* Ethernet controller node
-+
-+Required controller properties:
-+ - #address-cells: shall be 1.
-+ - #size-cells: shall be 0.
-+ - compatible: shall be one of "marvell,orion-eth", "marvell,kirkwood-eth".
-+ - reg: address and length of the controller registers.
-+
-+Optional controller properties:
-+ - clocks: phandle reference to the controller clock.
-+ - marvell,tx-checksum-limit: max tx packet size for hardware checksum.
-+
-+* Ethernet port node
-+
-+Required port properties:
-+ - device_type: shall be "network".
-+ - compatible: shall be one of "marvell,orion-eth-port",
-+ "marvell,kirkwood-eth-port".
-+ - reg: port number relative to ethernet controller, shall be 0, 1, or 2.
-+ - interrupts: port interrupt.
-+ - local-mac-address: 6 bytes MAC address.
-+
-+Optional port properties:
-+ - marvell,tx-queue-size: size of the transmit ring buffer.
-+ - marvell,tx-sram-addr: address of transmit descriptor buffer located in SRAM.
-+ - marvell,tx-sram-size: size of transmit descriptor buffer located in SRAM.
-+ - marvell,rx-queue-size: size of the receive ring buffer.
-+ - marvell,rx-sram-addr: address of receive descriptor buffer located in SRAM.
-+ - marvell,rx-sram-size: size of receive descriptor buffer located in SRAM.
-+
-+and
-+
-+ - phy-handle: phandle reference to ethernet PHY.
-+
-+or
-+
-+ - speed: port speed if no PHY connected.
-+ - duplex: port mode if no PHY connected.
-+
-+* Node example:
-+
-+mdio-bus {
-+ ...
-+ ethphy: ethernet-phy@8 {
-+ device_type = "ethernet-phy";
-+ ...
-+ };
-+};
-+
-+eth: ethernet-controller@72000 {
-+ compatible = "marvell,orion-eth";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0x72000 0x2000>;
-+ clocks = <&gate_clk 2>;
-+ marvell,tx-checksum-limit = <1600>;
-+
-+ ethernet@0 {
-+ device_type = "network";
-+ compatible = "marvell,orion-eth-port";
-+ reg = <0>;
-+ interrupts = <29>;
-+ phy-handle = <ðphy>;
-+ local-mac-address = [00 00 00 00 00 00];
-+ };
-+};
-diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
-index af6bdcc..004a250 100644
---- a/drivers/net/ethernet/marvell/mv643xx_eth.c
-+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
-@@ -60,6 +60,9 @@
- #include <linux/types.h>
- #include <linux/slab.h>
- #include <linux/clk.h>
-+#include <linux/of.h>
-+#include <linux/of_irq.h>
-+#include <linux/of_net.h>
- #include <linux/of_mdio.h>
-
- static char mv643xx_eth_driver_name[] = "mv643xx_eth";
-@@ -2453,13 +2456,148 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
- }
- }
-
-+#if defined(CONFIG_OF)
-+static const struct of_device_id mv643xx_eth_shared_ids[] = {
-+ { .compatible = "marvell,orion-eth", },
-+ { .compatible = "marvell,kirkwood-eth", },
-+ { }
-+};
-+MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids);
-+#endif
-+
-+#if defined(CONFIG_OF) && !defined(CONFIG_MV64X60)
-+#define mv643xx_eth_property(_np, _name, _v) \
-+ do { \
-+ u32 tmp; \
-+ if (!of_property_read_u32(_np, "marvell," _name, &tmp)) \
-+ _v = tmp; \
-+ } while (0)
-+
-+static struct platform_device *port_platdev[3];
-+
-+static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
-+ struct device_node *pnp)
-+{
-+ struct platform_device *ppdev;
-+ struct mv643xx_eth_platform_data ppd;
-+ struct resource res;
-+ const char *mac_addr;
-+ int ret;
-+
-+ memset(&ppd, 0, sizeof(ppd));
-+ ppd.shared = pdev;
-+
-+ memset(&res, 0, sizeof(res));
-+ if (!of_irq_to_resource(pnp, 0, &res)) {
-+ dev_err(&pdev->dev, "missing interrupt on %s\n", pnp->name);
-+ return -EINVAL;
-+ }
-+
-+ if (of_property_read_u32(pnp, "reg", &ppd.port_number)) {
-+ dev_err(&pdev->dev, "missing reg property on %s\n", pnp->name);
-+ return -EINVAL;
-+ }
-+
-+ if (ppd.port_number >= 3) {
-+ dev_err(&pdev->dev, "invalid reg property on %s\n", pnp->name);
-+ return -EINVAL;
-+ }
-+
-+ mac_addr = of_get_mac_address(pnp);
-+ if (mac_addr)
-+ memcpy(ppd.mac_addr, mac_addr, 6);
-+
-+ mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
-+ mv643xx_eth_property(pnp, "tx-sram-addr", ppd.tx_sram_addr);
-+ mv643xx_eth_property(pnp, "tx-sram-size", ppd.tx_sram_size);
-+ mv643xx_eth_property(pnp, "rx-queue-size", ppd.rx_queue_size);
-+ mv643xx_eth_property(pnp, "rx-sram-addr", ppd.rx_sram_addr);
-+ mv643xx_eth_property(pnp, "rx-sram-size", ppd.rx_sram_size);
-+
-+ ppd.phy_node = of_parse_phandle(pnp, "phy-handle", 0);
-+ if (!ppd.phy_node) {
-+ ppd.phy_addr = MV643XX_ETH_PHY_NONE;
-+ of_property_read_u32(pnp, "speed", &ppd.speed);
-+ of_property_read_u32(pnp, "duplex", &ppd.duplex);
-+ }
-+
-+ ppdev = platform_device_alloc(MV643XX_ETH_NAME, ppd.port_number);
-+ if (!ppdev)
-+ return -ENOMEM;
-+ ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-+
-+ ret = platform_device_add_resources(ppdev, &res, 1);
-+ if (ret)
-+ goto port_err;
-+
-+ ret = platform_device_add_data(ppdev, &ppd, sizeof(ppd));
-+ if (ret)
-+ goto port_err;
-+
-+ ret = platform_device_add(ppdev);
-+ if (ret)
-+ goto port_err;
-+
-+ port_platdev[ppd.port_number] = ppdev;
-+
-+ return 0;
-+
-+port_err:
-+ platform_device_put(ppdev);
-+ return ret;
-+}
-+
-+static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
-+{
-+ struct mv643xx_eth_shared_platform_data *pd;
-+ struct device_node *pnp, *np = pdev->dev.of_node;
-+ int ret;
-+
-+ /* bail out if not registered from DT */
-+ if (!np)
-+ return 0;
-+
-+ pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL);
-+ if (!pd)
-+ return -ENOMEM;
-+ pdev->dev.platform_data = pd;
-+
-+ mv643xx_eth_property(np, "tx-checksum-limit", pd->tx_csum_limit);
-+
-+ for_each_available_child_of_node(np, pnp) {
-+ ret = mv643xx_eth_shared_of_add_port(pdev, pnp);
-+ if (ret)
-+ return ret;
-+ }
-+ return 0;
-+}
-+
-+static void mv643xx_eth_shared_of_remove(void)
-+{
-+ int n;
-+
-+ for (n = 0; n < 3; n++) {
-+ platform_device_del(port_platdev[n]);
-+ port_platdev[n] = NULL;
-+ }
-+}
-+#else
-+static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
-+{
-+ return 0
-+}
-+
-+#define mv643xx_eth_shared_of_remove()
-+#endif
-+
- static int mv643xx_eth_shared_probe(struct platform_device *pdev)
- {
- static int mv643xx_eth_version_printed;
-- struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
-+ struct mv643xx_eth_shared_platform_data *pd;
- struct mv643xx_eth_shared_private *msp;
- const struct mbus_dram_target_info *dram;
- struct resource *res;
-+ int ret;
-
- if (!mv643xx_eth_version_printed++)
- pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
-@@ -2472,6 +2610,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
- msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
- if (msp == NULL)
- return -ENOMEM;
-+ platform_set_drvdata(pdev, msp);
-
- msp->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (msp->base == NULL)
-@@ -2488,12 +2627,15 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
- if (dram)
- mv643xx_eth_conf_mbus_windows(msp, dram);
-
-+ ret = mv643xx_eth_shared_of_probe(pdev);
-+ if (ret)
-+ return ret;
-+ pd = pdev->dev.platform_data;
-+
- msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
- pd->tx_csum_limit : 9 * 1024;
- infer_hw_params(msp);
-
-- platform_set_drvdata(pdev, msp);
--
- return 0;
- }
-
-@@ -2501,9 +2643,9 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
- {
- struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev);
-
-+ mv643xx_eth_shared_of_remove();
- if (!IS_ERR(msp->clk))
- clk_disable_unprepare(msp->clk);
--
- return 0;
- }
-
-@@ -2513,6 +2655,7 @@ static struct platform_driver mv643xx_eth_shared_driver = {
- .driver = {
- .name = MV643XX_ETH_SHARED_NAME,
- .owner = THIS_MODULE,
-+ .of_match_table = of_match_ptr(mv643xx_eth_shared_ids),
- },
- };
-
-@@ -2721,6 +2864,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
- if (!IS_ERR(mp->clk)) {
- clk_prepare_enable(mp->clk);
- mp->t_clk = clk_get_rate(mp->clk);
-+ } else if (!IS_ERR(mp->shared->clk)) {
-+ mp->t_clk = clk_get_rate(mp->shared->clk);
- }
-
- set_params(mp, pd);
---
-1.8.4.rc1
-
--- /dev/null
+From db22a1196162f981444d241f92d02e2e50d12ed7 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 29 May 2013 09:32:46 +0000
+Subject: [PATCH 23/29] net: mv643xx_eth: use of_phy_connect if phy_node
+ present
+
+This connects to a phy node passed to the port device instead of probing
+the phy by phy_addr.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/marvell/mv643xx_eth.c | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -60,6 +60,7 @@
+ #include <linux/types.h>
+ #include <linux/slab.h>
+ #include <linux/clk.h>
++#include <linux/of_mdio.h>
+
+ static char mv643xx_eth_driver_name[] = "mv643xx_eth";
+ static char mv643xx_eth_driver_version[] = "1.4";
+@@ -2715,17 +2716,27 @@ static int mv643xx_eth_probe(struct plat
+ netif_set_real_num_tx_queues(dev, mp->txq_count);
+ netif_set_real_num_rx_queues(dev, mp->rxq_count);
+
+- if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
++ err = 0;
++ if (pd->phy_node) {
++ mp->phy = of_phy_connect(mp->dev, pd->phy_node,
++ mv643xx_eth_adjust_link, 0,
++ PHY_INTERFACE_MODE_GMII);
++ if (!mp->phy)
++ err = -ENODEV;
++ } else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
+ mp->phy = phy_scan(mp, pd->phy_addr);
+
+- if (IS_ERR(mp->phy)) {
++ if (IS_ERR(mp->phy))
+ err = PTR_ERR(mp->phy);
+- if (err == -ENODEV)
+- err = -EPROBE_DEFER;
+- goto out;
+- }
+- phy_init(mp, pd->speed, pd->duplex);
++ else
++ phy_init(mp, pd->speed, pd->duplex);
+ }
++ if (err == -ENODEV) {
++ err = -EPROBE_DEFER;
++ goto out;
++ }
++ if (err)
++ goto out;
+
+ SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);
+
+++ /dev/null
-From 81547b563bd8340d98cdf2c020449ef2e7e8821d Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Tue, 2 Jul 2013 13:00:19 +0200
-Subject: [PATCH 24/29] ARM: kirkwood: add gigabit ethernet and mvmdio device
- tree nodes
-
-This patch adds mv643xx_eth and mvmdio device tree nodes for DT enabled
-Kirkwood boards. Phy nodes are also added with reg property set on a
-per-board basis.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- arch/arm/boot/dts/kirkwood-cloudbox.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-db.dtsi | 16 +++++++
- arch/arm/boot/dts/kirkwood-dnskw.dtsi | 16 +++++++
- arch/arm/boot/dts/kirkwood-dockstar.dts | 17 +++++++
- arch/arm/boot/dts/kirkwood-dreamplug.dts | 28 ++++++++++++
- arch/arm/boot/dts/kirkwood-goflexnet.dts | 16 +++++++
- .../arm/boot/dts/kirkwood-guruplug-server-plus.dts | 30 +++++++++++++
- arch/arm/boot/dts/kirkwood-ib62x0.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-iconnect.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 24 ++++++++++
- arch/arm/boot/dts/kirkwood-is2.dts | 2 +
- arch/arm/boot/dts/kirkwood-km_kirkwood.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 28 ++++++++++++
- arch/arm/boot/dts/kirkwood-mplcec4.dts | 27 +++++++++++
- .../boot/dts/kirkwood-netgear_readynas_duo_v2.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 16 +++++++
- arch/arm/boot/dts/kirkwood-ns2.dts | 2 +
- arch/arm/boot/dts/kirkwood-ns2lite.dts | 2 +
- arch/arm/boot/dts/kirkwood-ns2max.dts | 2 +
- arch/arm/boot/dts/kirkwood-ns2mini.dts | 2 +
- arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-topkick.dts | 16 +++++++
- arch/arm/boot/dts/kirkwood-ts219-6281.dts | 4 +-
- arch/arm/boot/dts/kirkwood-ts219-6282.dts | 4 +-
- arch/arm/boot/dts/kirkwood-ts219.dtsi | 16 +++++++
- arch/arm/boot/dts/kirkwood.dtsi | 52 ++++++++++++++++++++++
- 26 files changed, 414 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/boot/dts/kirkwood-cloudbox.dts b/arch/arm/boot/dts/kirkwood-cloudbox.dts
-index 5f21d4e..03e1b68 100644
---- a/arch/arm/boot/dts/kirkwood-cloudbox.dts
-+++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
-@@ -87,3 +87,19 @@
- gpios = <&gpio0 17 0>;
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-db.dtsi b/arch/arm/boot/dts/kirkwood-db.dtsi
-index c87cfb8..ca8bf36 100644
---- a/arch/arm/boot/dts/kirkwood-db.dtsi
-+++ b/arch/arm/boot/dts/kirkwood-db.dtsi
-@@ -87,3 +87,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@8 {
-+ device_type = "ethernet-phy";
-+ reg = <8>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
-index 6875ac0..7c8bc17 100644
---- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
-+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
-@@ -217,3 +217,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@8 {
-+ device_type = "ethernet-phy";
-+ reg = <8>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
-index 0196cf6..b5aebbc 100644
---- a/arch/arm/boot/dts/kirkwood-dockstar.dts
-+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
-@@ -91,3 +91,20 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ compatible = "marvell,88e1116";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
-index 289e51d..e0c93d4 100644
---- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
-+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
-@@ -99,3 +99,31 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+
-+ ethphy1: ethernet-phy@1 {
-+ device_type = "ethernet-phy";
-+ reg = <1>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-+
-+ð1 {
-+ status = "okay";
-+ ethernet1-port@0 {
-+ phy-handle = <ðphy1>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
-index c3573be..aba5849 100644
---- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
-+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
-@@ -170,3 +170,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
-index 44fd97d..210dfb9 100644
---- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
-+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
-@@ -96,3 +96,33 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ compatible = "marvell,88e1121";
-+ reg = <0>;
-+ };
-+
-+ ethphy1: ethernet-phy@1 {
-+ device_type = "ethernet-phy";
-+ compatible = "marvell,88e1121";
-+ reg = <1>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-+
-+ð1 {
-+ status = "okay";
-+ ethernet1-port@0 {
-+ phy-handle = <ðphy1>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
-index 5335b1a..fff3e65 100644
---- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
-+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
-@@ -119,3 +119,19 @@
-
-
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@8 {
-+ device_type = "ethernet-phy";
-+ reg = <8>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
-index e591d5d..9fe8ba2 100644
---- a/arch/arm/boot/dts/kirkwood-iconnect.dts
-+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
-@@ -176,3 +176,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@11 {
-+ device_type = "ethernet-phy";
-+ reg = <11>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
-index 3694e94..315f095 100644
---- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
-+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
-@@ -191,3 +191,27 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy1: ethernet-phy@11 {
-+ device_type = "ethernet-phy";
-+ reg = <11>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ speed = <1000>;
-+ duplex = <1>;
-+ };
-+};
-+
-+ð1 {
-+ status = "okay";
-+ ethernet1-port@0 {
-+ phy-handle = <ðphy1>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-is2.dts b/arch/arm/boot/dts/kirkwood-is2.dts
-index 0bdce0a..2e5fe72 100644
---- a/arch/arm/boot/dts/kirkwood-is2.dts
-+++ b/arch/arm/boot/dts/kirkwood-is2.dts
-@@ -28,3 +28,5 @@
- };
- };
- };
-+
-+ðphy0 { reg = <8>; };
-diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
-index 5bbd054..f9194b1 100644
---- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
-+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
-@@ -43,3 +43,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
-index 37d45c4..dcc6470 100644
---- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
-+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
-@@ -201,3 +201,31 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+
-+ ethphy1: ethernet-phy@8 {
-+ device_type = "ethernet-phy";
-+ reg = <8>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-+
-+ð1 {
-+ status = "okay";
-+ ethernet1-port@0 {
-+ phy-handle = <ðphy1>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
-index 90501cf..32a0133 100644
---- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
-+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
-@@ -190,3 +190,30 @@
- };
- };
-
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@1 {
-+ device_type = "ethernet-phy";
-+ reg = <1>;
-+ };
-+
-+ ethphy1: ethernet-phy@2 {
-+ device_type = "ethernet-phy";
-+ reg = <2>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-+
-+ð1 {
-+ status = "okay";
-+ ethernet1-port@0 {
-+ phy-handle = <ðphy1>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
-index 1ca66ab..b66b2cd 100644
---- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
-+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
-@@ -178,3 +178,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
-index 6affd92..6a48bfd 100644
---- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
-+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
-@@ -82,3 +82,19 @@
- };
-
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy {
-+ device_type = "ethernet-phy";
-+ /* overwrite reg property in board file */
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-ns2.dts b/arch/arm/boot/dts/kirkwood-ns2.dts
-index f2d36ecf..8ffd552 100644
---- a/arch/arm/boot/dts/kirkwood-ns2.dts
-+++ b/arch/arm/boot/dts/kirkwood-ns2.dts
-@@ -28,3 +28,5 @@
- };
- };
- };
-+
-+ðphy0 { reg = <8>; };
-diff --git a/arch/arm/boot/dts/kirkwood-ns2lite.dts b/arch/arm/boot/dts/kirkwood-ns2lite.dts
-index b02eb4e..16332f8 100644
---- a/arch/arm/boot/dts/kirkwood-ns2lite.dts
-+++ b/arch/arm/boot/dts/kirkwood-ns2lite.dts
-@@ -28,3 +28,5 @@
- };
- };
- };
-+
-+ðphy0 { reg = <0>; };
-diff --git a/arch/arm/boot/dts/kirkwood-ns2max.dts b/arch/arm/boot/dts/kirkwood-ns2max.dts
-index bcec4d6..68d767d 100644
---- a/arch/arm/boot/dts/kirkwood-ns2max.dts
-+++ b/arch/arm/boot/dts/kirkwood-ns2max.dts
-@@ -47,3 +47,5 @@
- };
- };
- };
-+
-+ðphy0 { reg = <8>; };
-diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
-index adab1ab..5b1b17b 100644
---- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
-+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
-@@ -48,3 +48,5 @@
- };
- };
- };
-+
-+ðphy0 { reg = <0>; };
-diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
-index d27f724..f8be3e3 100644
---- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
-+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
-@@ -210,3 +210,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
-index 66eb45b..34eacf2 100644
---- a/arch/arm/boot/dts/kirkwood-topkick.dts
-+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
-@@ -201,3 +201,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy@0 {
-+ device_type = "ethernet-phy";
-+ reg = <0>;
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
-index 42648ab..fff3a3e 100644
---- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
-+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
-@@ -50,4 +50,6 @@
- gpios = <&gpio0 16 1>;
- };
- };
--};
-\ No newline at end of file
-+};
-+
-+ðphy0 { reg = <8>; };
-diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
-index 95ceeb9..ed0441a 100644
---- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
-+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
-@@ -50,4 +50,6 @@
- gpios = <&gpio1 5 1>;
- };
- };
--};
-\ No newline at end of file
-+};
-+
-+ðphy0 { reg = <0>; };
-diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
-index 7c022fd..6b063eb 100644
---- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
-+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
-@@ -81,3 +81,19 @@
- };
- };
- };
-+
-+&mdio {
-+ status = "okay";
-+
-+ ethphy0: ethernet-phy {
-+ device_type = "ethernet-phy";
-+ /* overwrite reg property in board file */
-+ };
-+};
-+
-+ð0 {
-+ status = "okay";
-+ ethernet0-port@0 {
-+ phy-handle = <ðphy0>;
-+ };
-+};
-diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
-index 7eef88f..ebc6dc4 100644
---- a/arch/arm/boot/dts/kirkwood.dtsi
-+++ b/arch/arm/boot/dts/kirkwood.dtsi
-@@ -203,5 +203,57 @@
- clocks = <&gate_clk 4>;
- status = "disabled";
- };
-+
-+ mdio: mdio-bus@72004 {
-+ compatible = "marvell,orion-mdio";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0x72004 0x84>;
-+ interrupts = <46>;
-+ clocks = <&gate_clk 0>;
-+ status = "disabled";
-+
-+ /* add phy nodes in board file */
-+ };
-+
-+ eth0: ethernet-controller@72000 {
-+ compatible = "marvell,kirkwood-eth";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0x72000 0x4000>;
-+ clocks = <&gate_clk 0>;
-+ marvell,tx-checksum-limit = <1600>;
-+ status = "disabled";
-+
-+ ethernet0-port@0 {
-+ device_type = "network";
-+ compatible = "marvell,kirkwood-eth-port";
-+ reg = <0>;
-+ interrupts = <11>;
-+ /* overwrite MAC address in bootloader */
-+ local-mac-address = [00 00 00 00 00 00];
-+ /* set phy-handle property in board file */
-+ };
-+ };
-+
-+ eth1: ethernet-controller@76000 {
-+ compatible = "marvell,kirkwood-eth";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0x76000 0x4000>;
-+ clocks = <&gate_clk 19>;
-+ marvell,tx-checksum-limit = <1600>;
-+ status = "disabled";
-+
-+ ethernet1-port@0 {
-+ device_type = "network";
-+ compatible = "marvell,kirkwood-eth-port";
-+ reg = <0>;
-+ interrupts = <15>;
-+ /* overwrite MAC address in bootloader */
-+ local-mac-address = [00 00 00 00 00 00];
-+ /* set phy-handle property in board file */
-+ };
-+ };
- };
- };
---
-1.8.4.rc1
-
--- /dev/null
+From 4c1ae9f272bf34388d0fbdc99aa18af2b6c9eda1 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 29 May 2013 09:32:47 +0000
+Subject: [PATCH 24/29] net: mv643xx_eth: proper initialization for Kirkwood
+ SoCs
+
+Ethernet controllers found on Kirkwood SoCs not only suffer from loosing
+MAC address register contents on clock gating but also some important
+registers are reset to values that would break ethernet. This patch
+clears the CLK125_BYPASS_EN bit for DT enabled Kirkwood only by using
+of_device_is_compatible() instead of #ifdefs. Non-DT Kirkwood is not
+affected as it installs a clock gating workaround because of the MAC
+address issue above. Other Orion SoCs do not suffer from register reset,
+do not have the bit in question, or do not have the register at all.
+Moreover, system controllers on PPC using this driver should also be
+protected from clearing that bit.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/marvell/mv643xx_eth.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -116,6 +116,8 @@ static char mv643xx_eth_driver_version[]
+ #define LINK_UP 0x00000002
+ #define TXQ_COMMAND 0x0048
+ #define TXQ_FIX_PRIO_CONF 0x004c
++#define PORT_SERIAL_CONTROL1 0x004c
++#define CLK125_BYPASS_EN 0x00000010
+ #define TX_BW_RATE 0x0050
+ #define TX_BW_MTU 0x0058
+ #define TX_BW_BURST 0x005c
+@@ -2701,6 +2703,15 @@ static int mv643xx_eth_probe(struct plat
+
+ mp->dev = dev;
+
++ /* Kirkwood resets some registers on gated clocks. Especially
++ * CLK125_BYPASS_EN must be cleared but is not available on
++ * all other SoCs/System Controllers using this driver.
++ */
++ if (of_device_is_compatible(pdev->dev.of_node,
++ "marvell,kirkwood-eth-port"))
++ wrlp(mp, PORT_SERIAL_CONTROL1,
++ rdlp(mp, PORT_SERIAL_CONTROL1) & ~CLK125_BYPASS_EN);
++
+ /*
+ * Start with a default rate, and if there is a clock, allow
+ * it to override the default.
+++ /dev/null
-From 3bfe255171bf03fa4b776e8e10b93d4dbd7df1e8 Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Tue, 2 Jul 2013 13:00:22 +0200
-Subject: [PATCH 25/29] ARM: kirkwood: remove redundant DT board files
-
-With DT support for mv643xx_eth board specific init for some boards now
-is unneccessary. Remove those board files, Kconfig entries, and
-corresponding entries in kirkwood_defconfig.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- arch/arm/mach-kirkwood/Kconfig | 148 --------------------------------
- arch/arm/mach-kirkwood/Makefile | 22 +----
- arch/arm/mach-kirkwood/board-dnskw.c | 7 --
- arch/arm/mach-kirkwood/board-dt.c | 80 +----------------
- arch/arm/mach-kirkwood/board-lsxl.c | 52 -----------
- arch/arm/mach-kirkwood/board-readynas.c | 28 ------
- 6 files changed, 2 insertions(+), 335 deletions(-)
- delete mode 100644 arch/arm/mach-kirkwood/board-lsxl.c
- delete mode 100644 arch/arm/mach-kirkwood/board-readynas.c
-
-diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
-index b56bd3d..dc99588 100644
---- a/arch/arm/mach-kirkwood/Kconfig
-+++ b/arch/arm/mach-kirkwood/Kconfig
-@@ -140,20 +140,6 @@ config ARCH_KIRKWOOD_DT
- Say 'Y' here if you want your kernel to support the
- Marvell Kirkwood using flattened device tree.
-
--config MACH_CLOUDBOX_DT
-- bool "LaCie CloudBox NAS (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the LaCie
-- CloudBox NAS, using Flattened Device Tree.
--
--config MACH_DB88F628X_BP_DT
-- bool "Marvell DB-88F628x-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_DLINK_KIRKWOOD_DT
- bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
- select ARCH_KIRKWOOD_DT
-@@ -162,140 +148,6 @@ config MACH_DLINK_KIRKWOOD_DT
- Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
- using Flattened Device Tree.
-
--config MACH_DOCKSTAR_DT
-- bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Seagate FreeAgent Dockstar (Flattened Device Tree).
--
--config MACH_DREAMPLUG_DT
-- bool "Marvell DreamPlug (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Marvell DreamPlug (Flattened Device Tree).
--
--config MACH_GOFLEXNET_DT
-- bool "Seagate GoFlex Net (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Seagate GoFlex Net (Flattened Device Tree).
--
--config MACH_GURUPLUG_DT
-- bool "Marvell GuruPlug Reference Board (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Marvell GuruPlug Reference Board (Flattened Device Tree).
--
--config MACH_IB62X0_DT
-- bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
-- Flattened Device Tree.
--
--config MACH_ICONNECT_DT
-- bool "Iomega Iconnect (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here to enable Iomega Iconnect support.
--
--config MACH_INETSPACE_V2_DT
-- bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the LaCie
-- Internet Space v2 NAS, using Flattened Device Tree.
--
--config MACH_IOMEGA_IX2_200_DT
-- bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Iomega StorCenter ix2-200 (Flattened Device Tree).
--
--config MACH_KM_KIRKWOOD_DT
-- bool "Keymile Kirkwood Reference Design (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
--
--config MACH_LSXL_DT
-- bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
-- Flattened Device Tree.
--
--config MACH_MPLCEC4_DT
-- bool "MPL CEC4 (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- MPL CEC4 (Flattened Device Tree).
--
--config MACH_NETSPACE_LITE_V2_DT
-- bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the LaCie
-- Network Space Lite v2 NAS, using Flattened Device Tree.
--
--config MACH_NETSPACE_MAX_V2_DT
-- bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the LaCie
-- Network Space Max v2 NAS, using Flattened Device Tree.
--
--config MACH_NETSPACE_MINI_V2_DT
-- bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the LaCie
-- Network Space Mini v2 NAS using Flattened Device Tree.
--
-- This board is embedded in a product named CloudBox, which
-- provides automatic backup on a 100GB cloud storage. This
-- should not confused with a more recent LaCie NAS also named
-- CloudBox. For this last, the disk capacity is 1TB or above.
--
--config MACH_NETSPACE_V2_DT
-- bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the LaCie
-- Network Space v2 NAS, using Flattened Device Tree.
--
--config MACH_OPENBLOCKS_A6_DT
-- bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- Plat'Home OpenBlocks A6 (Flattened Device Tree).
--
--config MACH_READYNAS_DT
-- bool "NETGEAR ReadyNAS Duo v2 (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- select ARM_APPENDED_DTB
-- select ARM_ATAG_DTB_COMPAT
-- help
-- Say 'Y' here if you want your kernel to support the
-- NETGEAR ReadyNAS Duo v2 using Fattened Device Tree.
--
--config MACH_TOPKICK_DT
-- bool "USI Topkick (Flattened Device Tree)"
-- select ARCH_KIRKWOOD_DT
-- help
-- Say 'Y' here if you want your kernel to support the
-- USI Topkick, using Flattened Device Tree
--
- config MACH_TS219_DT
- bool "Device Tree for QNAP TS-11X, TS-21X NAS"
- select ARCH_KIRKWOOD_DT
-diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
-index 2fdc3a7..062f8c7 100644
---- a/arch/arm/mach-kirkwood/Makefile
-+++ b/arch/arm/mach-kirkwood/Makefile
-@@ -19,25 +19,5 @@ obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
- obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
-
- obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
--obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
--obj-$(CONFIG_MACH_DB88F628X_BP_DT) += board-db88f628x-bp.o
- obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
--obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
--obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
--obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
--obj-$(CONFIG_MACH_GURUPLUG_DT) += board-guruplug.o
--obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
--obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
--obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o
--obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
--obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o
--obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
--obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o
--obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
--obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
--obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
--obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
--obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
--obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o
--obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
--obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
-+obj-$(CONFIG_MACH_TS219_DT) += tsx1x-common.o
-diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
-index a1aa87f..2af7a95 100644
---- a/arch/arm/mach-kirkwood/board-dnskw.c
-+++ b/arch/arm/mach-kirkwood/board-dnskw.c
-@@ -14,14 +14,9 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/platform_device.h>
--#include <linux/mv643xx_eth.h>
- #include <linux/gpio.h>
- #include "common.h"
-
--static struct mv643xx_eth_platform_data dnskw_ge00_data = {
-- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
--};
--
- /* Register any GPIO for output and set the value */
- static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
- {
-@@ -36,8 +31,6 @@ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
-
- void __init dnskw_init(void)
- {
-- kirkwood_ge00_init(&dnskw_ge00_data);
--
- /* Set NAS to turn back on after a power failure */
- dnskw_gpio_register(37, "dnskw:power:recover", 1);
- }
-diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
-index f5aed1f..15e61c8 100644
---- a/arch/arm/mach-kirkwood/board-dt.c
-+++ b/arch/arm/mach-kirkwood/board-dt.c
-@@ -106,92 +106,14 @@ static void __init kirkwood_dt_init(void)
- kexec_reinit = kirkwood_enable_pcie;
- #endif
-
-- if (of_machine_is_compatible("globalscale,dreamplug"))
-- dreamplug_init();
--
-- if (of_machine_is_compatible("globalscale,guruplug"))
-- guruplug_dt_init();
--
- if (of_machine_is_compatible("dlink,dns-kirkwood"))
- dnskw_init();
-
-- if (of_machine_is_compatible("iom,iconnect"))
-- iconnect_init();
--
-- if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
-- ib62x0_init();
--
-- if (of_machine_is_compatible("qnap,ts219"))
-- qnap_dt_ts219_init();
--
-- if (of_machine_is_compatible("seagate,dockstar"))
-- dockstar_dt_init();
--
-- if (of_machine_is_compatible("seagate,goflexnet"))
-- goflexnet_init();
--
-- if (of_machine_is_compatible("buffalo,lsxl"))
-- lsxl_init();
--
-- if (of_machine_is_compatible("iom,ix2-200"))
-- iomega_ix2_200_init();
--
-- if (of_machine_is_compatible("keymile,km_kirkwood"))
-- km_kirkwood_init();
--
-- if (of_machine_is_compatible("lacie,cloudbox") ||
-- of_machine_is_compatible("lacie,inetspace_v2") ||
-- of_machine_is_compatible("lacie,netspace_lite_v2") ||
-- of_machine_is_compatible("lacie,netspace_max_v2") ||
-- of_machine_is_compatible("lacie,netspace_mini_v2") ||
-- of_machine_is_compatible("lacie,netspace_v2"))
-- ns2_init();
--
-- if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
-- of_machine_is_compatible("marvell,db-88f6282-bp"))
-- db88f628x_init();
--
-- if (of_machine_is_compatible("mpl,cec4"))
-- mplcec4_init();
--
-- if (of_machine_is_compatible("netgear,readynas-duo-v2"))
-- netgear_readynas_init();
--
-- if (of_machine_is_compatible("plathome,openblocks-a6"))
-- openblocks_a6_init();
--
-- if (of_machine_is_compatible("usi,topkick"))
-- usi_topkick_init();
--
- of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
- }
-
- static const char * const kirkwood_dt_board_compat[] = {
-- "globalscale,dreamplug",
-- "globalscale,guruplug",
-- "dlink,dns-320",
-- "dlink,dns-325",
-- "iom,iconnect",
-- "raidsonic,ib-nas62x0",
-- "qnap,ts219",
-- "seagate,dockstar",
-- "seagate,goflexnet",
-- "buffalo,lsxl",
-- "iom,ix2-200",
-- "keymile,km_kirkwood",
-- "lacie,cloudbox",
-- "lacie,inetspace_v2",
-- "lacie,netspace_lite_v2",
-- "lacie,netspace_max_v2",
-- "lacie,netspace_mini_v2",
-- "lacie,netspace_v2",
-- "marvell,db-88f6281-bp",
-- "marvell,db-88f6282-bp",
-- "mpl,cec4",
-- "netgear,readynas-duo-v2",
-- "plathome,openblocks-a6",
-- "usi,topkick",
-- "zyxel,nsa310",
-+ "marvell,kirkwood",
- NULL
- };
-
-diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
-deleted file mode 100644
-index 4ec8b7a..0000000
---- a/arch/arm/mach-kirkwood/board-lsxl.c
-+++ /dev/null
-@@ -1,52 +0,0 @@
--/*
-- * Copyright 2012 (C), Michael Walle <michael@walle.cc>
-- *
-- * arch/arm/mach-kirkwood/board-lsxl.c
-- *
-- * Buffalo Linkstation LS-XHL and LS-CHLv2 init for drivers not
-- * converted to flattened device tree yet.
-- *
-- * 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/platform_device.h>
--#include <linux/mv643xx_eth.h>
--#include "common.h"
--
--static struct mv643xx_eth_platform_data lsxl_ge00_data = {
-- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
--};
--
--static struct mv643xx_eth_platform_data lsxl_ge01_data = {
-- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
--};
--
--/*
-- * On the LS-XHL/LS-CHLv2, the shutdown process is following:
-- * - Userland monitors key events until the power switch goes to off position
-- * - The board reboots
-- * - U-boot starts and goes into an idle mode waiting for the user
-- * to move the switch to ON position
-- *
-- */
--static void lsxl_power_off(void)
--{
-- kirkwood_restart('h', NULL);
--}
--
--void __init lsxl_init(void)
--{
-- /*
-- * Basic setup. Needs to be called early.
-- */
--
-- kirkwood_ge00_init(&lsxl_ge00_data);
-- kirkwood_ge01_init(&lsxl_ge01_data);
--
-- /* register power-off method */
-- pm_power_off = lsxl_power_off;
--}
-diff --git a/arch/arm/mach-kirkwood/board-readynas.c b/arch/arm/mach-kirkwood/board-readynas.c
-deleted file mode 100644
-index fb42c20..0000000
---- a/arch/arm/mach-kirkwood/board-readynas.c
-+++ /dev/null
-@@ -1,28 +0,0 @@
--/*
-- * NETGEAR ReadyNAS Duo v2 Board setup for drivers not already
-- * converted to DT.
-- *
-- * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
-- *
-- * This program is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU General Public License
-- * as published by the Free Software Foundation; either version
-- * 2 of the License, or (at your option) any later version.
-- */
--
--#include <linux/kernel.h>
--#include <linux/init.h>
--#include <linux/platform_device.h>
--#include <linux/mv643xx_eth.h>
--#include <mach/kirkwood.h>
--#include "common.h"
--
--static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = {
-- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
--};
--
--void __init netgear_readynas_init(void)
--{
-- kirkwood_ge00_init(&netgear_readynas_ge00_data);
-- kirkwood_pcie_init(KW_PCIE0);
--}
---
-1.8.4.rc1
-
--- /dev/null
+From 0e701e28611fc08558406accadae40be36fe5289 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 29 May 2013 09:32:48 +0000
+Subject: [PATCH 25/29] net: mv643xx_eth: add DT parsing support
+
+This adds device tree parsing support for the shared driver of mv643xx_eth.
+As the bindings are slightly different from current PPC bindings new binding
+documentation is also added. Following PPC-style device setup, the shared
+driver now also adds port platform_devices and sets up port platform_data.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ .../devicetree/bindings/net/marvell-orion-net.txt | 85 ++++++++++++
+ drivers/net/ethernet/marvell/mv643xx_eth.c | 153 ++++++++++++++++++++-
+ 2 files changed, 234 insertions(+), 4 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/net/marvell-orion-net.txt
+
+--- /dev/null
++++ b/Documentation/devicetree/bindings/net/marvell-orion-net.txt
+@@ -0,0 +1,85 @@
++Marvell Orion/Discovery ethernet controller
++=============================================
++
++The Marvell Discovery ethernet controller can be found on Marvell Orion SoCs
++(Kirkwood, Dove, Orion5x, and Discovery Innovation) and as part of Marvell
++Discovery system controller chips (mv64[345]60).
++
++The Discovery ethernet controller is described with two levels of nodes. The
++first level describes the ethernet controller itself and the second level
++describes up to 3 ethernet port nodes within that controller. The reason for
++the multiple levels is that the port registers are interleaved within a single
++set of controller registers. Each port node describes port-specific properties.
++
++Note: The above separation is only true for Discovery system controllers.
++For Orion SoCs we stick to the separation, although there each controller has
++only one port associated. Multiple ports are implemented as multiple single-port
++controllers. As Kirkwood has some issues with proper initialization after reset,
++an extra compatible string is added for it.
++
++* Ethernet controller node
++
++Required controller properties:
++ - #address-cells: shall be 1.
++ - #size-cells: shall be 0.
++ - compatible: shall be one of "marvell,orion-eth", "marvell,kirkwood-eth".
++ - reg: address and length of the controller registers.
++
++Optional controller properties:
++ - clocks: phandle reference to the controller clock.
++ - marvell,tx-checksum-limit: max tx packet size for hardware checksum.
++
++* Ethernet port node
++
++Required port properties:
++ - device_type: shall be "network".
++ - compatible: shall be one of "marvell,orion-eth-port",
++ "marvell,kirkwood-eth-port".
++ - reg: port number relative to ethernet controller, shall be 0, 1, or 2.
++ - interrupts: port interrupt.
++ - local-mac-address: 6 bytes MAC address.
++
++Optional port properties:
++ - marvell,tx-queue-size: size of the transmit ring buffer.
++ - marvell,tx-sram-addr: address of transmit descriptor buffer located in SRAM.
++ - marvell,tx-sram-size: size of transmit descriptor buffer located in SRAM.
++ - marvell,rx-queue-size: size of the receive ring buffer.
++ - marvell,rx-sram-addr: address of receive descriptor buffer located in SRAM.
++ - marvell,rx-sram-size: size of receive descriptor buffer located in SRAM.
++
++and
++
++ - phy-handle: phandle reference to ethernet PHY.
++
++or
++
++ - speed: port speed if no PHY connected.
++ - duplex: port mode if no PHY connected.
++
++* Node example:
++
++mdio-bus {
++ ...
++ ethphy: ethernet-phy@8 {
++ device_type = "ethernet-phy";
++ ...
++ };
++};
++
++eth: ethernet-controller@72000 {
++ compatible = "marvell,orion-eth";
++ #address-cells = <1>;
++ #size-cells = <0>;
++ reg = <0x72000 0x2000>;
++ clocks = <&gate_clk 2>;
++ marvell,tx-checksum-limit = <1600>;
++
++ ethernet@0 {
++ device_type = "network";
++ compatible = "marvell,orion-eth-port";
++ reg = <0>;
++ interrupts = <29>;
++ phy-handle = <ðphy>;
++ local-mac-address = [00 00 00 00 00 00];
++ };
++};
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -60,6 +60,9 @@
+ #include <linux/types.h>
+ #include <linux/slab.h>
+ #include <linux/clk.h>
++#include <linux/of.h>
++#include <linux/of_irq.h>
++#include <linux/of_net.h>
+ #include <linux/of_mdio.h>
+
+ static char mv643xx_eth_driver_name[] = "mv643xx_eth";
+@@ -2453,13 +2456,148 @@ static void infer_hw_params(struct mv643
+ }
+ }
+
++#if defined(CONFIG_OF)
++static const struct of_device_id mv643xx_eth_shared_ids[] = {
++ { .compatible = "marvell,orion-eth", },
++ { .compatible = "marvell,kirkwood-eth", },
++ { }
++};
++MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids);
++#endif
++
++#if defined(CONFIG_OF) && !defined(CONFIG_MV64X60)
++#define mv643xx_eth_property(_np, _name, _v) \
++ do { \
++ u32 tmp; \
++ if (!of_property_read_u32(_np, "marvell," _name, &tmp)) \
++ _v = tmp; \
++ } while (0)
++
++static struct platform_device *port_platdev[3];
++
++static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
++ struct device_node *pnp)
++{
++ struct platform_device *ppdev;
++ struct mv643xx_eth_platform_data ppd;
++ struct resource res;
++ const char *mac_addr;
++ int ret;
++
++ memset(&ppd, 0, sizeof(ppd));
++ ppd.shared = pdev;
++
++ memset(&res, 0, sizeof(res));
++ if (!of_irq_to_resource(pnp, 0, &res)) {
++ dev_err(&pdev->dev, "missing interrupt on %s\n", pnp->name);
++ return -EINVAL;
++ }
++
++ if (of_property_read_u32(pnp, "reg", &ppd.port_number)) {
++ dev_err(&pdev->dev, "missing reg property on %s\n", pnp->name);
++ return -EINVAL;
++ }
++
++ if (ppd.port_number >= 3) {
++ dev_err(&pdev->dev, "invalid reg property on %s\n", pnp->name);
++ return -EINVAL;
++ }
++
++ mac_addr = of_get_mac_address(pnp);
++ if (mac_addr)
++ memcpy(ppd.mac_addr, mac_addr, 6);
++
++ mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
++ mv643xx_eth_property(pnp, "tx-sram-addr", ppd.tx_sram_addr);
++ mv643xx_eth_property(pnp, "tx-sram-size", ppd.tx_sram_size);
++ mv643xx_eth_property(pnp, "rx-queue-size", ppd.rx_queue_size);
++ mv643xx_eth_property(pnp, "rx-sram-addr", ppd.rx_sram_addr);
++ mv643xx_eth_property(pnp, "rx-sram-size", ppd.rx_sram_size);
++
++ ppd.phy_node = of_parse_phandle(pnp, "phy-handle", 0);
++ if (!ppd.phy_node) {
++ ppd.phy_addr = MV643XX_ETH_PHY_NONE;
++ of_property_read_u32(pnp, "speed", &ppd.speed);
++ of_property_read_u32(pnp, "duplex", &ppd.duplex);
++ }
++
++ ppdev = platform_device_alloc(MV643XX_ETH_NAME, ppd.port_number);
++ if (!ppdev)
++ return -ENOMEM;
++ ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
++
++ ret = platform_device_add_resources(ppdev, &res, 1);
++ if (ret)
++ goto port_err;
++
++ ret = platform_device_add_data(ppdev, &ppd, sizeof(ppd));
++ if (ret)
++ goto port_err;
++
++ ret = platform_device_add(ppdev);
++ if (ret)
++ goto port_err;
++
++ port_platdev[ppd.port_number] = ppdev;
++
++ return 0;
++
++port_err:
++ platform_device_put(ppdev);
++ return ret;
++}
++
++static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
++{
++ struct mv643xx_eth_shared_platform_data *pd;
++ struct device_node *pnp, *np = pdev->dev.of_node;
++ int ret;
++
++ /* bail out if not registered from DT */
++ if (!np)
++ return 0;
++
++ pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL);
++ if (!pd)
++ return -ENOMEM;
++ pdev->dev.platform_data = pd;
++
++ mv643xx_eth_property(np, "tx-checksum-limit", pd->tx_csum_limit);
++
++ for_each_available_child_of_node(np, pnp) {
++ ret = mv643xx_eth_shared_of_add_port(pdev, pnp);
++ if (ret)
++ return ret;
++ }
++ return 0;
++}
++
++static void mv643xx_eth_shared_of_remove(void)
++{
++ int n;
++
++ for (n = 0; n < 3; n++) {
++ platform_device_del(port_platdev[n]);
++ port_platdev[n] = NULL;
++ }
++}
++#else
++static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
++{
++ return 0
++}
++
++#define mv643xx_eth_shared_of_remove()
++#endif
++
+ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
+ {
+ static int mv643xx_eth_version_printed;
+- struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
++ struct mv643xx_eth_shared_platform_data *pd;
+ struct mv643xx_eth_shared_private *msp;
+ const struct mbus_dram_target_info *dram;
+ struct resource *res;
++ int ret;
+
+ if (!mv643xx_eth_version_printed++)
+ pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
+@@ -2472,6 +2610,7 @@ static int mv643xx_eth_shared_probe(stru
+ msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
+ if (msp == NULL)
+ return -ENOMEM;
++ platform_set_drvdata(pdev, msp);
+
+ msp->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+ if (msp->base == NULL)
+@@ -2488,12 +2627,15 @@ static int mv643xx_eth_shared_probe(stru
+ if (dram)
+ mv643xx_eth_conf_mbus_windows(msp, dram);
+
++ ret = mv643xx_eth_shared_of_probe(pdev);
++ if (ret)
++ return ret;
++ pd = pdev->dev.platform_data;
++
+ msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
+ pd->tx_csum_limit : 9 * 1024;
+ infer_hw_params(msp);
+
+- platform_set_drvdata(pdev, msp);
+-
+ return 0;
+ }
+
+@@ -2501,9 +2643,9 @@ static int mv643xx_eth_shared_remove(str
+ {
+ struct mv643xx_eth_shared_private *msp = platform_get_drvdata(pdev);
+
++ mv643xx_eth_shared_of_remove();
+ if (!IS_ERR(msp->clk))
+ clk_disable_unprepare(msp->clk);
+-
+ return 0;
+ }
+
+@@ -2513,6 +2655,7 @@ static struct platform_driver mv643xx_et
+ .driver = {
+ .name = MV643XX_ETH_SHARED_NAME,
+ .owner = THIS_MODULE,
++ .of_match_table = of_match_ptr(mv643xx_eth_shared_ids),
+ },
+ };
+
+@@ -2721,6 +2864,8 @@ static int mv643xx_eth_probe(struct plat
+ if (!IS_ERR(mp->clk)) {
+ clk_prepare_enable(mp->clk);
+ mp->t_clk = clk_get_rate(mp->clk);
++ } else if (!IS_ERR(mp->shared->clk)) {
++ mp->t_clk = clk_get_rate(mp->shared->clk);
+ }
+
+ set_params(mp, pd);
--- /dev/null
+From 678cc6aa6f66182cddfc0c8fc34d4ef196669b83 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Sun, 7 Jul 2013 22:34:56 +0200
+Subject: [PATCH 26/29] ARM: kirkwood: add gigabit ethernet and mvmdio device
+ tree nodes
+
+This patch adds mv643xx_eth and mvmdio device tree nodes for DT enabled
+Kirkwood boards. Phy nodes are also added with reg property set on a
+per-board basis.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ arch/arm/boot/dts/kirkwood-cloudbox.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-db.dtsi | 16 +++++++
+ arch/arm/boot/dts/kirkwood-dnskw.dtsi | 16 +++++++
+ arch/arm/boot/dts/kirkwood-dockstar.dts | 17 +++++++
+ arch/arm/boot/dts/kirkwood-dreamplug.dts | 28 ++++++++++++
+ arch/arm/boot/dts/kirkwood-goflexnet.dts | 16 +++++++
+ .../arm/boot/dts/kirkwood-guruplug-server-plus.dts | 30 +++++++++++++
+ arch/arm/boot/dts/kirkwood-ib62x0.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-iconnect.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 24 ++++++++++
+ arch/arm/boot/dts/kirkwood-is2.dts | 2 +
+ arch/arm/boot/dts/kirkwood-km_kirkwood.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-lsxl.dtsi | 28 ++++++++++++
+ arch/arm/boot/dts/kirkwood-mplcec4.dts | 27 +++++++++++
+ .../boot/dts/kirkwood-netgear_readynas_duo_v2.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 16 +++++++
+ arch/arm/boot/dts/kirkwood-ns2.dts | 2 +
+ arch/arm/boot/dts/kirkwood-ns2lite.dts | 2 +
+ arch/arm/boot/dts/kirkwood-ns2max.dts | 2 +
+ arch/arm/boot/dts/kirkwood-ns2mini.dts | 2 +
+ arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-topkick.dts | 16 +++++++
+ arch/arm/boot/dts/kirkwood-ts219-6281.dts | 4 +-
+ arch/arm/boot/dts/kirkwood-ts219-6282.dts | 4 +-
+ arch/arm/boot/dts/kirkwood-ts219.dtsi | 16 +++++++
+ arch/arm/boot/dts/kirkwood.dtsi | 52 ++++++++++++++++++++++
+ 26 files changed, 414 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/boot/dts/kirkwood-cloudbox.dts
++++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
+@@ -87,3 +87,19 @@
+ gpios = <&gpio0 17 0>;
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-db.dtsi
++++ b/arch/arm/boot/dts/kirkwood-db.dtsi
+@@ -87,3 +87,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@8 {
++ device_type = "ethernet-phy";
++ reg = <8>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
++++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+@@ -217,3 +217,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@8 {
++ device_type = "ethernet-phy";
++ reg = <8>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
++++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
+@@ -91,3 +91,20 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ compatible = "marvell,88e1116";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
++++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
+@@ -99,3 +99,31 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++
++ ethphy1: ethernet-phy@1 {
++ device_type = "ethernet-phy";
++ reg = <1>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
++
++ð1 {
++ status = "okay";
++ ethernet1-port@0 {
++ phy-handle = <ðphy1>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
++++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
+@@ -170,3 +170,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
++++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+@@ -96,3 +96,33 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ compatible = "marvell,88e1121";
++ reg = <0>;
++ };
++
++ ethphy1: ethernet-phy@1 {
++ device_type = "ethernet-phy";
++ compatible = "marvell,88e1121";
++ reg = <1>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
++
++ð1 {
++ status = "okay";
++ ethernet1-port@0 {
++ phy-handle = <ðphy1>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
++++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
+@@ -119,3 +119,19 @@
+
+
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@8 {
++ device_type = "ethernet-phy";
++ reg = <8>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
++++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
+@@ -176,3 +176,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@11 {
++ device_type = "ethernet-phy";
++ reg = <11>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
++++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+@@ -191,3 +191,27 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy1: ethernet-phy@11 {
++ device_type = "ethernet-phy";
++ reg = <11>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ speed = <1000>;
++ duplex = <1>;
++ };
++};
++
++ð1 {
++ status = "okay";
++ ethernet1-port@0 {
++ phy-handle = <ðphy1>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-is2.dts
++++ b/arch/arm/boot/dts/kirkwood-is2.dts
+@@ -28,3 +28,5 @@
+ };
+ };
+ };
++
++ðphy0 { reg = <8>; };
+--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
++++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+@@ -43,3 +43,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
++++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+@@ -201,3 +201,31 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++
++ ethphy1: ethernet-phy@8 {
++ device_type = "ethernet-phy";
++ reg = <8>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
++
++ð1 {
++ status = "okay";
++ ethernet1-port@0 {
++ phy-handle = <ðphy1>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
++++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
+@@ -190,3 +190,30 @@
+ };
+ };
+
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@1 {
++ device_type = "ethernet-phy";
++ reg = <1>;
++ };
++
++ ethphy1: ethernet-phy@2 {
++ device_type = "ethernet-phy";
++ reg = <2>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
++
++ð1 {
++ status = "okay";
++ ethernet1-port@0 {
++ phy-handle = <ðphy1>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
++++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
+@@ -178,3 +178,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
++++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+@@ -82,3 +82,19 @@
+ };
+
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy {
++ device_type = "ethernet-phy";
++ /* overwrite reg property in board file */
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-ns2.dts
++++ b/arch/arm/boot/dts/kirkwood-ns2.dts
+@@ -28,3 +28,5 @@
+ };
+ };
+ };
++
++ðphy0 { reg = <8>; };
+--- a/arch/arm/boot/dts/kirkwood-ns2lite.dts
++++ b/arch/arm/boot/dts/kirkwood-ns2lite.dts
+@@ -28,3 +28,5 @@
+ };
+ };
+ };
++
++ðphy0 { reg = <0>; };
+--- a/arch/arm/boot/dts/kirkwood-ns2max.dts
++++ b/arch/arm/boot/dts/kirkwood-ns2max.dts
+@@ -47,3 +47,5 @@
+ };
+ };
+ };
++
++ðphy0 { reg = <8>; };
+--- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
++++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
+@@ -48,3 +48,5 @@
+ };
+ };
+ };
++
++ðphy0 { reg = <0>; };
+--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
++++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+@@ -210,3 +210,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-topkick.dts
++++ b/arch/arm/boot/dts/kirkwood-topkick.dts
+@@ -201,3 +201,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy@0 {
++ device_type = "ethernet-phy";
++ reg = <0>;
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
++++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
+@@ -50,4 +50,6 @@
+ gpios = <&gpio0 16 1>;
+ };
+ };
+-};
+\ No newline at end of file
++};
++
++ðphy0 { reg = <8>; };
+--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
++++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+@@ -50,4 +50,6 @@
+ gpios = <&gpio1 5 1>;
+ };
+ };
+-};
+\ No newline at end of file
++};
++
++ðphy0 { reg = <0>; };
+--- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
++++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
+@@ -81,3 +81,19 @@
+ };
+ };
+ };
++
++&mdio {
++ status = "okay";
++
++ ethphy0: ethernet-phy {
++ device_type = "ethernet-phy";
++ /* overwrite reg property in board file */
++ };
++};
++
++ð0 {
++ status = "okay";
++ ethernet0-port@0 {
++ phy-handle = <ðphy0>;
++ };
++};
+--- a/arch/arm/boot/dts/kirkwood.dtsi
++++ b/arch/arm/boot/dts/kirkwood.dtsi
+@@ -203,5 +203,57 @@
+ clocks = <&gate_clk 4>;
+ status = "disabled";
+ };
++
++ mdio: mdio-bus@72004 {
++ compatible = "marvell,orion-mdio";
++ #address-cells = <1>;
++ #size-cells = <0>;
++ reg = <0x72004 0x84>;
++ interrupts = <46>;
++ clocks = <&gate_clk 0>;
++ status = "disabled";
++
++ /* add phy nodes in board file */
++ };
++
++ eth0: ethernet-controller@72000 {
++ compatible = "marvell,kirkwood-eth";
++ #address-cells = <1>;
++ #size-cells = <0>;
++ reg = <0x72000 0x4000>;
++ clocks = <&gate_clk 0>;
++ marvell,tx-checksum-limit = <1600>;
++ status = "disabled";
++
++ ethernet0-port@0 {
++ device_type = "network";
++ compatible = "marvell,kirkwood-eth-port";
++ reg = <0>;
++ interrupts = <11>;
++ /* overwrite MAC address in bootloader */
++ local-mac-address = [00 00 00 00 00 00];
++ /* set phy-handle property in board file */
++ };
++ };
++
++ eth1: ethernet-controller@76000 {
++ compatible = "marvell,kirkwood-eth";
++ #address-cells = <1>;
++ #size-cells = <0>;
++ reg = <0x76000 0x4000>;
++ clocks = <&gate_clk 19>;
++ marvell,tx-checksum-limit = <1600>;
++ status = "disabled";
++
++ ethernet1-port@0 {
++ device_type = "network";
++ compatible = "marvell,kirkwood-eth-port";
++ reg = <0>;
++ interrupts = <15>;
++ /* overwrite MAC address in bootloader */
++ local-mac-address = [00 00 00 00 00 00];
++ /* set phy-handle property in board file */
++ };
++ };
+ };
+ };
+++ /dev/null
-From dcfe8d8652de29fae2e247137d0e776fdda60b14 Mon Sep 17 00:00:00 2001
-From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-Date: Tue, 2 Jul 2013 13:00:23 +0200
-Subject: [PATCH 26/29] ARM: kirkwood: remove legacy clk alias for mv643xx_eth
-
-With all boards converted to DT enabled mv643xx_eth we can now
-remove the clock alias for gbe clocks.
-
-Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
----
- arch/arm/mach-kirkwood/board-dt.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
-index 15e61c8..a6ff0a8 100644
---- a/arch/arm/mach-kirkwood/board-dt.c
-+++ b/arch/arm/mach-kirkwood/board-dt.c
-@@ -66,12 +66,10 @@ static void __init kirkwood_legacy_clk_init(void)
- */
- clkspec.args[0] = CGC_BIT_GE0;
- clk = of_clk_get_from_provider(&clkspec);
-- orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
- clk_prepare_enable(clk);
-
- clkspec.args[0] = CGC_BIT_GE1;
- clk = of_clk_get_from_provider(&clkspec);
-- orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
- clk_prepare_enable(clk);
- }
-
---
-1.8.4.rc1
-
--- /dev/null
+From 3973689b8f58652143ffa433bec6096d22904ee0 Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Wed, 3 Jul 2013 18:57:51 +0200
+Subject: [PATCH 27/29] ARM: kirkwood: remove redundant DT board files
+
+With DT support for mv643xx_eth board specific init for some boards now
+is unneccessary. Remove those board files, Kconfig entries, and
+corresponding entries in kirkwood_defconfig.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ arch/arm/configs/kirkwood_defconfig | 21 ----
+ arch/arm/mach-kirkwood/Kconfig | 162 --------------------------
+ arch/arm/mach-kirkwood/Makefile | 21 ----
+ arch/arm/mach-kirkwood/board-db88f628x-bp.c | 24 ----
+ arch/arm/mach-kirkwood/board-dnskw.c | 7 --
+ arch/arm/mach-kirkwood/board-dockstar.c | 32 -----
+ arch/arm/mach-kirkwood/board-dreamplug.c | 35 ------
+ arch/arm/mach-kirkwood/board-dt.c | 82 +------------
+ arch/arm/mach-kirkwood/board-goflexnet.c | 34 ------
+ arch/arm/mach-kirkwood/board-guruplug.c | 33 ------
+ arch/arm/mach-kirkwood/board-ib62x0.c | 29 -----
+ arch/arm/mach-kirkwood/board-iconnect.c | 24 ----
+ arch/arm/mach-kirkwood/board-iomega_ix2_200.c | 34 ------
+ arch/arm/mach-kirkwood/board-km_kirkwood.c | 44 -------
+ arch/arm/mach-kirkwood/board-lsxl.c | 52 ---------
+ arch/arm/mach-kirkwood/board-mplcec4.c | 35 ------
+ arch/arm/mach-kirkwood/board-ns2.c | 35 ------
+ arch/arm/mach-kirkwood/board-openblocks_a6.c | 26 -----
+ arch/arm/mach-kirkwood/board-readynas.c | 28 -----
+ arch/arm/mach-kirkwood/board-ts219.c | 43 -------
+ arch/arm/mach-kirkwood/board-usi_topkick.c | 29 -----
+ arch/arm/mach-kirkwood/common.h | 104 -----------------
+ 22 files changed, 2 insertions(+), 932 deletions(-)
+ delete mode 100644 arch/arm/mach-kirkwood/board-db88f628x-bp.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-dockstar.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-dreamplug.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-goflexnet.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-guruplug.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-ib62x0.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-iomega_ix2_200.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-km_kirkwood.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-lsxl.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-mplcec4.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-ns2.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-openblocks_a6.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-readynas.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-ts219.c
+ delete mode 100644 arch/arm/mach-kirkwood/board-usi_topkick.c
+
+--- a/arch/arm/configs/kirkwood_defconfig
++++ b/arch/arm/configs/kirkwood_defconfig
+@@ -30,28 +30,7 @@ CONFIG_MACH_SHEEVAPLUG=y
+ CONFIG_MACH_T5325=y
+ CONFIG_MACH_TS219=y
+ CONFIG_MACH_TS41X=y
+-CONFIG_MACH_CLOUDBOX_DT=y
+ CONFIG_MACH_DLINK_KIRKWOOD_DT=y
+-CONFIG_MACH_DOCKSTAR_DT=y
+-CONFIG_MACH_DREAMPLUG_DT=y
+-CONFIG_MACH_GOFLEXNET_DT=y
+-CONFIG_MACH_GURUPLUG_DT=y
+-CONFIG_MACH_IB62X0_DT=y
+-CONFIG_MACH_ICONNECT_DT=y
+-CONFIG_MACH_INETSPACE_V2_DT=y
+-CONFIG_MACH_IOMEGA_IX2_200_DT=y
+-CONFIG_MACH_KM_KIRKWOOD_DT=y
+-CONFIG_MACH_LSXL_DT=y
+-CONFIG_MACH_MPLCEC4_DT=y
+-CONFIG_MACH_NETSPACE_LITE_V2_DT=y
+-CONFIG_MACH_NETSPACE_MAX_V2_DT=y
+-CONFIG_MACH_NETSPACE_MINI_V2_DT=y
+-CONFIG_MACH_NETSPACE_V2_DT=y
+-CONFIG_MACH_NSA310_DT=y
+-CONFIG_MACH_OPENBLOCKS_A6_DT=y
+-CONFIG_MACH_READYNAS_DT=y
+-CONFIG_MACH_TOPKICK_DT=y
+-CONFIG_MACH_TS219_DT=y
+ # CONFIG_CPU_FEROCEON_OLD_ID is not set
+ CONFIG_PREEMPT=y
+ CONFIG_AEABI=y
+--- a/arch/arm/mach-kirkwood/Kconfig
++++ b/arch/arm/mach-kirkwood/Kconfig
+@@ -140,20 +140,6 @@ config ARCH_KIRKWOOD_DT
+ Say 'Y' here if you want your kernel to support the
+ Marvell Kirkwood using flattened device tree.
+
+-config MACH_CLOUDBOX_DT
+- bool "LaCie CloudBox NAS (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the LaCie
+- CloudBox NAS, using Flattened Device Tree.
+-
+-config MACH_DB88F628X_BP_DT
+- bool "Marvell DB-88F628x-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_DLINK_KIRKWOOD_DT
+ bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
+ select ARCH_KIRKWOOD_DT
+@@ -162,154 +148,6 @@ config MACH_DLINK_KIRKWOOD_DT
+ Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
+ using Flattened Device Tree.
+
+-config MACH_DOCKSTAR_DT
+- bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Seagate FreeAgent Dockstar (Flattened Device Tree).
+-
+-config MACH_DREAMPLUG_DT
+- bool "Marvell DreamPlug (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Marvell DreamPlug (Flattened Device Tree).
+-
+-config MACH_GOFLEXNET_DT
+- bool "Seagate GoFlex Net (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Seagate GoFlex Net (Flattened Device Tree).
+-
+-config MACH_GURUPLUG_DT
+- bool "Marvell GuruPlug Reference Board (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Marvell GuruPlug Reference Board (Flattened Device Tree).
+-
+-config MACH_IB62X0_DT
+- bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
+- Flattened Device Tree.
+-
+-config MACH_ICONNECT_DT
+- bool "Iomega Iconnect (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here to enable Iomega Iconnect support.
+-
+-config MACH_INETSPACE_V2_DT
+- bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the LaCie
+- Internet Space v2 NAS, using Flattened Device Tree.
+-
+-config MACH_IOMEGA_IX2_200_DT
+- bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Iomega StorCenter ix2-200 (Flattened Device Tree).
+-
+-config MACH_KM_KIRKWOOD_DT
+- bool "Keymile Kirkwood Reference Design (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
+-
+-config MACH_LSXL_DT
+- bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
+- Flattened Device Tree.
+-
+-config MACH_MPLCEC4_DT
+- bool "MPL CEC4 (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- MPL CEC4 (Flattened Device Tree).
+-
+-config MACH_NETSPACE_LITE_V2_DT
+- bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the LaCie
+- Network Space Lite v2 NAS, using Flattened Device Tree.
+-
+-config MACH_NETSPACE_MAX_V2_DT
+- bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the LaCie
+- Network Space Max v2 NAS, using Flattened Device Tree.
+-
+-config MACH_NETSPACE_MINI_V2_DT
+- bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the LaCie
+- Network Space Mini v2 NAS using Flattened Device Tree.
+-
+- This board is embedded in a product named CloudBox, which
+- provides automatic backup on a 100GB cloud storage. This
+- should not confused with a more recent LaCie NAS also named
+- CloudBox. For this last, the disk capacity is 1TB or above.
+-
+-config MACH_NETSPACE_V2_DT
+- bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the LaCie
+- Network Space v2 NAS, using Flattened Device Tree.
+-
+-config MACH_OPENBLOCKS_A6_DT
+- bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- Plat'Home OpenBlocks A6 (Flattened Device Tree).
+-
+-config MACH_READYNAS_DT
+- bool "NETGEAR ReadyNAS Duo v2 (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- select ARM_APPENDED_DTB
+- select ARM_ATAG_DTB_COMPAT
+- help
+- Say 'Y' here if you want your kernel to support the
+- NETGEAR ReadyNAS Duo v2 using Fattened Device Tree.
+-
+-config MACH_TOPKICK_DT
+- bool "USI Topkick (Flattened Device Tree)"
+- select ARCH_KIRKWOOD_DT
+- help
+- Say 'Y' here if you want your kernel to support the
+- USI Topkick, using Flattened Device Tree
+-
+-config MACH_TS219_DT
+- bool "Device Tree for QNAP TS-11X, TS-21X NAS"
+- select ARCH_KIRKWOOD_DT
+- select ARM_APPENDED_DTB
+- select ARM_ATAG_DTB_COMPAT
+- help
+- Say 'Y' here if you want your kernel to support the QNAP
+- TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
+- TS-219P+ Turbo NAS devices using Fattened Device Tree.
+- There are two different Device Tree descriptions, depending
+- on if the device is based on an if the board uses the MV6281
+- or MV6282. If you have the wrong one, the buttons will not
+- work.
+-
+ endmenu
+
+ endif
+--- a/arch/arm/mach-kirkwood/Makefile
++++ b/arch/arm/mach-kirkwood/Makefile
+@@ -19,25 +19,4 @@ obj-$(CONFIG_MACH_TS219) += ts219-setup
+ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
+
+ obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
+-obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
+-obj-$(CONFIG_MACH_DB88F628X_BP_DT) += board-db88f628x-bp.o
+ obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
+-obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
+-obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
+-obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
+-obj-$(CONFIG_MACH_GURUPLUG_DT) += board-guruplug.o
+-obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
+-obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
+-obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o
+-obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
+-obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o
+-obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
+-obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o
+-obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
+-obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
+-obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
+-obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
+-obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
+-obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o
+-obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
+-obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
+--- a/arch/arm/mach-kirkwood/board-db88f628x-bp.c
++++ /dev/null
+@@ -1,24 +0,0 @@
+-/*
+- * Saeed Bishara <saeed@marvell.com>
+- *
+- * Marvell DB-88F628{1,2}-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 db88f628x_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+-};
+-
+-void __init db88f628x_init(void)
+-{
+- kirkwood_ge00_init(&db88f628x_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-dnskw.c
++++ b/arch/arm/mach-kirkwood/board-dnskw.c
+@@ -14,14 +14,9 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+-#include <linux/mv643xx_eth.h>
+ #include <linux/gpio.h>
+ #include "common.h"
+
+-static struct mv643xx_eth_platform_data dnskw_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+-};
+-
+ /* Register any GPIO for output and set the value */
+ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
+ {
+@@ -36,8 +31,6 @@ static void __init dnskw_gpio_register(u
+
+ void __init dnskw_init(void)
+ {
+- kirkwood_ge00_init(&dnskw_ge00_data);
+-
+ /* Set NAS to turn back on after a power failure */
+ dnskw_gpio_register(37, "dnskw:power:recover", 1);
+ }
+--- a/arch/arm/mach-kirkwood/board-dockstar.c
++++ /dev/null
+@@ -1,32 +0,0 @@
+-/*
+- * arch/arm/mach-kirkwood/board-dockstar.c
+- *
+- * Seagate FreeAgent Dockstar Board Init for drivers not converted to
+- * flattened device tree yet.
+- *
+- * 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.
+- *
+- * Copied and modified for Seagate GoFlex Net support by
+- * Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
+- * GoFlex kernel patches.
+- *
+- */
+-
+-#include <linux/kernel.h>
+-#include <linux/init.h>
+-#include <linux/mv643xx_eth.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data dockstar_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-void __init dockstar_dt_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&dockstar_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-dreamplug.c
++++ /dev/null
+@@ -1,35 +0,0 @@
+-/*
+- * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
+- *
+- * arch/arm/mach-kirkwood/board-dreamplug.c
+- *
+- * Marvell DreamPlug Reference Board Init for drivers not converted to
+- * flattened device tree yet.
+- *
+- * 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/mv643xx_eth.h>
+-#include <linux/gpio.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(1),
+-};
+-
+-void __init dreamplug_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&dreamplug_ge00_data);
+- kirkwood_ge01_init(&dreamplug_ge01_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-dt.c
++++ b/arch/arm/mach-kirkwood/board-dt.c
+@@ -106,92 +106,14 @@ static void __init kirkwood_dt_init(void
+ kexec_reinit = kirkwood_enable_pcie;
+ #endif
+
+- if (of_machine_is_compatible("globalscale,dreamplug"))
+- dreamplug_init();
+-
+- if (of_machine_is_compatible("globalscale,guruplug"))
+- guruplug_dt_init();
+-
+ if (of_machine_is_compatible("dlink,dns-kirkwood"))
+ dnskw_init();
+
+- if (of_machine_is_compatible("iom,iconnect"))
+- iconnect_init();
+-
+- if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
+- ib62x0_init();
+-
+- if (of_machine_is_compatible("qnap,ts219"))
+- qnap_dt_ts219_init();
+-
+- if (of_machine_is_compatible("seagate,dockstar"))
+- dockstar_dt_init();
+-
+- if (of_machine_is_compatible("seagate,goflexnet"))
+- goflexnet_init();
+-
+- if (of_machine_is_compatible("buffalo,lsxl"))
+- lsxl_init();
+-
+- if (of_machine_is_compatible("iom,ix2-200"))
+- iomega_ix2_200_init();
+-
+- if (of_machine_is_compatible("keymile,km_kirkwood"))
+- km_kirkwood_init();
+-
+- if (of_machine_is_compatible("lacie,cloudbox") ||
+- of_machine_is_compatible("lacie,inetspace_v2") ||
+- of_machine_is_compatible("lacie,netspace_lite_v2") ||
+- of_machine_is_compatible("lacie,netspace_max_v2") ||
+- of_machine_is_compatible("lacie,netspace_mini_v2") ||
+- of_machine_is_compatible("lacie,netspace_v2"))
+- ns2_init();
+-
+- if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
+- of_machine_is_compatible("marvell,db-88f6282-bp"))
+- db88f628x_init();
+-
+- if (of_machine_is_compatible("mpl,cec4"))
+- mplcec4_init();
+-
+- if (of_machine_is_compatible("netgear,readynas-duo-v2"))
+- netgear_readynas_init();
+-
+- if (of_machine_is_compatible("plathome,openblocks-a6"))
+- openblocks_a6_init();
+-
+- if (of_machine_is_compatible("usi,topkick"))
+- usi_topkick_init();
+-
+- of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
++ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ }
+
+ static const char * const kirkwood_dt_board_compat[] = {
+- "globalscale,dreamplug",
+- "globalscale,guruplug",
+- "dlink,dns-320",
+- "dlink,dns-325",
+- "iom,iconnect",
+- "raidsonic,ib-nas62x0",
+- "qnap,ts219",
+- "seagate,dockstar",
+- "seagate,goflexnet",
+- "buffalo,lsxl",
+- "iom,ix2-200",
+- "keymile,km_kirkwood",
+- "lacie,cloudbox",
+- "lacie,inetspace_v2",
+- "lacie,netspace_lite_v2",
+- "lacie,netspace_max_v2",
+- "lacie,netspace_mini_v2",
+- "lacie,netspace_v2",
+- "marvell,db-88f6281-bp",
+- "marvell,db-88f6282-bp",
+- "mpl,cec4",
+- "netgear,readynas-duo-v2",
+- "plathome,openblocks-a6",
+- "usi,topkick",
+- "zyxel,nsa310",
++ "marvell,kirkwood",
+ NULL
+ };
+
+--- a/arch/arm/mach-kirkwood/board-goflexnet.c
++++ /dev/null
+@@ -1,34 +0,0 @@
+-/*
+- * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
+- *
+- * arch/arm/mach-kirkwood/board-goflexnet.c
+- *
+- * Seagate GoFlext Net Board Init for drivers not converted to
+- * flattened device tree yet.
+- *
+- * 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.
+- *
+- * Copied and modified for Seagate GoFlex Net support by
+- * Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
+- * GoFlex kernel patches.
+- *
+- */
+-
+-#include <linux/kernel.h>
+-#include <linux/init.h>
+-#include <linux/mv643xx_eth.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-void __init goflexnet_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&goflexnet_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-guruplug.c
++++ /dev/null
+@@ -1,33 +0,0 @@
+-/*
+- * arch/arm/mach-kirkwood/board-guruplug.c
+- *
+- * Marvell Guruplug Reference Board Init for drivers not converted to
+- * flattened device tree yet.
+- *
+- * 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/mv643xx_eth.h>
+-#include <linux/gpio.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data guruplug_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-static struct mv643xx_eth_platform_data guruplug_ge01_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(1),
+-};
+-
+-void __init guruplug_dt_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&guruplug_ge00_data);
+- kirkwood_ge01_init(&guruplug_ge01_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-ib62x0.c
++++ /dev/null
+@@ -1,29 +0,0 @@
+-/*
+- * Copyright 2012 (C), Simon Baatz <gmbnomis@gmail.com>
+- *
+- * arch/arm/mach-kirkwood/board-ib62x0.c
+- *
+- * RaidSonic ICY BOX IB-NAS6210 & IB-NAS6220 init for drivers not
+- * converted to flattened device tree yet.
+- *
+- * 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/mv643xx_eth.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+-};
+-
+-void __init ib62x0_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&ib62x0_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-iconnect.c
++++ /dev/null
+@@ -1,24 +0,0 @@
+-/*
+- * arch/arm/mach-kirkwood/board-iconnect.c
+- *
+- * Iomega i-connect 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 iconnect_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(11),
+-};
+-
+-void __init iconnect_init(void)
+-{
+- kirkwood_ge00_init(&iconnect_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
++++ /dev/null
+@@ -1,34 +0,0 @@
+-/*
+- * arch/arm/mach-kirkwood/board-iomega_ix2_200.c
+- *
+- * Iomega StorCenter ix2-200
+- *
+- * 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/mv643xx_eth.h>
+-#include <linux/ethtool.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_NONE,
+- .speed = SPEED_1000,
+- .duplex = DUPLEX_FULL,
+-};
+-
+-static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(11),
+-};
+-
+-void __init iomega_ix2_200_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
+- kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-km_kirkwood.c
++++ /dev/null
+@@ -1,44 +0,0 @@
+-/*
+- * Copyright 2012 2012 KEYMILE AG, CH-3097 Bern
+- * Valentin Longchamp <valentin.longchamp@keymile.com>
+- *
+- * arch/arm/mach-kirkwood/board-km_kirkwood.c
+- *
+- * Keymile km_kirkwood Reference Desing Init for drivers not converted to
+- * flattened device tree yet.
+- *
+- * 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/mv643xx_eth.h>
+-#include <linux/clk.h>
+-#include <linux/clk-private.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-void __init km_kirkwood_init(void)
+-{
+- struct clk *sata_clk;
+- /*
+- * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
+- * SATA bits (14-15) of the Clock Gating Control Register. Since these
+- * devices are also not present in this variant, their clocks get
+- * disabled because unused when clk_disable_unused() gets called.
+- * That's why we change the flags to these clocks to CLK_IGNORE_UNUSED
+- */
+- sata_clk = clk_get_sys("sata_mv.0", "0");
+- if (!IS_ERR(sata_clk))
+- sata_clk->flags |= CLK_IGNORE_UNUSED;
+- sata_clk = clk_get_sys("sata_mv.0", "1");
+- if (!IS_ERR(sata_clk))
+- sata_clk->flags |= CLK_IGNORE_UNUSED;
+-
+- kirkwood_ge00_init(&km_kirkwood_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-lsxl.c
++++ /dev/null
+@@ -1,52 +0,0 @@
+-/*
+- * Copyright 2012 (C), Michael Walle <michael@walle.cc>
+- *
+- * arch/arm/mach-kirkwood/board-lsxl.c
+- *
+- * Buffalo Linkstation LS-XHL and LS-CHLv2 init for drivers not
+- * converted to flattened device tree yet.
+- *
+- * 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/platform_device.h>
+-#include <linux/mv643xx_eth.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data lsxl_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-static struct mv643xx_eth_platform_data lsxl_ge01_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+-};
+-
+-/*
+- * On the LS-XHL/LS-CHLv2, the shutdown process is following:
+- * - Userland monitors key events until the power switch goes to off position
+- * - The board reboots
+- * - U-boot starts and goes into an idle mode waiting for the user
+- * to move the switch to ON position
+- *
+- */
+-static void lsxl_power_off(void)
+-{
+- kirkwood_restart('h', NULL);
+-}
+-
+-void __init lsxl_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+-
+- kirkwood_ge00_init(&lsxl_ge00_data);
+- kirkwood_ge01_init(&lsxl_ge01_data);
+-
+- /* register power-off method */
+- pm_power_off = lsxl_power_off;
+-}
+--- a/arch/arm/mach-kirkwood/board-mplcec4.c
++++ /dev/null
+@@ -1,35 +0,0 @@
+-/*
+- * Copyright (C) 2012 MPL AG, Switzerland
+- * Stefan Peter <s.peter@mpl.ch>
+- *
+- * arch/arm/mach-kirkwood/board-mplcec4.c
+- *
+- * 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/mv643xx_eth.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data mplcec4_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(1),
+-};
+-
+-static struct mv643xx_eth_platform_data mplcec4_ge01_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(2),
+-};
+-
+-void __init mplcec4_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&mplcec4_ge00_data);
+- kirkwood_ge01_init(&mplcec4_ge01_data);
+-}
+-
+-
+-
+--- a/arch/arm/mach-kirkwood/board-ns2.c
++++ /dev/null
+@@ -1,35 +0,0 @@
+-/*
+- * Copyright 2012 (C), Simon Guinot <simon.guinot@sequanux.org>
+- *
+- * arch/arm/mach-kirkwood/board-ns2.c
+- *
+- * LaCie Network Space v2 board (and parents) initialization for drivers
+- * not converted to flattened device tree yet.
+- *
+- * 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/platform_device.h>
+-#include <linux/mv643xx_eth.h>
+-#include <linux/of.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data ns2_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+-};
+-
+-void __init ns2_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- if (of_machine_is_compatible("lacie,cloudbox") ||
+- of_machine_is_compatible("lacie,netspace_lite_v2") ||
+- of_machine_is_compatible("lacie,netspace_mini_v2"))
+- ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
+- kirkwood_ge00_init(&ns2_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-openblocks_a6.c
++++ /dev/null
+@@ -1,26 +0,0 @@
+-/*
+- * Copyright 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+- *
+- * arch/arm/mach-kirkwood/board-openblocks_a6.c
+- *
+- * 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/mv643xx_eth.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data openblocks_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-void __init openblocks_a6_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&openblocks_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/board-readynas.c
++++ /dev/null
+@@ -1,28 +0,0 @@
+-/*
+- * NETGEAR ReadyNAS Duo v2 Board setup for drivers not already
+- * converted to DT.
+- *
+- * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License
+- * as published by the Free Software Foundation; either version
+- * 2 of the License, or (at your option) any later version.
+- */
+-
+-#include <linux/kernel.h>
+-#include <linux/init.h>
+-#include <linux/platform_device.h>
+-#include <linux/mv643xx_eth.h>
+-#include <mach/kirkwood.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-void __init netgear_readynas_init(void)
+-{
+- kirkwood_ge00_init(&netgear_readynas_ge00_data);
+- kirkwood_pcie_init(KW_PCIE0);
+-}
+--- a/arch/arm/mach-kirkwood/board-ts219.c
++++ /dev/null
+@@ -1,43 +0,0 @@
+-/*
+- *
+- * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
+- *
+- * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
+- *
+- * Based on the board file ts219-setup.c:
+- *
+- * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
+- * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License
+- * as published by the Free Software Foundation; either version
+- * 2 of the License, or (at your option) any later version.
+- */
+-
+-#include <linux/kernel.h>
+-#include <linux/init.h>
+-#include <linux/platform_device.h>
+-#include <linux/mv643xx_eth.h>
+-#include <asm/mach-types.h>
+-#include <asm/mach/arch.h>
+-#include <mach/kirkwood.h>
+-#include "common.h"
+-#include "tsx1x-common.h"
+-
+-static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+-};
+-
+-void __init qnap_dt_ts219_init(void)
+-{
+- u32 dev, rev;
+-
+- kirkwood_pcie_id(&dev, &rev);
+- if (dev == MV88F6282_DEV_ID)
+- qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
+-
+- kirkwood_ge00_init(&qnap_ts219_ge00_data);
+-
+- pm_power_off = qnap_tsx1x_power_off;
+-}
+--- a/arch/arm/mach-kirkwood/board-usi_topkick.c
++++ /dev/null
+@@ -1,29 +0,0 @@
+-/*
+- * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
+- *
+- * arch/arm/mach-kirkwood/board-usi_topkick.c
+- *
+- * USI Topkick Init for drivers not converted to flattened device tree yet.
+- *
+- * 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/mv643xx_eth.h>
+-#include <linux/gpio.h>
+-#include "common.h"
+-
+-static struct mv643xx_eth_platform_data topkick_ge00_data = {
+- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+-};
+-
+-void __init usi_topkick_init(void)
+-{
+- /*
+- * Basic setup. Needs to be called early.
+- */
+- kirkwood_ge00_init(&topkick_ge00_data);
+-}
+--- a/arch/arm/mach-kirkwood/common.h
++++ b/arch/arm/mach-kirkwood/common.h
+@@ -55,116 +55,12 @@ void kirkwood_restart(char, const char *
+ void kirkwood_clk_init(void);
+
+ /* board init functions for boards not fully converted to fdt */
+-#ifdef CONFIG_MACH_DREAMPLUG_DT
+-void dreamplug_init(void);
+-#else
+-static inline void dreamplug_init(void) {};
+-#endif
+-#ifdef CONFIG_MACH_GURUPLUG_DT
+-void guruplug_dt_init(void);
+-#else
+-static inline void guruplug_dt_init(void) {};
+-#endif
+-#ifdef CONFIG_MACH_TS219_DT
+-void qnap_dt_ts219_init(void);
+-#else
+-static inline void qnap_dt_ts219_init(void) {};
+-#endif
+-
+ #ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
+ void dnskw_init(void);
+ #else
+ static inline void dnskw_init(void) {};
+ #endif
+
+-#ifdef CONFIG_MACH_ICONNECT_DT
+-void iconnect_init(void);
+-#else
+-static inline void iconnect_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_IB62X0_DT
+-void ib62x0_init(void);
+-#else
+-static inline void ib62x0_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_DOCKSTAR_DT
+-void dockstar_dt_init(void);
+-#else
+-static inline void dockstar_dt_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_GOFLEXNET_DT
+-void goflexnet_init(void);
+-#else
+-static inline void goflexnet_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_LSXL_DT
+-void lsxl_init(void);
+-#else
+-static inline void lsxl_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_IOMEGA_IX2_200_DT
+-void iomega_ix2_200_init(void);
+-#else
+-static inline void iomega_ix2_200_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_KM_KIRKWOOD_DT
+-void km_kirkwood_init(void);
+-#else
+-static inline void km_kirkwood_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_DB88F628X_BP_DT
+-void db88f628x_init(void);
+-#else
+-static inline void db88f628x_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_MPLCEC4_DT
+-void mplcec4_init(void);
+-#else
+-static inline void mplcec4_init(void) {};
+-#endif
+-
+-#if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
+- defined(CONFIG_MACH_NETSPACE_V2_DT) || \
+- defined(CONFIG_MACH_NETSPACE_MAX_V2_DT) || \
+- defined(CONFIG_MACH_NETSPACE_LITE_V2_DT) || \
+- defined(CONFIG_MACH_NETSPACE_MINI_V2_DT)
+-void ns2_init(void);
+-#else
+-static inline void ns2_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_OPENBLOCKS_A6_DT
+-void openblocks_a6_init(void);
+-#else
+-static inline void openblocks_a6_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_READYNAS_DT
+-void netgear_readynas_init(void);
+-#else
+-static inline void netgear_readynas_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_TOPKICK_DT
+-void usi_topkick_init(void);
+-#else
+-static inline void usi_topkick_init(void) {};
+-#endif
+-
+-#ifdef CONFIG_MACH_CLOUDBOX_DT
+-void cloudbox_init(void);
+-#else
+-static inline void cloudbox_init(void) {};
+-#endif
+-
+ /* early init functions not converted to fdt yet */
+ char *kirkwood_id(void);
+ void kirkwood_l2_init(void);
+++ /dev/null
-From eac92acae29cfab34785d61cbb3218e88e487b77 Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jogo@openwrt.org>
-Date: Mon, 8 Jul 2013 00:35:12 +0200
-Subject: [PATCH 27/29] net: mv643xx_eth: do not use port number as platform
- device id
-
-The port number is only local to the ethernet block, not global, so
-there can be two ethernet blocks both using the same port, like
-kirkwood with both using port 0.
-
-Fix this by using the array index offset for the allocated platform
-devices as the id.
-
-Signed-off-by: Jonas Gorski <jogo@openwrt.org>
----
- drivers/net/ethernet/marvell/mv643xx_eth.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
-index 004a250..e57d292 100644
---- a/drivers/net/ethernet/marvell/mv643xx_eth.c
-+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
-@@ -2483,6 +2483,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
- struct resource res;
- const char *mac_addr;
- int ret;
-+ int dev_num = 0;
-
- memset(&ppd, 0, sizeof(ppd));
- ppd.shared = pdev;
-@@ -2503,6 +2504,14 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
- return -EINVAL;
- }
-
-+ while (dev_num < 3 && port_platdev[dev_num])
-+ dev_num++;
-+
-+ if (dev_num == 3) {
-+ dev_err(&pdev->dev, "too many ports registered\n");
-+ return -EINVAL;
-+ }
-+
- mac_addr = of_get_mac_address(pnp);
- if (mac_addr)
- memcpy(ppd.mac_addr, mac_addr, 6);
-@@ -2521,7 +2530,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
- of_property_read_u32(pnp, "duplex", &ppd.duplex);
- }
-
-- ppdev = platform_device_alloc(MV643XX_ETH_NAME, ppd.port_number);
-+ ppdev = platform_device_alloc(MV643XX_ETH_NAME, dev_num);
- if (!ppdev)
- return -ENOMEM;
- ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-@@ -2538,7 +2547,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
- if (ret)
- goto port_err;
-
-- port_platdev[ppd.port_number] = ppdev;
-+ port_platdev[dev_num] = ppdev;
-
- return 0;
-
---
-1.8.4.rc1
-
--- /dev/null
+From 57bad8fd425fd4fd2ae6e4ae1e7e19c9281d2d3d Mon Sep 17 00:00:00 2001
+From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Date: Tue, 2 Jul 2013 13:00:23 +0200
+Subject: [PATCH 28/29] ARM: kirkwood: remove legacy clk alias for mv643xx_eth
+
+With all boards converted to DT enabled mv643xx_eth we can now
+remove the clock alias for gbe clocks.
+
+Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+---
+ arch/arm/mach-kirkwood/board-dt.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/arch/arm/mach-kirkwood/board-dt.c
++++ b/arch/arm/mach-kirkwood/board-dt.c
+@@ -66,12 +66,10 @@ static void __init kirkwood_legacy_clk_i
+ */
+ clkspec.args[0] = CGC_BIT_GE0;
+ clk = of_clk_get_from_provider(&clkspec);
+- orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
+ clk_prepare_enable(clk);
+
+ clkspec.args[0] = CGC_BIT_GE1;
+ clk = of_clk_get_from_provider(&clkspec);
+- orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
+ clk_prepare_enable(clk);
+ }
+
--- /dev/null
+From dc4eff91629aa5132f9c0737ef6d9ef013d4f8ce Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Mon, 8 Jul 2013 00:44:55 +0200
+Subject: [PATCH 29/29] net: mv643xx_eth: do not use port number as platform
+ device id
+
+The port number is only local to the ethernet block, not global, so
+there can be two ethernet blocks both using the same port, like
+kirkwood with both using port 0.
+
+Fix this by using the array index offset for the allocated platform
+devices as the id.
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/marvell/mv643xx_eth.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -2483,6 +2483,7 @@ static int mv643xx_eth_shared_of_add_por
+ struct resource res;
+ const char *mac_addr;
+ int ret;
++ int dev_num = 0;
+
+ memset(&ppd, 0, sizeof(ppd));
+ ppd.shared = pdev;
+@@ -2503,6 +2504,14 @@ static int mv643xx_eth_shared_of_add_por
+ return -EINVAL;
+ }
+
++ while (dev_num < 3 && port_platdev[dev_num])
++ dev_num++;
++
++ if (dev_num == 3) {
++ dev_err(&pdev->dev, "too many ports registered\n");
++ return -EINVAL;
++ }
++
+ mac_addr = of_get_mac_address(pnp);
+ if (mac_addr)
+ memcpy(ppd.mac_addr, mac_addr, 6);
+@@ -2521,7 +2530,7 @@ static int mv643xx_eth_shared_of_add_por
+ of_property_read_u32(pnp, "duplex", &ppd.duplex);
+ }
+
+- ppdev = platform_device_alloc(MV643XX_ETH_NAME, ppd.port_number);
++ ppdev = platform_device_alloc(MV643XX_ETH_NAME, dev_num);
+ if (!ppdev)
+ return -ENOMEM;
+ ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+@@ -2538,7 +2547,7 @@ static int mv643xx_eth_shared_of_add_por
+ if (ret)
+ goto port_err;
+
+- port_platdev[ppd.port_number] = ppdev;
++ port_platdev[dev_num] = ppdev;
+
+ return 0;
+
drivers/of/of_net.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 99 insertions(+), 1 deletion(-)
-diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
-index ffab033..8b40ac6 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -10,6 +10,7 @@
/**
* It maps 'enum phy_interface_t' found in include/linux/phy.h
-@@ -55,6 +56,103 @@ const int of_get_phy_mode(struct device_node *np)
+@@ -55,6 +56,103 @@ const int of_get_phy_mode(struct device_
}
EXPORT_SYMBOL_GPL(of_get_phy_mode);
/**
* Search the device tree for the best MAC address to use. 'mac-address' is
* checked first, because that is supposed to contain to "most recent" MAC
-@@ -89,6 +187,6 @@ const void *of_get_mac_address(struct device_node *np)
+@@ -89,6 +187,6 @@ const void *of_get_mac_address(struct de
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
return pp->value;
+ return of_get_mac_address_mtd(np);
}
EXPORT_SYMBOL(of_get_mac_address);
---
-1.8.4.rc1
-
--- /dev/null
+--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
++++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
+@@ -5,7 +5,7 @@
+
+ / {
+ model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)";
+- compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood";
++ compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+ memory {
+ device_type = "memory";
+@@ -50,6 +50,7 @@
+ marvell,function = "gpio";
+ };
+ };
++
+ serial@12000 {
+ status = "okay";
+ };
+@@ -64,19 +65,18 @@
+
+ partition@0 {
+ label = "u-boot";
+- reg = <0x0000000 0x100000>;
++ reg = <0x0000000 0xe0000>;
+ };
+
+- partition@100000 {
+- label = "uImage";
+- reg = <0x0100000 0x600000>;
++ partition@e0000 {
++ label = "u-boot environment";
++ reg = <0xe0000 0x100000>;
+ };
+
+- partition@700000 {
+- label = "root";
+- reg = <0x0700000 0xf900000>;
++ partition@100000 {
++ label = "rootfs";
++ reg = <0x100000 0xff00000>;
+ };
+-
+ };
+ };
+
+@@ -84,6 +84,7 @@
+ compatible = "gpio-keys";
+ #address-cells = <1>;
+ #size-cells = <0>;
++
+ button@1 {
+ label = "USB Copy";
+ linux,code = <133>;
+@@ -95,6 +96,7 @@
+ gpios = <&gpio0 28 1>;
+ };
+ };
++
+ gpio-leds {
+ compatible = "gpio-leds";
+
+@@ -112,12 +114,11 @@
+ gpios = <&gpio0 27 0>;
+ };
+ };
++
+ gpio_poweroff {
+ compatible = "gpio-poweroff";
+ gpios = <&gpio0 24 0>;
+ };
+-
+-
+ };
+
+ &mdio {
+@@ -131,6 +132,7 @@
+
+ ð0 {
+ status = "okay";
++
+ ethernet0-port@0 {
+ phy-handle = <ðphy0>;
+ };