2013-08-15 06:02:10

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v4 0/5] 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(-)

--
1.7.9.5


2013-08-15 06:02:16

by Lad, Prabhakar

[permalink] [raw]
Subject: [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.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
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(-)

diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 111613b..d6c746e 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -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),
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 5ef37f9..f56e5fb 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -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),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 280f67d..a408b30 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -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[] = {
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 3a039bc..278080d 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -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;
}
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 23de0de..4f74682 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -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;
}
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 4b25804..68f8d1f 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -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;
}
--
1.7.9.5

2013-08-15 06:02:30

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v4 2/5] ARM: davinci: da850: add DT node for mdio device

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

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

Signed-off-by: Lad, Prabhakar <[email protected]>
---
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(+)

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

2013-08-15 06:02:42

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v4 3/5] ARM: davinci: da850: add OF_DEV_AUXDATA entry for mdio.

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

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

Signed-off-by: Lad, Prabhakar <[email protected]>
---
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(+)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 9683cbd..d172563 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -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),
{}
};

--
1.7.9.5

2013-08-15 06:02:52

by Lad, Prabhakar

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

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.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
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(+)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 1f8cfdd..65bc080 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -96,6 +96,11 @@
pinctrl-0 = <&mdio_pins>;
bus_freq = <2200000>;
};
+ eth0: emac@1e20000 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mii_pins>;
+ };
};
nand_cs3@62000000 {
status = "okay";
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index d5138b4..911f647 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -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@1c42000 {
@@ -226,6 +242,20 @@
#size-cells = <0>;
reg = <0x224000 0x1000>;
};
+ eth0: emac@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@62000000 {
compatible = "ti,davinci-nand";
--
1.7.9.5

2013-08-15 06:02:58

by Lad, Prabhakar

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

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

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

Signed-off-by: Lad, Prabhakar <[email protected]>
---
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(+)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index d172563..caa9202 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -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),
+
{}
};

--
1.7.9.5

2013-08-15 19:30:21

by Sergei Shtylyov

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

Hello.

On 15-08-2013 10:01, Lad, Prabhakar wrote:

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

> Signed-off-by: Lad, Prabhakar <[email protected]>
[...]

> @@ -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

2013-08-15 19:31:55

by Sergei Shtylyov

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

Hello.

On 15-08-2013 10:01, Lad, Prabhakar wrote:

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

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

> Signed-off-by: Lad, Prabhakar <[email protected]>
[...]

> diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
> index d172563..caa9202 100644
> --- a/arch/arm/mach-davinci/da8xx-dt.c
> +++ b/arch/arm/mach-davinci/da8xx-dt.c
> @@ -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.

> {}
> };

WBR, Sergei

2013-08-16 04:07:54

by Lad, Prabhakar

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

Hi Sergei,

On Fri, Aug 16, 2013 at 1:00 AM, Sergei Shtylyov
<[email protected]> wrote:
> Hello.
>
>
> On 15-08-2013 10:01, Lad, Prabhakar wrote:
>
>> 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.
>
>
>> Signed-off-by: Lad, Prabhakar <[email protected]>
>
> [...]
>
>
>> @@ -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".
>
Thanks for pointing it, I'll fix and repost it.

Regards,
--Prabhakar Lad

> [1] http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf
>
> WBR, Sergei
>

2013-08-16 04:08:53

by Lad, Prabhakar

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

Hi Sergei,

On Fri, Aug 16, 2013 at 1:01 AM, Sergei Shtylyov
<[email protected]> wrote:
> Hello.
>
>
> On 15-08-2013 10:01, Lad, Prabhakar wrote:
>
>> From: "Lad, Prabhakar" <[email protected]>
>
>
>> Add OF_DEV_AUXDATA for eth0 driver in da850 board dt
>> file to use emac clock.
>
>
>> Signed-off-by: Lad, Prabhakar <[email protected]>
>
> [...]
>
>
>> diff --git a/arch/arm/mach-davinci/da8xx-dt.c
>> b/arch/arm/mach-davinci/da8xx-dt.c
>> index d172563..caa9202 100644
>> --- a/arch/arm/mach-davinci/da8xx-dt.c
>> +++ b/arch/arm/mach-davinci/da8xx-dt.c
>> @@ -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.
>
Ah my bad, will fix and repost.

Regards,
--Prabhakar Lad

2013-08-16 12:39:23

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 1/5] ARM: davinci: fix clock lookup for mdio device

On Thursday 15 August 2013 11:31 AM, Lad, Prabhakar wrote:
> 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.
>
> Signed-off-by: Lad, Prabhakar <[email protected]>

Queuing for v3.12

Thanks,
Sekhar

2013-08-16 12:45:28

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 2/5] ARM: davinci: da850: add DT node for mdio device

On Thursday 15 August 2013 11:31 AM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <[email protected]>
>
> Add mdio device tree node information to da850 by
> providing register details and bus frequency of mdio.
>
> Signed-off-by: Lad, Prabhakar <[email protected]>

Queuing for v3.12

Thanks,
Sekhar

2013-08-16 15:59:31

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v4 3/5] ARM: davinci: da850: add OF_DEV_AUXDATA entry for mdio.

On 8/15/2013 11:31 AM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <[email protected]>
>
> Add OF_DEV_AUXDATA for mdio driver in da850 board dt
> file to use mdio clock.
>
> Signed-off-by: Lad, Prabhakar <[email protected]>

Queued for v3.12

Thanks,
Sekhar