Skip to contentSkip to conversation

mv643xx Ethernet DT support and CSB1724 board support.

PATCH Superseded Ian Molton 8 participants 35 messages Jul 30, 2012 – Jul 31, 2012

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ian Molton

author
#0 lore raw

cover mv643xx Ethernet DT support and CSB1724 board support.

This patch series adds support for the CSB1724 SoM by Cogent.

It also provides mv643xx DT support, and the CSB1724 was my test platform for this support.

The mv643xx driver needs a LOT more TLC, but this should be a pretty non-invasive way to get started on it.

The CSB1724 SoM platform support is ready-to-go. Supported so far is SATA, Ethernet, and Serial.

SATA is built upon Thomas' work.

Ian Molton (6):
Initial csb1724 board support (FDT)
mv643xx.c: Remove magic numbers.
mv643xx.c: Add basic device tree support.
kirkwood: setup clock only in eth helpers.
csb1724: Enable device tree based mv643xx ethernet support.
DT: Convert all kirkwood boards with mv643xx that use DT

 arch/arm/boot/dts/kirkwood-csb1724.dts     |   55 ++++++++++++++
 arch/arm/boot/dts/kirkwood-dnskw.dtsi      |   12 +++
 arch/arm/boot/dts/kirkwood-dreamplug.dts   |   24 ++++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts   |   11 +++
 arch/arm/boot/dts/kirkwood-ib62x0.dts      |   13 ++++
 arch/arm/boot/dts/kirkwood-iconnect.dts    |   13 ++++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi       |   23 ++++++
 arch/arm/boot/dts/kirkwood-ts219-6281.dts  |   11 ++-
 arch/arm/boot/dts/kirkwood-ts219-6282.dts  |   11 ++-
 arch/arm/boot/dts/kirkwood-ts219.dtsi      |    3 +
 arch/arm/boot/dts/kirkwood.dtsi            |   16 ++++
 arch/arm/configs/csb1724_defconfig         |   92 ++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig             |    7 ++
 arch/arm/mach-kirkwood/Makefile            |    1 +
 arch/arm/mach-kirkwood/Makefile.boot       |    1 +
 arch/arm/mach-kirkwood/board-csb1724.c     |   62 +++++++++++++++
 arch/arm/mach-kirkwood/board-dnskw.c       |    7 +-
 arch/arm/mach-kirkwood/board-dreamplug.c   |   13 +---
 arch/arm/mach-kirkwood/board-dt.c          |    4 +
 arch/arm/mach-kirkwood/board-goflexnet.c   |    7 +-
 arch/arm/mach-kirkwood/board-ib62x0.c      |    7 +-
 arch/arm/mach-kirkwood/board-iconnect.c    |    7 +-
 arch/arm/mach-kirkwood/board-lsxl.c        |   13 +---
 arch/arm/mach-kirkwood/board-ts219.c       |   10 +--
 arch/arm/mach-kirkwood/common.c            |    6 +-
 arch/arm/mach-kirkwood/common.h            |    6 ++
 drivers/net/ethernet/marvell/mv643xx_eth.c |  114 ++++++++++++++++++++++++----
 27 files changed, 475 insertions(+), 74 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-csb1724.dts
 create mode 100644 arch/arm/configs/csb1724_defconfig
 create mode 100644 arch/arm/mach-kirkwood/board-csb1724.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/6 Initial csb1724 board support (FDT)

This patch adds support for the csb1724 SoM.

It includes serial and SATA support.

---
 arch/arm/boot/dts/kirkwood-csb1724.dts |   30 ++++++++++++++++
 arch/arm/configs/csb1724_defconfig     |   47 +++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig         |    7 ++++
 arch/arm/mach-kirkwood/Makefile        |    1 +
 arch/arm/mach-kirkwood/Makefile.boot   |    1 +
 arch/arm/mach-kirkwood/board-csb1724.c |   59 ++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c      |    4 +++
 arch/arm/mach-kirkwood/common.h        |    6 ++++
 8 files changed, 155 insertions(+)
 create mode 100644 arch/arm/boot/dts/kirkwood-csb1724.dts
 create mode 100644 arch/arm/configs/csb1724_defconfig
 create mode 100644 arch/arm/mach-kirkwood/board-csb1724.c
arch/arm/boot/dts/kirkwood-csb1724.dts new file +30 -0
new file mode 100644
index 0000000..44dfe9a
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Cogent CSB1724-88F-628X SoM";
+	compatible = "cogent,csb1724", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "ok";
+		};
+
+		sata at 80000 {
+			nr-ports = <2>;
+			status = "ok";
+		};
+	};
+
+};
arch/arm/configs/csb1724_defconfig new file +47 -0

47 lines not on this page · raw message

arch/arm/mach-kirkwood/Kconfig +7 -0
index ca5c15a..6f59f0d 100644
@@ -109,6 +109,13 @@ config MACH_LSXL_DT
 	  Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
 	  Flattened Device Tree.
 
+config MACH_CSB1724_DT
+	bool "Cogent csb1724 SoM (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Cogent csb1724 SoM, using Flattened Device Tree.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
arch/arm/mach-kirkwood/Makefile +1 -0
index 055c85a..665ed63 100644
@@ -28,3 +28,4 @@ obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
 obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
 obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
+obj-$(CONFIG_MACH_CSB1724_DT)		+= board-csb1724.o
arch/arm/mach-kirkwood/Makefile.boot +1 -0
index 2a576ab..899bc80 100644
@@ -2,6 +2,7 @@
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
 
+dtb-$(CONFIG_MACH_CSB1724_DT) += kirkwood-csb1724.dtb
 dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
 dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
 dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
arch/arm/mach-kirkwood/board-csb1724.c new file +59 -0

59 lines not on this page · raw message

arch/arm/mach-kirkwood/board-dt.c +4 -0
index e4eb450..7679f7f 100644
@@ -87,6 +87,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("buffalo,lsxl"))
 		lsxl_init();
 
+	if (of_machine_is_compatible("cogent,csb1724"))
+		csb1724_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -100,6 +103,7 @@ static const char *kirkwood_dt_board_compat[] = {
 	"qnap,ts219",
 	"seagate,goflexnet",
 	"buffalo,lsxl",
+	"cogent,csb1724",
 	NULL
 };
 
arch/arm/mach-kirkwood/common.h +6 -0
index 304dd1a..8aab1ae 100644
@@ -94,6 +94,12 @@ void lsxl_init(void);
 static inline void lsxl_init(void) {};
 #endif
 
+#ifdef CONFIG_MACH_CSB1724_DT
+void csb1724_init(void);
+#else
+static inline void csb1724_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/6 Initial csb1724 board support (FDT)

Hi Ian

arch/arm/configs/csb1724_defconfig line 3

Quoted 9 lines
arch/arm/configs/csb1724_defconfig new file +3 -0
new file mode 100644
index 0000000..927b269
@@ -0,0 +1,47 @@
+CONFIG_ARCH_KIRKWOOD=y
+CONFIG_ARCH_KIRKWOOD_DT=y
+CONFIG_MACH_CSB1724_DT=y

Do you really need this? Its the only kirkwood board with its on _defconfig file. What makes this board special?

Thanks
Andrew

author
#3 lore raw

PATCH 1/6 Initial csb1724 board support (FDT)

Quoted 10 lines · Andrew Lunn

Hi Ian

Review

Quoted 6 lines
(quoted diff) +0 -0

b/arch/arm/configs/csb1724_defconfig new file mode 100644 index 0000000..927b269 --- /dev/null +++ b/arch/arm/configs/csb1724_defconfig @@ -0,0 +1,47 @@

