Skip to contentSkip to conversation

ARM: kirkwood: cleanup DT conversion

RFC PATCH New Jason Cooper 13 participants 102 messages Jan 23, 2013 – Feb 16, 2013

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

cover ARM: kirkwood: cleanup DT conversion

All,

This is a first cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

thx,

Jason.

Jason Cooper (6):
ARM: kirkwood: topkick: init mvsdio via DT
ARM: kirkwood: topkick: convert to pinctrl
ARM: kirkwood: nsa310: cleanup includes and unneeded code
ARM: kirkwood: nsa310: convert to pinctrl
ARM: kirkwood: consolidate DT init of pcie
ARM: kirkwood: consolidate mv643xx_eth init for DT

 arch/arm/boot/dts/kirkwood-nsa310.dts        |  99 +++++++++++++++++++
 arch/arm/boot/dts/kirkwood-topkick.dts       |  95 ++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig               | 101 -------------------
 arch/arm/mach-kirkwood/Makefile              |  15 ---
 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            | 140 ++++++++++++++++++++-------
 arch/arm/mach-kirkwood/board-goflexnet.c     |  34 -------
 arch/arm/mach-kirkwood/board-ib62x0.c        |  29 ------
 arch/arm/mach-kirkwood/board-iconnect.c      |  32 ------
 arch/arm/mach-kirkwood/board-lsxl.c          |  36 -------
 arch/arm/mach-kirkwood/board-mplcec4.c       |  36 -------
 arch/arm/mach-kirkwood/board-ns2.c           |  34 -------
 arch/arm/mach-kirkwood/board-nsa310.c        |  58 -----------
 arch/arm/mach-kirkwood/board-openblocks_a6.c |  26 -----
 arch/arm/mach-kirkwood/board-ts219.c         |  13 ---
 arch/arm/mach-kirkwood/board-usi_topkick.c   |  77 ---------------
 arch/arm/mach-kirkwood/common.h              |  69 -------------
 19 files changed, 298 insertions(+), 670 deletions(-)
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-nsa310.c
 delete mode 100644 arch/arm/mach-kirkwood/board-openblocks_a6.c
 delete mode 100644 arch/arm/mach-kirkwood/board-usi_topkick.c
Signature · 1 line
1.8.1.1
#1 lore raw

RFC PATCH 1/6 ARM: kirkwood: topkick: init mvsdio via DT

---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 7 +++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +7 -0
index cd15452..23c2ddc 100644
@@ -54,6 +54,13 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		mvsdio at 90000 {
+			pinctrl-0 = <&pmx_sdio>;
+			pinctrl-names = "default";
+			status = "okay";
+			/* No CD or WP GPIOs */
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -6
index 23d2dd1..95f0711 100644
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
-#include <linux/platform_data/mmc-mvsdio.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -22,10 +21,6 @@ static struct mv643xx_eth_platform_data topkick_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
 };
 
