Skip to contentSkip to conversation

ARM: davinci: da850: add ethernet driver DT support

PATCH Superseded Lad, Prabhakar 3 participants 13 messages Aug 15, 2013 – Aug 16, 2013

Subsystems (6)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover ARM: davinci: da850: add ethernet driver DT support

From: "Lad, Prabhakar" <[email protected]>

This patch set enables Ethernet support through device tree model. This patch set enables mii interface only and is being tested to boot via rootfs. The rmii phy is present on the i2c gpio expander chip (UI board) for which yet support needs to be added, once the DT support for the chip is enabled, enabling rmii will be subsequnet patch.

Changes for v2:
1: Enabled mdio device.
2: Fixed clock lookup.

Changes for v3:
1: Fixed review comments pointed out by Sekhar.

Changes for v4:
1: Fixed review comments pointed out by Sekhar.
2: Dropped patch v3 6/6 (https://patchwork.kernel.org/patch/2768361/)
Which depends on adding GPIO DT node, will address it once GPIO support is added.
3: Rebased the patches on [1]

[1] https://git.kernel.org/cgit/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=v3.12/soc

Lad, Prabhakar (5):
ARM: davinci: fix clock lookup for mdio device
ARM: davinci: da850: add DT node for mdio device
ARM: davinci: da850: add OF_DEV_AUXDATA entry for mdio.
ARM: davinci: da850: add DT node for eth0.
ARM: davinci: da850: add OF_DEV_AUXDATA entry for eth0.

 arch/arm/boot/dts/da850-evm.dts       |   11 +++++++++
 arch/arm/boot/dts/da850.dtsi          |   43 +++++++++++++++++++++++++++++++++
 arch/arm/mach-davinci/da830.c         |    1 +
 arch/arm/mach-davinci/da850.c         |    1 +
 arch/arm/mach-davinci/da8xx-dt.c      |    4 +++
 arch/arm/mach-davinci/devices-da8xx.c |    8 ++----
 arch/arm/mach-davinci/dm365.c         |    3 +--
 arch/arm/mach-davinci/dm644x.c        |    3 +--
 arch/arm/mach-davinci/dm646x.c        |    3 +--
 9 files changed, 65 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/5 ARM: davinci: fix clock lookup for mdio device

From: "Lad, Prabhakar" <[email protected]>

This patch removes the clock alias for mdio device and adds a entry in clock lookup table, this entry can now be used by both DT and NON DT case.

---
changes for v2: None

Changes for v3:
a> added clock lookup entry for davinci_mdio in da830 file.

Changes for v4:
a> added clock lookup entry for all davinci devices.

 arch/arm/mach-davinci/da830.c         |    1 +
 arch/arm/mach-davinci/da850.c         |    1 +
 arch/arm/mach-davinci/devices-da8xx.c |    8 ++------
 arch/arm/mach-davinci/dm365.c         |    3 +--
 arch/arm/mach-davinci/dm644x.c        |    3 +--
 arch/arm/mach-davinci/dm646x.c        |    3 +--
 6 files changed, 7 insertions(+), 12 deletions(-)
arch/arm/mach-davinci/da830.c +1 -0
index 111613b..d6c746e 100644
@@ -417,6 +417,7 @@ static struct clk_lookup da830_clks[] = {
 	CLK(NULL,		"aintc",	&aintc_clk),
 	CLK(NULL,		"secu_mgr",	&secu_mgr_clk),
 	CLK("davinci_emac.1",	NULL,		&emac_clk),
+	CLK("davinci_mdio.0",   "fck",          &emac_clk),
 	CLK(NULL,		"gpio",		&gpio_clk),
 	CLK("i2c_davinci.2",	NULL,		&i2c1_clk),
 	CLK(NULL,		"usb11",	&usb11_clk),
arch/arm/mach-davinci/da850.c +1 -0
index 5ef37f9..f56e5fb 100644
@@ -461,6 +461,7 @@ static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"arm",		&arm_clk),
 	CLK(NULL,		"rmii",		&rmii_clk),
 	CLK("davinci_emac.1",	NULL,		&emac_clk),
+	CLK("davinci_mdio.0",	"fck",		&emac_clk),
 	CLK("davinci-mcasp.0",	NULL,		&mcasp_clk),
 	CLK("da8xx_lcdc.0",	"fck",		&lcdc_clk),
 	CLK("da830-mmc.0",	NULL,		&mmcsd0_clk),
arch/arm/mach-davinci/devices-da8xx.c +2 -6
index 280f67d..a408b30 100644
@@ -481,12 +481,8 @@ int __init da8xx_register_emac(void)
 	ret = platform_device_register(&da8xx_mdio_device);
 	if (ret < 0)
 		return ret;
-	ret = platform_device_register(&da8xx_emac_device);
-	if (ret < 0)
-		return ret;
-	ret = clk_add_alias(NULL, dev_name(&da8xx_mdio_device.dev),
-			    NULL, &da8xx_emac_device.dev);
-	return ret;
+
+	return platform_device_register(&da8xx_emac_device);
 }
 
 static struct resource da830_mcasp1_resources[] = {
arch/arm/mach-davinci/dm365.c +1 -2
index 3a039bc..278080d 100644
@@ -477,6 +477,7 @@ static struct clk_lookup dm365_clks[] = {
 	CLK(NULL, "timer3", &timer3_clk),
 	CLK(NULL, "usb", &usb_clk),
 	CLK("davinci_emac.1", NULL, &emac_clk),
+	CLK("davinci_mdio.0", "fck", &emac_clk),
 	CLK("davinci_voicecodec", NULL, &voicecodec_clk),
 	CLK("davinci-mcbsp", NULL, &asp0_clk),
 	CLK(NULL, "rto", &rto_clk),
@@ -1422,8 +1423,6 @@ static int __init dm365_init_devices(void)
 
 	platform_device_register(&dm365_mdio_device);
 	platform_device_register(&dm365_emac_device);
-	clk_add_alias(NULL, dev_name(&dm365_mdio_device.dev),
-		      NULL, &dm365_emac_device.dev);
 
 	return 0;
 }
arch/arm/mach-davinci/dm644x.c +1 -2
index 23de0de..4f74682 100644
@@ -307,6 +307,7 @@ static struct clk_lookup dm644x_clks[] = {
 	CLK("serial8250.1", NULL, &uart1_clk),
 	CLK("serial8250.2", NULL, &uart2_clk),
 	CLK("davinci_emac.1", NULL, &emac_clk),
+	CLK("davinci_mdio.0", "fck", &emac_clk),
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
 	CLK("palm_bk3710", NULL, &ide_clk),
 	CLK("davinci-mcbsp", NULL, &asp_clk),
@@ -950,8 +951,6 @@ static int __init dm644x_init_devices(void)
 
 	platform_device_register(&dm644x_mdio_device);
 	platform_device_register(&dm644x_emac_device);
-	clk_add_alias(NULL, dev_name(&dm644x_mdio_device.dev),
-		      NULL, &dm644x_emac_device.dev);
 
 	return 0;
 }
arch/arm/mach-davinci/dm646x.c +1 -2
index 4b25804..68f8d1f 100644
@@ -351,6 +351,7 @@ static struct clk_lookup dm646x_clks[] = {
 	CLK("davinci-mcasp.1", NULL, &mcasp1_clk),
 	CLK(NULL, "aemif", &aemif_clk),
 	CLK("davinci_emac.1", NULL, &emac_clk),
+	CLK("davinci_mdio.0", "fck", &emac_clk),
 	CLK(NULL, "pwm0", &pwm0_clk),
 	CLK(NULL, "pwm1", &pwm1_clk),
 	CLK(NULL, "timer0", &timer0_clk),
@@ -940,8 +941,6 @@ static int __init dm646x_init_devices(void)
 
 	platform_device_register(&dm646x_mdio_device);
 	platform_device_register(&dm646x_emac_device);
-	clk_add_alias(NULL, dev_name(&dm646x_mdio_device.dev),
-		      NULL, &dm646x_emac_device.dev);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v4 2/5 ARM: davinci: da850: add DT node for mdio device

In reply to Lad, Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add mdio device tree node information to da850 by providing register details and bus frequency of mdio.

---
Changes for v2: none

Changes for v3:
a> Added pin entries for mdio.

Changes for v4: none

 arch/arm/boot/dts/da850-evm.dts |    6 ++++++
 arch/arm/boot/dts/da850.dtsi    |   13 +++++++++++++
 2 files changed, 19 insertions(+)
arch/arm/boot/dts/da850-evm.dts +6 -0
index 5bce7cc..1f8cfdd 100644
@@ -90,6 +90,12 @@
 				};
 			};
 		};