(quoted diff) +2 -0
+CONFIG_ARCH_KIRKWOOD=y +CONFIG_ARCH_KIRKWOOD_DT=y
+CONFIG_MACH_CSB1724_DT=y

Do you really need this? Its the only kirkwood board with its on _defconfig file. What makes this board special?

Nothing. defconfigs are just there to make configuring your kernel easy.

The kirkwood defconfig doesnt fit the currently supported hardware set on the csb1724 very well. Why build stuff you dont need?

-Ian

#4 lore raw

PATCH 1/6 Initial csb1724 board support (FDT)

Quoted 12 lines · Ian Molton
Quoted 10 lines · Andrew Lunn

Hi Ian

Review

Quoted 6 lines
(quoted diff) +0 -0

b/arch/arm/configs/csb1724_defconfig new file mode 100644 index 0000000..927b269 --- /dev/null +++ b/arch/arm/configs/csb1724_defconfig @@ -0,0 +1,47 @@

(quoted diff) +2 -0
+CONFIG_ARCH_KIRKWOOD=y +CONFIG_ARCH_KIRKWOOD_DT=y
+CONFIG_MACH_CSB1724_DT=y

Do you really need this? Its the only kirkwood board with its on _defconfig file. What makes this board special?

Quoted 4 lines

Nothing. defconfigs are just there to make configuring your kernel easy.

The kirkwood defconfig doesnt fit the currently supported hardware set on the csb1724 very well. Why build stuff you dont need?

The defconfig files serve a number of purposes. One of them is for build regression testing, and for that reason we try to enable as many boards as possible with a small number of defconfig files.

It's very rare that we have a board specific defconfig file, and I would also ask you to just enable the hardware you need in the kirkwood defconfig. It should not be hard for you to create your own configuration by starting with that and disabling everything you don't need.

Arnd

author
#5 lore raw

PATCH 2/6 mv643xx.c: Remove magic numbers.

In reply to Ian Molton

replace magic number with RX_CSUM_WITH_HEADER.

---
 drivers/net/ethernet/marvell/mv643xx_eth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mv643xx_eth.c +2 -1
index 4fbba57..92497eb 100644
@@ -86,6 +86,7 @@ static char mv643xx_eth_driver_version[] = "1.4";
  * port #0, 0x0800 for port #1, and 0x0c00 for port #2.
  */
 #define PORT_CONFIG			0x0000
+#define  RX_CSUM_WITH_HEADER		0x02000000
 #define  UNICAST_PROMISCUOUS_MODE	0x00000001
 #define PORT_CONFIG_EXT			0x0004
 #define MAC_ADDR_LOW			0x0014
@@ -1607,7 +1608,7 @@ mv643xx_eth_set_features(struct net_device *dev, netdev_features_t features)
 	struct mv643xx_eth_private *mp = netdev_priv(dev);
 	bool rx_csum = features & NETIF_F_RXCSUM;
 
-	wrlp(mp, PORT_CONFIG, rx_csum ? 0x02000000 : 0x00000000);
+	wrlp(mp, PORT_CONFIG, rx_csum ? RX_CSUM_WITH_HEADER : 0x00000000);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

In reply to Ian Molton

This patch adds basic device tree support to the mv643xx ethernet driver.

It should be enough for most current users of the device, and should allow a fairly painless migration once proper support for clk devices is available to those platforms.

---
 drivers/net/ethernet/marvell/mv643xx_eth.c |  111 ++++++++++++++++++++++++----
 1 file changed, 97 insertions(+), 14 deletions(-)
drivers/net/ethernet/marvell/mv643xx_eth.c +97 -14
index 92497eb..579692f 100644
@@ -48,6 +48,9 @@
 #include <linux/ethtool.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_irq.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
@@ -2601,11 +2604,11 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
 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;
+	int ret, irq = -1;
 
 	if (!mv643xx_eth_version_printed++)
 		pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
@@ -2625,6 +2628,23 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 	if (msp->base == NULL)
 		goto out_free;
 
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			goto out_free;
+		}
+
+		np = of_parse_phandle(pdev->dev.of_node, "shared_smi", 0);
+		if (np)
+			pd->shared_smi = of_find_device_by_node(np);
+
+	} else {
+		pd = pdev->dev.platform_data;
+	}
 	/*
 	 * Set up and register SMI bus.
 	 */
@@ -2654,15 +2674,22 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 	/*
 	 * Check whether the error interrupt is hooked up.
 	 */
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res != NULL) {
+	if (pdev->dev.of_node) {
+		irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	} else {
+		res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+		if (res)
+			irq = res->start;
+	}
+
+	if (irq != -1) {
 		int err;
 
-		err = request_irq(res->start, mv643xx_eth_err_irq,
+		err = request_irq(irq, mv643xx_eth_err_irq,
 				  IRQF_SHARED, "mv643xx_eth", msp);
 		if (!err) {
 			writel(ERR_INT_SMI_DONE, msp->base + ERR_INT_MASK);
-			msp->err_interrupt = res->start;
+			msp->err_interrupt = irq;
 		}
 	}
 
@@ -2675,6 +2702,10 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 
 	msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
 					pd->tx_csum_limit : 9 * 1024;
+
+	if (pdev->dev.of_node)
+		kfree(pd);  /* If we created a fake pd, free it now */
+
 	infer_hw_params(msp);
 
 	platform_set_drvdata(pdev, msp);
@@ -2708,12 +2739,21 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id mv_mdio_dt_ids[] __devinitdata = {
+	{ .compatible = "marvell,mdio-mv643xx", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mv_mdio_dt_ids);
+#endif
+
 static struct platform_driver mv643xx_eth_shared_driver = {
 	.probe		= mv643xx_eth_shared_probe,
 	.remove		= mv643xx_eth_shared_remove,
 	.driver = {
 		.name	= MV643XX_ETH_SHARED_NAME,
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(mv_mdio_dt_ids),
 	},
 };
 
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);
+		np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
+		if (np) {
+			pd->shared = of_find_device_by_node(np);
+		} else {
+			kfree(pd);
+			return -ENODEV;
+		}
+	} else {
+		pd = pdev->dev.platform_data;
+	}
+
 	if (pd == NULL) {
 		dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
 		return -ENODEV;
@@ -2881,12 +2945,15 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 
 	if (pd->shared == NULL) {
 		dev_err(&pdev->dev, "no mv643xx_eth_platform_data->shared\n");
-		return -ENODEV;
+		err = -ENODEV;
+		goto out_free_pd;
 	}
 
 	dev = alloc_etherdev_mq(sizeof(struct mv643xx_eth_private), 8);
-	if (!dev)
-		return -ENOMEM;
+	if (!dev) {
+		err = -ENOMEM;
+		goto out_free_pd;
+	}
 
 	mp = netdev_priv(dev);
 	platform_set_drvdata(pdev, mp);
@@ -2923,6 +2990,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 
 	init_pscr(mp, pd->speed, pd->duplex);
 
+	if (pdev->dev.of_node)
+		kfree(pd); /* If we created a fake pd, free it now */
 
 	mib_counters_clear(mp);
 
@@ -2942,10 +3011,13 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	mp->rx_oom.data = (unsigned long)mp;
 	mp->rx_oom.function = oom_timer_wrapper;
 
-
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	BUG_ON(!res);
-	dev->irq = res->start;
+	if (pdev->dev.of_node) {
+		dev->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	} else {
+		res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+		BUG_ON(!res);
+		dev->irq = res->start;
+	}
 
 	dev->netdev_ops = &mv643xx_eth_netdev_ops;
 
@@ -2991,6 +3063,8 @@ out:
 	}
 #endif
 	free_netdev(dev);
+out_free_pd:
+	kfree(pd);
 
 	return err;
 }