-static struct mvsdio_platform_data topkick_mvsdio_data = {
-	/* unfortunately the CD signal has not been connected */
-};
-
 /*
  * GPIO LED layout
  *
@@ -73,5 +68,4 @@ void __init usi_topkick_init(void)
 
 
 	kirkwood_ge00_init(&topkick_ge00_data);
-	kirkwood_sdio_init(&topkick_mvsdio_data);
 }
Signature · 1 line
1.8.1.1
#2 lore raw

RFC PATCH 2/6 ARM: kirkwood: topkick: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 88 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 42 --------------
 2 files changed, 88 insertions(+), 42 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +88 -0
index 23c2ddc..d959873 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 /include/ "kirkwood.dtsi"
+/include/ "kirkwood-6281.dtsi"
 
 / {
 	model = "Univeral Scientific Industrial Co. Topkick-1281P2";
@@ -16,6 +17,93 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			/*
+			 * GPIO LED layout
+			 *
+			 *       /-SYS_LED(2)
+			 *       |
+			 *       |   /-DISK_LED
+			 *       |   |
+			 *       |   |   /-WLAN_LED(2)
+			 *       |   |   |
+			 * [SW] [*] [*] [*]
+			 */
+
+			/*
+			 * Switch positions
+			 *
+			 *     /-SW_LEFT(2)
+			 *     |
+			 *     |   /-SW_IDLE
+			 *     |   |
+			 *     |   |   /-SW_RIGHT
+			 *     |   |   |
+			 * PS [L] [I] [R] LEDS
+			 */
+			pinctrl-0 = < &pmx_led_disk_yellow
+				      &pmx_sata0_pwr_enable
+				      &pmx_led_sys_red
+				      &pmx_led_sys_blue
+				      &pmx_led_wifi_green
+				      &pmx_sw_left
+				      &pmx_sw_right
+				      &pmx_sw_idle
+				      &pmx_sw_left2
+				      &pmx_led_wifi_yellow >;
+			pinctrl-names = "default";
+
+			pmx_led_disk_yellow: pmx-led-disk-yellow {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_sata0_pwr_enable: pmx-sata0-pwr-enable {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_blue: pmx-led-sys-blue {
+				marvell,pins = "mpp38";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_green: pmx-led-wifi-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left: pmx-sw-left {
+				marvell,pins = "mpp43";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_right: pmx-sw-right {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_idle: pmx-sw-idle {
+				marvell,pins = "mpp45";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left2: pmx-sw-left2 {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_yellow: pmx-led-wifi-yellow {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
+
 		serial at 12000 {
 			clock-frequency = <200000000>;
 			status = "ok";
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -42

57 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#3 lore raw

RFC PATCH 3/6 ARM: kirkwood: nsa310: cleanup includes and unneeded code

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -8
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
Signature · 1 line
1.8.1.1
#4 lore raw

RFC PATCH 3/6 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Quoted 37 lines · Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -8
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
Signature · 1 line
1.8.1.1

Hi Jason, Tero

This board is rather unusual for a Kirkwood. It has no Ethernet interfaces. Is this correct?

Thanks
Andrew

#5 lore raw

RFC PATCH 3/6 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Quoted 41 lines · Andrew Lunn
Quoted 35 lines · Jason Cooper
---
  arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
  1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -9
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
  #include <linux/kernel.h>
  #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
  #include <mach/kirkwood.h>
+#include <linux/of.h>
  #include "common.h"
  #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
  void __init nsa310_init(void)
  {
-	u32 dev, rev;
-
  	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
  }
 
  static int __init nsa310_pci_init(void)
--
Quoted 2 lines

1.8.1.1

Hi Jason, Tero

Quoted 2 lines

This board is rather unusual for a Kirkwood. It has no Ethernet interfaces. Is this correct?

It seems like it really has an Gigabit Ethernet interface:
http://www.clubic.com/disque-dur-memoire/nas/article-465814-1-zyxel-nsa-310.html

(in french, but the pictures show a Gigabit Ethernet). --
Florian

#6 lore raw

RFC PATCH 3/6 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Quoted 42 lines · Florian Fainelli
Quoted 41 lines · Andrew Lunn
Quoted 35 lines · Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -9
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
--
Quoted 2 lines

1.8.1.1

Hi Jason, Tero

Quoted 5 lines
Quoted 2 lines

This board is rather unusual for a Kirkwood. It has no Ethernet interfaces. Is this correct?

It seems like it really has an Gigabit Ethernet interface:
http://www.clubic.com/disque-dur-memoire/nas/article-465814-1-zyxel-nsa-310.html

It's easy enough to add, we just need to know the phy_addr. Does anyone have one to test?

thx,

Jason.

#7 lore raw

RFC PATCH 3/6 ARM: kirkwood: nsa310: cleanup includes and unneeded code

In reply to Andrew Lunn
Quoted 41 lines · Andrew Lunn
Quoted 37 lines · Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -8
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
Signature · 1 line
1.8.1.1

Hi Jason, Tero

Quoted 2 lines

This board is rather unusual for a Kirkwood. It has no Ethernet interfaces. Is this correct?

Found this [1], it details some mpp we don't have, and a hwmon interface. No mention of ethernet, though. :-/ Apparently there's a buzzer attached to mpp44, fun.

[2] for the nsa320 does initialize it. Apparently auto-negotiation in borked?

thx,

Jason.

[1] https://github.com/peeter123/linux-nsa320/blob/master/arch/arm/mach-kirkwood/nsa310-setup.c
[2] https://github.com/peeter123/linux-nsa320/blob/master/arch/arm/mach-kirkwood/nsa320-setup.c

#8 lore raw

RFC PATCH 4/6 ARM: kirkwood: nsa310: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-nsa310.dts | 99 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |  3 --
 arch/arm/mach-kirkwood/board-nsa310.c | 26 ---------
 arch/arm/mach-kirkwood/common.h       |  6 ---
 4 files changed, 99 insertions(+), 35 deletions(-)
arch/arm/boot/dts/kirkwood-nsa310.dts +99 -0
index dbb3551..3a178cf 100644
@@ -16,6 +16,105 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			pinctrl-0 = < &pmx_led_esata_green
+				      &pmx_led_esata_red
+				      &pmx_led_usb_green
+				      &pmx_led_usb_red
+				      &pmx_usb_power_off
+				      &pmx_led_sys_green
+				      &pmx_led_sys_red
+				      &pmx_btn_reset
+				      &pmx_btn_copy
+				      &pmx_led_copy_green
+				      &pmx_led_copy_red
+				      &pmx_led_hdd_green
+				      &pmx_led_hdd_red
+				      &pmx_unknown
+				      &pmx_btn_power
+				      &pmx_pwr_off >;
+			pinctrl-names = "default";
+
+			pmx_led_esata_green: pmx-led-esata-green {
+				marvell,pins = "mpp12";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_esata_red: pmx-led-esata-red {
+				marvell,pins = "mpp13";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_red: pmx-led-usb-red {
+				marvell,pins = "mpp16";
+				marvell,function = "gpio";
+			};
+
+			pmx_usb_power_off: pmx-usb-power-off {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp29";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_reset: pmx-btn-reset {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_copy: pmx-btn-copy {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_green: pmx-led-copy-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_red: pmx-led-copy-red {
+				marvell,pins = "mpp40";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_green: pmx-led-hdd-green {
+				marvell,pins = "mpp41";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_red: pmx-led-hdd-red {
+				marvell,pins = "mpp42";
+				marvell,function = "gpio";
+			};
+
+			pmx_unknown: pmx-unknown {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_power: pmx-btn-power {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_off: pmx-pwr-off {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
 
 		serial at 12000 {
 			clock-frequency = <200000000>;
arch/arm/mach-kirkwood/board-dt.c +0 -3
index 8eac548..8b35157 100644
@@ -141,9 +141,6 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		nsa310_init();
-
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
arch/arm/mach-kirkwood/board-nsa310.c +0 -26
index 0b99533..55ade93 100644
@@ -13,32 +13,6 @@
 #include <mach/kirkwood.h>
 #include <linux/of.h>
 #include "common.h"
-#include "mpp.h"
-
-static unsigned int nsa310_mpp_config[] __initdata = {
-	MPP12_GPIO, /* led esata green */
-	MPP13_GPIO, /* led esata red */
-	MPP15_GPIO, /* led usb green */
-	MPP16_GPIO, /* led usb red */
-	MPP21_GPIO, /* control usb power off */
-	MPP28_GPIO, /* led sys green */
-	MPP29_GPIO, /* led sys red */
-	MPP36_GPIO, /* key reset */
-	MPP37_GPIO, /* key copy */
-	MPP39_GPIO, /* led copy green */
-	MPP40_GPIO, /* led copy red */
-	MPP41_GPIO, /* led hdd green */
-	MPP42_GPIO, /* led hdd red */
-	MPP44_GPIO, /* ?? */
-	MPP46_GPIO, /* key power */
-	MPP48_GPIO, /* control power off */
-	0
-};
-
-void __init nsa310_init(void)
-{
-	kirkwood_mpp_conf(nsa310_mpp_config);
-}
 
 static int __init nsa310_pci_init(void)
 {
arch/arm/mach-kirkwood/common.h +0 -6
index e956d02..1c42cb8 100644
@@ -130,12 +130,6 @@ void ns2_init(void);
 static inline void ns2_init(void) {};
 #endif
 
-#ifdef CONFIG_MACH_NSA310_DT
-void nsa310_init(void);
-#else
-static inline void nsa310_init(void) {};
-#endif
-
 #ifdef CONFIG_MACH_OPENBLOCKS_A6_DT
 void openblocks_a6_init(void);
 #else
Signature · 1 line
1.8.1.1
#9 lore raw

RFC PATCH 5/6 ARM: kirkwood: consolidate DT init of pcie

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/Makefile         |  1 -
 arch/arm/mach-kirkwood/board-dt.c       | 23 +++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-iconnect.c |  9 ---------
 arch/arm/mach-kirkwood/board-mplcec4.c  |  1 -
 arch/arm/mach-kirkwood/board-nsa310.c   | 25 -------------------------
 arch/arm/mach-kirkwood/board-ts219.c    | 13 -------------
 6 files changed, 23 insertions(+), 49 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
arch/arm/mach-kirkwood/Makefile +0 -1
index d665309..ee3aa77 100644
@@ -36,6 +36,5 @@ obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NSA310_DT)		+= board-nsa310.o
 obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
 obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dt.c +23 -0
index 8b35157..73b76e4 100644
@@ -70,6 +70,29 @@ static void __init kirkwood_of_clk_init(void)
 	kirkwood_legacy_clk_init();
 }
 
+static const char * const kirkwood_dt_pcie0_compat[] = {
+	"iom,iconnect",
+	"mpl,cec4",
+	"qnap,ts219",
+	"zyxel,nsa310",
+	NULL
+};
+
+static int __init kirkwood_pcie_dt_init(void)
+{
+	int i;
+
+	for (i = 0; kirkwood_dt_pcie0_compat[i] != NULL; i++) {
+		if (of_machine_is_compatible(kirkwood_dt_pcie0_compat[i])) {
+			kirkwood_pcie_init(KW_PCIE0);
+			break;
+		}
+	}
+
+	return 0;
+}
+subsys_initcall(kirkwood_pcie_dt_init);
+
 static void __init kirkwood_dt_init(void)
 {
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
arch/arm/mach-kirkwood/board-iconnect.c +0 -9
index c8ebde4..ff042dc 100644
@@ -10,7 +10,6 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/of.h>
 #include <linux/mv643xx_eth.h>
 #include "common.h"
 
@@ -22,11 +21,3 @@ void __init iconnect_init(void)
 {
 	kirkwood_ge00_init(&iconnect_ge00_data);
 }
-
-static int __init iconnect_pci_init(void)
-{
-	if (of_machine_is_compatible("iom,iconnect"))
-		kirkwood_pcie_init(KW_PCIE0);
-	return 0;
-}
-subsys_initcall(iconnect_pci_init);
arch/arm/mach-kirkwood/board-mplcec4.c +0 -1
index 7d6dc66..938712e 100644
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
 	 */
 	kirkwood_ge00_init(&mplcec4_ge00_data);
 	kirkwood_ge01_init(&mplcec4_ge01_data);
-	kirkwood_pcie_init(KW_PCIE0);
 }
 
 
arch/arm/mach-kirkwood/board-nsa310.c deleted +0 -25
deleted file mode 100644
index 55ade93..0000000
@@ -1,25 +0,0 @@
-/*
- * arch/arm/mach-kirkwood/nsa-310-setup.c
- *
- * ZyXEL NSA-310 Setup
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <mach/kirkwood.h>
-#include <linux/of.h>
-#include "common.h"
-
-static int __init nsa310_pci_init(void)
-{
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-
-subsys_initcall(nsa310_pci_init);
arch/arm/mach-kirkwood/board-ts219.c +0 -13
index 10fb397..f00c0a9 100644
@@ -17,10 +17,7 @@
 
 #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"
 
@@ -38,13 +35,3 @@ void __init qnap_dt_ts219_init(void)
 
 	kirkwood_ge00_init(&qnap_ts219_ge00_data);
 }
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);
Signature · 1 line
1.8.1.1
#10 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

In reply to Jason Cooper

replace a lot of unneeded code and files with a lookup table.

---
 arch/arm/mach-kirkwood/Kconfig               | 101 ------------------------
 arch/arm/mach-kirkwood/Makefile              |  14 ----
 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            | 114 +++++++++++++++++++--------
 arch/arm/mach-kirkwood/board-goflexnet.c     |  34 --------
 arch/arm/mach-kirkwood/board-ib62x0.c        |  29 -------
 arch/arm/mach-kirkwood/board-iconnect.c      |  23 ------
 arch/arm/mach-kirkwood/board-lsxl.c          |  36 ---------
 arch/arm/mach-kirkwood/board-mplcec4.c       |  35 --------
 arch/arm/mach-kirkwood/board-ns2.c           |  34 --------
 arch/arm/mach-kirkwood/board-openblocks_a6.c |  26 ------
 arch/arm/mach-kirkwood/board-usi_topkick.c   |  29 -------
 arch/arm/mach-kirkwood/common.h              |  63 ---------------
 15 files changed, 81 insertions(+), 531 deletions(-)
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-usi_topkick.c
arch/arm/mach-kirkwood/Kconfig +0 -101
index 432bee0..188651b 100644
@@ -58,19 +58,6 @@ config ARCH_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Kirkwood using 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_ICONNECT_DT
-	bool "Iomega Iconnect (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	help
-	  Say 'Y' here to enable Iomega Iconnect support.
-
 config MACH_DLINK_KIRKWOOD_DT
 	bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
@@ -79,14 +66,6 @@ config MACH_DLINK_KIRKWOOD_DT
 	  Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
 	  using 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_TS219_DT
 	bool "Device Tree for QNAP TS-11X, TS-21X NAS"
 	select ARCH_KIRKWOOD_DT
@@ -102,29 +81,6 @@ config MACH_TS219_DT
 	  or MV6282. If you have the wrong one, the buttons will not
 	  work.
 
-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_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_LSXL_DT
-	bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	select POWER_RESET_RESTART
-	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_IOMEGA_IX2_200_DT
 	bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
@@ -139,63 +95,6 @@ config MACH_KM_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
 
-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_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_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_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_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_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 (aka SafeBox), 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_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
 	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 +0 -14
index ee3aa77..ab739b0 100644
@@ -20,21 +20,7 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
-obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
-obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
-obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
-obj-$(CONFIG_MACH_DOCKSTAR_DT)		+= board-dockstar.o
-obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
-obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.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_INETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_MPLCEC4_DT)		+= board-mplcec4.o
-obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
-obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dnskw.c +0 -7
index a1aa87f..2af7a95 100644
@@ -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);
 }
arch/arm/mach-kirkwood/board-dockstar.c deleted +0 -32
deleted file mode 100644
index d7196db..0000000
@@ -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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-dreamplug.c deleted +0 -35
deleted file mode 100644
index 0903242..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-dt.c +81 -33

139 lines not on this page · raw message

arch/arm/mach-kirkwood/board-goflexnet.c deleted +0 -34
deleted file mode 100644
index 9db979a..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-ib62x0.c deleted +0 -29
deleted file mode 100644
index 9a857ae..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Baatz <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-iconnect.c deleted +0 -23
deleted file mode 100644
index ff042dc..0000000
@@ -1,23 +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/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);
-}
arch/arm/mach-kirkwood/board-lsxl.c deleted +0 -36
deleted file mode 100644
index 3483952..0000000
@@ -1,36 +0,0 @@
-/*
- * Copyright 2012 (C), Michael Walle <[email protected]>
- *
- * 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),
-};
-
-void __init lsxl_init(void)
-{
-	/*
-	 * Basic setup. Needs to be called early.
-	 */
-
-	kirkwood_ge00_init(&lsxl_ge00_data);
-	kirkwood_ge01_init(&lsxl_ge01_data);
-}
arch/arm/mach-kirkwood/board-mplcec4.c deleted +0 -35
deleted file mode 100644
index 938712e..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 MPL AG, Switzerland
- * Stefan Peter <[email protected]>
- *
- * 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);
-}
-
-
-
arch/arm/mach-kirkwood/board-ns2.c deleted +0 -34
deleted file mode 100644
index f2ea3b7..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Guinot <[email protected]>
- *
- * 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,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);
-}
arch/arm/mach-kirkwood/board-openblocks_a6.c deleted +0 -26
deleted file mode 100644
index b11d8fd..0000000
@@ -1,26 +0,0 @@
-/*
- * Copyright 2012 Nobuhiro Iwamatsu <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-usi_topkick.c deleted +0 -29
deleted file mode 100644
index 1cc04ec..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/common.h +0 -63

81 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#11 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 372 lines · Jason Cooper

replace a lot of unneeded code and files with a lookup table.

---
 arch/arm/mach-kirkwood/Kconfig               | 101 ------------------------
 arch/arm/mach-kirkwood/Makefile              |  14 ----
 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            | 114 +++++++++++++++++++--------
 arch/arm/mach-kirkwood/board-goflexnet.c     |  34 --------
 arch/arm/mach-kirkwood/board-ib62x0.c        |  29 -------
 arch/arm/mach-kirkwood/board-iconnect.c      |  23 ------
 arch/arm/mach-kirkwood/board-lsxl.c          |  36 ---------
 arch/arm/mach-kirkwood/board-mplcec4.c       |  35 --------
 arch/arm/mach-kirkwood/board-ns2.c           |  34 --------
 arch/arm/mach-kirkwood/board-openblocks_a6.c |  26 ------
 arch/arm/mach-kirkwood/board-usi_topkick.c   |  29 -------
 arch/arm/mach-kirkwood/common.h              |  63 ---------------
 15 files changed, 81 insertions(+), 531 deletions(-)
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-usi_topkick.c
arch/arm/mach-kirkwood/Kconfig +0 -101
index 432bee0..188651b 100644
@@ -58,19 +58,6 @@ config ARCH_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Kirkwood using 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_ICONNECT_DT
-	bool "Iomega Iconnect (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	help
-	  Say 'Y' here to enable Iomega Iconnect support.
-
 config MACH_DLINK_KIRKWOOD_DT
 	bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
@@ -79,14 +66,6 @@ config MACH_DLINK_KIRKWOOD_DT
 	  Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
 	  using 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_TS219_DT
 	bool "Device Tree for QNAP TS-11X, TS-21X NAS"
 	select ARCH_KIRKWOOD_DT
@@ -102,29 +81,6 @@ config MACH_TS219_DT
 	  or MV6282. If you have the wrong one, the buttons will not
 	  work.
 
-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_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_LSXL_DT
-	bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	select POWER_RESET_RESTART
-	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_IOMEGA_IX2_200_DT
 	bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
@@ -139,63 +95,6 @@ config MACH_KM_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
 
-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_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_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_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_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_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 (aka SafeBox), 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_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
 	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 +0 -14
index ee3aa77..ab739b0 100644
@@ -20,21 +20,7 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
-obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
-obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
-obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
-obj-$(CONFIG_MACH_DOCKSTAR_DT)		+= board-dockstar.o
-obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
-obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.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_INETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_MPLCEC4_DT)		+= board-mplcec4.o
-obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
-obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dnskw.c +0 -7
index a1aa87f..2af7a95 100644
@@ -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);
 }
arch/arm/mach-kirkwood/board-dockstar.c deleted +0 -32
deleted file mode 100644
index d7196db..0000000
@@ -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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-dreamplug.c deleted +0 -35
deleted file mode 100644
index 0903242..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-dt.c +67 -0
index 73b76e4..f5bd640 100644
@@ -93,6 +93,86 @@ static int __init kirkwood_pcie_dt_init(void)
 }
 subsys_initcall(kirkwood_pcie_dt_init);
 
+struct kirkwood_dt_gige {
+	const char *compatible;
+	int phy_addr00;
+	int phy_addr01;
+};
+
+static struct kirkwood_dt_gige kw_dt_gige[] = {
+	{ .compatible = "buffalo,lsxl",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_ADDR(8) },
+	{ .compatible = "dlink,dns-kirkwood",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(8),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "globalscale,dreamplug",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_ADDR(1) },
+	{ .compatible = "iom,iconnect",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(11),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "lacie,inetspace_v2",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(8),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "lacie,netspace_v2",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(8),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "lacie,netspace_max_v2",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(8),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "lacie,netspace_lite_v2",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "lacie,netspace_mini_v2",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "mpl,cec4",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(1),
+	  .phy_addr01 = MV643XX_ETH_PHY_ADDR(2) },
+	{ .compatible = "plathome,openblocks-a6",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "raidsonic,ib-nas62x0",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(8),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "seagate,dockstar",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "seagate,goflexnet",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ .compatible = "usi,topkick",
+	  .phy_addr00 = MV643XX_ETH_PHY_ADDR(0),
+	  .phy_addr01 = MV643XX_ETH_PHY_NONE },
+	{ NULL, MV643XX_ETH_PHY_NONE, MV643XX_ETH_PHY_NONE },
+};
+
+static void kirkwood_gige_dt_init(void) {
+	int i;
+
+	for (i = 0; kw_dt_gige[i].compatible != NULL; i++) {
+		if (of_machine_is_compatible(kw_dt_gige[i].compatible)) {
+
+			if (kw_dt_gige[i].phy_addr00 != MV643XX_ETH_PHY_NONE) {
+				struct mv643xx_eth_platform_data d = {
+					.phy_addr = kw_dt_gige[i].phy_addr00,
+				};
+				kirkwood_ge00_init(&d);
+			}

arch/arm/mach-kirkwood/board-dt.c static int __init kirkwood_pcie_dt_init(void) · line 172

Quoted 10 lines
arch/arm/mach-kirkwood/board-dt.c +10 -0
+
+			if (kw_dt_gige[i].phy_addr01 != MV643XX_ETH_PHY_NONE) {
+				struct mv643xx_eth_platform_data d = {
+					.phy_addr = kw_dt_gige[i].phy_addr01,
+				};
+				kirkwood_ge01_init(&d);
+			}
+
+			break;
+		}

meh, hindsight is 50/50 :-) Much more readable this way, I think:

		if (of_machine_is_compatible(kw_dt_gige[i].compatible)) {
			struct mv643xx_eth_platform_data d;

			if (kw_dt_gige[i].phy_addr00 != MV643XX_ETH_PHY_NONE) {
				d.phy_addr = kw_dt_gige[i].phy_addr00,
				kirkwood_ge00_init(&d);
			}

			if (kw_dt_gige[i].phy_addr01 != MV643XX_ETH_PHY_NONE) {
				d.phy_addr = kw_dt_gige[i].phy_addr01,
				kirkwood_ge01_init(&d);
			}

			break;
		}

thx,

Jason.

#12 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 41 lines
Quoted 12 lines
arch/arm/mach-kirkwood/board-dt.c +12 -0
+static void kirkwood_gige_dt_init(void) {
+	int i;
+
+	for (i = 0; kw_dt_gige[i].compatible != NULL; i++) {
+		if (of_machine_is_compatible(kw_dt_gige[i].compatible)) {
+
+			if (kw_dt_gige[i].phy_addr00 != MV643XX_ETH_PHY_NONE) {
+				struct mv643xx_eth_platform_data d = {
+					.phy_addr = kw_dt_gige[i].phy_addr00,
+				};
+				kirkwood_ge00_init(&d);
+			}

arch/arm/mach-kirkwood/board-dt.c static int __init kirkwood_pcie_dt_init(void) · line 172

Quoted 10 lines
arch/arm/mach-kirkwood/board-dt.c +10 -0
+
+			if (kw_dt_gige[i].phy_addr01 != MV643XX_ETH_PHY_NONE) {
+				struct mv643xx_eth_platform_data d = {
+					.phy_addr = kw_dt_gige[i].phy_addr01,
+				};
+				kirkwood_ge01_init(&d);
+			}
+
+			break;
+		}

meh, hindsight is 50/50 :-) Much more readable this way, I think:

		if (of_machine_is_compatible(kw_dt_gige[i].compatible)) {
			struct mv643xx_eth_platform_data d;

			if (kw_dt_gige[i].phy_addr00 != MV643XX_ETH_PHY_NONE) {
				d.phy_addr = kw_dt_gige[i].phy_addr00,
				kirkwood_ge00_init(&d);
			}

			if (kw_dt_gige[i].phy_addr01 != MV643XX_ETH_PHY_NONE) {
				d.phy_addr = kw_dt_gige[i].phy_addr01,
				kirkwood_ge01_init(&d);
			}

			break;
		}
Quoted 3 lines

thx,

Jason.

Hi Jason

Might it be better still to implement something like:

const struct of_device_id *of_match_machine(const struct of_device_id *matches)

{
        struct device_node *root;
	const struct of_device_id *match;

	if (!matches)
		return NULL;

	root = of_find_node_by_path("/");
	if (!root)
		return NULL;	

	match = of_match_node(matches, root);
	of_node_put(root);

	return match;
}

and then board-dt.c becomes

    match = of_match_machine(ge00_matches);
    if (match)
	krikwood_ge00_init(match->data)

    match = of_match_machine(ge01_matches);
    if (match)
	krikwood_ge01_init(match->data)

	Andrew
#13 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 50 lines · Andrew Lunn
Quoted 41 lines
Quoted 12 lines
arch/arm/mach-kirkwood/board-dt.c +12 -0
+static void kirkwood_gige_dt_init(void) {
+	int i;
+
+	for (i = 0; kw_dt_gige[i].compatible != NULL; i++) {
+		if (of_machine_is_compatible(kw_dt_gige[i].compatible)) {
+
+			if (kw_dt_gige[i].phy_addr00 != MV643XX_ETH_PHY_NONE) {
+				struct mv643xx_eth_platform_data d = {
+					.phy_addr = kw_dt_gige[i].phy_addr00,
+				};
+				kirkwood_ge00_init(&d);
+			}

arch/arm/mach-kirkwood/board-dt.c static int __init kirkwood_pcie_dt_init(void) · line 172

Quoted 10 lines
arch/arm/mach-kirkwood/board-dt.c +10 -0
+
+			if (kw_dt_gige[i].phy_addr01 != MV643XX_ETH_PHY_NONE) {
+				struct mv643xx_eth_platform_data d = {
+					.phy_addr = kw_dt_gige[i].phy_addr01,
+				};
+				kirkwood_ge01_init(&d);
+			}
+
+			break;
+		}

meh, hindsight is 50/50 :-) Much more readable this way, I think:

		if (of_machine_is_compatible(kw_dt_gige[i].compatible)) {
			struct mv643xx_eth_platform_data d;

			if (kw_dt_gige[i].phy_addr00 != MV643XX_ETH_PHY_NONE) {
				d.phy_addr = kw_dt_gige[i].phy_addr00,
				kirkwood_ge00_init(&d);
			}

			if (kw_dt_gige[i].phy_addr01 != MV643XX_ETH_PHY_NONE) {
				d.phy_addr = kw_dt_gige[i].phy_addr01,
				kirkwood_ge01_init(&d);
			}

			break;
		}
Quoted 3 lines

thx,

Jason.

Hi Jason

Might it be better still to implement something like:

const struct of_device_id *of_match_machine(const struct of_device_id *matches)

Quoted 16 lines
{
        struct device_node *root;
	const struct of_device_id *match;

	if (!matches)
		return NULL;

	root = of_find_node_by_path("/");
	if (!root)
		return NULL;	

	match = of_match_node(matches, root);
	of_node_put(root);

	return match;
}

I actually went looking for something like this in linux/of.h and didn't find it. Perhaps it should be added? Although I'm not sure I see a use case after the conversion to DT is complete...

Quoted 10 lines

and then board-dt.c becomes

    match = of_match_machine(ge00_matches);
    if (match)
	krikwood_ge00_init(match->data)

    match = of_match_machine(ge01_matches);
    if (match)
	krikwood_ge01_init(match->data)

Much nicer, I'll do this for the next revision and see what the devicetree guys think.

thx,

Jason.

#14 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

In reply to Jason Cooper

Hello Jason,

Quoted 1 line · Jason Cooper

replace a lot of unneeded code and files with a lookup table.

Would not it be better to keep all of this as-is and merge/improve Ian's mv643xx_eth device tree bindings [1], and then only remove these files? It is just 81 new lines, so it is not a big deal, just wondering here what is best.

[1]: http://patchwork.ozlabs.org/patch/175652/

Quoted 2 lines

--
Florian

#15 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 9 lines · Florian Fainelli

Hello Jason,

Quoted 1 line · Jason Cooper

replace a lot of unneeded code and files with a lookup table.

Would not it be better to keep all of this as-is and merge/improve Ian's mv643xx_eth device tree bindings [1], and then only remove these files? It is just 81 new lines, so it is not a big deal, just wondering here what is best.

I agree, however, there is a long history with that patch. That driver has been in use by powerpc for many years. We need to be mindful not to break existing installations. I don't think it'll be ready in time for v3.9. So, I'd like to do the cleanup now.

thx,

Jason.

Quoted 1 line

[1]: http://patchwork.ozlabs.org/patch/175652/

#16 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 10 lines · Jason Cooper

I agree, however, there is a long history with that patch. That driver has been in use by powerpc for many years. We need to be mindful not to break existing installations. I don't think it'll be ready in time for v3.9. So, I'd like to do the cleanup now.

thx,

Jason.

Quoted 1 line

[1]: http://patchwork.ozlabs.org/patch/175652/

I actually think we can take that patch. The result of the discussion back then was after all that we won't try to keep the bindings compatible, and the powerpc version just uses the platform_device part of the driver by fabricating platform_data from the arch code.

It should not have any impact on this, as long as you ensure that the platform_data is still supported.

Arnd

#17 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Jason Cooper

I agree, however, there is a long history with that patch. That driver has been in use by powerpc for many years. We need to be mindful not to break existing installations. I don't think it'll be ready in time for v3.9. So, I'd like to do the cleanup now.

Quoted 1 line

[1]: http://patchwork.ozlabs.org/patch/175652/

I actually think we can take that patch.

Woot!

Quoted 7 lines

The result of the discussion back then was after all that we won't try to keep the bindings compatible, and the powerpc version just uses the platform_device part of the driver by fabricating platform_data from the arch code.

It should not have any impact on this, as long as you ensure that the platform_data is still supported.

Ian's patch appears to do so. I'll respin this series using it vice my lookup table.

thx,

Jason.

#18 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 16 lines · Jason Cooper
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · Jason Cooper

I agree, however, there is a long history with that patch. That driver has been in use by powerpc for many years. We need to be mindful not to break existing installations. I don't think it'll be ready in time for v3.9. So, I'd like to do the cleanup now.

Quoted 1 line

[1]: http://patchwork.ozlabs.org/patch/175652/

I actually think we can take that patch.

Woot!

Quoted 5 lines

The result of the discussion back then was after all that we won't try to keep the bindings compatible, and the powerpc version just uses the platform_device part of the driver by fabricating platform_data from the arch code.

Quoted 4 lines
Quoted 2 lines

It should not have any impact on this, as long as you ensure that the platform_data is still supported.

Ian's patch appears to do so. I'll respin this series using it vice my lookup table.

Sounds good, while at it, I wonder if we could not simplify Ian's patch to be limited to the actual Ethernet MAC driver and use Thomas's mvdio device tree binding for the MDIO bits of mv643xx_eth. What do you think? --
Florian

#19 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 22 lines · Florian Fainelli
Quoted 21 lines · Jason Cooper
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · Jason Cooper

I agree, however, there is a long history with that patch. That driver has been in use by powerpc for many years. We need to be mindful not to break existing installations. I don't think it'll be ready in time for v3.9. So, I'd like to do the cleanup now.

Quoted 1 line

[1]: http://patchwork.ozlabs.org/patch/175652/

I actually think we can take that patch.

Woot!

Quoted 7 lines

The result of the discussion back then was after all that we won't try to keep the bindings compatible, and the powerpc version just uses the platform_device part of the driver by fabricating platform_data from the arch code.

It should not have any impact on this, as long as you ensure that the platform_data is still supported.

Quoted 7 lines
Quoted 3 lines

Ian's patch appears to do so. I'll respin this series using it vice my lookup table.

Sounds good, while at it, I wonder if we could not simplify Ian's patch to be limited to the actual Ethernet MAC driver and use Thomas's mvdio device tree binding for the MDIO bits of mv643xx_eth. What do you think?

It sounds like you just volunteered ;-) Do you think you have the time to knock it out for v3.9?

I'd like to drop most of these board-*.c files for v3.9. They've been bugging me since I added the first one (board-dreamplug.c).

thx,

Jason.

#20 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 10 lines · On Thursday 24 January 2013 13:16:22 Jason Cooper wrote:
Quoted 7 lines
Quoted 3 lines

Ian's patch appears to do so. I'll respin this series using it vice my lookup table.

Sounds good, while at it, I wonder if we could not simplify Ian's patch to be limited to the actual Ethernet MAC driver and use Thomas's mvdio device tree binding for the MDIO bits of mv643xx_eth. What do you think?

It sounds like you just volunteered ;-) Do you think you have the time to knock it out for v3.9?

I do not have any kirkwood board at the moment and I really want to be able to test this properly especially with the "clock must be enabled for ethernet not be lost". Let me get one and I should be able to do it. Let's adopt your patch for the moment, and once I have a kirkwood board I can deal with the ethernet driver device tree bindings.

Does that sound ok with you?

Quoted 7 lines

I'd like to drop most of these board-*.c files for v3.9. They've been bugging me since I added the first one (board-dreamplug.c).

thx,

Jason.

Signature · 1 line
Florian
#21 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 12 lines · Florian Fainelli
Quoted 10 lines · On Thursday 24 January 2013 13:16:22 Jason Cooper wrote:
Quoted 7 lines
Quoted 3 lines

Ian's patch appears to do so. I'll respin this series using it vice my lookup table.

Sounds good, while at it, I wonder if we could not simplify Ian's patch to be limited to the actual Ethernet MAC driver and use Thomas's mvdio device tree binding for the MDIO bits of mv643xx_eth. What do you think?

It sounds like you just volunteered ;-) Do you think you have the time to knock it out for v3.9?

Quoted 7 lines

I do not have any kirkwood board at the moment and I really want to be able to test this properly especially with the "clock must be enabled for ethernet not be lost". Let me get one and I should be able to do it. Let's adopt your patch for the moment, and once I have a kirkwood board I can deal with the ethernet driver device tree bindings.

Does that sound ok with you?

using Ian's patch as is, I have the following in kirkwood.dtsi:

+
+ 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>;
+                       status = "disabled";
+               };
+
+               egiga0 {
+                       compatible = "marvell,mv643xx-eth";
+                       reg = <0x72000 0x4000>;
+                       mdio = <&smi0>;
+                       port_number = <0>;
+                       phy_addr = <0x80>;
+                       interrupts = <11>;
+                       clocks = <&gate_clk 0>;
+                       status = "disabled";
+               };
+
+               egiga1 {
+                       compatible = "marvell,mv643xx-eth";
+                       reg = <0x76000 0x4000>;
+                       mdio = <&smi1>;
+                       port_number = <1>;
+                       phy_addr = <0x81>;
+                       interrupts = <15>;
+                       clocks = <&gate_clk 19>;
+                       status = "disabled";

+ };

I'll see if I can get it working as is, then we can migrate to Thomas' mdio bindings.

btw - it might be a shared smi, I haven't looked yet, and haven't tested...

thx,

Jason.

#22 lore raw

RFC PATCH 6/6 ARM: kirkwood: consolidate mv643xx_eth init for DT

Quoted 60 lines · On Thursday 24 January 2013 15:38:24 Jason Cooper wrote:
Quoted 12 lines · Florian Fainelli
Quoted 10 lines · On Thursday 24 January 2013 13:16:22 Jason Cooper wrote:
Quoted 7 lines
Quoted 3 lines

Ian's patch appears to do so. I'll respin this series using it vice my lookup table.

Sounds good, while at it, I wonder if we could not simplify Ian's patch to be limited to the actual Ethernet MAC driver and use Thomas's mvdio device tree binding for the MDIO bits of mv643xx_eth. What do you think?

It sounds like you just volunteered ;-) Do you think you have the time to knock it out for v3.9?

Quoted 7 lines

I do not have any kirkwood board at the moment and I really want to be able to test this properly especially with the "clock must be enabled for ethernet not be lost". Let me get one and I should be able to do it. Let's adopt your patch for the moment, and once I have a kirkwood board I can deal with the ethernet driver device tree bindings.

Does that sound ok with you?

using Ian's patch as is, I have the following in kirkwood.dtsi:

(quoted diff) +36 -0
+
+               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>;
+                       status = "disabled";
+               };
+
+               egiga0 {
+                       compatible = "marvell,mv643xx-eth";
+                       reg = <0x72000 0x4000>;
+                       mdio = <&smi0>;
+                       port_number = <0>;
+                       phy_addr = <0x80>;
+                       interrupts = <11>;
+                       clocks = <&gate_clk 0>;
+                       status = "disabled";
+               };
+
+               egiga1 {
+                       compatible = "marvell,mv643xx-eth";
+                       reg = <0x76000 0x4000>;
+                       mdio = <&smi1>;
+                       port_number = <1>;
+                       phy_addr = <0x81>;
+                       interrupts = <15>;
+                       clocks = <&gate_clk 19>;
+                       status = "disabled";
+               };
Quoted 5 lines

I'll see if I can get it working as is, then we can migrate to Thomas' mdio bindings.

btw - it might be a shared smi, I haven't looked yet, and haven't tested...

Ok, the existing mv643xx-eth SMI code also deals with an interrupt-driven SMI completion scheme, which is not handled yet with Thomas's mvmdio driver.

Signature · 1 line
Florian
#23 lore raw

cover ARM: kirkwood: cleanup DT conversion

In reply to Jason Cooper
Quoted 10 lines · Jason Cooper

All,

This is a first cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

I should also mention, this was built against mvebu/for-next (not stable) which is just the merging of all the mvebu/* branches and arm-soc/for-next into one branch.

thx,

Jason.

#24 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

In reply to Jason Cooper

All,

This is a second cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

Changes since V1:
- Included Ian Molton's patch to add DT bindings to mv643xx_eth
- little doc cleanup
- tested on dreamplug
- good: boots fine to bash prompt
- bad: hangs within one minute of booting (even with init=/bin/sh)
- no output, just frozen hard
- will debug more tomorrow

thx,

Jason.

Ian Molton (1):
mv643xx.c: Add basic device tree support.

Jason Cooper (7):
ARM: kirkwood: topkick: init mvsdio via DT
ARM: kirkwood: topkick: convert to pinctrl
ARM: kirkwood: nsa310: cleanup includes and unneeded code
ARM: kirkwood: nsa310: convert to pinctrl
ARM: kirkwood: consolidate DT init of pcie
ARM: mvebu: correct gated clock documentation
ARM: kirkwood: mv643xx_eth dt conversion

 .../bindings/clock/mvebu-gated-clock.txt           |   2 +-
 Documentation/devicetree/bindings/net/mv643xx.txt  |  75 +++++++++++++++
 arch/arm/boot/dts/kirkwood-dnskw.dtsi              |   9 ++
 arch/arm/boot/dts/kirkwood-dockstar.dts            |   8 ++
 arch/arm/boot/dts/kirkwood-dreamplug.dts           |  16 ++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts           |   7 ++
 arch/arm/boot/dts/kirkwood-ib62x0.dts              |   9 ++
 arch/arm/boot/dts/kirkwood-iconnect.dts            |   9 ++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi               |  18 ++++
 arch/arm/boot/dts/kirkwood-mplcec4.dts             |  18 ++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi         |   9 ++
 arch/arm/boot/dts/kirkwood-ns2lite.dts             |   5 +
 arch/arm/boot/dts/kirkwood-ns2mini.dts             |   5 +
 arch/arm/boot/dts/kirkwood-nsa310.dts              |  99 ++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts       |   8 ++
 arch/arm/boot/dts/kirkwood-topkick.dts             | 103 +++++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi                    |  38 ++++++++
 arch/arm/mach-kirkwood/Kconfig                     | 101 --------------------
 arch/arm/mach-kirkwood/Makefile                    |  15 ---
 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                  |  68 +++++---------
 arch/arm/mach-kirkwood/board-goflexnet.c           |  34 -------
 arch/arm/mach-kirkwood/board-ib62x0.c              |  29 ------
 arch/arm/mach-kirkwood/board-iconnect.c            |  32 -------
 arch/arm/mach-kirkwood/board-lsxl.c                |  36 -------
 arch/arm/mach-kirkwood/board-mplcec4.c             |  36 -------
 arch/arm/mach-kirkwood/board-ns2.c                 |  34 -------
 arch/arm/mach-kirkwood/board-nsa310.c              |  58 ------------
 arch/arm/mach-kirkwood/board-openblocks_a6.c       |  26 ------
 arch/arm/mach-kirkwood/board-ts219.c               |  13 ---
 arch/arm/mach-kirkwood/board-usi_topkick.c         |  77 ---------------
 arch/arm/mach-kirkwood/common.h                    |  69 --------------
 drivers/net/ethernet/marvell/mv643xx_eth.c         |  93 +++++++++++++++++--
 35 files changed, 546 insertions(+), 687 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-nsa310.c
 delete mode 100644 arch/arm/mach-kirkwood/board-openblocks_a6.c
 delete mode 100644 arch/arm/mach-kirkwood/board-usi_topkick.c
Signature · 1 line
1.8.1.1
#25 lore raw

RFC PATCH v2 1/8 ARM: kirkwood: topkick: init mvsdio via DT

---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 7 +++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +7 -0
index cd15452..23c2ddc 100644
@@ -54,6 +54,13 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		mvsdio at 90000 {
+			pinctrl-0 = <&pmx_sdio>;
+			pinctrl-names = "default";
+			status = "okay";
+			/* No CD or WP GPIOs */
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -6
index 23d2dd1..95f0711 100644
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
-#include <linux/platform_data/mmc-mvsdio.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -22,10 +21,6 @@ static struct mv643xx_eth_platform_data topkick_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
 };
 
-static struct mvsdio_platform_data topkick_mvsdio_data = {
-	/* unfortunately the CD signal has not been connected */
-};
-
 /*
  * GPIO LED layout
  *
@@ -73,5 +68,4 @@ void __init usi_topkick_init(void)
 
 
 	kirkwood_ge00_init(&topkick_ge00_data);
-	kirkwood_sdio_init(&topkick_mvsdio_data);
 }
Signature · 1 line
1.8.1.1
#26 lore raw

RFC PATCH v2 2/8 ARM: kirkwood: topkick: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 88 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 42 --------------
 2 files changed, 88 insertions(+), 42 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +88 -0
index 23c2ddc..d959873 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 /include/ "kirkwood.dtsi"
+/include/ "kirkwood-6281.dtsi"
 
 / {
 	model = "Univeral Scientific Industrial Co. Topkick-1281P2";
@@ -16,6 +17,93 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			/*
+			 * GPIO LED layout
+			 *
+			 *       /-SYS_LED(2)
+			 *       |
+			 *       |   /-DISK_LED
+			 *       |   |
+			 *       |   |   /-WLAN_LED(2)
+			 *       |   |   |
+			 * [SW] [*] [*] [*]
+			 */
+
+			/*
+			 * Switch positions
+			 *
+			 *     /-SW_LEFT(2)
+			 *     |
+			 *     |   /-SW_IDLE
+			 *     |   |
+			 *     |   |   /-SW_RIGHT
+			 *     |   |   |
+			 * PS [L] [I] [R] LEDS
+			 */
+			pinctrl-0 = < &pmx_led_disk_yellow
+				      &pmx_sata0_pwr_enable
+				      &pmx_led_sys_red
+				      &pmx_led_sys_blue
+				      &pmx_led_wifi_green
+				      &pmx_sw_left
+				      &pmx_sw_right
+				      &pmx_sw_idle
+				      &pmx_sw_left2
+				      &pmx_led_wifi_yellow >;
+			pinctrl-names = "default";
+
+			pmx_led_disk_yellow: pmx-led-disk-yellow {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_sata0_pwr_enable: pmx-sata0-pwr-enable {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_blue: pmx-led-sys-blue {
+				marvell,pins = "mpp38";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_green: pmx-led-wifi-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left: pmx-sw-left {
+				marvell,pins = "mpp43";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_right: pmx-sw-right {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_idle: pmx-sw-idle {
+				marvell,pins = "mpp45";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left2: pmx-sw-left2 {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_yellow: pmx-led-wifi-yellow {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
+
 		serial at 12000 {
 			clock-frequency = <200000000>;
 			status = "ok";
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -42

57 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#27 lore raw

RFC PATCH v2 3/8 ARM: kirkwood: nsa310: cleanup includes and unneeded code

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -8
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
Signature · 1 line
1.8.1.1
#28 lore raw

RFC PATCH v2 3/8 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Hello.

Quoted 10 lines · Jason Cooper
---
  arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
  1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +0 -0
index 1bd328d..0b99533 100644

arch/arm/mach-kirkwood/board-nsa310.c line 14

Quoted 9 lines
arch/arm/mach-kirkwood/board-nsa310.c +1 -4
@@ -10,11 +10,8 @@
 
  #include <linux/kernel.h>
  #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
  #include <mach/kirkwood.h>
+#include <linux/of.h>

You also add an #include and don't mention it anywhere. Or is that part of
the cleanup?

WBR, Sergei

#29 lore raw

RFC PATCH v2 3/8 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Quoted 15 lines · Sergei Shtylyov

Hello.

Quoted 11 lines · Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +0 -0
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
Quoted 11 lines

arch/arm/mach-kirkwood/board-nsa310.c line 14

Quoted 8 lines
arch/arm/mach-kirkwood/board-nsa310.c +1 -4
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>

You also add an #include and don't mention it anywhere. Or is
that part of the cleanup?

After removing the unneeded linux/i2c.h, linux/of.h was needed for of_machine_is_compatible(). i2c.h had included of.h.

thanks for the review,

Jason.

#30 lore raw

RFC PATCH v2 3/8 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Hello.

Quoted 23 lines · Jason Cooper
Quoted 11 lines
Quoted 11 lines
---
  arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
  1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +0 -0
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
Quoted 11 lines

arch/arm/mach-kirkwood/board-nsa310.c line 14

Quoted 8 lines
arch/arm/mach-kirkwood/board-nsa310.c +1 -4
  #include <linux/kernel.h>
  #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
  #include <mach/kirkwood.h>
+#include <linux/of.h>

You also add an #include and don't mention it anywhere. Or is
that part of the cleanup?

Quoted 2 lines

After removing the unneeded linux/i2c.h, linux/of.h was needed for of_machine_is_compatible(). i2c.h had included of.h.

Would be worth mentioning it in the changelog.

Quoted 3 lines

thanks for the review,

Jason.

WBR, Sergei

#31 lore raw

RFC PATCH v2 3/8 ARM: kirkwood: nsa310: cleanup includes and unneeded code

Quoted 27 lines · Sergei Shtylyov

Hello.

Quoted 22 lines · Jason Cooper
Quoted 22 lines
Quoted 10 lines
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +0 -0
index 1bd328d..0b99533 100644

arch/arm/mach-kirkwood/board-nsa310.c line 14

Quoted 9 lines
arch/arm/mach-kirkwood/board-nsa310.c +1 -4
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>

You also add an #include and don't mention it anywhere. Or is
that part of the cleanup?

Quoted 4 lines
Quoted 2 lines

After removing the unneeded linux/i2c.h, linux/of.h was needed for of_machine_is_compatible(). i2c.h had included of.h.

Would be worth mentioning it in the changelog.

Ok, I'll add it when I pull it in.

thx,

Jason.

#32 lore raw

RFC PATCH v2 4/8 ARM: kirkwood: nsa310: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-nsa310.dts | 99 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |  3 --
 arch/arm/mach-kirkwood/board-nsa310.c | 26 ---------
 arch/arm/mach-kirkwood/common.h       |  6 ---
 4 files changed, 99 insertions(+), 35 deletions(-)
arch/arm/boot/dts/kirkwood-nsa310.dts +99 -0
index dbb3551..3a178cf 100644
@@ -16,6 +16,105 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			pinctrl-0 = < &pmx_led_esata_green
+				      &pmx_led_esata_red
+				      &pmx_led_usb_green
+				      &pmx_led_usb_red
+				      &pmx_usb_power_off
+				      &pmx_led_sys_green
+				      &pmx_led_sys_red
+				      &pmx_btn_reset
+				      &pmx_btn_copy
+				      &pmx_led_copy_green
+				      &pmx_led_copy_red
+				      &pmx_led_hdd_green
+				      &pmx_led_hdd_red
+				      &pmx_unknown
+				      &pmx_btn_power
+				      &pmx_pwr_off >;
+			pinctrl-names = "default";
+
+			pmx_led_esata_green: pmx-led-esata-green {
+				marvell,pins = "mpp12";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_esata_red: pmx-led-esata-red {
+				marvell,pins = "mpp13";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_red: pmx-led-usb-red {
+				marvell,pins = "mpp16";
+				marvell,function = "gpio";
+			};
+
+			pmx_usb_power_off: pmx-usb-power-off {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp29";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_reset: pmx-btn-reset {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_copy: pmx-btn-copy {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_green: pmx-led-copy-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_red: pmx-led-copy-red {
+				marvell,pins = "mpp40";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_green: pmx-led-hdd-green {
+				marvell,pins = "mpp41";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_red: pmx-led-hdd-red {
+				marvell,pins = "mpp42";
+				marvell,function = "gpio";
+			};
+
+			pmx_unknown: pmx-unknown {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_power: pmx-btn-power {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_off: pmx-pwr-off {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
 
 		serial at 12000 {
 			clock-frequency = <200000000>;
arch/arm/mach-kirkwood/board-dt.c +0 -3
index 8eac548..8b35157 100644
@@ -141,9 +141,6 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		nsa310_init();
-
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
arch/arm/mach-kirkwood/board-nsa310.c +0 -26
index 0b99533..55ade93 100644
@@ -13,32 +13,6 @@
 #include <mach/kirkwood.h>
 #include <linux/of.h>
 #include "common.h"
-#include "mpp.h"
-
-static unsigned int nsa310_mpp_config[] __initdata = {
-	MPP12_GPIO, /* led esata green */
-	MPP13_GPIO, /* led esata red */
-	MPP15_GPIO, /* led usb green */
-	MPP16_GPIO, /* led usb red */
-	MPP21_GPIO, /* control usb power off */
-	MPP28_GPIO, /* led sys green */
-	MPP29_GPIO, /* led sys red */
-	MPP36_GPIO, /* key reset */
-	MPP37_GPIO, /* key copy */
-	MPP39_GPIO, /* led copy green */
-	MPP40_GPIO, /* led copy red */
-	MPP41_GPIO, /* led hdd green */
-	MPP42_GPIO, /* led hdd red */
-	MPP44_GPIO, /* ?? */
-	MPP46_GPIO, /* key power */
-	MPP48_GPIO, /* control power off */
-	0
-};
-
-void __init nsa310_init(void)
-{
-	kirkwood_mpp_conf(nsa310_mpp_config);
-}
 
 static int __init nsa310_pci_init(void)
 {
arch/arm/mach-kirkwood/common.h +0 -6
index e956d02..1c42cb8 100644
@@ -130,12 +130,6 @@ void ns2_init(void);
 static inline void ns2_init(void) {};
 #endif
 
-#ifdef CONFIG_MACH_NSA310_DT
-void nsa310_init(void);
-#else
-static inline void nsa310_init(void) {};
-#endif
-
 #ifdef CONFIG_MACH_OPENBLOCKS_A6_DT
 void openblocks_a6_init(void);
 #else
Signature · 1 line
1.8.1.1
#33 lore raw

RFC PATCH v2 5/8 ARM: kirkwood: consolidate DT init of pcie

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/Makefile         |  1 -
 arch/arm/mach-kirkwood/board-dt.c       | 23 +++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-iconnect.c |  9 ---------
 arch/arm/mach-kirkwood/board-mplcec4.c  |  1 -
 arch/arm/mach-kirkwood/board-nsa310.c   | 25 -------------------------
 arch/arm/mach-kirkwood/board-ts219.c    | 13 -------------
 6 files changed, 23 insertions(+), 49 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
arch/arm/mach-kirkwood/Makefile +0 -1
index d665309..ee3aa77 100644
@@ -36,6 +36,5 @@ obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NSA310_DT)		+= board-nsa310.o
 obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
 obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dt.c +23 -0
index 8b35157..73b76e4 100644
@@ -70,6 +70,29 @@ static void __init kirkwood_of_clk_init(void)
 	kirkwood_legacy_clk_init();
 }
 
+static const char * const kirkwood_dt_pcie0_compat[] = {
+	"iom,iconnect",
+	"mpl,cec4",
+	"qnap,ts219",
+	"zyxel,nsa310",
+	NULL
+};
+
+static int __init kirkwood_pcie_dt_init(void)
+{
+	int i;
+
+	for (i = 0; kirkwood_dt_pcie0_compat[i] != NULL; i++) {
+		if (of_machine_is_compatible(kirkwood_dt_pcie0_compat[i])) {
+			kirkwood_pcie_init(KW_PCIE0);
+			break;
+		}
+	}
+
+	return 0;
+}
+subsys_initcall(kirkwood_pcie_dt_init);
+
 static void __init kirkwood_dt_init(void)
 {
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
arch/arm/mach-kirkwood/board-iconnect.c +0 -9
index c8ebde4..ff042dc 100644
@@ -10,7 +10,6 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/of.h>
 #include <linux/mv643xx_eth.h>
 #include "common.h"
 
@@ -22,11 +21,3 @@ void __init iconnect_init(void)
 {
 	kirkwood_ge00_init(&iconnect_ge00_data);
 }
-
-static int __init iconnect_pci_init(void)
-{
-	if (of_machine_is_compatible("iom,iconnect"))
-		kirkwood_pcie_init(KW_PCIE0);
-	return 0;
-}
-subsys_initcall(iconnect_pci_init);
arch/arm/mach-kirkwood/board-mplcec4.c +0 -1
index 7d6dc66..938712e 100644
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
 	 */
 	kirkwood_ge00_init(&mplcec4_ge00_data);
 	kirkwood_ge01_init(&mplcec4_ge01_data);
-	kirkwood_pcie_init(KW_PCIE0);
 }
 
 
arch/arm/mach-kirkwood/board-nsa310.c deleted +0 -25
deleted file mode 100644
index 55ade93..0000000
@@ -1,25 +0,0 @@
-/*
- * arch/arm/mach-kirkwood/nsa-310-setup.c
- *
- * ZyXEL NSA-310 Setup
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <mach/kirkwood.h>
-#include <linux/of.h>
-#include "common.h"
-
-static int __init nsa310_pci_init(void)
-{
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-
-subsys_initcall(nsa310_pci_init);
arch/arm/mach-kirkwood/board-ts219.c +0 -13
index 10fb397..f00c0a9 100644
@@ -17,10 +17,7 @@
 
 #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"
 
@@ -38,13 +35,3 @@ void __init qnap_dt_ts219_init(void)
 
 	kirkwood_ge00_init(&qnap_ts219_ge00_data);
 }
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);
Signature · 1 line
1.8.1.1
#34 lore raw

RFC PATCH v2 6/8 ARM: mvebu: correct gated clock documentation

In reply to Jason Cooper
---
 Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt +1 -1
index 7337005..cffc93d 100644
@@ -89,7 +89,7 @@ ID	Clock	Peripheral
 16	xor1	XOR DMA 1
 17	crypto	CESA engine
 18	pex1	PCIe Cntrl 1
-19	ge1	Gigabit Ethernet 0
+19	ge1	Gigabit Ethernet 1
 20	tdm	Time Division Mplx
 
 Required properties:
Signature · 1 line
1.8.1.1
#35 lore raw

RFC PATCH v2 7/8 mv643xx.c: Add basic device tree support.

In reply to Jason Cooper

From: Ian Molton <[email protected]>

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 painless migration.

---
 Documentation/devicetree/bindings/net/mv643xx.txt | 75 ++++++++++++++++++
 drivers/net/ethernet/marvell/mv643xx_eth.c        | 93 +++++++++++++++++++++--
 2 files changed, 161 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
Documentation/devicetree/bindings/net/mv643xx.txt new file +75 -0
new file mode 100644
index 0000000..2727f798
@@ -0,0 +1,75 @@
+mv643xx related nodes.
+
+marvell,mdio-mv643xx:
+
+Required properties:
+
+ - interrupts : <a> where a is the SMI interrupt number.
+ - reg : the base address and size of the controllers register space.
+
+Optional properties:
+ - shared_smi : on some chips, the second PHY is "shared", meaning it is
+	really accessed via the first SMI controller. It is passed in this
+	way due to the present structure of the driver, which requires the
+	base address for the MAC to be passed in via the SMI controllers
+	platform data.
+ - tx_csum_limit : on some devices, this option is required for proper
+	operation wrt. jumbo frames.
+
+
+Example:
+
+smi0: mdio at 72000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x72000 0x4000>;
+	interrupts = <46>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+smi1: mdio at 76000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x76000 0x4000>;
+	interrupts = <47>;
+	shared_smi = <&smi0>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+
+
+marvell,mv643xx-eth:
+
+Required properties:
+ - interrupts : the port interrupt number.
+ - mdio : phandle of the smi device as drescribed above
+
+Optional properties:
+ - port_number : the port number on this bus.
+ - phy_addr : the PHY address.
+ - reg : should match the mdio reg this device is attached to.
+	this is a required hack for now due to the way the
+	driver is constructed. This allows the device clock to be
+	kept running so that the MAC is not lost after boot.
+
+
+Example:
+
+egiga0 {
+	compatible = "marvell,mv643xx-eth";
+	reg = <0x72000 0x4000>;
+	mdio = <&smi0>;
+	port_number = <0>;
+	phy_addr = <0x80>;
+	interrupts = <11>;
+};
+
+egiga1 {
+	compatible = "marvell,mv643xx-eth";
+	reg = <0x76000 0x4000>;
+	mdio = <&smi1>;
+	port_number = <0>;
+	phy_addr = <0x81>;
+	interrupts = <15>;
+};
+
drivers/net/ethernet/marvell/mv643xx_eth.c +86 -7

180 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#36 lore raw

RFC PATCH v2 8/8 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Jason Cooper

Tested on the dreamplug:

mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
libphy: mv643xx_eth smi: probed
libphy: mv643xx_eth smi: probed
mv643xx_eth_port f1072000.egiga0 eth0: port 0 with MAC address XX:XX:XX:XX:XX:XX mv643xx_eth_port f1076000.egiga1 eth1: port 0 with MAC address XX:XX:XX:XX:XX:XX

---
 arch/arm/boot/dts/kirkwood-dnskw.dtsi        |   9 +++
 arch/arm/boot/dts/kirkwood-dockstar.dts      |   8 +++
 arch/arm/boot/dts/kirkwood-dreamplug.dts     |  16 +++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts     |   7 ++
 arch/arm/boot/dts/kirkwood-ib62x0.dts        |   9 +++
 arch/arm/boot/dts/kirkwood-iconnect.dts      |   9 +++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi         |  18 +++++
 arch/arm/boot/dts/kirkwood-mplcec4.dts       |  18 +++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi   |   9 +++
 arch/arm/boot/dts/kirkwood-ns2lite.dts       |   5 ++
 arch/arm/boot/dts/kirkwood-ns2mini.dts       |   5 ++
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts |   8 +++
 arch/arm/boot/dts/kirkwood-topkick.dts       |   8 +++
 arch/arm/boot/dts/kirkwood.dtsi              |  38 ++++++++++
 arch/arm/mach-kirkwood/Kconfig               | 101 ---------------------------
 arch/arm/mach-kirkwood/Makefile              |  14 ----
 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            |  42 -----------
 arch/arm/mach-kirkwood/board-goflexnet.c     |  34 ---------
 arch/arm/mach-kirkwood/board-ib62x0.c        |  29 --------
 arch/arm/mach-kirkwood/board-iconnect.c      |  23 ------
 arch/arm/mach-kirkwood/board-lsxl.c          |  36 ----------
 arch/arm/mach-kirkwood/board-mplcec4.c       |  35 ----------
 arch/arm/mach-kirkwood/board-ns2.c           |  34 ---------
 arch/arm/mach-kirkwood/board-openblocks_a6.c |  26 -------
 arch/arm/mach-kirkwood/board-usi_topkick.c   |  29 --------
 arch/arm/mach-kirkwood/common.h              |  63 -----------------
 29 files changed, 167 insertions(+), 540 deletions(-)
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-usi_topkick.c
arch/arm/boot/dts/kirkwood-dnskw.dtsi +9 -0
index 6875ac0..9e2132a 100644
@@ -186,6 +186,15 @@
 				reg = <0x7b00000 0x500000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	regulators {
arch/arm/boot/dts/kirkwood-dockstar.dts +8 -0
index 2e3dd34..ec09085 100644
@@ -60,6 +60,14 @@
 				reg = <0x0500000 0xfb00000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-dreamplug.dts +16 -0
index ef2d8c7..ae130a5 100644
@@ -81,6 +81,22 @@
 			status = "okay";
 			/* No CD or WP GPIOs */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
+
+		egiga1 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-goflexnet.dts +7 -0
index 1b133e0..98513ee 100644
@@ -106,6 +106,13 @@
 			nr-ports = <2>;
 		};
 
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-ib62x0.dts +9 -0
index 71902da..e77b06d 100644
@@ -79,6 +79,15 @@
 			};
 
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-iconnect.dts +9 -0
index 504f16b..5b89685 100644
@@ -110,6 +110,15 @@
 				reg = <0x980000 0x1f400000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x91>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-lsxl.dtsi +18 -0
index 996c7fe..16199bf 100644
@@ -106,6 +106,24 @@
 				};
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
+
+		egiga1 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-mplcec4.dts +18 -0
index 662dfd8..33130d1 100644
@@ -140,6 +140,24 @@
 			cd-gpios = <&gpio1 15 0>;
 			/* No WP GPIO */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x81>;
+			status = "ok";
+		};
+
+		egiga1 {
+			phy_addr = <0x82>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-ns2-common.dtsi +9 -0
index e8e7ece..0c54321 100644
@@ -54,6 +54,15 @@
 				reg = <0x50>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-ns2lite.dts +5 -0
index b02eb4e..e7cd611 100644
@@ -16,6 +16,11 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-ns2mini.dts +5 -0
index b79f5eb..700d308 100644
@@ -16,6 +16,11 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
 	};
 
 	gpio_fan {
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +8 -0
index ede7fe0d..b179d43 100644
@@ -191,6 +191,14 @@
 				marvell,function = "gpio";
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-topkick.dts +8 -0
index d959873..edefbb5 100644
@@ -149,6 +149,14 @@
 			status = "okay";
 			/* No CD or WP GPIOs */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 2c738d9..b13a405 100644
@@ -201,5 +201,43 @@
 			clocks = <&gate_clk 4>;
 			status = "disabled";
 		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x72000 0x4000>;
+			interrupts = <46>;
+			tx_csum_limit = <1600>;
+			status = "disabled";
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x76000 0x4000>;
+			interrupts = <47>;
+			tx_csum_limit = <1600>;
+			status = "disabled";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx-eth";
+			reg = <0x72000 0x4000>;
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+			clocks = <&gate_clk 0>;
+			status = "disabled";
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx-eth";
+			reg = <0x76000 0x4000>;
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x81>;
+			interrupts = <15>;
+			clocks = <&gate_clk 19>;
+			status = "disabled";
+		};
 	};
 };
arch/arm/mach-kirkwood/Kconfig +0 -101

125 lines not on this page · raw message

arch/arm/mach-kirkwood/Makefile +0 -14
index ee3aa77..ab739b0 100644
@@ -20,21 +20,7 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
-obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
-obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
-obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
-obj-$(CONFIG_MACH_DOCKSTAR_DT)		+= board-dockstar.o
-obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
-obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.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_INETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_MPLCEC4_DT)		+= board-mplcec4.o
-obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
-obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dnskw.c +0 -7
index a1aa87f..2af7a95 100644
@@ -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);
 }
arch/arm/mach-kirkwood/board-dockstar.c deleted +0 -32
deleted file mode 100644
index d7196db..0000000
@@ -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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-dreamplug.c deleted +0 -35
deleted file mode 100644
index 0903242..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-dt.c +0 -42

72 lines not on this page · raw message

arch/arm/mach-kirkwood/board-goflexnet.c deleted +0 -34
deleted file mode 100644
index 9db979a..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-ib62x0.c deleted +0 -29
deleted file mode 100644
index 9a857ae..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Baatz <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-iconnect.c deleted +0 -23
deleted file mode 100644
index ff042dc..0000000
@@ -1,23 +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/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);
-}
arch/arm/mach-kirkwood/board-lsxl.c deleted +0 -36
deleted file mode 100644
index 3483952..0000000
@@ -1,36 +0,0 @@
-/*
- * Copyright 2012 (C), Michael Walle <[email protected]>
- *
- * 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),
-};
-
-void __init lsxl_init(void)
-{
-	/*
-	 * Basic setup. Needs to be called early.
-	 */
-
-	kirkwood_ge00_init(&lsxl_ge00_data);
-	kirkwood_ge01_init(&lsxl_ge01_data);
-}
arch/arm/mach-kirkwood/board-mplcec4.c deleted +0 -35
deleted file mode 100644
index 938712e..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 MPL AG, Switzerland
- * Stefan Peter <[email protected]>
- *
- * 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);
-}
-
-
-
arch/arm/mach-kirkwood/board-ns2.c deleted +0 -34
deleted file mode 100644
index f2ea3b7..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Guinot <[email protected]>
- *
- * 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,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);
-}
arch/arm/mach-kirkwood/board-openblocks_a6.c deleted +0 -26
deleted file mode 100644
index b11d8fd..0000000
@@ -1,26 +0,0 @@
-/*
- * Copyright 2012 Nobuhiro Iwamatsu <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-usi_topkick.c deleted +0 -29
deleted file mode 100644
index 1cc04ec..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/common.h +0 -63

81 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#37 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

In reply to Jason Cooper
Quoted 8 lines · Jason Cooper

This is a second cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

Great work, it's really nice to see where things are going now!

In patch 7, the changeset text seems to be indented wrong, but the patch is still good.

I wonder if it makes sense to collapse the few remaining DT based board files now and move their entire contents back into board-dt.c. Of course, if you think they will all be gone soon anyway, there is no point.

Arnd

#38 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Quoted 12 lines · Arnd Bergmann
Quoted 8 lines · Jason Cooper

This is a second cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

Great work, it's really nice to see where things are going now!

Quoted 7 lines

In patch 7, the changeset text seems to be indented wrong, but the patch is still good.

I wonder if it makes sense to collapse the few remaining DT based board files now and move their entire contents back into board-dt.c. Of course, if you think they will all be gone soon anyway, there is no point.

Once I have the mv643xx_eth binding working reliably, preferably with mvmdio, I'll take a look at removing the last board-*.c files. If the stars align, we'll get it all done for v3.9.

The only big thing left will be pcie.

thx,

Jason.

#39 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Quoted 5 lines · Jason Cooper

Once I have the mv643xx_eth binding working reliably, preferably with mvmdio, I'll take a look at removing the last board-*.c files. If the stars align, we'll get it all done for v3.9.

The only big thing left will be pcie.

Jason,

there is also addr_map that we haven't thought about yet. Is it supposed to be configurable through DT or do we leave it as "linux wants it that way"?

Sebastian

#40 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Quoted 9 lines · Sebastian Hesselbarth
Quoted 5 lines · Jason Cooper

Once I have the mv643xx_eth binding working reliably, preferably with mvmdio, I'll take a look at removing the last board-*.c files. If the stars align, we'll get it all done for v3.9.

The only big thing left will be pcie.

there is also addr_map that we haven't thought about yet. Is it supposed to be configurable through DT or do we leave it as "linux wants it that way"?

FWIW, this was a pain + surprise for us when we started out. The address map Linux wants is not the same as the device power on default, and the Linux mapping is hardwired into the kernel :(

I would be happy to see the address map setup be more flexible and done via DT. It would be a bit of a pain to change, but via DT each decoded window could be described as a bus with a ranges and an OF address map driver could directly setup the windows to match those DT nodes. Something like this, repeated for each window:

        // MBUS Decoder window for NAND
        nand at f4000000 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "simple-bus", "marvell,orion-mbus";
		mbus-target = 0xXXXXX;
                ranges = <0 0xf4000000 0x10000>;

                nand at 0 {
                        cle = <0>;
                        ale = <1>;
                        bank-width = <1>;
                        chip-delay = <50>;
                        compatible = "marvell,orion-nand";
                        reg = <0x0 0x400>;
                };
        };

	// MBUS decoder window for internal registers
        internal at f1000000 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "simple-bus", "marvell,orion-mbus";
		mbus-target = 0xXXXXX;
                ranges = <0 0xf1000000 0x100000>;

                intc: interrupt-controller at 20204 {
                        #interrupt-cells = <1>;
                        compatible = "marvell,orion-intc", "marvell,intc";
                        interrupt-controller;
                        reg = <0x20204 0x04>,
                              <0x20214 0x04>;
                };

[... etc ...]

        };

Regards,
Jason

#41 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Quoted 9 lines · Jason Gunthorpe
        // MBUS Decoder window for NAND
        nand at f4000000 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "simple-bus", "marvell,orion-mbus";
                mbus-target = 0xXXXXX;
                ranges = <0 0xf4000000 0x10000>;

                nand at 0 {
Quoted 9 lines
                        cle = <0>;
                        ale = <1>;
                        bank-width = <1>;
                        chip-delay = <50>;
                        compatible = "marvell,orion-nand";
                        reg = <0x0 0x400>;
                };
        };

Yes, this looks quite reasonable. I would not claim compatibility with "simple-bus" though because it clearly isn't simple.

If we need a driver to set up the mappings, that driver should also instantiate its child devices.

Arnd

#42 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

In reply to Jason Gunthorpe

Hi Jason,

Quoted 30 lines · Jason Gunthorpe
Quoted 9 lines · Sebastian Hesselbarth
Quoted 5 lines · Jason Cooper

Once I have the mv643xx_eth binding working reliably, preferably with mvmdio, I'll take a look at removing the last board-*.c files. If the stars align, we'll get it all done for v3.9.

The only big thing left will be pcie.

there is also addr_map that we haven't thought about yet. Is it supposed to be configurable through DT or do we leave it as "linux wants it that way"?

FWIW, this was a pain + surprise for us when we started out. The address map Linux wants is not the same as the device power on default, and the Linux mapping is hardwired into the kernel :(

I would be happy to see the address map setup be more flexible and done via DT. It would be a bit of a pain to change, but via DT each decoded window could be described as a bus with a ranges and an OF address map driver could directly setup the windows to match those DT nodes. Something like this, repeated for each window:

        // MBUS Decoder window for NAND
        nand at f4000000 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "simple-bus", "marvell,orion-mbus";
		mbus-target = 0xXXXXX;
                ranges = <0 0xf4000000 0x10000>;

                nand at 0 {
Quoted 9 lines
                        cle = <0>;
                        ale = <1>;
                        bank-width = <1>;
                        chip-delay = <50>;
                        compatible = "marvell,orion-nand";
                        reg = <0x0 0x400>;
                };
        };

This is a nice idea.

I have a few questions, though.

1. Are you sure we should use "ranges" property?
In this case it's not an address translation but rather and address window configuration.
If I got this right, in this case child device address space is the same as its parent. So, it's not an actual translation.

I would think we could add a new "windows" property to reflect address window configuration.

2. Also, If we use "ranges" property. How would that work? By reading the property in the addr-map driver or
by somehow improving on of_bus to include this new kind of busses?

Thanks,

Signature · 3 lines
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#43 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Quoted 19 lines
Quoted 9 lines
        // MBUS Decoder window for NAND
        nand at f4000000 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "simple-bus", "marvell,orion-mbus";
		mbus-target = 0xXXXXX;
                ranges = <0 0xf4000000 0x10000>;

                nand at 0 {
Quoted 9 lines
                        cle = <0>;
                        ale = <1>;
                        bank-width = <1>;
                        chip-delay = <50>;
                        compatible = "marvell,orion-nand";
                        reg = <0x0 0x400>;
                };
        };
Quoted 7 lines

This is a nice idea.

I have a few questions, though.

1. Are you sure we should use "ranges" property? In this case it's not an address translation but rather and address window configuration.

Yes, you'd use ranges with an identity transation. The purpose is so that child OF blocks are all relative to the start of the decode region. This way changing the address of the HW block behind the mbus window is simply done by changing the ranges property.

Note the reg on the nand is starting at offset 0, so ranges will translate that to 0xf4000000. Similar for the internal regs.

Quoted 2 lines

I would think we could add a new "windows" property to reflect address window configuration.

My arrangement above would have each "marvell,orion-mbus" specify the mbus-target, which I imagined to be all the HW specific bits (target, attributes, etc). The addr-map driver would select a window for this bus and then assign those bits to it.

Quoted 3 lines

2. Also, If we use "ranges" property. How would that work? By reading the property in the addr-map driver or
by somehow improving on of_bus to include this new kind of busses?

The addr-map driver would have to read it, I believe the rules of how busses work make this fairly simple:

1) very early on the addr-map driver would have to scan the OF tree, find the address of the mbus mapping registers, and the internal register map.
2) Verify the mbus window for the internal registers matches the DT This is just a sanity check, if the correct value doesn't come back then the DT doesnt match what the bootloader setup, and some jtag accessible diagnostic can be printed...
3) Wipe all the mbus windows
4) Register a "marvell,orion-mbus" bus handler somehow
5) When OF processes the DT it would call the bus handler for each "marvell,orion-mbus" which should parse the ranges, allocate a free window, program that window then instantiate the child devices.

Jason

#44 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Dear Jason Gunthorpe,

Quoted 7 lines · Jason Gunthorpe
Quoted 3 lines

2. Also, If we use "ranges" property. How would that work? By reading the property in the addr-map driver or
by somehow improving on of_bus to include this new kind of busses?

The addr-map driver would have to read it, I believe the rules of how busses work make this fairly simple:

Quoted 13 lines

1) very early on the addr-map driver would have to scan the OF tree, find the address of the mbus mapping registers, and the internal register map.
2) Verify the mbus window for the internal registers matches the DT This is just a sanity check, if the correct value doesn't come back then the DT doesnt match what the bootloader setup, and some jtag accessible diagnostic can be printed...
3) Wipe all the mbus windows
4) Register a "marvell,orion-mbus" bus handler somehow
5) When OF processes the DT it would call the bus handler for each "marvell,orion-mbus" which should parse the ranges, allocate a free window, program that window then instantiate the child devices.

I am not totally convinced that we want to describe the address decoding windows in the DT, because it is too static. For example, the number, size and location of address decoding windows for PCIe interfaces vary depending on the PCIe devices connected in those PCIe interfaces. So we clearly do not want to have address decoding windows fixed in stone in the Device Tree, in my opinion.

Instead, I think the "address decoding window driver" in the kernel should provide an API for device drivers to request an address decoding window at a given address, with a given size and target/attribute. This is already what the PCIe code is doing (I'm going to submit v2 of the PCIe code soon), and I think we should to the same for other devices as well.

Best regards,

Thomas

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

v2 cover ARM: kirkwood: cleanup DT conversion

Hi Thomas,

Quoted 8 lines · Thomas Petazzoni

Instead, I think the "address decoding window driver" in the kernel should provide an API for device drivers to request an address decoding window at a given address, with a given size and target/attribute. This is already what the PCIe code is doing (I'm going to submit v2 of the PCIe code soon), and I think we should to the same for other devices as well.

Note that in Jason's proposal, it's possible to instantiate a bus' child device, configure its address window and then call the corresponding driver using a regular of_node.

For instance,

// MBUS Decoder window for NAND

nand at f4000000 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "simple-bus", "marvell,orion-mbus";
        mbus-target = <0x01 0x2f>;
        ranges = <0 0xf4000000 0x10000>;

        nand at 0 {
                // ...
               compatible = "marvell,orion-nand";
               reg = <0x0 0x400>;
        };
};

In this example, we can configure the window using both mbus-target and ranges properties and then use the child node to instantiate an "orion-nand" device.

I understand your point regarding PCIe flexibility needs. So I wonder, in your proposed scheme,
who should call this "address decoding window" driver in order to still be able to instantiate child devices easily?

Thanks,

Signature · 1 line
    Ezequiel
#46 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

Dear Ezequiel Garcia,

Quoted 21 lines · Ezequiel Garcia

Note that in Jason's proposal, it's possible to instantiate a bus' child device, configure its address window and then call the corresponding driver using a regular of_node.

For instance,

// MBUS Decoder window for NAND

nand at f4000000 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "simple-bus", "marvell,orion-mbus";
        mbus-target = <0x01 0x2f>;
        ranges = <0 0xf4000000 0x10000>;

        nand at 0 {
                // ...
               compatible = "marvell,orion-nand";
               reg = <0x0 0x400>;
        };
};
Quoted 8 lines

In this example, we can configure the window using both mbus-target and ranges properties and then use the child node to instantiate an "orion-nand" device.

I understand your point regarding PCIe flexibility needs. So I wonder, in your proposed scheme,
who should call this "address decoding window" driver in order to still be able to instantiate child devices easily?

I am not sure to exactly understand what you mean here. You would have a DT node for the NAND, and another one for the NOR. Each of them use a different compatible string (such as the "marvell,orion-nand" you've mentioned). Those correspond to platform_drivers, like all other devices described in the DT, nothing different. In their ->probe() function, those driver call some mvebu_setup_addr_decoding_window() function, which is part of an API provided by the address mapping driver.

The address at which we configure the various address decoding windows is an operating system specific decision, it is not a description of the hardware. Therefore, it shouldn't be encoded in the DT, because the DT describes the hardware, not the Linux-specific decisions on how the hardware should be used.

Of course, for things like the internal registers decoding windows, we can't really make the DT unaware of that, because it is so fundamental to even having the platform booting. But for all other windows, it is an operating system decision, and not a hardware description.

Best regards,

Thomas

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

v2 cover ARM: kirkwood: cleanup DT conversion

Quoted 4 lines · Thomas Petazzoni

devices described in the DT, nothing different. In their ->probe() function, those driver call some mvebu_setup_addr_decoding_window() function, which is part of an API provided by the address mapping driver.

I think that would be a layering mess to update these possibly shared drivers to conditionally call some mvebu specific function in some case, with some SOC specific set of parameters.. The MBUS driver should take care of that, just like the PCI framework takes care of address allocation.

Quoted 5 lines

The address at which we configure the various address decoding windows is an operating system specific decision, it is not a description of the hardware. Therefore, it shouldn't be encoded in the DT, because the DT describes the hardware, not the Linux-specific decisions on how the hardware should be used.

DT models PCI BARs/Bridge windows as well, which are functionally identical to the MBUS decode windows. There *is* a piece of address decoder hardware, and the DT binding for that kind of hardware is a bus with ranges. So it is completely appropriate to model that in DT.

The OF convention for bridge buses is to put the boot loader assigned address in the DT (under the assumption that the boot loader sets things up properly) so it is reasonable to include those addresses in DT as well..

If, someday, the MBUS driver wants to dynamically allocate every MBUS region, then that is fine, it can ignore/override the addresses from the DT, just like the PCI stuff does for BARs/etc, but for today without dynamic assignment it makes alot of sense to just use the DT values directly.

Jason

#48 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

In reply to Thomas Petazzoni
Quoted 34 lines · Thomas Petazzoni

Dear Ezequiel Garcia,

Quoted 21 lines · Ezequiel Garcia

Note that in Jason's proposal, it's possible to instantiate a bus' child device, configure its address window and then call the corresponding driver using a regular of_node.

For instance,

// MBUS Decoder window for NAND

nand at f4000000 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "simple-bus", "marvell,orion-mbus";
        mbus-target = <0x01 0x2f>;
        ranges = <0 0xf4000000 0x10000>;

        nand at 0 {
                // ...
               compatible = "marvell,orion-nand";
               reg = <0x0 0x400>;
        };
};
Quoted 8 lines

In this example, we can configure the window using both mbus-target and ranges properties and then use the child node to instantiate an "orion-nand" device.

I understand your point regarding PCIe flexibility needs. So I wonder, in your proposed scheme,
who should call this "address decoding window" driver in order to still be able to instantiate child devices easily?

Quoted 9 lines

I am not sure to exactly understand what you mean here. You would have a DT node for the NAND, and another one for the NOR. Each of them use a different compatible string (such as the "marvell,orion-nand" you've mentioned). Those correspond to platform_drivers, like all other devices described in the DT, nothing different. In their ->probe() function, those driver call some mvebu_setup_addr_decoding_window() function, which is part of an API provided by the address mapping driver.

Well, I guess we can call this mvebu_setup_addr_decoding_window() from orion-nand driver, being orion specific.
I assume we will have to add something like the mbus-target property to the orion-nand DT node, right?
(This describes the hardware, since it basically describes how the flash is wired;
so I believe we must put that into the DT).

On the other side, I still don't understand how we will call something like this for the NOR driver, which could probably be cfi-flash.

Quoted 6 lines

The address at which we configure the various address decoding windows is an operating system specific decision, it is not a description of the hardware. Therefore, it shouldn't be encoded in the DT, because the DT describes the hardware, not the Linux-specific decisions on how the hardware should be used.

Good point. I haven't thought it that way.

Signature · 1 line
    Ezequiel
#49 lore raw

v2 cover ARM: kirkwood: cleanup DT conversion

In reply to Thomas Petazzoni
Quoted 13 lines · Thomas Petazzoni
Quoted 13 lines

1) very early on the addr-map driver would have to scan the OF tree, find the address of the mbus mapping registers, and the internal register map.
2) Verify the mbus window for the internal registers matches the DT This is just a sanity check, if the correct value doesn't come back then the DT doesnt match what the bootloader setup, and some jtag accessible diagnostic can be printed...
3) Wipe all the mbus windows
4) Register a "marvell,orion-mbus" bus handler somehow
5) When OF processes the DT it would call the bus handler for each "marvell,orion-mbus" which should parse the ranges, allocate a free window, program that window then instantiate the child devices.

[..]

Quoted 6 lines

Instead, I think the "address decoding window driver" in the kernel should provide an API for device drivers to request an address decoding window at a given address, with a given size and target/attribute. This is already what the PCIe code is doing (I'm going to submit v2 of the PCIe code soon), and I think we should to the same for other devices as well.

Sure, but that isn't exclusive with setting up the bulk of the windows through DT - the tegra PCI-E driver can use a request API for its dynamic windows, while everyone else can be setup by having the DT bus declarations automatically request the proper windows.

All this would do is replace the tables of window configurations in the board files with a DT representation of the same table.

Jason

#50 lore raw

v3 cover ARM: kirkwood: cleanup DT conversion

In reply to Jason Cooper

All,

This is a third cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

Changes since V1:
- Included Ian Molton's patch to add DT bindings to mv643xx_eth
- little doc cleanup
- tested on dreamplug
- good: boots fine to bash prompt
- bad: hangs within one minute of booting (even with init=/bin/sh)
- no output, just frozen hard
- will debug more tomorrow

Changes since V2:
- discovered source of hang. ge0/1 clocks getting gated
- changed alias for clocks
- able to pull ip address and ping though the interface

thx,

Jason.

Ian Molton (1):
mv643xx.c: Add basic device tree support.

Jason Cooper (7):
ARM: kirkwood: topkick: init mvsdio via DT
ARM: kirkwood: topkick: convert to pinctrl
ARM: kirkwood: nsa310: cleanup includes and unneeded code
ARM: kirkwood: nsa310: convert to pinctrl
ARM: kirkwood: consolidate DT init of pcie
ARM: mvebu: correct gated clock documentation
ARM: kirkwood: mv643xx_eth dt conversion

 .../bindings/clock/mvebu-gated-clock.txt           |   2 +-
 Documentation/devicetree/bindings/net/mv643xx.txt  |  75 +++++++++++++++
 arch/arm/boot/dts/kirkwood-dnskw.dtsi              |   9 ++
 arch/arm/boot/dts/kirkwood-dockstar.dts            |   8 ++
 arch/arm/boot/dts/kirkwood-dreamplug.dts           |  16 ++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts           |   7 ++
 arch/arm/boot/dts/kirkwood-ib62x0.dts              |   9 ++
 arch/arm/boot/dts/kirkwood-iconnect.dts            |   9 ++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi               |  18 ++++
 arch/arm/boot/dts/kirkwood-mplcec4.dts             |  18 ++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi         |   9 ++
 arch/arm/boot/dts/kirkwood-ns2lite.dts             |   5 +
 arch/arm/boot/dts/kirkwood-ns2mini.dts             |   5 +
 arch/arm/boot/dts/kirkwood-nsa310.dts              |  99 ++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts       |   8 ++
 arch/arm/boot/dts/kirkwood-topkick.dts             | 103 +++++++++++++++++++++
 arch/arm/boot/dts/kirkwood.dtsi                    |  38 ++++++++
 arch/arm/mach-kirkwood/Kconfig                     | 101 --------------------
 arch/arm/mach-kirkwood/Makefile                    |  15 ---
 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                  |  64 +++++--------
 arch/arm/mach-kirkwood/board-goflexnet.c           |  34 -------
 arch/arm/mach-kirkwood/board-ib62x0.c              |  29 ------
 arch/arm/mach-kirkwood/board-iconnect.c            |  32 -------
 arch/arm/mach-kirkwood/board-lsxl.c                |  36 -------
 arch/arm/mach-kirkwood/board-mplcec4.c             |  36 -------
 arch/arm/mach-kirkwood/board-ns2.c                 |  34 -------
 arch/arm/mach-kirkwood/board-nsa310.c              |  58 ------------
 arch/arm/mach-kirkwood/board-openblocks_a6.c       |  26 ------
 arch/arm/mach-kirkwood/board-ts219.c               |  13 ---
 arch/arm/mach-kirkwood/board-usi_topkick.c         |  77 ---------------
 arch/arm/mach-kirkwood/common.h                    |  69 --------------
 drivers/net/ethernet/marvell/mv643xx_eth.c         |  93 +++++++++++++++++--
 35 files changed, 548 insertions(+), 681 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-nsa310.c
 delete mode 100644 arch/arm/mach-kirkwood/board-openblocks_a6.c
 delete mode 100644 arch/arm/mach-kirkwood/board-usi_topkick.c
Signature · 1 line
1.8.1.1
#51 lore raw

PATCH v3 1/8 ARM: kirkwood: topkick: init mvsdio via DT

---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 7 +++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +7 -0
index cd15452..23c2ddc 100644
@@ -54,6 +54,13 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		mvsdio at 90000 {
+			pinctrl-0 = <&pmx_sdio>;
+			pinctrl-names = "default";
+			status = "okay";
+			/* No CD or WP GPIOs */
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -6
index 23d2dd1..95f0711 100644
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
-#include <linux/platform_data/mmc-mvsdio.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -22,10 +21,6 @@ static struct mv643xx_eth_platform_data topkick_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
 };
 
-static struct mvsdio_platform_data topkick_mvsdio_data = {
-	/* unfortunately the CD signal has not been connected */
-};
-
 /*
  * GPIO LED layout
  *
@@ -73,5 +68,4 @@ void __init usi_topkick_init(void)
 
 
 	kirkwood_ge00_init(&topkick_ge00_data);
-	kirkwood_sdio_init(&topkick_mvsdio_data);
 }
Signature · 1 line
1.8.1.1
#52 lore raw

PATCH v3 1/8 ARM: kirkwood: topkick: init mvsdio via DT

Quoted 56 lines · Jason Cooper
---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 7 +++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +7 -0
index cd15452..23c2ddc 100644
@@ -54,6 +54,13 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		mvsdio at 90000 {
+			pinctrl-0 = <&pmx_sdio>;
+			pinctrl-names = "default";
+			status = "okay";
+			/* No CD or WP GPIOs */
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -6
index 23d2dd1..95f0711 100644
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
-#include <linux/platform_data/mmc-mvsdio.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -22,10 +21,6 @@ static struct mv643xx_eth_platform_data topkick_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
 };
 
-static struct mvsdio_platform_data topkick_mvsdio_data = {
-	/* unfortunately the CD signal has not been connected */
-};
-
 /*
  * GPIO LED layout
  *
@@ -73,5 +68,4 @@ void __init usi_topkick_init(void)
 
 
 	kirkwood_ge00_init(&topkick_ge00_data);
-	kirkwood_sdio_init(&topkick_mvsdio_data);
 }
Signature · 1 line
1.8.1.1

Andrew

#53 lore raw

PATCH v3 2/8 ARM: kirkwood: topkick: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 88 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 42 --------------
 2 files changed, 88 insertions(+), 42 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +88 -0
index 23c2ddc..d959873 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 /include/ "kirkwood.dtsi"
+/include/ "kirkwood-6281.dtsi"
 
 / {
 	model = "Univeral Scientific Industrial Co. Topkick-1281P2";
@@ -16,6 +17,93 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			/*
+			 * GPIO LED layout
+			 *
+			 *       /-SYS_LED(2)
+			 *       |
+			 *       |   /-DISK_LED
+			 *       |   |
+			 *       |   |   /-WLAN_LED(2)
+			 *       |   |   |
+			 * [SW] [*] [*] [*]
+			 */
+
+			/*
+			 * Switch positions
+			 *
+			 *     /-SW_LEFT(2)
+			 *     |
+			 *     |   /-SW_IDLE
+			 *     |   |
+			 *     |   |   /-SW_RIGHT
+			 *     |   |   |
+			 * PS [L] [I] [R] LEDS
+			 */
+			pinctrl-0 = < &pmx_led_disk_yellow
+				      &pmx_sata0_pwr_enable
+				      &pmx_led_sys_red
+				      &pmx_led_sys_blue
+				      &pmx_led_wifi_green
+				      &pmx_sw_left
+				      &pmx_sw_right
+				      &pmx_sw_idle
+				      &pmx_sw_left2
+				      &pmx_led_wifi_yellow >;
+			pinctrl-names = "default";
+
+			pmx_led_disk_yellow: pmx-led-disk-yellow {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_sata0_pwr_enable: pmx-sata0-pwr-enable {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_blue: pmx-led-sys-blue {
+				marvell,pins = "mpp38";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_green: pmx-led-wifi-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left: pmx-sw-left {
+				marvell,pins = "mpp43";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_right: pmx-sw-right {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_idle: pmx-sw-idle {
+				marvell,pins = "mpp45";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left2: pmx-sw-left2 {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_yellow: pmx-led-wifi-yellow {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
+
 		serial at 12000 {
 			clock-frequency = <200000000>;
 			status = "ok";
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -42

57 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#54 lore raw

PATCH 1/2 ARM: Kirkwood: topkick: Fix SoC type and add missing pins

Topkick contains a Marvell 6282, not an 6281 as included in the kirkwood-topkick.dts file.

Also, add pinhogs for the serial port and nand devices.

---
 arch/arm/boot/dts/kirkwood-topkick.dts |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +4 -2
index edefbb5..c8e8a64 100644
@@ -1,7 +1,7 @@
 /dts-v1/;
 
 /include/ "kirkwood.dtsi"
-/include/ "kirkwood-6281.dtsi"
+/include/ "kirkwood-6282.dtsi"
 
 / {
 	model = "Univeral Scientific Industrial Co. Topkick-1281P2";
@@ -50,7 +50,9 @@
 				      &pmx_sw_right
 				      &pmx_sw_idle
 				      &pmx_sw_left2
-				      &pmx_led_wifi_yellow >;
+				      &pmx_led_wifi_yellow
+				      &pmx_uart0
+				      &pmx_nand >;
 			pinctrl-names = "default";
 
 			pmx_led_disk_yellow: pmx-led-disk-yellow {
Signature · 1 line
1.7.10.4
#55 lore raw

PATCH 2/2 ARM: Kirkwood: topkick: Enable i2c bus.

Add a DT node for I2C and pinctrl hog for the pins. There appears to be an i2c bus on topkick with a device on it:

i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

---
 arch/arm/boot/dts/kirkwood-topkick.dts |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/boot/dts/kirkwood-topkick.dts +5 -1
index c8e8a64..75fc1dd 100644
@@ -52,7 +52,8 @@
 				      &pmx_sw_left2
 				      &pmx_led_wifi_yellow
 				      &pmx_uart0
-				      &pmx_nand >;
+				      &pmx_nand
+				      &pmx_twsi0 >;
 			pinctrl-names = "default";
 
 			pmx_led_disk_yellow: pmx-led-disk-yellow {
@@ -159,6 +160,9 @@
 		egiga0 {
 			status = "ok";
 		};
+		i2c at 11000 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
Signature · 1 line
1.7.10.4
#56 lore raw

PATCH 2/2 ARM: Kirkwood: topkick: Enable i2c bus.

Quoted 4 lines · Andrew Lunn

Add a DT node for I2C and pinctrl hog for the pins. There appears to be an i2c bus on topkick with a device on it:

60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --

Andrew,

this could be a Nuvoton NCT3012S ACPI PMIC. It is located right next to Wifi/BT. There is i2c address should be 6c but officially it only supports 100kHz bus frequency. Can you post i2cdetect and i2cdump with 100kHz?

Sebastian

[1] http://www.catagle.com/29-11/NCT3012S.htm

#57 lore raw

PATCH 2/2 ARM: Kirkwood: topkick: Enable i2c bus.

Quoted 4 lines · Sebastian Hesselbarth
Quoted 3 lines · Andrew Lunn

Add a DT node for I2C and pinctrl hog for the pins. There appears to be an i2c bus on topkick with a device on it:

Quoted 8 lines
Quoted 1 line

60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --

Andrew,

this could be a Nuvoton NCT3012S ACPI PMIC. It is located right next to Wifi/BT. There is i2c address should be 6c but officially it only supports 100kHz bus frequency. Can you post i2cdetect and i2cdump with 100kHz?

Hi Sebastian

100KHz is the default in the kirkwood.dtsi file.

Just to be paranoid, i dropped it to 10KHz. No difference, still at address 0x64.

Probing just 0x6c does not help:

# i2cdetect 0 0x6c 0x6c
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x6c-0x6c.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                                                 
10:                                                 
20:                                                 
30:                                                 
40:                                                 
50:                                                 
60:                                     --          
70:                                             

However, there are some issues at other addresses, both at 100KHz and 10KHz:

# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- --i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x71
 -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x2, 1
-- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

Full message is:

[  215.514562] i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x7, status: 0x38, addr: 0x36, flags: 0x1
[  215.545791] i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x2, status: 0x0, addr: 0x37, flags: 0x1

So maybe there is something at 0x36 and 0x37 as well?

# i2cdump 0 0x36
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0, address 0x36, mode byte
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 3d 00 00 87 47 0c 00 08 00 13 00 00 10 00 00 00    =..?G?.?.?..?...
10: ff ff 00 6c 09 02 ff ff ff ff ff ff ff ff ff ff    ...l??..........
20: 88 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ?...............
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
# i2cdump 0 0x37
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0, address 0x37, mode byte
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX

Nothing interesting at 0x64:

# i2cdump 0 0x64
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0, address 0x64, mode byte
Continue? [Y/n] y
     0  1  2  3 i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x2, status: 0x0, addr: 0x64, flags: 0x0
 4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX

Humm. A thought. 6282 has two i2c busses. I had noticed that uboot had configured the pin multiplexer such that they could be used for i2c. But maybe the NCT3012S is on the other i2c bus? Need to go look and see, but that will probably happen tomorrow....

Andrew

#58 lore raw

PATCH 2/2 ARM: Kirkwood: topkick: Enable i2c bus.

Quoted 10 lines · Andrew Lunn
# i2cdump 0 0x36
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0, address 0x36, mode byte
Continue? [Y/n] y
      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 3d 00 00 87 47 0c 00 08 00 13 00 00 10 00 00 00    =..?G?.?.?..?...
10: ff ff 00 6c 09 02 ff ff ff ff ff ff ff ff ff ff    ...l??..........
20: 88 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ?...............
Quoted 6 lines

...

Humm. A thought. 6282 has two i2c busses. I had noticed that uboot had configured the pin multiplexer such that they could be used for i2c. But maybe the NCT3012S is on the other i2c bus? Need to go look and see, but that will probably happen tomorrow....

0x36 (=0x6c >> 1) is the nuvoton pmic. Register values match what is written in that very short datasheet.

Sebastian

#59 lore raw

PATCH 2/2 ARM: Kirkwood: topkick: Enable i2c bus.

In reply to Andrew Lunn
Quoted 18 lines · Andrew Lunn

Add a DT node for I2C and pinctrl hog for the pins. There appears to be an i2c bus on topkick with a device on it:

i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Quoted 4 lines
---
 arch/arm/boot/dts/kirkwood-topkick.dts |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Pulled into series,

thanks,

Jason.

#60 lore raw

PATCH 1/2 ARM: Kirkwood: topkick: Fix SoC type and add missing pins

In reply to Andrew Lunn
Quoted 9 lines · Andrew Lunn

Topkick contains a Marvell 6282, not an 6281 as included in the kirkwood-topkick.dts file.

Also, add pinhogs for the serial port and nand devices.

---
 arch/arm/boot/dts/kirkwood-topkick.dts |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Squashed into pinctrl conversion, thanks and good catch.

thx,

Jason.

#61 lore raw

PATCH v3 3/8 ARM: kirkwood: nsa310: cleanup includes and unneeded code

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -8
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
Signature · 1 line
1.8.1.1
#62 lore raw

PATCH v3 4/8 ARM: kirkwood: nsa310: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-nsa310.dts | 99 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |  3 --
 arch/arm/mach-kirkwood/board-nsa310.c | 26 ---------
 arch/arm/mach-kirkwood/common.h       |  6 ---
 4 files changed, 99 insertions(+), 35 deletions(-)
arch/arm/boot/dts/kirkwood-nsa310.dts +99 -0
index dbb3551..3a178cf 100644
@@ -16,6 +16,105 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			pinctrl-0 = < &pmx_led_esata_green
+				      &pmx_led_esata_red
+				      &pmx_led_usb_green
+				      &pmx_led_usb_red
+				      &pmx_usb_power_off
+				      &pmx_led_sys_green
+				      &pmx_led_sys_red
+				      &pmx_btn_reset
+				      &pmx_btn_copy
+				      &pmx_led_copy_green
+				      &pmx_led_copy_red
+				      &pmx_led_hdd_green
+				      &pmx_led_hdd_red
+				      &pmx_unknown
+				      &pmx_btn_power
+				      &pmx_pwr_off >;
+			pinctrl-names = "default";
+
+			pmx_led_esata_green: pmx-led-esata-green {
+				marvell,pins = "mpp12";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_esata_red: pmx-led-esata-red {
+				marvell,pins = "mpp13";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_red: pmx-led-usb-red {
+				marvell,pins = "mpp16";
+				marvell,function = "gpio";
+			};
+
+			pmx_usb_power_off: pmx-usb-power-off {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp29";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_reset: pmx-btn-reset {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_copy: pmx-btn-copy {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_green: pmx-led-copy-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_red: pmx-led-copy-red {
+				marvell,pins = "mpp40";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_green: pmx-led-hdd-green {
+				marvell,pins = "mpp41";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_red: pmx-led-hdd-red {
+				marvell,pins = "mpp42";
+				marvell,function = "gpio";
+			};
+
+			pmx_unknown: pmx-unknown {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_power: pmx-btn-power {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_off: pmx-pwr-off {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
 
 		serial at 12000 {
 			clock-frequency = <200000000>;
arch/arm/mach-kirkwood/board-dt.c +0 -3
index 8eac548..8b35157 100644
@@ -141,9 +141,6 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		nsa310_init();
-
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
arch/arm/mach-kirkwood/board-nsa310.c +0 -26
index 0b99533..55ade93 100644
@@ -13,32 +13,6 @@
 #include <mach/kirkwood.h>
 #include <linux/of.h>
 #include "common.h"
-#include "mpp.h"
-
-static unsigned int nsa310_mpp_config[] __initdata = {
-	MPP12_GPIO, /* led esata green */
-	MPP13_GPIO, /* led esata red */
-	MPP15_GPIO, /* led usb green */
-	MPP16_GPIO, /* led usb red */
-	MPP21_GPIO, /* control usb power off */
-	MPP28_GPIO, /* led sys green */
-	MPP29_GPIO, /* led sys red */
-	MPP36_GPIO, /* key reset */
-	MPP37_GPIO, /* key copy */
-	MPP39_GPIO, /* led copy green */
-	MPP40_GPIO, /* led copy red */
-	MPP41_GPIO, /* led hdd green */
-	MPP42_GPIO, /* led hdd red */
-	MPP44_GPIO, /* ?? */
-	MPP46_GPIO, /* key power */
-	MPP48_GPIO, /* control power off */
-	0
-};
-
-void __init nsa310_init(void)
-{
-	kirkwood_mpp_conf(nsa310_mpp_config);
-}
 
 static int __init nsa310_pci_init(void)
 {
arch/arm/mach-kirkwood/common.h +0 -6
index e956d02..1c42cb8 100644
@@ -130,12 +130,6 @@ void ns2_init(void);
 static inline void ns2_init(void) {};
 #endif
 
-#ifdef CONFIG_MACH_NSA310_DT
-void nsa310_init(void);
-#else
-static inline void nsa310_init(void) {};
-#endif
-
 #ifdef CONFIG_MACH_OPENBLOCKS_A6_DT
 void openblocks_a6_init(void);
 #else
Signature · 1 line
1.8.1.1
#63 lore raw

PATCH v3 5/8 ARM: kirkwood: consolidate DT init of pcie

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/Makefile         |  1 -
 arch/arm/mach-kirkwood/board-dt.c       | 23 +++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-iconnect.c |  9 ---------
 arch/arm/mach-kirkwood/board-mplcec4.c  |  1 -
 arch/arm/mach-kirkwood/board-nsa310.c   | 25 -------------------------
 arch/arm/mach-kirkwood/board-ts219.c    | 13 -------------
 6 files changed, 23 insertions(+), 49 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
arch/arm/mach-kirkwood/Makefile +0 -1
index d665309..ee3aa77 100644
@@ -36,6 +36,5 @@ obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NSA310_DT)		+= board-nsa310.o
 obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
 obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dt.c +23 -0
index 8b35157..73b76e4 100644
@@ -70,6 +70,29 @@ static void __init kirkwood_of_clk_init(void)
 	kirkwood_legacy_clk_init();
 }
 
+static const char * const kirkwood_dt_pcie0_compat[] = {
+	"iom,iconnect",
+	"mpl,cec4",
+	"qnap,ts219",
+	"zyxel,nsa310",
+	NULL
+};
+
+static int __init kirkwood_pcie_dt_init(void)
+{
+	int i;
+
+	for (i = 0; kirkwood_dt_pcie0_compat[i] != NULL; i++) {
+		if (of_machine_is_compatible(kirkwood_dt_pcie0_compat[i])) {
+			kirkwood_pcie_init(KW_PCIE0);
+			break;
+		}
+	}
+
+	return 0;
+}
+subsys_initcall(kirkwood_pcie_dt_init);
+
 static void __init kirkwood_dt_init(void)
 {
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
arch/arm/mach-kirkwood/board-iconnect.c +0 -9
index c8ebde4..ff042dc 100644
@@ -10,7 +10,6 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/of.h>
 #include <linux/mv643xx_eth.h>
 #include "common.h"
 
@@ -22,11 +21,3 @@ void __init iconnect_init(void)
 {
 	kirkwood_ge00_init(&iconnect_ge00_data);
 }
-
-static int __init iconnect_pci_init(void)
-{
-	if (of_machine_is_compatible("iom,iconnect"))
-		kirkwood_pcie_init(KW_PCIE0);
-	return 0;
-}
-subsys_initcall(iconnect_pci_init);
arch/arm/mach-kirkwood/board-mplcec4.c +0 -1
index 7d6dc66..938712e 100644
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
 	 */
 	kirkwood_ge00_init(&mplcec4_ge00_data);
 	kirkwood_ge01_init(&mplcec4_ge01_data);
-	kirkwood_pcie_init(KW_PCIE0);
 }
 
 
arch/arm/mach-kirkwood/board-nsa310.c deleted +0 -25
deleted file mode 100644
index 55ade93..0000000
@@ -1,25 +0,0 @@
-/*
- * arch/arm/mach-kirkwood/nsa-310-setup.c
- *
- * ZyXEL NSA-310 Setup
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <mach/kirkwood.h>
-#include <linux/of.h>
-#include "common.h"
-
-static int __init nsa310_pci_init(void)
-{
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-
-subsys_initcall(nsa310_pci_init);
arch/arm/mach-kirkwood/board-ts219.c +0 -13
index 10fb397..f00c0a9 100644
@@ -17,10 +17,7 @@
 
 #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"
 
@@ -38,13 +35,3 @@ void __init qnap_dt_ts219_init(void)
 
 	kirkwood_ge00_init(&qnap_ts219_ge00_data);
 }
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);
Signature · 1 line
1.8.1.1
#64 lore raw

PATCH v3 6/8 ARM: mvebu: correct gated clock documentation

In reply to Jason Cooper
---
 Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt +1 -1
index 7337005..cffc93d 100644
@@ -89,7 +89,7 @@ ID	Clock	Peripheral
 16	xor1	XOR DMA 1
 17	crypto	CESA engine
 18	pex1	PCIe Cntrl 1
-19	ge1	Gigabit Ethernet 0
+19	ge1	Gigabit Ethernet 1
 20	tdm	Time Division Mplx
 
 Required properties:
Signature · 1 line
1.8.1.1
#65 lore raw

PATCH v3 7/8 mv643xx.c: Add basic device tree support.

In reply to Jason Cooper

From: Ian Molton <[email protected]>

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 painless migration.

---
 Documentation/devicetree/bindings/net/mv643xx.txt | 75 ++++++++++++++++++
 drivers/net/ethernet/marvell/mv643xx_eth.c        | 93 +++++++++++++++++++++--
 2 files changed, 161 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
Documentation/devicetree/bindings/net/mv643xx.txt new file +75 -0
new file mode 100644
index 0000000..2727f798
@@ -0,0 +1,75 @@
+mv643xx related nodes.
+
+marvell,mdio-mv643xx:
+
+Required properties:
+
+ - interrupts : <a> where a is the SMI interrupt number.
+ - reg : the base address and size of the controllers register space.
+
+Optional properties:
+ - shared_smi : on some chips, the second PHY is "shared", meaning it is
+	really accessed via the first SMI controller. It is passed in this
+	way due to the present structure of the driver, which requires the
+	base address for the MAC to be passed in via the SMI controllers
+	platform data.
+ - tx_csum_limit : on some devices, this option is required for proper
+	operation wrt. jumbo frames.
+
+
+Example:
+
+smi0: mdio at 72000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x72000 0x4000>;
+	interrupts = <46>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+smi1: mdio at 76000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x76000 0x4000>;
+	interrupts = <47>;
+	shared_smi = <&smi0>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+
+
+marvell,mv643xx-eth:
+
+Required properties:
+ - interrupts : the port interrupt number.
+ - mdio : phandle of the smi device as drescribed above
+
+Optional properties:
+ - port_number : the port number on this bus.
+ - phy_addr : the PHY address.
+ - reg : should match the mdio reg this device is attached to.
+	this is a required hack for now due to the way the
+	driver is constructed. This allows the device clock to be
+	kept running so that the MAC is not lost after boot.
+
+
+Example:
+
+egiga0 {
+	compatible = "marvell,mv643xx-eth";
+	reg = <0x72000 0x4000>;
+	mdio = <&smi0>;
+	port_number = <0>;
+	phy_addr = <0x80>;
+	interrupts = <11>;
+};
+
+egiga1 {
+	compatible = "marvell,mv643xx-eth";
+	reg = <0x76000 0x4000>;
+	mdio = <&smi1>;
+	port_number = <0>;
+	phy_addr = <0x81>;
+	interrupts = <15>;
+};
+
drivers/net/ethernet/marvell/mv643xx_eth.c +86 -7

180 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#66 lore raw

PATCH v3 7/8 mv643xx.c: Add basic device tree support.

Hello,

I've taken a quick look at this, and I have a couple of comments on the binding and the way it's parsed.

Quoted 27 lines · Jason Cooper

From: Ian Molton <[email protected]>

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 painless migration.

---
 Documentation/devicetree/bindings/net/mv643xx.txt | 75 ++++++++++++++++++
 drivers/net/ethernet/marvell/mv643xx_eth.c        | 93 +++++++++++++++++++++--
 2 files changed, 161 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
Documentation/devicetree/bindings/net/mv643xx.txt new file +5 -0
new file mode 100644
index 0000000..2727f798
@@ -0,0 +1,75 @@
+mv643xx related nodes.
+
+marvell,mdio-mv643xx:
+
+Required properties:

Documentation/devicetree/bindings/net/mv643xx.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +10 -0
+
+ - interrupts : <a> where a is the SMI interrupt number.
+ - reg : the base address and size of the controllers register space.
+
+Optional properties:
+ - shared_smi : on some chips, the second PHY is "shared", meaning it is
+	really accessed via the first SMI controller. It is passed in this
+	way due to the present structure of the driver, which requires the
+	base address for the MAC to be passed in via the SMI controllers
+	platform data.

The phrase "the present structure of the driver" is not something that's generally good to hear in a binding document. Is shared_smi always going to be required for such configurations, or is there going to be any driver rework that makes it irrelevant?

Documentation/devicetree/bindings/net/mv643xx.txt line 17

Quoted 2 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +2 -0
+ - tx_csum_limit : on some devices, this option is required for proper
+	operation wrt. jumbo frames.

This doesn't explain what this property is. Also "limit" doesn't describe what's limited (e.g. size, rate). How about something like max-tx-checksum-size?

Quoted 26 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +26 -0
+
+
+Example:
+
+smi0: mdio at 72000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x72000 0x4000>;
+	interrupts = <46>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+smi1: mdio at 76000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x76000 0x4000>;
+	interrupts = <47>;
+	shared_smi = <&smi0>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+
+
+marvell,mv643xx-eth:
+
+Required properties:

Documentation/devicetree/bindings/net/mv643xx.txt line 53

Quoted 10 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +10 -0
+ - interrupts : the port interrupt number.
+ - mdio : phandle of the smi device as drescribed above
+
+Optional properties:
+ - port_number : the port number on this bus.
+ - phy_addr : the PHY address.
+ - reg : should match the mdio reg this device is attached to.
+	this is a required hack for now due to the way the
+	driver is constructed. This allows the device clock to be
+	kept running so that the MAC is not lost after boot.

More s/_/-/ candidates.

Is there any reason to have "phy_addr" rather than "phy_address"? We already have #address-cells, which would seem to have set a precedent for naming.

[...]

Quoted 6 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +2 -0
@@ -2610,6 +2613,26 @@ 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;

Documentation/devicetree/bindings/net/mv643xx.txt static int mv643xx_eth_shared_probe(struct platform_device *pdev) · line 2627

Quoted 10 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +10 -0
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			goto out_free;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"tx_csum_limit", &pd->tx_csum_limit);

Is there any upper limit on what this property could be? It would be nice to have a sanity check.

Also, of_property_read_u32 reads a u32, but pd->tx_csum_limit is an int. It would be good to use a u32 temporary.

[...]

Quoted 22 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +16 -1
@@ -2858,7 +2893,36 @@ 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_KERNEL);
+		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);
+
+		if (!of_property_read_u32(pdev->dev.of_node,
+				"phy_addr", &pd->phy_addr))
+			pd->phy_addr = MV643XX_ETH_PHY_ADDR(pd->phy_addr);
 
Quoted 1 line

From a cursory glance at mv643xx_eth.c, it looks like phy_addr needs to be in

the range 0 to 0x1f. It might be worth a sanity check here (even if it just prints a warning).

Quoted 7 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +7 -0
+		else
+			pd->phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT;
+
+		np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
+		if (np) {
+			pd->shared = of_find_device_by_node(np);
+		} else {

Documentation/devicetree/bindings/net/mv643xx.txt

Quoted 10 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +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;

[...]

Thanks,
Mark.

#67 lore raw

PATCH v3 7/8 mv643xx.c: Add basic device tree support.

Quoted 40 lines · Mark Rutland

Hello,

I've taken a quick look at this, and I have a couple of comments on the binding and the way it's parsed.

Quoted 34 lines · Jason Cooper

From: Ian Molton <[email protected]>

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 painless migration.

---
 Documentation/devicetree/bindings/net/mv643xx.txt | 75 ++++++++++++++++++
 drivers/net/ethernet/marvell/mv643xx_eth.c        | 93 +++++++++++++++++++++--
 2 files changed, 161 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
Documentation/devicetree/bindings/net/mv643xx.txt new file +12 -0
new file mode 100644
index 0000000..2727f798
@@ -0,0 +1,75 @@
+mv643xx related nodes.
+
+marvell,mdio-mv643xx:
+
+Required properties:
+
+ - interrupts : <a> where a is the SMI interrupt number.
+ - reg : the base address and size of the controllers register space.
+
+Optional properties:
+ - shared_smi : on some chips, the second PHY is "shared", meaning it is
+	really accessed via the first SMI controller. It is passed in this
Quoted 8 lines

Documentation/devicetree/bindings/net/mv643xx.txt line 15

Quoted 3 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +3 -0
+	way due to the present structure of the driver, which requires the
+	base address for the MAC to be passed in via the SMI controllers
+	platform data.

The phrase "the present structure of the driver" is not something that's generally good to hear in a binding document. Is shared_smi always going to be required for such configurations, or is there going to be any driver rework that makes it irrelevant?

Florian is working on bring mvmdio up to speed, I'll let him comment on this.

Quoted 6 lines

Documentation/devicetree/bindings/net/mv643xx.txt line 17

Quoted 2 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +2 -0
+ - tx_csum_limit : on some devices, this option is required for proper
+	operation wrt. jumbo frames.

This doesn't explain what this property is. Also "limit" doesn't describe what's limited (e.g. size, rate). How about something like max-tx-checksum-size?

sounds better, I'll update for the next version.

Quoted 31 lines
Quoted 31 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +30 -0
+
+
+Example:
+
+smi0: mdio at 72000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x72000 0x4000>;
+	interrupts = <46>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+smi1: mdio at 76000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x76000 0x4000>;
+	interrupts = <47>;
+	shared_smi = <&smi0>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+
+
+marvell,mv643xx-eth:
+
+Required properties:
+ - interrupts : the port interrupt number.
+ - mdio : phandle of the smi device as drescribed above
+
+Optional properties:
Quoted 8 lines

Documentation/devicetree/bindings/net/mv643xx.txt line 53

Quoted 6 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +6 -0
+ - port_number : the port number on this bus.
+ - phy_addr : the PHY address.
+ - reg : should match the mdio reg this device is attached to.
+	this is a required hack for now due to the way the
+	driver is constructed. This allows the device clock to be
+	kept running so that the MAC is not lost after boot.

More s/_/-/ candidates.

ok.

Quoted 2 lines

Is there any reason to have "phy_addr" rather than "phy_address"? We already have #address-cells, which would seem to have set a precedent for naming.

Well, we also have "reg", which would seem to indicate the opposite. And, following your logic, we should really say "physical_address" :-P . I personally feel "phy_addr" is well understood, but I don't have a strong opinion on it.

Quoted 23 lines

[...]

Quoted 6 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +2 -0
@@ -2610,6 +2613,26 @@ 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;

Documentation/devicetree/bindings/net/mv643xx.txt static int mv643xx_eth_shared_probe(struct platform_device *pdev) · line 2627

Quoted 10 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +10 -0
+
+		/* when all users of this driver use FDT, we can remove this */
+		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+		if (!pd) {
+			dev_dbg(&pdev->dev, "Could not allocate platform data\n");
+			goto out_free;
+		}
+
+		of_property_read_u32(pdev->dev.of_node,
+			"tx_csum_limit", &pd->tx_csum_limit);

Is there any upper limit on what this property could be? It would be nice to have a sanity check.

Quoted 2 lines

Also, of_property_read_u32 reads a u32, but pd->tx_csum_limit is an int. It would be good to use a u32 temporary.

Good catch, I'll update for both.

Quoted 20 lines

[...]

Quoted 17 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +12 -1
@@ -2858,7 +2893,36 @@ 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_KERNEL);
+		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);
Quoted 8 lines

Documentation/devicetree/bindings/net/mv643xx.txt static int mv643xx_eth_probe(struct platform_device *pdev) · line 2911

Quoted 4 lines
Documentation/devicetree/bindings/net/mv643xx.txt new file +4 -0
+
+		if (!of_property_read_u32(pdev->dev.of_node,
+				"phy_addr", &pd->phy_addr))
+			pd->phy_addr = MV643XX_ETH_PHY_ADDR(pd->phy_addr);

From a cursory glance at mv643xx_eth.c, it looks like phy_addr needs to be in the range 0 to 0x1f. It might be worth a sanity check here (even if it just prints a warning).

right, this had been commented elsewhere. phy_addr is XORd with 0x80, so I'll correct my subsequent patch adding the DT entries and add the warning here.

Thanks for the review,

Jason.

#68 lore raw

PATCH v3 7/8 mv643xx.c: Add basic device tree support.

On 28/01/13 19:38, Jason Cooper wrote:

Good to see this patch get some TLC guys - have at it :)

-Ian

#69 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Jason Cooper

Tested on the dreamplug:

mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
libphy: mv643xx_eth smi: probed
libphy: mv643xx_eth smi: probed
mv643xx_eth_port f1072000.egiga0 eth0: port 0 with MAC address XX:XX:XX... mv643xx_eth_port f1076000.egiga1 eth1: port 0 with MAC address XX:XX:XX...

Successfully pulled an ip address and pinged through the interface

---
 arch/arm/boot/dts/kirkwood-dnskw.dtsi        |   9 +++
 arch/arm/boot/dts/kirkwood-dockstar.dts      |   8 +++
 arch/arm/boot/dts/kirkwood-dreamplug.dts     |  16 +++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts     |   7 ++
 arch/arm/boot/dts/kirkwood-ib62x0.dts        |   9 +++
 arch/arm/boot/dts/kirkwood-iconnect.dts      |   9 +++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi         |  18 +++++
 arch/arm/boot/dts/kirkwood-mplcec4.dts       |  18 +++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi   |   9 +++
 arch/arm/boot/dts/kirkwood-ns2lite.dts       |   5 ++
 arch/arm/boot/dts/kirkwood-ns2mini.dts       |   5 ++
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts |   8 +++
 arch/arm/boot/dts/kirkwood-topkick.dts       |   8 +++
 arch/arm/boot/dts/kirkwood.dtsi              |  38 ++++++++++
 arch/arm/mach-kirkwood/Kconfig               | 101 ---------------------------
 arch/arm/mach-kirkwood/Makefile              |  14 ----
 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            |  38 +---------
 arch/arm/mach-kirkwood/board-goflexnet.c     |  34 ---------
 arch/arm/mach-kirkwood/board-ib62x0.c        |  29 --------
 arch/arm/mach-kirkwood/board-iconnect.c      |  23 ------
 arch/arm/mach-kirkwood/board-lsxl.c          |  36 ----------
 arch/arm/mach-kirkwood/board-mplcec4.c       |  35 ----------
 arch/arm/mach-kirkwood/board-ns2.c           |  34 ---------
 arch/arm/mach-kirkwood/board-openblocks_a6.c |  26 -------
 arch/arm/mach-kirkwood/board-usi_topkick.c   |  29 --------
 arch/arm/mach-kirkwood/common.h              |  63 -----------------
 29 files changed, 169 insertions(+), 534 deletions(-)
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-usi_topkick.c
arch/arm/boot/dts/kirkwood-dnskw.dtsi +9 -0
index 6875ac0..9e2132a 100644
@@ -186,6 +186,15 @@
 				reg = <0x7b00000 0x500000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	regulators {
arch/arm/boot/dts/kirkwood-dockstar.dts +8 -0
index 2e3dd34..ec09085 100644
@@ -60,6 +60,14 @@
 				reg = <0x0500000 0xfb00000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-dreamplug.dts +16 -0
index ef2d8c7..ae130a5 100644
@@ -81,6 +81,22 @@
 			status = "okay";
 			/* No CD or WP GPIOs */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
+
+		egiga1 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-goflexnet.dts +7 -0
index 1b133e0..98513ee 100644
@@ -106,6 +106,13 @@
 			nr-ports = <2>;
 		};
 
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-ib62x0.dts +9 -0
index 71902da..e77b06d 100644
@@ -79,6 +79,15 @@
 			};
 
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-iconnect.dts +9 -0
index 504f16b..5b89685 100644
@@ -110,6 +110,15 @@
 				reg = <0x980000 0x1f400000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x91>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-lsxl.dtsi +18 -0
index 996c7fe..16199bf 100644
@@ -106,6 +106,24 @@
 				};
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
+
+		egiga1 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-mplcec4.dts +18 -0
index 662dfd8..33130d1 100644
@@ -140,6 +140,24 @@
 			cd-gpios = <&gpio1 15 0>;
 			/* No WP GPIO */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x81>;
+			status = "ok";
+		};
+
+		egiga1 {
+			phy_addr = <0x82>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-ns2-common.dtsi +9 -0
index e8e7ece..0c54321 100644
@@ -54,6 +54,15 @@
 				reg = <0x50>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-ns2lite.dts +5 -0
index b02eb4e..e7cd611 100644
@@ -16,6 +16,11 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-ns2mini.dts +5 -0
index b79f5eb..700d308 100644
@@ -16,6 +16,11 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
 	};
 
 	gpio_fan {
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +8 -0
index ede7fe0d..b179d43 100644
@@ -191,6 +191,14 @@
 				marvell,function = "gpio";
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-topkick.dts +8 -0
index d959873..edefbb5 100644
@@ -149,6 +149,14 @@
 			status = "okay";
 			/* No CD or WP GPIOs */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 2c738d9..b13a405 100644
@@ -201,5 +201,43 @@
 			clocks = <&gate_clk 4>;
 			status = "disabled";
 		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x72000 0x4000>;
+			interrupts = <46>;
+			tx_csum_limit = <1600>;
+			status = "disabled";
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x76000 0x4000>;
+			interrupts = <47>;
+			tx_csum_limit = <1600>;
+			status = "disabled";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx-eth";
+			reg = <0x72000 0x4000>;
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+			clocks = <&gate_clk 0>;
+			status = "disabled";
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx-eth";
+			reg = <0x76000 0x4000>;
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x81>;
+			interrupts = <15>;
+			clocks = <&gate_clk 19>;
+			status = "disabled";
+		};
 	};
 };
arch/arm/mach-kirkwood/Kconfig +0 -101

125 lines not on this page · raw message

arch/arm/mach-kirkwood/Makefile +0 -14
index ee3aa77..ab739b0 100644
@@ -20,21 +20,7 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
-obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
-obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
-obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
-obj-$(CONFIG_MACH_DOCKSTAR_DT)		+= board-dockstar.o
-obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
-obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.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_INETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_MPLCEC4_DT)		+= board-mplcec4.o
-obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
-obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dnskw.c +0 -7
index a1aa87f..2af7a95 100644
@@ -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);
 }
arch/arm/mach-kirkwood/board-dockstar.c deleted +0 -32
deleted file mode 100644
index d7196db..0000000
@@ -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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-dreamplug.c deleted +0 -35
deleted file mode 100644
index 0903242..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-dt.c +2 -36
index 73b76e4..7ab92e5 100644
@@ -48,7 +48,7 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.args_count = 1;
 
 	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.0",
+	orion_clkdev_add(NULL, "f1072000.egiga0",
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_PEX0;
@@ -60,7 +60,7 @@ static void __init kirkwood_legacy_clk_init(void)
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.1",
+	orion_clkdev_add(NULL, "f1076000.egiga1",
 			 of_clk_get_from_provider(&clkspec));
 }
 
@@ -118,52 +118,18 @@ 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("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,inetspace_v2") ||
-	    of_machine_is_compatible("lacie,netspace_v2") ||
-	    of_machine_is_compatible("lacie,netspace_max_v2") ||
-	    of_machine_is_compatible("lacie,netspace_lite_v2") ||
-	    of_machine_is_compatible("lacie,netspace_mini_v2"))
-		ns2_init();
-
-	if (of_machine_is_compatible("mpl,cec4"))
-		mplcec4_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);
 }
 
arch/arm/mach-kirkwood/board-goflexnet.c deleted +0 -34
deleted file mode 100644
index 9db979a..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-ib62x0.c deleted +0 -29
deleted file mode 100644
index 9a857ae..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Baatz <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-iconnect.c deleted +0 -23
deleted file mode 100644
index ff042dc..0000000
@@ -1,23 +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/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);
-}
arch/arm/mach-kirkwood/board-lsxl.c deleted +0 -36
deleted file mode 100644
index 3483952..0000000
@@ -1,36 +0,0 @@
-/*
- * Copyright 2012 (C), Michael Walle <[email protected]>
- *
- * 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),
-};
-
-void __init lsxl_init(void)
-{
-	/*
-	 * Basic setup. Needs to be called early.
-	 */
-
-	kirkwood_ge00_init(&lsxl_ge00_data);
-	kirkwood_ge01_init(&lsxl_ge01_data);
-}
arch/arm/mach-kirkwood/board-mplcec4.c deleted +0 -35
deleted file mode 100644
index 938712e..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 MPL AG, Switzerland
- * Stefan Peter <[email protected]>
- *
- * 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);
-}
-
-
-
arch/arm/mach-kirkwood/board-ns2.c deleted +0 -34
deleted file mode 100644
index f2ea3b7..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Guinot <[email protected]>
- *
- * 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,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);
-}
arch/arm/mach-kirkwood/board-openblocks_a6.c deleted +0 -26
deleted file mode 100644
index b11d8fd..0000000
@@ -1,26 +0,0 @@
-/*
- * Copyright 2012 Nobuhiro Iwamatsu <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-usi_topkick.c deleted +0 -29
deleted file mode 100644
index 1cc04ec..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/common.h +0 -63

81 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#70 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 14 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
index 73b76e4..7ab92e5 100644
@@ -48,7 +48,7 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.args_count = 1;
 
 	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.0",
+	orion_clkdev_add(NULL, "f1072000.egiga0",
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_PEX0;

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

Quoted 8 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
@@ -60,7 +60,7 @@ static void __init kirkwood_legacy_clk_init(void)
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.1",
+	orion_clkdev_add(NULL, "f1076000.egiga1",
 			 of_clk_get_from_provider(&clkspec));
 }
 

Hi Jason

These changes break any platform not yet converted, eg my QNAP box now locks up solid.

Something is not right here, or i'm not understanding something. DT devices should not need code like this, only devices not yet using DT....

Andrew

#71 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 25 lines · Andrew Lunn
Quoted 14 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
index 73b76e4..7ab92e5 100644
@@ -48,7 +48,7 @@ static void __init kirkwood_legacy_clk_init(void)
  	clkspec.args_count = 1;
 
  	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.0",
+	orion_clkdev_add(NULL, "f1072000.egiga0",
  			 of_clk_get_from_provider(&clkspec));
 
  	clkspec.args[0] = CGC_BIT_PEX0;

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

Quoted 8 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
@@ -60,7 +60,7 @@ static void __init kirkwood_legacy_clk_init(void)
  			 of_clk_get_from_provider(&clkspec));
 
  	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.1",
+	orion_clkdev_add(NULL, "f1076000.egiga1",
  			 of_clk_get_from_provider(&clkspec));
  }
 

These changes break any platform not yet converted, eg my QNAP box now locks up solid.

Quoted 3 lines

Something is not right here, or i'm not understanding something. DT devices should not need code like this, only devices not yet using DT....

Jason, Andrew,

have a look at dove_legacy_clk_init() in arch/arm/mach-dove/common.c. This is how I handled non-DT clock aliases from DT provided clocks. Maybe you can also use it for kirkwood.

Sebastian

#72 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 30 lines · Sebastian Hesselbarth
Quoted 25 lines · Andrew Lunn
Quoted 14 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
index 73b76e4..7ab92e5 100644
@@ -48,7 +48,7 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.args_count = 1;
 
 	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.0",
+	orion_clkdev_add(NULL, "f1072000.egiga0",
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_PEX0;

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

Quoted 8 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
@@ -60,7 +60,7 @@ static void __init kirkwood_legacy_clk_init(void)
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.1",
+	orion_clkdev_add(NULL, "f1076000.egiga1",
 			 of_clk_get_from_provider(&clkspec));
 }
 

These changes break any platform not yet converted, eg my QNAP box now locks up solid.

Quoted 3 lines

Something is not right here, or i'm not understanding something. DT devices should not need code like this, only devices not yet using DT....

Quoted 5 lines

Jason, Andrew,

have a look at dove_legacy_clk_init() in arch/arm/mach-dove/common.c. This is how I handled non-DT clock aliases from DT provided clocks. Maybe you can also use it for kirkwood.

Hi Sebastian

The code here is based on dove_legacy_clk_init(). However the change made by Jason is in order to make a DT device work, not an non-DT device.

The problem is the way the driver is getting the clock.

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

clk_get() then calls

                clk = of_clk_get_by_name(dev->of_node, con_id);

* of_clk_get_by_name() - Parse and lookup a clock referenced by a device node
* @np: pointer to clock consumer node
* @name: name of consumer's clock input, or NULL for the first clock reference

So it is looking for a clock called "0" or "1" in the node. This does not exist, and so it falls. Jason's change then comes into affect and it finds the clkdev entries added above.

I will change the driver to use of_clk_get() when passed an np.

Andrew

#73 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 8 lines · Andrew Lunn
Quoted 3 lines · Sebastian Hesselbarth

have a look at dove_legacy_clk_init() in arch/arm/mach-dove/common.c. This is how I handled non-DT clock aliases from DT provided clocks. Maybe you can also use it for kirkwood.

The code here is based on dove_legacy_clk_init(). However the change made by Jason is in order to make a DT device work, not an non-DT device.

Yeah, I know. The second after I sent that email, I knew it was just totally wrong. Sorry for that.

Quoted 12 lines

The problem is the way the driver is getting the clock.

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

clk_get() then calls

                 clk = of_clk_get_by_name(dev->of_node, con_id);

* of_clk_get_by_name() - Parse and lookup a clock referenced by a device node
* @np: pointer to clock consumer node
* @name: name of consumer's clock input, or NULL for the first clock reference

Quoted 5 lines

So it is looking for a clock called "0" or "1" in the node. This does not exist, and so it falls. Jason's change then comes into affect and it finds the clkdev entries added above.

I will change the driver to use of_clk_get() when passed an np.

This is way better.

Sebastian

#74 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Andrew Lunn
Quoted 51 lines · Andrew Lunn
Quoted 30 lines · Sebastian Hesselbarth
Quoted 25 lines · Andrew Lunn
Quoted 14 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
index 73b76e4..7ab92e5 100644
@@ -48,7 +48,7 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.args_count = 1;
 
 	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.0",
+	orion_clkdev_add(NULL, "f1072000.egiga0",
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_PEX0;

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

Quoted 8 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
@@ -60,7 +60,7 @@ static void __init kirkwood_legacy_clk_init(void)
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.1",
+	orion_clkdev_add(NULL, "f1076000.egiga1",
 			 of_clk_get_from_provider(&clkspec));
 }
 

These changes break any platform not yet converted, eg my QNAP box now locks up solid.

Quoted 3 lines

Something is not right here, or i'm not understanding something. DT devices should not need code like this, only devices not yet using DT....

Quoted 5 lines

Jason, Andrew,

have a look at dove_legacy_clk_init() in arch/arm/mach-dove/common.c. This is how I handled non-DT clock aliases from DT provided clocks. Maybe you can also use it for kirkwood.

Hi Sebastian

The code here is based on dove_legacy_clk_init(). However the change made by Jason is in order to make a DT device work, not an non-DT device.

The problem is the way the driver is getting the clock.

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

clk_get() then calls

                clk = of_clk_get_by_name(dev->of_node, con_id);
Quoted 7 lines

* of_clk_get_by_name() - Parse and lookup a clock referenced by a device node
* @np: pointer to clock consumer node
* @name: name of consumer's clock input, or NULL for the first clock reference

So it is looking for a clock called "0" or "1" in the node. This does not exist, and so it falls. Jason's change then comes into affect and it finds the clkdev entries added above.

Exactly.

Quoted 1 line

I will change the driver to use of_clk_get() when passed an np.

something like this? (on top of this series):

btw - I just booted this and it is working...

$ cat ge0/clk_prepare_count
1
$ cat ge1/clk_prepare_count
1
$ 

--8<-------

arch/arm/mach-kirkwood/board-dt.c +0 -8
index 7ab92e5..620c99f 100644
@@ -47,10 +47,6 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.np = np;
 	clkspec.args_count = 1;
 
-	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "f1072000.egiga0",
-			 of_clk_get_from_provider(&clkspec));
-
 	clkspec.args[0] = CGC_BIT_PEX0;
 	orion_clkdev_add("0", "pcie",
 			 of_clk_get_from_provider(&clkspec));
@@ -58,10 +54,6 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.args[0] = CGC_BIT_PEX1;
 	orion_clkdev_add("1", "pcie",
 			 of_clk_get_from_provider(&clkspec));
-
-	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "f1076000.egiga1",
-			 of_clk_get_from_provider(&clkspec));
 }
 
 static void __init kirkwood_of_clk_init(void)
drivers/net/ethernet/marvell/mv643xx_eth.c +7 -0
index 7048d7c..8fb92d4 100644
@@ -2895,6 +2895,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 
 	if (pdev->dev.of_node) {
 		struct device_node *np = NULL;
+		struct clk *clk = NULL;
 
 		/* when all users of this driver use FDT, we can remove this */
 		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
@@ -2912,6 +2913,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 		else
 			pd->phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT;
 
+		clk = of_clk_get(pdev->dev.of_node, 0);
+		if (!IS_ERR(clk)) {
+			clk_prepare_enable(clk);
+			clk_put(clk);
+		}
+
 		np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
 		if (np) {
 			pd->shared = of_find_device_by_node(np);
#75 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Andrew Lunn
Quoted 13 lines · Andrew Lunn

On Sat, Jan 26, 2013 at 01:50:11PM +0100, Sebastian Hesselbarth wrote:
The code here is based on dove_legacy_clk_init(). However the change made by Jason is in order to make a DT device work, not an non-DT device.

The problem is the way the driver is getting the clock.

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

clk_get() then calls

                clk = of_clk_get_by_name(dev->of_node, con_id);
Quoted 7 lines

* of_clk_get_by_name() - Parse and lookup a clock referenced by a device node
* @np: pointer to clock consumer node
* @name: name of consumer's clock input, or NULL for the first clock reference

So it is looking for a clock called "0" or "1" in the node. This does not exist, and so it falls. Jason's change then comes into affect and it finds the clkdev entries added above.

This is just bollocks. Sorry, but it is. Yet again, people misunderstand the clk API...

Look, the clk API is very simple, as it also is when using clkdev or OF. Stop naming your bloody clocks individually - whenever anyone does that it all breaks.

The API is designed to work as follows:

FIRST argument to clk_get() is the struct device. This _SHOULD_ be used to determine the clock or set of clocks which the device is going to use. In other words, it is the PRIMARY key in the lookup.

SECOND argument to clk_get() identifies the CONNECTION ON THE DEVICE passed as the first argument. To make this point, if the device only ever has one clock connection, convention is to pass NULL to ensure that people do _not_ think that they can use global clock names.

So, the whole:

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

is absolutely ludicrous. You already know which device it is by means of the first argument. You don't need to pass a "0" or a "1". So that should be NULL, so:

	mp->clk = clk_get(&pdev->dev, NULL);

That will get a clock from clkdev which is setup in the _matching_ tables to correlate with the device (and a NULL connection ID _there_ too). With OF, I believe it will get the first clock.

#76 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 19 lines · Russell King - ARM Linux
Quoted 9 lines · Andrew Lunn

On Sat, Jan 26, 2013 at 01:50:11PM +0100, Sebastian Hesselbarth wrote:
The code here is based on dove_legacy_clk_init(). However the change made by Jason is in order to make a DT device work, not an non-DT device.

The problem is the way the driver is getting the clock.

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

...
So, the whole:

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

is absolutely ludicrous. You already know which device it is by means of the first argument. You don't need to pass a "0" or a "1". So that should be NULL, so:

Quoted 5 lines
	mp->clk = clk_get(&pdev->dev, NULL);

That will get a clock from clkdev which is setup in the _matching_ tables to correlate with the device (and a NULL connection ID _there_ too). With OF, I believe it will get the first clock.

The conid was set for mv643xx but shouldn't be set anymore - check mach-kirkwood/common.c. From what I can tell, powerpc isn't using common clock at all and orion5x/mv78x00 don't have any clock gates.

I guess we can just remove the conid check and rely on DT passed clock only.

Sebastian

#77 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 20 lines · Sebastian Hesselbarth
Quoted 19 lines · Russell King - ARM Linux
Quoted 9 lines · Andrew Lunn

On Sat, Jan 26, 2013 at 01:50:11PM +0100, Sebastian Hesselbarth wrote:
The code here is based on dove_legacy_clk_init(). However the change made by Jason is in order to make a DT device work, not an non-DT device.

The problem is the way the driver is getting the clock.

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

...
So, the whole:

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

is absolutely ludicrous. You already know which device it is by means of the first argument. You don't need to pass a "0" or a "1". So that should be NULL, so:

Quoted 8 lines
Quoted 5 lines
	mp->clk = clk_get(&pdev->dev, NULL);

That will get a clock from clkdev which is setup in the _matching_ tables to correlate with the device (and a NULL connection ID _there_ too). With OF, I believe it will get the first clock.

The conid was set for mv643xx but shouldn't be set anymore - check mach-kirkwood/common.c.

If you're referring to:

	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));

That should _never_ have ever been allowed. It's total bollocks as I've pointed out above.

Quoted 2 lines

I guess we can just remove the conid check and rely on DT passed clock only.

Yes, and it _will_ work fine for non-DT too, because you have a device with a single clock connection. If it doesn't, then you've revealed a latent bug - probably down to a non-conforming clk API implementation by someone else.

#78 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Andrew Lunn
Quoted 25 lines · Andrew Lunn
Quoted 14 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
index 73b76e4..7ab92e5 100644
@@ -48,7 +48,7 @@ static void __init kirkwood_legacy_clk_init(void)
 	clkspec.args_count = 1;
 
 	clkspec.args[0] = CGC_BIT_GE0;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.0",
+	orion_clkdev_add(NULL, "f1072000.egiga0",
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_PEX0;

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

Quoted 8 lines
arch/arm/mach-kirkwood/board-dt.c +1 -1
@@ -60,7 +60,7 @@ static void __init kirkwood_legacy_clk_init(void)
 			 of_clk_get_from_provider(&clkspec));
 
 	clkspec.args[0] = CGC_BIT_GE1;
-	orion_clkdev_add(NULL, "mv643xx_eth_port.1",
+	orion_clkdev_add(NULL, "f1076000.egiga1",
 			 of_clk_get_from_provider(&clkspec));
 }
 

Hi Jason

Quoted 6 lines

These changes break any platform not yet converted, eg my QNAP box now locks up solid.

Something is not right here, or i'm not understanding something. DT devices should not need code like this, only devices not yet using DT....

Yes, hence my frustration yesterday. I posted this so everyone could see exactly what I was working with, and perhaps spot something I had missed. Looks like you did in your followup to Sebastian.

thx,

Jason.

#79 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 7 lines
Quoted 3 lines

Something is not right here, or i'm not understanding something. DT devices should not need code like this, only devices not yet using DT....

Yes, hence my frustration yesterday. I posted this so everyone could see exactly what I was working with, and perhaps spot something I had missed. Looks like you did in your followup to Sebastian.

Hi Jason

I have it fixed now. I just sent some patches, which you can insert or squash as appropriate.

Andrew

#80 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Jason Cooper

arch/arm/mach-kirkwood/Kconfig config MACH_TS219_DT · line 126

Quoted 8 lines
arch/arm/mach-kirkwood/Kconfig +0 -8
-config MACH_LSXL_DT
-	bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	select POWER_RESET_RESTART
-	help
-	  Say 'Y' here if you want your kernel to support the
-	  Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
-	  Flattened Device Tree.

Hi Jason

I don't think you add POWER_RESET_RESTART back anywhere. It should probably be added to ARCH_KIRKWOOD_DT. Otherwise it will not be possible to shutdown these boxes.

Thanks
Andrew

#81 lore raw

PATCH v3 8/8 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 11 lines · Andrew Lunn

arch/arm/mach-kirkwood/Kconfig config MACH_TS219_DT · line 126

Quoted 8 lines
arch/arm/mach-kirkwood/Kconfig +0 -8
-config MACH_LSXL_DT
-	bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	select POWER_RESET_RESTART
-	help
-	  Say 'Y' here if you want your kernel to support the
-	  Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
-	  Flattened Device Tree.

Hi Jason

Quoted 3 lines

I don't think you add POWER_RESET_RESTART back anywhere. It should probably be added to ARCH_KIRKWOOD_DT. Otherwise it will not be possible to shutdown these boxes.

Good catch, I'll add that in.

thx,

Jason.

#82 lore raw

v4 cover ARM: kirkwood: cleanup DT conversion

In reply to Jason Cooper

All,

This is a fourth cut at cleaning up mach-kirkwood/. There are a few DT conversions (topkick -> mvsdio, pinctrl) which, once reviewed, I'll put in the normal pull request cycle.

The others which remove board-*.c files, I'll keep updating against mvebu/for-next, and then apply at the end of the merge window.

Please test as you are able.

Changes since V1:
- Included Ian Molton's patch to add DT bindings to mv643xx_eth
- little doc cleanup
- tested on dreamplug
- good: boots fine to bash prompt
- bad: hangs within one minute of booting (even with init=/bin/sh)
- no output, just frozen hard
- will debug more tomorrow

Changes since V2:
- discovered source of hang. ge0/1 clocks getting gated
- changed alias for clocks
- able to pull ip address and ping though the interface

Changes since V3:
- fixed clock gating in mv643xx_eth driver (thanks Andrew!)
- corrected topkick pinctrl conversion (thanks Andrew!)
- added a i2c bus to topkick (thanks Andrew! (notice a pattern?))
- converted ts219 ethernet to DT (yep, same thanks)

thx,

Jason.

Andrew Lunn (3):
ARM: Kirkwood: topkick: Enable i2c bus.
NET: mv643xx: Get clk from device tree.
ARM: Kirkwood: Convert QNAP TS219 Ethernet to DT.

Ian Molton (1):
mv643xx.c: Add basic device tree support.

Jason Cooper (7):
ARM: kirkwood: topkick: init mvsdio via DT
ARM: kirkwood: topkick: convert to pinctrl
ARM: kirkwood: nsa310: cleanup includes and unneeded code
ARM: kirkwood: nsa310: convert to pinctrl
ARM: kirkwood: consolidate DT init of pcie
ARM: mvebu: correct gated clock documentation
ARM: kirkwood: mv643xx_eth dt conversion

 .../bindings/clock/mvebu-gated-clock.txt           |   2 +-
 Documentation/devicetree/bindings/net/mv643xx.txt  |  75 +++++++++++++
 arch/arm/boot/dts/kirkwood-dnskw.dtsi              |   9 ++
 arch/arm/boot/dts/kirkwood-dockstar.dts            |   8 ++
 arch/arm/boot/dts/kirkwood-dreamplug.dts           |  16 +++
 arch/arm/boot/dts/kirkwood-goflexnet.dts           |   7 ++
 arch/arm/boot/dts/kirkwood-ib62x0.dts              |   9 ++
 arch/arm/boot/dts/kirkwood-iconnect.dts            |   9 ++
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts         |   8 ++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi               |  18 ++++
 arch/arm/boot/dts/kirkwood-mplcec4.dts             |  18 ++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi         |   9 ++
 arch/arm/boot/dts/kirkwood-ns2lite.dts             |   5 +
 arch/arm/boot/dts/kirkwood-ns2mini.dts             |   5 +
 arch/arm/boot/dts/kirkwood-nsa310.dts              |  99 +++++++++++++++++
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts       |   8 ++
 arch/arm/boot/dts/kirkwood-topkick.dts             | 110 +++++++++++++++++++
 arch/arm/boot/dts/kirkwood-ts219-6281.dts          |   9 ++
 arch/arm/boot/dts/kirkwood-ts219-6282.dts          |  10 ++
 arch/arm/boot/dts/kirkwood.dtsi                    |  38 +++++++
 arch/arm/mach-kirkwood/Kconfig                     | 119 +--------------------
 arch/arm/mach-kirkwood/Makefile                    |  16 ---
 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                  |  63 ++++-------
 arch/arm/mach-kirkwood/board-goflexnet.c           |  34 ------
 arch/arm/mach-kirkwood/board-ib62x0.c              |  29 -----
 arch/arm/mach-kirkwood/board-iconnect.c            |  32 ------
 arch/arm/mach-kirkwood/board-km_kirkwood.c         |   7 --
 arch/arm/mach-kirkwood/board-lsxl.c                |  36 -------
 arch/arm/mach-kirkwood/board-mplcec4.c             |  36 -------
 arch/arm/mach-kirkwood/board-ns2.c                 |  34 ------
 arch/arm/mach-kirkwood/board-nsa310.c              |  58 ----------
 arch/arm/mach-kirkwood/board-openblocks_a6.c       |  26 -----
 arch/arm/mach-kirkwood/board-ts219.c               |  50 ---------
 arch/arm/mach-kirkwood/board-usi_topkick.c         |  77 -------------
 arch/arm/mach-kirkwood/common.h                    |  75 -------------
 drivers/net/ethernet/marvell/mv643xx_eth.c         |  98 +++++++++++++++--
 39 files changed, 587 insertions(+), 749 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-nsa310.c
 delete mode 100644 arch/arm/mach-kirkwood/board-openblocks_a6.c
 delete mode 100644 arch/arm/mach-kirkwood/board-ts219.c
 delete mode 100644 arch/arm/mach-kirkwood/board-usi_topkick.c
Signature · 1 line
1.8.1.1
#83 lore raw

PATCH v4 1/11 ARM: kirkwood: topkick: init mvsdio via DT

---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 7 +++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +7 -0
index cd15452..23c2ddc 100644
@@ -54,6 +54,13 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		mvsdio at 90000 {
+			pinctrl-0 = <&pmx_sdio>;
+			pinctrl-names = "default";
+			status = "okay";
+			/* No CD or WP GPIOs */
+		};
 	};
 
 	gpio-leds {
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -6
index 23d2dd1..95f0711 100644
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
-#include <linux/platform_data/mmc-mvsdio.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -22,10 +21,6 @@ static struct mv643xx_eth_platform_data topkick_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
 };
 
-static struct mvsdio_platform_data topkick_mvsdio_data = {
-	/* unfortunately the CD signal has not been connected */
-};
-
 /*
  * GPIO LED layout
  *
@@ -73,5 +68,4 @@ void __init usi_topkick_init(void)
 
 
 	kirkwood_ge00_init(&topkick_ge00_data);
-	kirkwood_sdio_init(&topkick_mvsdio_data);
 }
Signature · 1 line
1.8.1.1
#85 lore raw

PATCH v4 2/11 ARM: kirkwood: topkick: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 90 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 42 --------------
 2 files changed, 90 insertions(+), 42 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +90 -0
index 23c2ddc..9ae2d2c 100644
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 /include/ "kirkwood.dtsi"
+/include/ "kirkwood-6282.dtsi"
 
 / {
 	model = "Univeral Scientific Industrial Co. Topkick-1281P2";
@@ -16,6 +17,95 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			/*
+			 * GPIO LED layout
+			 *
+			 *       /-SYS_LED(2)
+			 *       |
+			 *       |   /-DISK_LED
+			 *       |   |
+			 *       |   |   /-WLAN_LED(2)
+			 *       |   |   |
+			 * [SW] [*] [*] [*]
+			 */
+
+			/*
+			 * Switch positions
+			 *
+			 *     /-SW_LEFT(2)
+			 *     |
+			 *     |   /-SW_IDLE
+			 *     |   |
+			 *     |   |   /-SW_RIGHT
+			 *     |   |   |
+			 * PS [L] [I] [R] LEDS
+			 */
+			pinctrl-0 = < &pmx_led_disk_yellow
+				      &pmx_sata0_pwr_enable
+				      &pmx_led_sys_red
+				      &pmx_led_sys_blue
+				      &pmx_led_wifi_green
+				      &pmx_sw_left
+				      &pmx_sw_right
+				      &pmx_sw_idle
+				      &pmx_sw_left2
+				      &pmx_led_wifi_yellow
+				      &pmx_uart0
+				      &pmx_nand >;
+			pinctrl-names = "default";
+
+			pmx_led_disk_yellow: pmx-led-disk-yellow {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_sata0_pwr_enable: pmx-sata0-pwr-enable {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_blue: pmx-led-sys-blue {
+				marvell,pins = "mpp38";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_green: pmx-led-wifi-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left: pmx-sw-left {
+				marvell,pins = "mpp43";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_right: pmx-sw-right {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_idle: pmx-sw-idle {
+				marvell,pins = "mpp45";
+				marvell,function = "gpio";
+			};
+
+			pmx_sw_left2: pmx-sw-left2 {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_wifi_yellow: pmx-led-wifi-yellow {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
+
 		serial at 12000 {
 			clock-frequency = <200000000>;
 			status = "ok";
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -42

57 lines not on this page · raw message

Signature · 1 line
1.8.1.1
author Applied
#86 lore raw

PATCH v4 2/11 ARM: kirkwood: topkick: convert to pinctrl

Quoted 5 lines · Jason Cooper
---
 arch/arm/boot/dts/kirkwood-topkick.dts     | 90 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c | 42 --------------
 2 files changed, 90 insertions(+), 42 deletions(-)

Applied to mvebu/dt

thx,

Jason.

#87 lore raw

PATCH v4 3/11 ARM: Kirkwood: topkick: Enable i2c bus.

In reply to Jason Cooper

From: Andrew Lunn <[email protected]>

Add a DT node for I2C and pinctrl hog for the pins. There appears to be an i2c bus on topkick with a device on it:

i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

---
 arch/arm/boot/dts/kirkwood-topkick.dts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/boot/dts/kirkwood-topkick.dts +6 -1
index 9ae2d2c..131aae5 100644
@@ -52,7 +52,8 @@
 				      &pmx_sw_left2
 				      &pmx_led_wifi_yellow
 				      &pmx_uart0
-				      &pmx_nand >;
+				      &pmx_nand
+				      &pmx_twsi0 >;
 			pinctrl-names = "default";
 
 			pmx_led_disk_yellow: pmx-led-disk-yellow {
@@ -151,6 +152,10 @@
 			status = "okay";
 			/* No CD or WP GPIOs */
 		};
+
+		i2c at 11000 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
Signature · 1 line
1.8.1.1
author Applied
#88 lore raw

PATCH v4 3/11 ARM: Kirkwood: topkick: Enable i2c bus.

Quoted 20 lines · Jason Cooper

From: Andrew Lunn <[email protected]>

Add a DT node for I2C and pinctrl hog for the pins. There appears to be an i2c bus on topkick with a device on it:

i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Quoted 5 lines
---
 arch/arm/boot/dts/kirkwood-topkick.dts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Applied to mvebu/dt

thx,

Jason.

#89 lore raw

PATCH v4 4/11 ARM: kirkwood: nsa310: cleanup includes and unneeded code

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/board-nsa310.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-kirkwood/board-nsa310.c +1 -8
index 1bd328d..0b99533 100644
@@ -10,11 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/i2c.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
 #include <mach/kirkwood.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -40,11 +37,7 @@ static unsigned int nsa310_mpp_config[] __initdata = {
 
 void __init nsa310_init(void)
 {
-	u32 dev, rev;
-
 	kirkwood_mpp_conf(nsa310_mpp_config);
-
-	kirkwood_pcie_id(&dev, &rev);
 }
 
 static int __init nsa310_pci_init(void)
Signature · 1 line
1.8.1.1
#90 lore raw

PATCH v4 5/11 ARM: kirkwood: nsa310: convert to pinctrl

In reply to Jason Cooper
---
 arch/arm/boot/dts/kirkwood-nsa310.dts | 99 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |  3 --
 arch/arm/mach-kirkwood/board-nsa310.c | 26 ---------
 arch/arm/mach-kirkwood/common.h       |  6 ---
 4 files changed, 99 insertions(+), 35 deletions(-)
arch/arm/boot/dts/kirkwood-nsa310.dts +99 -0
index dbb3551..3a178cf 100644
@@ -16,6 +16,105 @@
 	};
 
 	ocp at f1000000 {
+		pinctrl: pinctrl at 10000 {
+			pinctrl-0 = < &pmx_led_esata_green
+				      &pmx_led_esata_red
+				      &pmx_led_usb_green
+				      &pmx_led_usb_red
+				      &pmx_usb_power_off
+				      &pmx_led_sys_green
+				      &pmx_led_sys_red
+				      &pmx_btn_reset
+				      &pmx_btn_copy
+				      &pmx_led_copy_green
+				      &pmx_led_copy_red
+				      &pmx_led_hdd_green
+				      &pmx_led_hdd_red
+				      &pmx_unknown
+				      &pmx_btn_power
+				      &pmx_pwr_off >;
+			pinctrl-names = "default";
+
+			pmx_led_esata_green: pmx-led-esata-green {
+				marvell,pins = "mpp12";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_esata_red: pmx-led-esata-red {
+				marvell,pins = "mpp13";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_red: pmx-led-usb-red {
+				marvell,pins = "mpp16";
+				marvell,function = "gpio";
+			};
+
+			pmx_usb_power_off: pmx-usb-power-off {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp29";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_reset: pmx-btn-reset {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_copy: pmx-btn-copy {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_green: pmx-led-copy-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_red: pmx-led-copy-red {
+				marvell,pins = "mpp40";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_green: pmx-led-hdd-green {
+				marvell,pins = "mpp41";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_red: pmx-led-hdd-red {
+				marvell,pins = "mpp42";
+				marvell,function = "gpio";
+			};
+
+			pmx_unknown: pmx-unknown {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_power: pmx-btn-power {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_off: pmx-pwr-off {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+		};
 
 		serial at 12000 {
 			clock-frequency = <200000000>;
arch/arm/mach-kirkwood/board-dt.c +0 -3
index 8eac548..8b35157 100644
@@ -141,9 +141,6 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("usi,topkick"))
 		usi_topkick_init();
 
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		nsa310_init();
-
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
arch/arm/mach-kirkwood/board-nsa310.c +0 -26
index 0b99533..55ade93 100644
@@ -13,32 +13,6 @@
 #include <mach/kirkwood.h>
 #include <linux/of.h>
 #include "common.h"
-#include "mpp.h"
-
-static unsigned int nsa310_mpp_config[] __initdata = {
-	MPP12_GPIO, /* led esata green */
-	MPP13_GPIO, /* led esata red */
-	MPP15_GPIO, /* led usb green */
-	MPP16_GPIO, /* led usb red */
-	MPP21_GPIO, /* control usb power off */
-	MPP28_GPIO, /* led sys green */
-	MPP29_GPIO, /* led sys red */
-	MPP36_GPIO, /* key reset */
-	MPP37_GPIO, /* key copy */
-	MPP39_GPIO, /* led copy green */
-	MPP40_GPIO, /* led copy red */
-	MPP41_GPIO, /* led hdd green */
-	MPP42_GPIO, /* led hdd red */
-	MPP44_GPIO, /* ?? */
-	MPP46_GPIO, /* key power */
-	MPP48_GPIO, /* control power off */
-	0
-};
-
-void __init nsa310_init(void)
-{
-	kirkwood_mpp_conf(nsa310_mpp_config);
-}
 
 static int __init nsa310_pci_init(void)
 {
arch/arm/mach-kirkwood/common.h +0 -6
index e956d02..1c42cb8 100644
@@ -130,12 +130,6 @@ void ns2_init(void);
 static inline void ns2_init(void) {};
 #endif
 
-#ifdef CONFIG_MACH_NSA310_DT
-void nsa310_init(void);
-#else
-static inline void nsa310_init(void) {};
-#endif
-
 #ifdef CONFIG_MACH_OPENBLOCKS_A6_DT
 void openblocks_a6_init(void);
 #else
Signature · 1 line
1.8.1.1
author Applied
#91 lore raw

PATCH v4 5/11 ARM: kirkwood: nsa310: convert to pinctrl

Quoted 7 lines · Jason Cooper
---
 arch/arm/boot/dts/kirkwood-nsa310.dts | 99 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |  3 --
 arch/arm/mach-kirkwood/board-nsa310.c | 26 ---------
 arch/arm/mach-kirkwood/common.h       |  6 ---
 4 files changed, 99 insertions(+), 35 deletions(-)

Applied to mvebu/dt

thx,

Jason.

#92 lore raw

PATCH v4 6/11 ARM: kirkwood: consolidate DT init of pcie

In reply to Jason Cooper
---
 arch/arm/mach-kirkwood/Makefile         |  1 -
 arch/arm/mach-kirkwood/board-dt.c       | 23 +++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-iconnect.c |  9 ---------
 arch/arm/mach-kirkwood/board-mplcec4.c  |  1 -
 arch/arm/mach-kirkwood/board-nsa310.c   | 25 -------------------------
 arch/arm/mach-kirkwood/board-ts219.c    | 13 -------------
 6 files changed, 23 insertions(+), 49 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-nsa310.c
arch/arm/mach-kirkwood/Makefile +0 -1
index d665309..ee3aa77 100644
@@ -36,6 +36,5 @@ obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NSA310_DT)		+= board-nsa310.o
 obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
 obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dt.c +23 -0
index 8b35157..73b76e4 100644
@@ -70,6 +70,29 @@ static void __init kirkwood_of_clk_init(void)
 	kirkwood_legacy_clk_init();
 }
 
+static const char * const kirkwood_dt_pcie0_compat[] = {
+	"iom,iconnect",
+	"mpl,cec4",
+	"qnap,ts219",
+	"zyxel,nsa310",
+	NULL
+};
+
+static int __init kirkwood_pcie_dt_init(void)
+{
+	int i;
+
+	for (i = 0; kirkwood_dt_pcie0_compat[i] != NULL; i++) {
+		if (of_machine_is_compatible(kirkwood_dt_pcie0_compat[i])) {
+			kirkwood_pcie_init(KW_PCIE0);
+			break;
+		}
+	}
+
+	return 0;
+}
+subsys_initcall(kirkwood_pcie_dt_init);
+
 static void __init kirkwood_dt_init(void)
 {
 	pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
arch/arm/mach-kirkwood/board-iconnect.c +0 -9
index c8ebde4..ff042dc 100644
@@ -10,7 +10,6 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/of.h>
 #include <linux/mv643xx_eth.h>
 #include "common.h"
 
@@ -22,11 +21,3 @@ void __init iconnect_init(void)
 {
 	kirkwood_ge00_init(&iconnect_ge00_data);
 }
-
-static int __init iconnect_pci_init(void)
-{
-	if (of_machine_is_compatible("iom,iconnect"))
-		kirkwood_pcie_init(KW_PCIE0);
-	return 0;
-}
-subsys_initcall(iconnect_pci_init);
arch/arm/mach-kirkwood/board-mplcec4.c +0 -1
index 7d6dc66..938712e 100644
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
 	 */
 	kirkwood_ge00_init(&mplcec4_ge00_data);
 	kirkwood_ge01_init(&mplcec4_ge01_data);
-	kirkwood_pcie_init(KW_PCIE0);
 }
 
 
arch/arm/mach-kirkwood/board-nsa310.c deleted +0 -25
deleted file mode 100644
index 55ade93..0000000
@@ -1,25 +0,0 @@
-/*
- * arch/arm/mach-kirkwood/nsa-310-setup.c
- *
- * ZyXEL NSA-310 Setup
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <mach/kirkwood.h>
-#include <linux/of.h>
-#include "common.h"
-
-static int __init nsa310_pci_init(void)
-{
-	if (of_machine_is_compatible("zyxel,nsa310"))
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-
-subsys_initcall(nsa310_pci_init);
arch/arm/mach-kirkwood/board-ts219.c +0 -13
index 10fb397..f00c0a9 100644
@@ -17,10 +17,7 @@
 
 #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"
 
@@ -38,13 +35,3 @@ void __init qnap_dt_ts219_init(void)
 
 	kirkwood_ge00_init(&qnap_ts219_ge00_data);
 }
-
-/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
-static int __init ts219_pci_init(void)
-{
-	if (machine_is_ts219())
-		kirkwood_pcie_init(KW_PCIE0);
-
-	return 0;
-}
-subsys_initcall(ts219_pci_init);
Signature · 1 line
1.8.1.1
#93 lore raw

PATCH v4 7/11 ARM: mvebu: correct gated clock documentation

In reply to Jason Cooper
---
 Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt +1 -1
index 7337005..cffc93d 100644
@@ -89,7 +89,7 @@ ID	Clock	Peripheral
 16	xor1	XOR DMA 1
 17	crypto	CESA engine
 18	pex1	PCIe Cntrl 1
-19	ge1	Gigabit Ethernet 0
+19	ge1	Gigabit Ethernet 1
 20	tdm	Time Division Mplx
 
 Required properties:
Signature · 1 line
1.8.1.1
author Applied
#94 lore raw

PATCH v4 7/11 ARM: mvebu: correct gated clock documentation

Quoted 4 lines · Jason Cooper
---
 Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to mvebu/cleanup.

thx,

Jason.

#95 lore raw

PATCH v4 8/11 mv643xx.c: Add basic device tree support.

In reply to Jason Cooper

From: Ian Molton <[email protected]>

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 painless migration.

---
 Documentation/devicetree/bindings/net/mv643xx.txt | 75 ++++++++++++++++++
 drivers/net/ethernet/marvell/mv643xx_eth.c        | 93 +++++++++++++++++++++--
 2 files changed, 161 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mv643xx.txt
Documentation/devicetree/bindings/net/mv643xx.txt new file +75 -0
new file mode 100644
index 0000000..2727f798
@@ -0,0 +1,75 @@
+mv643xx related nodes.
+
+marvell,mdio-mv643xx:
+
+Required properties:
+
+ - interrupts : <a> where a is the SMI interrupt number.
+ - reg : the base address and size of the controllers register space.
+
+Optional properties:
+ - shared_smi : on some chips, the second PHY is "shared", meaning it is
+	really accessed via the first SMI controller. It is passed in this
+	way due to the present structure of the driver, which requires the
+	base address for the MAC to be passed in via the SMI controllers
+	platform data.
+ - tx_csum_limit : on some devices, this option is required for proper
+	operation wrt. jumbo frames.
+
+
+Example:
+
+smi0: mdio at 72000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x72000 0x4000>;
+	interrupts = <46>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+smi1: mdio at 76000 {
+	compatible = "marvell,mdio-mv643xx";
+	reg = <0x76000 0x4000>;
+	interrupts = <47>;
+	shared_smi = <&smi0>;
+	tx_csum_limit = <1600>;
+	status = "disabled";
+};
+
+
+
+marvell,mv643xx-eth:
+
+Required properties:
+ - interrupts : the port interrupt number.
+ - mdio : phandle of the smi device as drescribed above
+
+Optional properties:
+ - port_number : the port number on this bus.
+ - phy_addr : the PHY address.
+ - reg : should match the mdio reg this device is attached to.
+	this is a required hack for now due to the way the
+	driver is constructed. This allows the device clock to be
+	kept running so that the MAC is not lost after boot.
+
+
+Example:
+
+egiga0 {
+	compatible = "marvell,mv643xx-eth";
+	reg = <0x72000 0x4000>;
+	mdio = <&smi0>;
+	port_number = <0>;
+	phy_addr = <0x80>;
+	interrupts = <11>;
+};
+
+egiga1 {
+	compatible = "marvell,mv643xx-eth";
+	reg = <0x76000 0x4000>;
+	mdio = <&smi1>;
+	port_number = <0>;
+	phy_addr = <0x81>;
+	interrupts = <15>;
+};
+
drivers/net/ethernet/marvell/mv643xx_eth.c +86 -7

180 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#96 lore raw

PATCH v4 9/11 NET: mv643xx: Get clk from device tree.

In reply to Jason Cooper

From: Andrew Lunn <[email protected]>

If we are passed a device tree node pointer, get the clock from it. This avoids problems with con_id when using clk_get().

---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mv643xx_eth.c +4 -1
index 7048d7c..296beec 100644
@@ -2955,7 +2955,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	 */
 	mp->t_clk = 133000000;
 #if defined(CONFIG_HAVE_CLK)
-	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
+	if (pdev->dev.of_node)
+		mp->clk = of_clk_get(pdev->dev.of_node, 0);
+	else
+		mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
 	if (!IS_ERR(mp->clk)) {
 		clk_prepare_enable(mp->clk);
 		mp->t_clk = clk_get_rate(mp->clk);
Signature · 1 line
1.8.1.1
#97 lore raw

PATCH 1/1 NET: mv643xx: get smi clock from device tree

mv643xx_eth is split up into core (ethernet) and smi (mdio) driver parts. If clock gates are introduced as for Kirkwood and Dove SoCs, smi registers are accessed with clock gated and cause the SoC to hang.

This patch also gets and enables a clock passed from DT for the shared smi part of the driver. It has been tested on Dove and also allows the driver compiled and used as a module.

DT conversion patches for mv643xx_eth on Dove will be sent on another patch set.

---
Cc: Jason Cooper <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: Simon Baatz <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org

---
 drivers/net/ethernet/marvell/mv643xx_eth.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/net/ethernet/marvell/mv643xx_eth.c +21 -0
index 67e5d86..c0f0671 100644
@@ -296,6 +296,9 @@ struct mv643xx_eth_shared_private {
 	int extended_rx_coal_limit;
 	int tx_bw_control;
 	int tx_csum_limit;
+#if defined(CONFIG_HAVE_CLK)
+	struct clk *clk;
+#endif
 
 };
 
@@ -2626,6 +2629,12 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 		of_property_read_u32(pdev->dev.of_node,
 			"tx_csum_limit", &pd->tx_csum_limit);
 
+#if defined(CONFIG_HAVE_CLK)
+		msp->clk = of_clk_get(pdev->dev.of_node, 0);
+		if (!IS_ERR(msp->clk))
+			clk_prepare_enable(msp->clk);
+#endif
+
 		np = of_parse_phandle(pdev->dev.of_node, "shared_smi", 0);
 		if (np)
 			pd->shared_smi = of_find_device_by_node(np);
@@ -2695,6 +2704,12 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 out_free_mii_bus:
 	mdiobus_free(msp->smi_bus);
 out_unmap:
+#if defined(CONFIG_HAVE_CLK)
+	if (!IS_ERR(msp->clk)) {
+		clk_disable_unprepare(msp->clk);
+		clk_put(msp->clk);
+	}
+#endif
 	iounmap(msp->base);
 out_free:
 	kfree(msp);
@@ -2713,6 +2728,12 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
 	}
 	if (msp->err_interrupt != NO_IRQ)
 		free_irq(msp->err_interrupt, msp);
+#if defined(CONFIG_HAVE_CLK)
+	if (!IS_ERR(msp->clk)) {
+		clk_disable_unprepare(msp->clk);
+		clk_put(msp->clk);
+	}
+#endif
 	iounmap(msp->base);
 	kfree(msp);
 
Signature · 1 line
1.7.10.4
#98 lore raw

PATCH v4 10/11 ARM: kirkwood: mv643xx_eth dt conversion

In reply to Jason Cooper

Tested on the dreamplug:

mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
libphy: mv643xx_eth smi: probed
libphy: mv643xx_eth smi: probed
mv643xx_eth_port f1072000.egiga0 eth0: port 0 with MAC address XX:XX:XX... mv643xx_eth_port f1076000.egiga1 eth1: port 0 with MAC address XX:XX:XX...

Successfully pulled an ip address and pinged through the interface

---
 arch/arm/boot/dts/kirkwood-dnskw.dtsi        |   9 +++
 arch/arm/boot/dts/kirkwood-dockstar.dts      |   8 +++
 arch/arm/boot/dts/kirkwood-dreamplug.dts     |  16 +++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts     |   7 ++
 arch/arm/boot/dts/kirkwood-ib62x0.dts        |   9 +++
 arch/arm/boot/dts/kirkwood-iconnect.dts      |   9 +++
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts   |   8 +++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi         |  18 +++++
 arch/arm/boot/dts/kirkwood-mplcec4.dts       |  18 +++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi   |   9 +++
 arch/arm/boot/dts/kirkwood-ns2lite.dts       |   5 ++
 arch/arm/boot/dts/kirkwood-ns2mini.dts       |   5 ++
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts |   8 +++
 arch/arm/boot/dts/kirkwood-topkick.dts       |   8 +++
 arch/arm/boot/dts/kirkwood.dtsi              |  38 ++++++++++
 arch/arm/mach-kirkwood/Kconfig               | 102 +--------------------------
 arch/arm/mach-kirkwood/Makefile              |  14 ----
 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            |  34 ---------
 arch/arm/mach-kirkwood/board-goflexnet.c     |  34 ---------
 arch/arm/mach-kirkwood/board-ib62x0.c        |  29 --------
 arch/arm/mach-kirkwood/board-iconnect.c      |  23 ------
 arch/arm/mach-kirkwood/board-km_kirkwood.c   |   7 --
 arch/arm/mach-kirkwood/board-lsxl.c          |  36 ----------
 arch/arm/mach-kirkwood/board-mplcec4.c       |  35 ---------
 arch/arm/mach-kirkwood/board-ns2.c           |  34 ---------
 arch/arm/mach-kirkwood/board-openblocks_a6.c |  26 -------
 arch/arm/mach-kirkwood/board-usi_topkick.c   |  29 --------
 arch/arm/mach-kirkwood/common.h              |  63 -----------------
 31 files changed, 176 insertions(+), 539 deletions(-)
 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-ib62x0.c
 delete mode 100644 arch/arm/mach-kirkwood/board-iconnect.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-usi_topkick.c
arch/arm/boot/dts/kirkwood-dnskw.dtsi +9 -0
index 6875ac0..9e2132a 100644
@@ -186,6 +186,15 @@
 				reg = <0x7b00000 0x500000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	regulators {
arch/arm/boot/dts/kirkwood-dockstar.dts +8 -0
index 2e3dd34..ec09085 100644
@@ -60,6 +60,14 @@
 				reg = <0x0500000 0xfb00000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-dreamplug.dts +16 -0
index ef2d8c7..ae130a5 100644
@@ -81,6 +81,22 @@
 			status = "okay";
 			/* No CD or WP GPIOs */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
+
+		egiga1 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-goflexnet.dts +7 -0
index 1b133e0..98513ee 100644
@@ -106,6 +106,13 @@
 			nr-ports = <2>;
 		};
 
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
arch/arm/boot/dts/kirkwood-ib62x0.dts +9 -0
index 71902da..e77b06d 100644
@@ -79,6 +79,15 @@
 			};
 
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-iconnect.dts +9 -0
index 504f16b..5b89685 100644
@@ -110,6 +110,15 @@
 				reg = <0x980000 0x1f400000>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x91>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-km_kirkwood.dts +8 -0
index 8db3123..49a8049 100644
@@ -42,5 +42,13 @@
 			status = "ok";
 			chip-delay = <25>;
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 };
arch/arm/boot/dts/kirkwood-lsxl.dtsi +18 -0
index 996c7fe..16199bf 100644
@@ -106,6 +106,24 @@
 				};
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
+
+		egiga1 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-mplcec4.dts +18 -0
index 662dfd8..33130d1 100644
@@ -140,6 +140,24 @@
 			cd-gpios = <&gpio1 15 0>;
 			/* No WP GPIO */
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		smi1: mdio at 76000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x81>;
+			status = "ok";
+		};
+
+		egiga1 {
+			phy_addr = <0x82>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-ns2-common.dtsi +9 -0
index e8e7ece..0c54321 100644
@@ -54,6 +54,15 @@
 				reg = <0x50>;
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-ns2lite.dts +5 -0
index b02eb4e..e7cd611 100644
@@ -16,6 +16,11 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-ns2mini.dts +5 -0
index b79f5eb..700d308 100644
@@ -16,6 +16,11 @@
 			status = "okay";
 			nr-ports = <1>;
 		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
 	};
 
 	gpio_fan {
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +8 -0
index ede7fe0d..b179d43 100644
@@ -191,6 +191,14 @@
 				marvell,function = "gpio";
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood-topkick.dts +8 -0
index 131aae5..5c82f9d 100644
@@ -156,6 +156,14 @@
 		i2c at 11000 {
 			status = "ok";
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			status = "ok";
+		};
 	};
 
 	gpio-leds {
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 2c738d9..b13a405 100644
@@ -201,5 +201,43 @@
 			clocks = <&gate_clk 4>;
 			status = "disabled";
 		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x72000 0x4000>;
+			interrupts = <46>;
+			tx_csum_limit = <1600>;
+			status = "disabled";
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg = <0x76000 0x4000>;
+			interrupts = <47>;
+			tx_csum_limit = <1600>;
+			status = "disabled";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx-eth";
+			reg = <0x72000 0x4000>;
+			mdio = <&smi0>;
+			port_number = <0>;
+			phy_addr = <0x80>;
+			interrupts = <11>;
+			clocks = <&gate_clk 0>;
+			status = "disabled";
+		};
+
+		egiga1 {
+			compatible = "marvell,mv643xx-eth";
+			reg = <0x76000 0x4000>;
+			mdio = <&smi1>;
+			port_number = <0>;
+			phy_addr = <0x81>;
+			interrupts = <15>;
+			clocks = <&gate_clk 19>;
+			status = "disabled";
+		};
 	};
 };
arch/arm/mach-kirkwood/Kconfig +1 -101

132 lines not on this page · raw message

arch/arm/mach-kirkwood/Makefile +0 -14
index ee3aa77..ab739b0 100644
@@ -20,21 +20,7 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
-obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
-obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
-obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
-obj-$(CONFIG_MACH_DOCKSTAR_DT)		+= board-dockstar.o
-obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
-obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.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_INETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_MPLCEC4_DT)		+= board-mplcec4.o
-obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
-obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT)	+= board-openblocks_a6.o
-obj-$(CONFIG_MACH_TOPKICK_DT)		+= board-usi_topkick.o
arch/arm/mach-kirkwood/board-dnskw.c +0 -7
index a1aa87f..2af7a95 100644
@@ -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);
 }
arch/arm/mach-kirkwood/board-dockstar.c deleted +0 -32
deleted file mode 100644
index d7196db..0000000
@@ -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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-dreamplug.c deleted +0 -35
deleted file mode 100644
index 0903242..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-dt.c +0 -34
index 73b76e4..edb1215 100644
@@ -118,52 +118,18 @@ 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("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,inetspace_v2") ||
-	    of_machine_is_compatible("lacie,netspace_v2") ||
-	    of_machine_is_compatible("lacie,netspace_max_v2") ||
-	    of_machine_is_compatible("lacie,netspace_lite_v2") ||
-	    of_machine_is_compatible("lacie,netspace_mini_v2"))
-		ns2_init();
-
-	if (of_machine_is_compatible("mpl,cec4"))
-		mplcec4_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);
 }
 
arch/arm/mach-kirkwood/board-goflexnet.c deleted +0 -34
deleted file mode 100644
index 9db979a..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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 <[email protected]> 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);
-}
arch/arm/mach-kirkwood/board-ib62x0.c deleted +0 -29
deleted file mode 100644
index 9a857ae..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Baatz <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-iconnect.c deleted +0 -23
deleted file mode 100644
index ff042dc..0000000
@@ -1,23 +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/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);
-}
arch/arm/mach-kirkwood/board-km_kirkwood.c +0 -7
index 44e4605..6b8464b 100644
@@ -14,15 +14,10 @@
 
 #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;
@@ -39,6 +34,4 @@ void __init km_kirkwood_init(void)
 	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);
 }