+		mdio: mdio at 1e24000 {
+			status = "okay";
+			pinctrl-names = "default";
+			pinctrl-0 = <&mdio_pins>;
+			bus_freq = <2200000>;
+		};
 	};
 	nand_cs3 at 62000000 {
 		status = "okay";
arch/arm/boot/dts/da850.dtsi +13 -0
index 5f7e79a..d5138b4 100644
@@ -125,6 +125,13 @@
 					0x14 0x00000010 0x000000f0
 				>;
 			};
+			mdio_pins: pinmux_mdio_pins {
+				pinctrl-single,bits = <
+					/* MDIO_CLK, MDIO_D */
+					0x10 0x00000088 0x000000ff
+				>;
+			};
+
 		};
 		serial0: serial at 1c42000 {
 			compatible = "ns16550a";
@@ -213,6 +220,12 @@
 			interrupts = <56>;
 			status = "disabled";
 		};
+		mdio: mdio at 1e24000 {
+			compatible = "ti,davinci_mdio";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x224000 0x1000>;
+		};
 	};
 	nand_cs3 at 62000000 {
 		compatible = "ti,davinci-nand";
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v4 3/5 ARM: davinci: da850: add OF_DEV_AUXDATA entry for mdio.

In reply to Lad, Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add OF_DEV_AUXDATA for mdio driver in da850 board dt file to use mdio clock.

---
Changes for v2: none
Changes for v3: none
Changes for v4: none

 arch/arm/mach-davinci/da8xx-dt.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/da8xx-dt.c +1 -0
index 9683cbd..d172563 100644
@@ -43,6 +43,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ns16550a", 0x01c42000, "serial8250.0", NULL),
 	OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL),
 	OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL),