@@ -3030,6 +3104,14 @@ static void mv643xx_eth_shutdown(struct platform_device *pdev)
 		port_reset(mp);
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id mv_eth_dt_ids[] __devinitdata = {
+	{ .compatible = "marvell,mv643xx", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mv_eth_dt_ids);
+#endif
+
 static struct platform_driver mv643xx_eth_driver = {
 	.probe		= mv643xx_eth_probe,
 	.remove		= mv643xx_eth_remove,
@@ -3037,6 +3119,7 @@ static struct platform_driver mv643xx_eth_driver = {
 	.driver = {
 		.name	= MV643XX_ETH_NAME,
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(mv_eth_dt_ids),
 	},
 };
 
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 10 lines · Ian Molton

This patch adds basic device tree support to the mv643xx ethernet driver.

It should be enough for most current users of the device, and should allow a fairly painless migration once proper support for clk devices is available to those platforms.

---
 drivers/net/ethernet/marvell/mv643xx_eth.c |  111 ++++++++++++++++++++++++----
 1 file changed, 97 insertions(+), 14 deletions(-)

Hi Ian

Please document the DT binding in Documentation/devicetree/binding/....

Also, this should also be CC: to the netdev mailing. I got into trouble for not doing this and breaking the PPC build :-(

Andrew

author
#8 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 13 lines · Andrew Lunn
Quoted 11 lines · Ian Molton

This patch adds basic device tree support to the mv643xx ethernet driver.

It should be enough for most current users of the device, and should allow a fairly painless migration once proper support for clk devices is available to those platforms.

drivers/net/ethernet/marvell/mv643xx_eth.c | 111 ++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 14 deletions(-)

Quoted 4 lines

Hi Ian

Please document the DT binding in
Documentation/devicetree/binding/....

Done.

Quoted 2 lines

Also, this should also be CC: to the netdev mailing. I got into trouble for not doing this and breaking the PPC build :-(

Will do so for v2, thanks.

-Ian

#9 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

In reply to Ian Molton

Hi Ian,

Quoted 162 lines · Ian Molton

This patch adds basic device tree support to the mv643xx ethernet driver.

It should be enough for most current users of the device, and should allow a fairly painless migration once proper support for clk devices is available
to those platforms.

---
 drivers/net/ethernet/marvell/mv643xx_eth.c |  111
++++++++++++++++++++++++----
 1 file changed, 97 insertions(+), 14 deletions(-)
drivers/net/ethernet/marvell/mv643xx_eth.c +5 -2
index 92497eb..579692f 100644
@@ -48,6 +48,9 @@
 #include <linux/ethtool.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_irq.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
@@ -2601,11 +2604,11 @@ static void infer_hw_params(struct
 mv643xx_eth_shared_private *msp)
 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;
+       int ret, irq = -1;
 
        if (!mv643xx_eth_version_printed++)
                pr_notice("MV-643xx 10/100/1000 ethernet driver version

%s\n",

drivers/net/ethernet/marvell/mv643xx_eth.c +4 -0
@@ -2625,6 +2628,23 @@ static int mv643xx_eth_shared_probe(struct
 platform_device *pdev)
        if (msp->base == NULL)
                goto out_free;
 
+       if (pdev->dev.of_node) {
+               struct device_node *np = NULL;
+
+               /* when all users of this driver use FDT, we can remove

this */

drivers/net/ethernet/marvell/mv643xx_eth.c +3 -0
+               pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+               if (!pd) {
+                       dev_dbg(&pdev->dev, "Could not allocate platform

data\n");

drivers/net/ethernet/marvell/mv643xx_eth.c +25 -4
+                       goto out_free;
+               }
+
+               np = of_parse_phandle(pdev->dev.of_node, "shared_smi", 0);
+               if (np)
+                       pd->shared_smi = of_find_device_by_node(np);
+
+       } else {
+               pd = pdev->dev.platform_data;
+       }
        /*
         * Set up and register SMI bus.
         */
@@ -2654,15 +2674,22 @@ static int mv643xx_eth_shared_probe(struct
 platform_device *pdev)
        /*
         * Check whether the error interrupt is hooked up.
         */
-       res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (res != NULL) {
+       if (pdev->dev.of_node) {
+               irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+       } else {
+               res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+               if (res)
+                       irq = res->start;
+       }
+
+       if (irq != -1) {
                int err;
 
-               err = request_irq(res->start, mv643xx_eth_err_irq,
+               err = request_irq(irq, mv643xx_eth_err_irq,
                                  IRQF_SHARED, "mv643xx_eth", msp);
                if (!err) {
                        writel(ERR_INT_SMI_DONE, msp->base + ERR_INT_MASK);
-                       msp->err_interrupt = res->start;
+                       msp->err_interrupt = irq;
                }
        }
@@ -2675,6 +2702,10 @@ static int mv643xx_eth_shared_probe(struct
 platform_device *pdev)
 
        msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
                                        pd->tx_csum_limit : 9 * 1024;
+
+       if (pdev->dev.of_node)
+               kfree(pd);  /* If we created a fake pd, free it now */
+
        infer_hw_params(msp);
 
        platform_set_drvdata(pdev, msp);
drivers/net/ethernet/marvell/mv643xx_eth.c +13 -1
@@ -2708,12 +2739,21 @@ static int mv643xx_eth_shared_remove(struct
 platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id mv_mdio_dt_ids[] __devinitdata = {
+       { .compatible = "marvell,mdio-mv643xx", },
+       {},
+};
+MODULE_DEVICE_TABLE(of, mv_mdio_dt_ids);
+#endif
+
 static struct platform_driver mv643xx_eth_shared_driver = {
        .probe          = mv643xx_eth_shared_probe,
        .remove         = mv643xx_eth_shared_remove,
        .driver = {
                .name   = MV643XX_ETH_SHARED_NAME,
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(mv_mdio_dt_ids),
        },
 };
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device
 *pdev)
        struct resource *res;
        int err;
 
-       pd = pdev->dev.platform_data;
+       if (pdev->dev.of_node) {
+               struct device_node *np = NULL;
+
+               /* when all users of this driver use FDT, we can remove

this */

drivers/net/ethernet/marvell/mv643xx_eth.c +3 -0
+               pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+               if (!pd) {
+                       dev_dbg(&pdev->dev, "Could not allocate platform

data\n");

drivers/net/ethernet/marvell/mv643xx_eth.c +11 -0
+                       return -ENOMEM;
+               }
+
+               of_property_read_u32(pdev->dev.of_node,
+                       "port_number", &pd->port_number);
+               of_property_read_u32(pdev->dev.of_node,
+                       "phy_addr", &pd->phy_addr);
+               np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
+               if (np) {
+                       pd->shared = of_find_device_by_node(np);
+               } else {

drivers/net/ethernet/marvell/mv643xx_eth.c static int mv643xx_eth_probe(struct platform_device *pdev) · line 2943

Quoted 10 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +7 -0
+                       kfree(pd);
+                       return -ENODEV;
+               }
+       } else {
+               pd = pdev->dev.platform_data;
+       }
+
        if (pd == NULL) {
                dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
                return -ENODEV;

Can this check for pd be moved in the else part above as well, as for the pd allocation with kzalloc,
we have already made a check for memory allocation failure?

Quoted 87 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +6 -3
@@ -2881,12 +2945,15 @@ static int mv643xx_eth_probe(struct
 platform_device *pdev)
 
        if (pd->shared == NULL) {
                dev_err(&pdev->dev, "no
 mv643xx_eth_platform_data->shared\n");
-               return -ENODEV;
+               err = -ENODEV;
+               goto out_free_pd;
        }
 
        dev = alloc_etherdev_mq(sizeof(struct mv643xx_eth_private), 8);
-       if (!dev)
-               return -ENOMEM;
+       if (!dev) {
+               err = -ENOMEM;
+               goto out_free_pd;
+       }
 
        mp = netdev_priv(dev);
        platform_set_drvdata(pdev, mp);
drivers/net/ethernet/marvell/mv643xx_eth.c +19 -4
@@ -2923,6 +2990,8 @@ static int mv643xx_eth_probe(struct platform_device
 *pdev)
 
        init_pscr(mp, pd->speed, pd->duplex);
 
+       if (pdev->dev.of_node)
+               kfree(pd); /* If we created a fake pd, free it now */
 
        mib_counters_clear(mp);
@@ -2942,10 +3011,13 @@ static int mv643xx_eth_probe(struct
 platform_device *pdev)
        mp->rx_oom.data = (unsigned long)mp;
        mp->rx_oom.function = oom_timer_wrapper;
 
-
-       res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       BUG_ON(!res);
-       dev->irq = res->start;
+       if (pdev->dev.of_node) {
+               dev->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+       } else {
+               res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+               BUG_ON(!res);
+               dev->irq = res->start;
+       }
 
        dev->netdev_ops = &mv643xx_eth_netdev_ops;
@@ -2991,6 +3063,8 @@ out:
        }
 #endif
        free_netdev(dev);
+out_free_pd:
+       kfree(pd);
 
        return err;
 }
@@ -3030,6 +3104,14 @@ static void mv643xx_eth_shutdown(struct
 platform_device *pdev)
                port_reset(mp);
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id mv_eth_dt_ids[] __devinitdata = {
+       { .compatible = "marvell,mv643xx", },
+       {},
+};
+MODULE_DEVICE_TABLE(of, mv_eth_dt_ids);
+#endif
+
 static struct platform_driver mv643xx_eth_driver = {
        .probe          = mv643xx_eth_probe,

.remove = mv643xx_eth_remove,

drivers/net/ethernet/marvell/mv643xx_eth.c +1 -1
@@ -3037,6 +3119,7 @@ static struct platform_driver mv643xx_eth_driver = {
        .driver = {
                .name   = MV643XX_ETH_NAME,
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(mv_eth_dt_ids),
        },
 };
 
--

1.7.9.5

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Regards,
-Amar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120730/a2bd46ae/attachment-0001.html>

author
#10 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 31 lines · Amar Nath

Hi Ian,

Quoted 27 lines · Ian Molton
drivers/net/ethernet/marvell/mv643xx_eth.c +4 -1
-       pd = pdev->dev.platform_data;
+       if (pdev->dev.of_node) {
+               struct device_node *np = NULL;
+
+               /* when all users of this driver use FDT, we can remove

this */

drivers/net/ethernet/marvell/mv643xx_eth.c +3 -0
+               pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+               if (!pd) {
+                       dev_dbg(&pdev->dev, "Could not allocate platform

data\n");

drivers/net/ethernet/marvell/mv643xx_eth.c +17 -0
+                       return -ENOMEM;
+               }
+
+               of_property_read_u32(pdev->dev.of_node,
+                       "port_number", &pd->port_number);
+               of_property_read_u32(pdev->dev.of_node,
+                       "phy_addr", &pd->phy_addr);
+               np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
+               if (np) {
+                       pd->shared = of_find_device_by_node(np);
+               } else {
+                       kfree(pd);
+                       return -ENODEV;
+               }
+       } else {
+               pd = pdev->dev.platform_data;
+       }
Quoted 8 lines
Quoted 5 lines

+

        if (pd == NULL) {
                dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
                return -ENODEV;

Can this check for pd be moved in the else part above as well, as for the pd allocation with kzalloc,
we have already made a check for memory allocation failure?

Yes, Folded in for v2.

-Ian

#11 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Hello Ian,

Quoted 4 lines · On Monday 30 July 2012 17:32:39 Ian Molton wrote:
Quoted 3 lines · Amar Nath

Hi Ian,

On Mon, Jul 30, 2012 at 8:45 PM, Ian Molton

Quoted 8 lines · <[email protected]>wrote:
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +4 -1
-       pd = pdev->dev.platform_data;
+       if (pdev->dev.of_node) {
+               struct device_node *np = NULL;
+
+               /* when all users of this driver use FDT, we can remove

this */
+ pd = kzalloc(sizeof(*pd), GFP_ATOMIC);

Do you really need an allocation in atomic context here? Is not GFP_KERNEL sufficient?

There was a second place like this where you used an atomic allocation that needs fixing.

Quoted 37 lines
Quoted 20 lines
Quoted 20 lines
(quoted diff) +2 -0
+               if (!pd) {
+                       dev_dbg(&pdev->dev, "Could not allocate platform

data\n");

drivers/net/ethernet/marvell/mv643xx_eth.c +17 -0
+                       return -ENOMEM;
+               }
+
+               of_property_read_u32(pdev->dev.of_node,
+                       "port_number", &pd->port_number);
+               of_property_read_u32(pdev->dev.of_node,
+                       "phy_addr", &pd->phy_addr);
+               np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
+               if (np) {
+                       pd->shared = of_find_device_by_node(np);
+               } else {
+                       kfree(pd);
+                       return -ENODEV;
+               }
+       } else {
+               pd = pdev->dev.platform_data;
+       }
Quoted 8 lines
Quoted 5 lines

+

        if (pd == NULL) {
                dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
                return -ENODEV;

Can this check for pd be moved in the else part above as well, as for the pd allocation with kzalloc,
we have already made a check for memory allocation failure?

Yes, Folded in for v2.

-Ian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#12 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

In reply to Ian Molton

Ian Molton <[email protected]> writes:
Hi,

[...]

Quoted 9 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +4 -1
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */

drivers/net/ethernet/marvell/mv643xx_eth.c static int mv643xx_eth_probe(struct platform_device *pdev) · line 2929

Quoted 10 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +10 -0
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);

I guess we need something for tx_csum_limit in the device tree too. It's important for kirkwood and dove.

Arnaud

author
#13 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 18 lines · Arnaud Patard (Rtp)

Ian Molton <[email protected]> writes:
Hi,

[...]

Quoted 13 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +8 -1
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
Quoted 8 lines

drivers/net/ethernet/marvell/mv643xx_eth.c static int mv643xx_eth_probe(struct platform_device *pdev) · line 2929

Quoted 6 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +6 -0
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);

I guess we need something for tx_csum_limit in the device tree too. It's important for kirkwood and dove.

It was my intention to keep the patch as non-invasive as possible - none of the platforms using D-T at present require this.

Furthermore, git grep shows nothing in mach-kirkwood or mach-dove using at all...

Are you sure this is required? It can always be added if anything actually uses it :)

-Ian

#14 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 28 lines · Ian Molton
Quoted 18 lines · Arnaud Patard (Rtp)

Ian Molton <[email protected]> writes:
Hi,

[...]

Quoted 13 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +8 -1
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
Quoted 8 lines

drivers/net/ethernet/marvell/mv643xx_eth.c static int mv643xx_eth_probe(struct platform_device *pdev) · line 2929

Quoted 6 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +6 -0
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number", &pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr", &pd->phy_addr);

I guess we need something for tx_csum_limit in the device tree too. It's important for kirkwood and dove.

Quoted 8 lines

It was my intention to keep the patch as non-invasive as possible - none of the platforms using D-T at present require this.

Furthermore, git grep shows nothing in mach-kirkwood or mach-dove using at all...

Are you sure this is required? It can always be added if anything actually uses it :)

Hi Ian

Try using jumbo packets on kirkwood.

http://comments.gmane.org/gmane.linux.ports.arm.kernel/178785
http://www.spinics.net/lists/arm-kernel/msg186152.html

Andrew

author
#15 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 9 lines · Andrew Lunn
Quoted 2 lines · Ian Molton

Are you sure this is required? It can always be added if anything actually uses it :)

Hi Ian

Try using jumbo packets on kirkwood.

http://comments.gmane.org/gmane.linux.ports.arm.kernel/178785
http://www.spinics.net/lists/arm-kernel/msg186152.html

Ah, this postdates the D-T branches on which I am working being forked.

I'll fold this into my patchset.

-Ian

#16 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 4 lines · Ian Molton
Quoted 3 lines · Andrew Lunn
Quoted 2 lines · Ian Molton

Are you sure this is required? It can always be added if anything actually uses it :)

Quoted 8 lines
Quoted 6 lines

Hi Ian

Try using jumbo packets on kirkwood.

http://comments.gmane.org/gmane.linux.ports.arm.kernel/178785
http://www.spinics.net/lists/arm-kernel/msg186152.html

Ah, this postdates the D-T branches on which I am working being forked.

the original patch was from years ago but I noticed only recently it was still not merged and sent this patch. I asked about it on DT because I don't want it to get lost again, even if it looks like not a lot of people are using jumbo frames on kirkwood or dove.

Quoted 2 lines

I'll fold this into my patchset.

Thanks,
Arnaud

author
#17 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 5 lines · Arnaud Patard (Rtp)
Quoted 1 line

Ah, this postdates the D-T branches on which I am working being forked.

the original patch was from years ago but I noticed only recently it was still not merged and sent this patch. I asked about it on DT because I don't want it to get lost again, even if it looks like not a lot of people are using jumbo frames on kirkwood or dove.

No problem :) actually it works really nicely in DT, just drop it in the toplevel includes!

-Ian

#18 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

In reply to Arnaud Patard (Rtp)
Quoted 19 lines · Arnaud Patard (Rtp)

Ian Molton<[email protected]> writes:
Hi,

[...]

Quoted 14 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +9 -1
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
  	struct resource *res;
  	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
Quoted 8 lines

drivers/net/ethernet/marvell/mv643xx_eth.c static int mv643xx_eth_probe(struct platform_device *pdev)

Quoted 5 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +5 -0
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number",&pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr",&pd->phy_addr);

I guess we need something for tx_csum_limit in the device tree too. It's important for kirkwood and dove.

Is this something for all kirkwood devices? I think the best way of doing this is to give the driver a new device-tree name and having it set this field in the init sequence.

However we could also do with some of these as dt parameters just in case people want to try and alter them for their own systems.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#19 lore raw

PATCH 3/6 mv643xx.c: Add basic device tree support.

Quoted 29 lines · Ben Dooks
Quoted 19 lines · Arnaud Patard (Rtp)

Ian Molton<[email protected]> writes:
Hi,

[...]

Quoted 14 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +9 -1
@@ -2873,7 +2913,31 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
  	struct resource *res;
  	int err;
 
-	pd = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		struct device_node *np = NULL;
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			return -ENOMEM;
+		}
Quoted 8 lines

drivers/net/ethernet/marvell/mv643xx_eth.c static int mv643xx_eth_probe(struct platform_device *pdev)

Quoted 5 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +5 -0
+
+		of_property_read_u32(pdev->dev.of_node,
+			"port_number",&pd->port_number);
+		of_property_read_u32(pdev->dev.of_node,
+			"phy_addr",&pd->phy_addr);

I guess we need something for tx_csum_limit in the device tree too. It's important for kirkwood and dove.

Quoted 6 lines

Is this something for all kirkwood devices? I think the best way of doing this is to give the driver a new device-tree name and having it set this field in the init sequence.

However we could also do with some of these as dt parameters just in case people want to try and alter them for their own systems.

It's for _all_ kirkwood and dove devices. The kirkwood and dove fifos are smaller than the orion/mv78xxx ones (no idea about armada xp/370).

Arnaud

author
#20 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

In reply to Ian Molton

This patch modifies the ethernet setup helper functions so that they can be used /purely/ to set up the clocks.

This is part of ongoing work to enable device tree support in the mv643xx.c ethernet driver, where as yet the kirkwood platform does not have proper clk support.

This should allow a gradual migration to device tree and later to proper clk support, wherupon the helper functions can be removed entirely.

---
 arch/arm/mach-kirkwood/common.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-kirkwood/common.c +4 -2
index c4b64ad..c1776ea 100644
@@ -299,7 +299,8 @@ void __init kirkwood_ehci_init(void)
  ****************************************************************************/
 void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
 {
-	orion_ge00_init(eth_data,
+	if (eth_data)
+		orion_ge00_init(eth_data,
 			GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
 			IRQ_KIRKWOOD_GE00_ERR);
 	/* The interface forgets the MAC address assigned by u-boot if
@@ -313,7 +314,8 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
  ****************************************************************************/
 void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
 {
-	orion_ge01_init(eth_data,
+	if (eth_data)
+		orion_ge01_init(eth_data,
 			GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
 			IRQ_KIRKWOOD_GE01_ERR);
 	clk_prepare_enable(ge1);
Signature · 1 line
1.7.9.5
#21 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

Quoted 2 lines · Ian Molton

This patch modifies the ethernet setup helper functions so that they can be used /purely/ to set up the clocks.

Hi Ian

Set up is a bit ambiguous. I would actually say, start the clock ticking, if it is not already.

I'm also not sure this is the best way to do it. I'd like to throw in a counter proposal, and then we can discuss....

Problems start then the ethernet driver is a module, not built in. In this situation, the clock gets turned off, in a lateinitcall, and then later turned back on again when the module loads. Unfortunately, by then its forgotten its own MAC address, as programmed by u-boot. So this clk_prepare_enable() is here to ensure that the clock does not get turned off, when we know the module is likely to be loaded sometime later.

I've not looked at the clk DT bindings yet. Does it provide a mechanism to prepare & enable a named clock? Maybe it does, but this seems a bit of an edge case.

What i would instead do is add code to board-dt.c which looks into the DT and see if it finds nodes egige0/egige1 and if so, calls clk_prepare_enable(). We then don't need any per board code.

Andrew

Quoted 40 lines

This is part of ongoing work to enable device tree support in the mv643xx.c ethernet driver, where as yet the kirkwood platform does not have proper clk support.

This should allow a gradual migration to device tree and later to proper clk support, wherupon the helper functions can be removed entirely.

---
 arch/arm/mach-kirkwood/common.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-kirkwood/common.c +4 -2
index c4b64ad..c1776ea 100644
@@ -299,7 +299,8 @@ void __init kirkwood_ehci_init(void)
  ****************************************************************************/
 void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
 {
-	orion_ge00_init(eth_data,
+	if (eth_data)
+		orion_ge00_init(eth_data,
 			GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
 			IRQ_KIRKWOOD_GE00_ERR);
 	/* The interface forgets the MAC address assigned by u-boot if
@@ -313,7 +314,8 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
  ****************************************************************************/
 void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
 {
-	orion_ge01_init(eth_data,
+	if (eth_data)
+		orion_ge01_init(eth_data,
 			GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
 			IRQ_KIRKWOOD_GE01_ERR);
 	clk_prepare_enable(ge1);
Signature · 1 line
1.7.9.5
author
#22 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

Quoted 8 lines · Andrew Lunn
Quoted 2 lines · Ian Molton

This patch modifies the ethernet setup helper functions so that they can be used /purely/ to set up the clocks.

Hi Ian

Set up is a bit ambiguous. I would actually say, start the clock ticking, if it is not already.

Fair.

Quoted 4 lines

I'm also not sure this is the best way to do it. I'd like to throw in a counter proposal, and then we can discuss....

Problems start then the ethernet driver is a module, not built in.

I find that even if built in, it fails, not because it forgets its MAC, but later, it hangs because as yet it does not know how to handle the clk when it is set up from DT bindings. (Kirkwood doesnt really have this support yet AFAICT).

Quoted 3 lines

I've not looked at the clk DT bindings yet. Does it provide a mechanism to prepare & enable a named clock? Maybe it does, but this seems a bit of an edge case.

If it does, I cant see it.

Quoted 3 lines

What i would instead do is add code to board-dt.c which looks into the DT and see if it finds nodes egige0/egige1 and if so, calls clk_prepare_enable(). We then don't need any per board code.

I agree, this seems like a good compromise for now.

I will implement this for v2.

-Ian

-Ian

#23 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

Quoted 4 lines

I find that even if built in, it fails, not because it forgets its MAC, but later, it hangs because as yet it does not know how to handle the clk when it is set up from DT bindings. (Kirkwood doesnt really have this support yet AFAICT).

Ah, of course. You are missing auxdata in board-dt.c!

Andrew

#24 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

In reply to Ian Molton

If I'm reading this correctly, if kirkwood_ge00_init is called without any data, all that happens is the clock is enabled. If the right data is passed in, the ethernet interface is initialized, and then the clock is enabled.

Patch 6 in your series sets all the existing DT board files to call kirkwood_ge00_init with no data.

Would it make more sense for readability to separate the clock prep and other interface initialization so DT board files don't appear to be calling for a full turn up despite now handling that in the DTS tree? IE instead of converting all the board-XXX.c to call kirkwood_ge00_init(NULL) have them call a new function, kirkwood_ge00_clk_prep(NULL) instead, assuming the clock can't be handled directly via DTS.

Josh C

Quoted 47 lines · Ian Molton

This patch modifies the ethernet setup helper functions so that they can be used /purely/ to set up the clocks.

This is part of ongoing work to enable device tree support in the mv643xx.c ethernet driver, where as yet the kirkwood platform does not have proper clk support.

This should allow a gradual migration to device tree and later to proper clk support, wherupon the helper functions can be removed entirely.

---
 arch/arm/mach-kirkwood/common.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-kirkwood/common.c +4 -3
index c4b64ad..c1776ea 100644
@@ -299,7 +299,8 @@ void __init kirkwood_ehci_init(void)
  ****************************************************************************/
 void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
 {
-       orion_ge00_init(eth_data,
+       if (eth_data)
+               orion_ge00_init(eth_data,
                        GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
                        IRQ_KIRKWOOD_GE00_ERR);
        /* The interface forgets the MAC address assigned by u-boot if
@@ -313,7 +314,8 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
  ****************************************************************************/
 void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
 {
-       orion_ge01_init(eth_data,
+       if (eth_data)
+               orion_ge01_init(eth_data,
                        GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
                        IRQ_KIRKWOOD_GE01_ERR);
        clk_prepare_enable(ge1);
--

1.7.9.5

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#25 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

Quoted 8 lines · Josh Coombs

If I'm reading this correctly, if kirkwood_ge00_init is called without any data, all that happens is the clock is enabled. If the right data is passed in, the ethernet interface is initialized, and then the clock is enabled.

Patch 6 in your series sets all the existing DT board files to call kirkwood_ge00_init with no data.

Quoted 7 lines

Would it make more sense for readability to separate the clock prep and other interface initialization so DT board files don't appear to be calling for a full turn up despite now handling that in the DTS tree? IE instead of converting all the board-XXX.c to call kirkwood_ge00_init(NULL) have them call a new function, kirkwood_ge00_clk_prep(NULL) instead, assuming the clock can't be handled directly via DTS.

This is certainly possible, but I was trying to avoid yet another function being added to the sources with a (necessarily) short lifespan - it will only be needed until such time as the clk stuff is sorted out, which is on my TODO list.

My preference would be to add a comment explaining the choice in the code.

If its preferred, however, I have no real objection to splitting out the functionality.

-Ian

author
#26 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

In reply to Josh Coombs
Quoted 7 lines · Josh Coombs

If I'm reading this correctly, if kirkwood_ge00_init is called without any data, all that happens is the clock is enabled. If the right data is passed in, the ethernet interface is initialized, and then the clock is enabled.

Patch 6 in your series sets all the existing DT board files to call kirkwood_ge00_init with no data.

Actually Im thinking of dropping this change altogether - it would seem that since adding aliases so that the driver can managed the clocks itself (thanks Andrew), the DT code apparently doesnt disable the clocks, so the MAC is preserved.

I see no reason to keep the calls now that the driver manages to hang onto its clocks.

-Ian

#27 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

Quoted 2 lines

I see no reason to keep the calls now that the driver manages to hang onto its clocks.

Hi Ian

Did you test this with it built as a module? That is the real test....

Andrew

author
#28 lore raw

PATCH 4/6 kirkwood: setup clock only in eth helpers.

Quoted 5 lines · Andrew Lunn
Quoted 2 lines

I see no reason to keep the calls now that the driver manages to hang onto its clocks.

Hi Ian

Did you test this with it built as a module? That is the real test....

Rats. Yes, however it managed to survive. The minute I read this was the minute it died. sods law :(

Guess it'll still be needed for now.

So, the question is about how to implement it - I like the 'probe the OF device name' idea - I can implement that quickly enough.

Once thats done, I can push out a v2 patch, all the other issues are now addressed, AFAICS.

-Ian

author
#29 lore raw

PATCH 5/6 csb1724: Enable device tree based mv643xx ethernet support.

In reply to Ian Molton

This patch enables mv643xx based ethernet built into the SoM on the csb1724, via flattened device tree.

---
 arch/arm/boot/dts/kirkwood-csb1724.dts |   25 ++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi        |   16 ++++++++++++
 arch/arm/configs/csb1724_defconfig     |   45 ++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-csb1724.c |    3 +++
 4 files changed, 89 insertions(+)
arch/arm/boot/dts/kirkwood-csb1724.dts +25 -0
index 44dfe9a..f652797 100644
@@ -25,6 +25,31 @@
 			nr-ports = <2>;
 			status = "ok";
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x81>;
+			interrupts = <15>;
+		};
+
 	};
 
 };
arch/arm/boot/dts/kirkwood.dtsi +16 -0
index cef9616..dd10422 100644
@@ -105,5 +105,21 @@
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x72000 0x4000>;
+			interrupts = <46>;
+			status = "disabled";
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x76000 0x4000>;
+			interrupts = <47>;
+			shared_smi = <&smi0>;
+			status = "disabled";
+		};
+
 	};
 };
arch/arm/configs/csb1724_defconfig +45 -0

48 lines not on this page · raw message

arch/arm/mach-kirkwood/board-csb1724.c +3 -0
index 979112d..50f0c5b 100644
@@ -13,6 +13,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include "common.h"
 #include "mpp.h"
 
 static unsigned int csb1724_mpp_config[] __initdata = {
@@ -56,4 +57,6 @@ void __init csb1724_init(void)
 	 * Basic setup. Needs to be called early.
 	 */
 	kirkwood_mpp_conf(csb1724_mpp_config);
+	kirkwood_ge00_init(NULL);
+	kirkwood_ge01_init(NULL);
 }
Signature · 1 line
1.7.9.5
#30 lore raw

PATCH 5/6 csb1724: Enable device tree based mv643xx ethernet support.

Quoted 61 lines · Ian Molton

This patch enables mv643xx based ethernet built into the SoM on the csb1724, via flattened device tree.

---
 arch/arm/boot/dts/kirkwood-csb1724.dts |   25 ++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi        |   16 ++++++++++++
 arch/arm/configs/csb1724_defconfig     |   45 ++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-csb1724.c |    3 +++
 4 files changed, 89 insertions(+)
arch/arm/boot/dts/kirkwood-csb1724.dts +25 -0
index 44dfe9a..f652797 100644
@@ -25,6 +25,31 @@
 			nr-ports = <2>;
 			status = "ok";
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x81>;
+			interrupts = <15>;
+		};
+
 	};
 
 };
arch/arm/boot/dts/kirkwood.dtsi +6 -0
index cef9616..dd10422 100644
@@ -105,5 +105,21 @@
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x72000 0x4000>;
+			interrupts = <46>;
+			status = "disabled";

arch/arm/boot/dts/kirkwood.dtsi line 123

Quoted 10 lines
arch/arm/boot/dts/kirkwood.dtsi +10 -0
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x76000 0x4000>;
+			interrupts = <47>;
+			shared_smi = <&smi0>;
+			status = "disabled";
+		};
+

Hi Ian

I'm trying to keep this in order. Currently i2c is in the wrong place, but the rest are incremental. It looks like these should be between wdt & sata.

What about default entries for egiga0 and egiga1 with status "disabled"? It looks like the only thing which changes between boards is phy_addr.

Andrew

author
#31 lore raw

PATCH 5/6 csb1724: Enable device tree based mv643xx ethernet support.

Quoted 7 lines · Andrew Lunn

On Mon, Jul 30, 2012 at 04:15:58PM +0100, Ian Molton wrote:

Hi Ian

I'm trying to keep this in order. Currently i2c is in the wrong place, but the rest are incremental. It looks like these should be between wdt & sata.

Will fix.

Quoted 3 lines

What about default entries for egiga0 and egiga1 with status "disabled"? It looks like the only thing which changes between boards is phy_addr.

Seems sensible. I'll change that for v2.

-Ian

#32 lore raw

PATCH 5/6 csb1724: Enable device tree based mv643xx ethernet support.

In reply to Ian Molton
Quoted 25 lines · Ian Molton

This patch enables mv643xx based ethernet built into the SoM on the csb1724, via flattened device tree.

---
 arch/arm/boot/dts/kirkwood-csb1724.dts |   25 ++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi        |   16 ++++++++++++
 arch/arm/configs/csb1724_defconfig     |   45 ++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-csb1724.c |    3 +++
 4 files changed, 89 insertions(+)
arch/arm/boot/dts/kirkwood-csb1724.dts +6 -0
index 44dfe9a..f652797 100644
@@ -25,6 +25,31 @@
 			nr-ports = <2>;
 			status = "ok";
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {

arch/arm/boot/dts/kirkwood-csb1724.dts line 43

Quoted 10 lines
arch/arm/boot/dts/kirkwood-csb1724.dts +10 -0
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};

Hi Ian

Shouldn't there be two interrupt here?

292 orion_ge00_init(eth_data,
293 GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
294 IRQ_KIRKWOOD_GE00_ERR);

Documentation of the binding would help....

Andrew

author
#33 lore raw

PATCH 5/6 csb1724: Enable device tree based mv643xx ethernet support.

Quoted 7 lines · Andrew Lunn

Hi Ian

Shouldn't there be two interrupt here?

292 orion_ge00_init(eth_data, 293
GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM, 294
IRQ_KIRKWOOD_GE00_ERR);

No. This is thanks to the horrific mess in the mv643xx driver - its got two drivers in one source file, and they do horrid things like pass round base addresses.

Im making an effort to try to split them out into seperate mdio and MAC/PHY drivers.

This is a start. :)

-Ian

author
#34 lore raw

PATCH 6/6 DT: Convert all kirkwood boards with mv643xx that use DT

In reply to Ian Molton

This patch converts all present DT capable kirkwood board configurations to use DT to configure the mv643xx ethernet controller.

---
 arch/arm/boot/dts/kirkwood-dnskw.dtsi     |   12 ++++++++++++
 arch/arm/boot/dts/kirkwood-dreamplug.dts  |   24 ++++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts  |   11 +++++++++++
 arch/arm/boot/dts/kirkwood-ib62x0.dts     |   13 +++++++++++++
 arch/arm/boot/dts/kirkwood-iconnect.dts   |   13 +++++++++++++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi      |   23 +++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-ts219-6281.dts |   11 ++++++++++-
 arch/arm/boot/dts/kirkwood-ts219-6282.dts |   11 ++++++++++-
 arch/arm/boot/dts/kirkwood-ts219.dtsi     |    3 +++
 arch/arm/mach-kirkwood/board-dnskw.c      |    7 +------
 arch/arm/mach-kirkwood/board-dreamplug.c  |   13 ++-----------
 arch/arm/mach-kirkwood/board-goflexnet.c  |    7 +------
 arch/arm/mach-kirkwood/board-ib62x0.c     |    7 +------
 arch/arm/mach-kirkwood/board-iconnect.c   |    7 +------
 arch/arm/mach-kirkwood/board-lsxl.c       |   13 ++-----------
 arch/arm/mach-kirkwood/board-ts219.c      |   10 +---------
 16 files changed, 128 insertions(+), 57 deletions(-)
arch/arm/boot/dts/kirkwood-dnskw.dtsi +12 -0
index 7408655..466a7c6 100644
@@ -65,5 +65,17 @@
 				reg = <0x7b00000 0x500000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x88>;
+			interrupts = <11>;
+		};
 	};
 };
arch/arm/boot/dts/kirkwood-dreamplug.dts +24 -0
index 26e281f..83ada56 100644
@@ -53,6 +53,30 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x81>;
+			interrupts = <15>;
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-goflexnet.dts +11 -0
index 7c8238f..4346303 100644
@@ -50,6 +50,17 @@
 			nr-ports = <2>;
 		};
 
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-ib62x0.dts +13 -0
index 66794ed..0d0a0e6 100644
@@ -45,6 +45,19 @@
 			};
 
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x88>;
+			interrupts = <11>;
+		};
+
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-iconnect.dts +13 -0
index 52d9470..aef754d 100644
@@ -30,6 +30,19 @@
 			clock-frequency = <200000000>;
 			status = "ok";
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x8b>;
+			interrupts = <11>;
+		};
+
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-lsxl.dtsi +23 -0
index 8ac51c0..ae48bfb 100644
@@ -40,6 +40,29 @@
 				};
 			};
 		};
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x88>;
+			interrupts = <15>;
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-ts219-6281.dts +10 -1
index ccbf327..6813321 100644
@@ -3,6 +3,15 @@
 /include/ "kirkwood-ts219.dtsi"
 
 / {
+	ocp at f1000000 {
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x88>;
+			interrupts = <11>;
+		};
+	};
 	gpio_keys {
 		compatible = "gpio-keys";
 		#address-cells = <1>;
@@ -18,4 +27,4 @@
 			gpios = <&gpio0 16 1>;
 		};
 	};