arch/arm/mach-kirkwood/board-lsxl.c deleted +0 -36
deleted file mode 100644
index 3483952..0000000
@@ -1,36 +0,0 @@
-/*
- * Copyright 2012 (C), Michael Walle <[email protected]>
- *
- * 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),
-};
-
-void __init lsxl_init(void)
-{
-	/*
-	 * Basic setup. Needs to be called early.
-	 */
-
-	kirkwood_ge00_init(&lsxl_ge00_data);
-	kirkwood_ge01_init(&lsxl_ge01_data);
-}
arch/arm/mach-kirkwood/board-mplcec4.c deleted +0 -35
deleted file mode 100644
index 938712e..0000000
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 MPL AG, Switzerland
- * Stefan Peter <[email protected]>
- *
- * 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);
-}
-
-
-
arch/arm/mach-kirkwood/board-ns2.c deleted +0 -34
deleted file mode 100644
index f2ea3b7..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012 (C), Simon Guinot <[email protected]>
- *
- * 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,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);
-}
arch/arm/mach-kirkwood/board-openblocks_a6.c deleted +0 -26
deleted file mode 100644
index b11d8fd..0000000
@@ -1,26 +0,0 @@
-/*
- * Copyright 2012 Nobuhiro Iwamatsu <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/board-usi_topkick.c deleted +0 -29
deleted file mode 100644
index 1cc04ec..0000000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2012 (C), Jason Cooper <[email protected]>
- *
- * 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);
-}
arch/arm/mach-kirkwood/common.h +0 -63

81 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#99 lore raw

PATCH v4 10/11 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 33 lines · Jason Cooper

Tested on the dreamplug:

mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
libphy: mv643xx_eth smi: probed
libphy: mv643xx_eth smi: probed
mv643xx_eth_port f1072000.egiga0 eth0: port 0 with MAC address XX:XX:XX... mv643xx_eth_port f1076000.egiga1 eth1: port 0 with MAC address XX:XX:XX...

Successfully pulled an ip address and pinged through the interface

...

arch/arm/boot/dts/kirkwood.dtsi +13 -0
index 2c738d9..b13a405 100644
@@ -201,5 +201,43 @@
  			clocks =<&gate_clk 4>;
  			status = "disabled";
  		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg =<0x72000 0x4000>;
+			interrupts =<46>;
+			tx_csum_limit =<1600>;
+			status = "disabled";
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg =<0x76000 0x4000>;
+			interrupts =<47>;

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

Quoted 10 lines
arch/arm/boot/dts/kirkwood.dtsi +10 -0
+			tx_csum_limit =<1600>;
+			status = "disabled";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx-eth";
+			reg =<0x72000 0x4000>;
+			mdio =<&smi0>;
+			port_number =<0>;
+			phy_addr =<0x80>;

Jason,

This will break phy_scan on all kirkwood boards as 0x80 is _not_ equal MV643XX_ETH_PHY_ADDR_DEFAULT.

I suggest not to set phy_addr in kirkwood.dtsi at all and let the board specific DT files set the phy addresses (or rely on phy_scan if not set).

Also, you are ORing the address passed by phy_addr with 0x80 anyway. So all phy addresses should be passed as <0> or <1> instead the ORed ones.

Sebastian

#100 lore raw

PATCH v4 10/11 ARM: kirkwood: mv643xx_eth dt conversion

Quoted 47 lines · Sebastian Hesselbarth
Quoted 33 lines · Jason Cooper

Tested on the dreamplug:

mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
libphy: mv643xx_eth smi: probed
libphy: mv643xx_eth smi: probed
mv643xx_eth_port f1072000.egiga0 eth0: port 0 with MAC address XX:XX:XX... mv643xx_eth_port f1076000.egiga1 eth1: port 0 with MAC address XX:XX:XX...

Successfully pulled an ip address and pinged through the interface

...

arch/arm/boot/dts/kirkwood.dtsi +13 -0
index 2c738d9..b13a405 100644
@@ -201,5 +201,43 @@
 			clocks =<&gate_clk 4>;
 			status = "disabled";
 		};
+
+		smi0: mdio at 72000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg =<0x72000 0x4000>;
+			interrupts =<46>;
+			tx_csum_limit =<1600>;
+			status = "disabled";
+		};
+
+		smi1: mdio at 76000 {
+			compatible = "marvell,mdio-mv643xx";
+			reg =<0x76000 0x4000>;
+			interrupts =<47>;

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

Quoted 10 lines
arch/arm/boot/dts/kirkwood.dtsi +10 -0
+			tx_csum_limit =<1600>;
+			status = "disabled";
+		};
+
+		egiga0 {
+			compatible = "marvell,mv643xx-eth";
+			reg =<0x72000 0x4000>;
+			mdio =<&smi0>;
+			port_number =<0>;
+			phy_addr =<0x80>;

Jason,

Quoted 2 lines

This will break phy_scan on all kirkwood boards as 0x80 is _not_ equal MV643XX_ETH_PHY_ADDR_DEFAULT.

Good point.

Quoted 6 lines

I suggest not to set phy_addr in kirkwood.dtsi at all and let the board specific DT files set the phy addresses (or rely on phy_scan if not set).

Also, you are ORing the address passed by phy_addr with 0x80 anyway. So all phy addresses should be passed as <0> or <1> instead the ORed ones.

agreed. I'll make the changes for V5.

thanks for the review.

Jason.

#101 lore raw

PATCH v4 11/11 ARM: Kirkwood: Convert QNAP TS219 Ethernet to DT.

In reply to Jason Cooper

From: Andrew Lunn <[email protected]>

Add DT nodes for the Ethernet ports and remove the C code. The PHY addresses depends on which SoC is used, so place the nodes into the SoC specific DTS files.

---
 arch/arm/boot/dts/kirkwood-ts219-6281.dts |  9 ++++++++
 arch/arm/boot/dts/kirkwood-ts219-6282.dts | 10 +++++++++
 arch/arm/mach-kirkwood/Kconfig            | 17 ++------------
 arch/arm/mach-kirkwood/Makefile           |  1 -
 arch/arm/mach-kirkwood/board-dt.c         |  3 ---
 arch/arm/mach-kirkwood/board-ts219.c      | 37 -------------------------------
 arch/arm/mach-kirkwood/common.h           |  6 -----
 7 files changed, 21 insertions(+), 62 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-ts219.c
arch/arm/boot/dts/kirkwood-ts219-6281.dts +9 -0
index 8295c83..00b2c7f 100644
@@ -32,6 +32,15 @@
 				marvell,function = "gpio";
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x88>;
+			status = "ok";
+		};
 	};
 
 	gpio_keys {
arch/arm/boot/dts/kirkwood-ts219-6282.dts +10 -0
index df3f95d..61d69f5 100644
@@ -32,6 +32,16 @@
 				marvell,function = "gpio";
 			};
 		};
+
+		smi0: mdio at 72000 {
+			status = "ok";
+		};
+
+		egiga0 {
+			phy_addr = <0x80>;
+			status = "ok";
+		};
+
 	};
 
 	gpio_keys {
arch/arm/mach-kirkwood/Kconfig +2 -15
index ac27a3d..aa10096 100644
@@ -46,10 +46,12 @@ config MACH_GURUPLUG
 
 config ARCH_KIRKWOOD_DT
 	bool "Marvell Kirkwood Flattened Device Tree"
+	select ARM_APPENDED_DTB
 	select POWER_SUPPLY
 	select POWER_RESET
 	select POWER_RESET_RESTART
 	select POWER_RESET_GPIO
+	select POWER_RESET_QNAP
 	select REGULATOR
 	select REGULATOR_FIXED_VOLTAGE
 	select MVEBU_CLK_CORE
@@ -67,21 +69,6 @@ config MACH_DLINK_KIRKWOOD_DT
 	  Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
 	  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
-	select POWER_RESET_QNAP
-	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.
-
 config MACH_IOMEGA_IX2_200_DT
 	bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
arch/arm/mach-kirkwood/Makefile +0 -1
index ab739b0..e94973c 100644
@@ -21,6 +21,5 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
-obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
 obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)	+= board-iomega_ix2_200.o
 obj-$(CONFIG_MACH_KM_KIRKWOOD_DT)	+= board-km_kirkwood.o
arch/arm/mach-kirkwood/board-dt.c +0 -3
index edb1215..70c8d7d 100644
@@ -121,9 +121,6 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("dlink,dns-kirkwood"))
 		dnskw_init();
 
-	if (of_machine_is_compatible("qnap,ts219"))
-		qnap_dt_ts219_init();
-
 	if (of_machine_is_compatible("iom,ix2-200"))
 		iomega_ix2_200_init();
 
arch/arm/mach-kirkwood/board-ts219.c deleted +0 -37
deleted file mode 100644
index f00c0a9..0000000
@@ -1,37 +0,0 @@
-/*
- *
- * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
- *
- * Copyright (C) 2012 Andrew Lunn <[email protected]>
- *
- * Based on the board file ts219-setup.c:
- *
- * Copyright (C) 2009  Martin Michlmayr <[email protected]>
- * Copyright (C) 2008  Byron Bradley <[email protected]>
- *
- * 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/mv643xx_eth.h>
-#include <mach/kirkwood.h>
-#include "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);
-}
arch/arm/mach-kirkwood/common.h +0 -6
index ba6eb9c..8f98b67 100644
@@ -55,12 +55,6 @@ void kirkwood_restart(char, const char *);
 void kirkwood_clk_init(void);
 
 /* board init functions for boards not fully converted to fdt */
-#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
Signature · 1 line
1.8.1.1