+	OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL),
 	{}
 };
 
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v4 4/5 ARM: davinci: da850: add DT node for eth0.

In reply to Lad, Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add eth0 device tree node information and pinmux for mii to da850 by providing interrupt details and local mac address of eth0.

---
Changes for v2: None

Changes for v3:
a> Split the pinmux for mdio and mii.

Changes for v4: none

 arch/arm/boot/dts/da850-evm.dts |    5 +++++
 arch/arm/boot/dts/da850.dtsi    |   30 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
arch/arm/boot/dts/da850-evm.dts +5 -0
index 1f8cfdd..65bc080 100644
@@ -96,6 +96,11 @@
 			pinctrl-0 = <&mdio_pins>;
 			bus_freq = <2200000>;
 		};
+		eth0: emac at 1e20000 {
+			status = "okay";
+			pinctrl-names = "default";
+			pinctrl-0 = <&mii_pins>;
+		};
 	};
 	nand_cs3 at 62000000 {
 		status = "okay";
arch/arm/boot/dts/da850.dtsi +30 -0
index d5138b4..911f647 100644
@@ -131,6 +131,22 @@
 					0x10 0x00000088 0x000000ff
 				>;
 			};
+			mii_pins: pinmux_mii_pins {
+				pinctrl-single,bits = <
+					/*
+					 * MII_TXEN, MII_TXCLK, MII_COL
+					 * MII_TXD_3, MII_TXD_2, MII_TXD_1
+					 * MII_TXD_0
+					 */
+					0x8 0x88888880 0xfffffff0
+					/*
+					 * MII_RXER, MII_CRS, MII_RXCLK
+					 * MII_RXDV, MII_RXD_3, MII_RXD_2
+					 * MII_RXD_1, MII_RXD_0
+					 */
+					0xc 0x88888888 0xffffffff
+				>;
+			};
 
 		};
 		serial0: serial at 1c42000 {
@@ -226,6 +242,20 @@
 			#size-cells = <0>;
 			reg = <0x224000 0x1000>;
 		};
+		eth0: emac at 1e20000 {
+			compatible = "ti,davinci-dm6467-emac";
+			reg = <0x220000 0x4000>;
+			ti,davinci-ctrl-reg-offset = <0x3000>;
+			ti,davinci-ctrl-mod-reg-offset = <0x2000>;
+			ti,davinci-ctrl-ram-offset = <0>;
+			ti,davinci-ctrl-ram-size = <0x2000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <33
+					34
+					35
+					36
+					>;
+		};
 	};
 	nand_cs3 at 62000000 {
 		compatible = "ti,davinci-nand";
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v4 5/5 ARM: davinci: da850: add OF_DEV_AUXDATA entry for eth0.

In reply to Lad, Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add OF_DEV_AUXDATA for eth0 driver in da850 board dt file to use emac clock.

---
Changes for V2: none
Changes for V3: none
Changes for v4: none

 arch/arm/mach-davinci/da8xx-dt.c |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-davinci/da8xx-dt.c +3 -0
index d172563..caa9202 100644
@@ -44,6 +44,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL),
 	OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL),
 	OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL),