-};
\ No newline at end of file
+};
arch/arm/boot/dts/kirkwood-ts219-6282.dts +10 -1
index fbe9932..af68a71 100644
@@ -3,6 +3,15 @@
 /include/ "kirkwood-ts219.dtsi"
 
 / {
+	ocp at f1000000 {
+		egiga0 {
+			compatible = "marvell,mv643xx";
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+		};
+	};
 	gpio_keys {
 		compatible = "gpio-keys";
 		#address-cells = <1>;
@@ -18,4 +27,4 @@
 			gpios = <&gpio1 5 1>;
 		};
 	};
-};
\ No newline at end of file
+};
arch/arm/boot/dts/kirkwood-ts219.dtsi +3 -0
index 64ea27c..06caf41 100644
@@ -74,5 +74,8 @@
 			status = "okay";
 			nr-ports = <2>;
 		};
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
 	};
 };
arch/arm/mach-kirkwood/board-dnskw.c +1 -6
index 4ab3506..4d8216b 100644
@@ -15,7 +15,6 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/of.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
@@ -29,10 +28,6 @@
 #include "common.h"
 #include "mpp.h"
 
-static struct mv643xx_eth_platform_data dnskw_ge00_data = {
-	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
-};
-
 static unsigned int dnskw_mpp_config[] __initdata = {
 	MPP13_UART1_TXD,	/* Custom ... */
 	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
@@ -112,7 +107,7 @@ void __init dnskw_init(void)
 	kirkwood_mpp_conf(dnskw_mpp_config);
 
 	kirkwood_ehci_init();
-	kirkwood_ge00_init(&dnskw_ge00_data);
+	kirkwood_ge00_init(NULL);
 
 	platform_device_register(&dnskw_fan_device);
 
arch/arm/mach-kirkwood/board-dreamplug.c +2 -11
index aeb234d..b97a112 100644
@@ -15,7 +15,6 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_fdt.h>
@@ -34,14 +33,6 @@
 #include "common.h"
 #include "mpp.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),
-};
-
 static struct mvsdio_platform_data dreamplug_mvsdio_data = {
 	/* unfortunately the CD signal has not been connected */
 };
@@ -65,7 +56,7 @@ void __init dreamplug_init(void)
 	kirkwood_mpp_conf(dreamplug_mpp_config);
 
 	kirkwood_ehci_init();
-	kirkwood_ge00_init(&dreamplug_ge00_data);
-	kirkwood_ge01_init(&dreamplug_ge01_data);
+	kirkwood_ge00_init(NULL);
+	kirkwood_ge01_init(NULL);
 	kirkwood_sdio_init(&dreamplug_mvsdio_data);
 }
arch/arm/mach-kirkwood/board-goflexnet.c +1 -6
index 413e2c8..be7437d 100644
@@ -20,7 +20,6 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_fdt.h>
@@ -36,10 +35,6 @@
 #include "common.h"
 #include "mpp.h"
 
-static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
-	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
-};
-
 static unsigned int goflexnet_mpp_config[] __initdata = {
 	MPP29_GPIO,	/* USB Power Enable */
 	MPP47_GPIO,	/* LED Orange */
@@ -67,5 +62,5 @@ void __init goflexnet_init(void)
 		pr_err("can't setup GPIO 29 (USB Power Enable)\n");
 	kirkwood_ehci_init();
 
-	kirkwood_ge00_init(&goflexnet_ge00_data);
+	kirkwood_ge00_init(NULL);
 }