+	OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1",
+		       NULL),
+
 	{}
 };
 
Signature · 1 line
1.7.9.5
#8 lore raw

Re: [PATCH v4 4/5] ARM: davinci: da850: add DT node for eth0.

In reply to Lad, Prabhakar

Hello.

Quoted 6 lines · Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add eth0 device tree node information and pinmux for mii to da850 by providing interrupt details and local mac address of eth0.

[...]

arch/arm/boot/dts/da850.dtsi line 245

Quoted 5 lines
arch/arm/boot/dts/da850.dtsi +1 -0
@@ -226,6 +242,20 @@
  			#size-cells = <0>;
  			reg = <0x224000 0x1000>;
  		};
+		eth0: emac@1e20000 {

According to the ePAPR spec[1] section 2.2.2, the node should be named
"ethernet".

[1] http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf

WBR, Sergei

#11 lore raw

Re: [PATCH v4 5/5] ARM: davinci: da850: add OF_DEV_AUXDATA entry for eth0.

In reply to Lad, Prabhakar

Hello.

Quoted 6 lines · Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add OF_DEV_AUXDATA for eth0 driver in da850 board dt file to use emac clock.

[...]

arch/arm/mach-davinci/da8xx-dt.c static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { · line 49

Quoted 11 lines
arch/arm/mach-davinci/da8xx-dt.c +3 -0
index d172563..caa9202 100644
@@ -44,6 +44,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
  	OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL),
  	OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL),
  	OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL),
+	OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1",
+		       NULL),
+

Empty line hardly needed here.

arch/arm/mach-davinci/da8xx-dt.c static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { · line 51

Quoted 2 lines
arch/arm/mach-davinci/da8xx-dt.c +0 -0
  	{}
  };

WBR, Sergei

#9 lore raw

Re: [PATCH v4 4/5] ARM: davinci: da850: add DT node for eth0.

In reply to Sergei Shtylyov

Hi Sergei,

Quoted 17 lines · Sergei Shtylyov

Hello.

Quoted 8 lines · Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add eth0 device tree node information and pinmux for mii to da850 by providing interrupt details and local mac address of eth0.

[...]

Quoted 10 lines

arch/arm/boot/dts/da850.dtsi line 245

Quoted 5 lines
arch/arm/boot/dts/da850.dtsi +1 -0
@@ -226,6 +242,20 @@
                        #size-cells = <0>;
                        reg = <0x224000 0x1000>;
                };
+               eth0: emac at 1e20000 {

According to the ePAPR spec[1] section 2.2.2, the node should be named
"ethernet".

Thanks for pointing it, I'll fix and repost it.

Regards,
--Prabhakar Lad

Quoted 4 lines

[1] http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf

WBR, Sergei

#12 lore raw

Re: [PATCH v4 5/5] ARM: davinci: da850: add OF_DEV_AUXDATA entry for eth0.

In reply to Sergei Shtylyov

Hi Sergei,

Quoted 27 lines · Sergei Shtylyov

Hello.

Quoted 8 lines · Prabhakar

From: "Lad, Prabhakar" <[email protected]>

Add OF_DEV_AUXDATA for eth0 driver in da850 board dt file to use emac clock.

[...]

Quoted 10 lines
arch/arm/mach-davinci/da8xx-dt.c +0 -0
index d172563..caa9202 100644
@@ -44,6 +44,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[]
 __initdata = {
        OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL),
        OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL),
        OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0",
Quoted 9 lines

arch/arm/mach-davinci/da8xx-dt.c static struct of_dev_auxdata da850_auxdata_lookup[] · line 52

Quoted 5 lines
arch/arm/mach-davinci/da8xx-dt.c +3 -0
 NULL),
+       OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000,
 "davinci_emac.1",
+                      NULL),
+

Empty line hardly needed here.

Ah my bad, will fix and repost.

Regards,
--Prabhakar Lad