arch/arm/mach-kirkwood/board-ib62x0.c +1 -6
index cfc47f8..0a29183 100644
@@ -16,7 +16,6 @@
 #include <linux/platform_device.h>
 #include <linux/mtd/partitions.h>
 #include <linux/ata_platform.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <asm/mach-types.h>
@@ -27,10 +26,6 @@
 
 #define IB62X0_GPIO_POWER_OFF	24
 
-static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
-	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
-};
-
 static unsigned int ib62x0_mpp_config[] __initdata = {
 	MPP0_NF_IO2,
 	MPP1_NF_IO3,
@@ -62,7 +57,7 @@ void __init ib62x0_init(void)
 	kirkwood_mpp_conf(ib62x0_mpp_config);
 
 	kirkwood_ehci_init();
-	kirkwood_ge00_init(&ib62x0_ge00_data);
+	kirkwood_ge00_init(NULL);
 	if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
 	    gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
 		pm_power_off = ib62x0_power_off;
arch/arm/mach-kirkwood/board-iconnect.c +1 -6
index d7a9198..220f0d4 100644
@@ -17,7 +17,6 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/mtd/partitions.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
@@ -26,10 +25,6 @@
 #include "common.h"
 #include "mpp.h"
 
-static struct mv643xx_eth_platform_data iconnect_ge00_data = {
-	.phy_addr	= MV643XX_ETH_PHY_ADDR(11),
-};
-
 static unsigned int iconnect_mpp_config[] __initdata = {
 	MPP12_GPIO,
 	MPP35_GPIO,
@@ -92,7 +87,7 @@ void __init iconnect_init(void)
 	kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
 
 	kirkwood_ehci_init();
-	kirkwood_ge00_init(&iconnect_ge00_data);
+	kirkwood_ge00_init(NULL);
 
 	platform_device_register(&iconnect_button_device);
 }
arch/arm/mach-kirkwood/board-lsxl.c +2 -11
index 83d8975..60331d1 100644
@@ -18,7 +18,6 @@
 #include <linux/ata_platform.h>
 #include <linux/spi/flash.h>
 #include <linux/spi/spi.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
 #include <linux/gpio-fan.h>
 #include <linux/input.h>
@@ -28,14 +27,6 @@
 #include "common.h"
 #include "mpp.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),
-};
-
 static unsigned int lsxl_mpp_config[] __initdata = {
 	MPP10_GPO,	/* HDD Power Enable */
 	MPP11_GPIO,	/* USB Vbus Enable */
@@ -126,8 +117,8 @@ void __init lsxl_init(void)
 	gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
 
 	kirkwood_ehci_init();
-	kirkwood_ge00_init(&lsxl_ge00_data);
-	kirkwood_ge01_init(&lsxl_ge01_data);
+	kirkwood_ge00_init(NULL);
+	kirkwood_ge01_init(NULL);
 	platform_device_register(&lsxl_fan_device);
 
 	/* register power-off method */
arch/arm/mach-kirkwood/board-ts219.c +1 -9
index 1750e68..7e7fe6c 100644
@@ -18,7 +18,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mv643xx_eth.h>
 #include <linux/ata_platform.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
@@ -29,10 +28,6 @@
 #include "mpp.h"
 #include "tsx1x-common.h"
 
-static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
-	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
-};
-
 static unsigned int qnap_ts219_mpp_config[] __initdata = {
 	MPP0_SPI_SCn,
 	MPP1_SPI_MOSI,
@@ -62,10 +57,7 @@ void __init qnap_dt_ts219_init(void)
 	kirkwood_mpp_conf(qnap_ts219_mpp_config);
 
 	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);
+	kirkwood_ge00_init(NULL);
 	kirkwood_ehci_init();
 
 	pm_power_off = qnap_tsx1x_power_off;
Signature · 1 line
1.7.9.5