All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: sunxi: dt: add EMAC aliases
@ 2013-11-15 20:16 Emilio López
  2013-11-16  6:32 ` Maxime Ripard
  2013-11-16 18:17 ` [PATCH v2] " Emilio López
  0 siblings, 2 replies; 9+ messages in thread
From: Emilio López @ 2013-11-15 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

U-Boot uses the ethernet0 alias to locate the right node to fill in
the MAC address of the first ethernet interface. This patch adds the
alias on all the sunxi boards with EMAC and an ethernet port. In this
way, people using ethernet in U-Boot (eg, for tftp) can keep a consistent
address on both U-Boot and Linux with no additional effort.

Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
---

Hi everyone,

I have tested this on a cubieboard2 and found it to work as intended, 
and I don't see why it wouldn't work on the other boards, given that 
the U-Boot codebase is shared. It may be worth submitting this for 
3.13-rc0, but I'm not the one that has to make that call :)

Cheers,

Emilio

 arch/arm/boot/dts/sun4i-a10-a1000.dts            | 1 +
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts       | 1 +
 arch/arm/boot/dts/sun4i-a10-hackberry.dts        | 4 ++++
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 4 ++++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts      | 4 ++++
 arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts  | 4 ++++
 6 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index eb4d73b..6e56986 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -20,6 +20,7 @@
 
 	aliases {
 		serial0 = &uart0;
+		ethernet0 = &emac;
 	};
 
 	soc at 01c00000 {
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 425a7db..c2e251d 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -20,6 +20,7 @@
 	aliases {
 		serial0 = &uart0;
 		serial1 = &uart1;
+		ethernet0 = &emac;
 	};
 
 	chosen {
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index b3ae51f..551ccbd 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -18,6 +18,10 @@
 	model = "Miniand Hackberry";
 	compatible = "miniand,hackberry", "allwinner,sun4i-a10";
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	chosen {
 		bootargs = "earlyprintk console=ttyS0,115200";
 	};
diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
index 88ec795..bb48737 100644
--- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
@@ -18,6 +18,10 @@
 	model = "Olimex A10s-Olinuxino Micro";
 	compatible = "olimex,a10s-olinuxino-micro", "allwinner,sun5i-a10s";
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	soc at 01c00000 {
 		emac: ethernet at 01c0b000 {
 			pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index 15e625e..cad4c19 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -18,6 +18,10 @@
 	model = "Cubietech Cubieboard2";
 	compatible = "cubietech,cubieboard2", "allwinner,sun7i-a20";
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	soc at 01c00000 {
 		emac: ethernet at 01c0b000 {
 			pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index 9e77855..39e1fd0 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -18,6 +18,10 @@
 	model = "Olimex A20-Olinuxino Micro";
 	compatible = "olimex,a20-olinuxino-micro", "allwinner,sun7i-a20";
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	soc at 01c00000 {
 		emac: ethernet at 01c0b000 {
 			pinctrl-names = "default";
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] ARM: sunxi: dt: add EMAC aliases
  2013-11-15 20:16 [PATCH] ARM: sunxi: dt: add EMAC aliases Emilio López
@ 2013-11-16  6:32 ` Maxime Ripard
  2013-11-16 18:17 ` [PATCH v2] " Emilio López
  1 sibling, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2013-11-16  6:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Emilio,

On Fri, Nov 15, 2013 at 05:16:40PM -0300, Emilio L?pez wrote:
> U-Boot uses the ethernet0 alias to locate the right node to fill in
> the MAC address of the first ethernet interface. This patch adds the
> alias on all the sunxi boards with EMAC and an ethernet port. In this
> way, people using ethernet in U-Boot (eg, for tftp) can keep a consistent
> address on both U-Boot and Linux with no additional effort.
> 
> Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
> ---
> 
> Hi everyone,
> 
> I have tested this on a cubieboard2 and found it to work as intended, 
> and I don't see why it wouldn't work on the other boards, given that 
> the U-Boot codebase is shared. It may be worth submitting this for 
> 3.13-rc0, but I'm not the one that has to make that call :)
> 
> Cheers,
> 
> Emilio
> 
>  arch/arm/boot/dts/sun4i-a10-a1000.dts            | 1 +
>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts       | 1 +
>  arch/arm/boot/dts/sun4i-a10-hackberry.dts        | 4 ++++
>  arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 4 ++++
>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts      | 4 ++++
>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts  | 4 ++++
>  6 files changed, 18 insertions(+)

I think it would make more sense to add it to the dtsi.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131116/aeaed47a/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-15 20:16 [PATCH] ARM: sunxi: dt: add EMAC aliases Emilio López
  2013-11-16  6:32 ` Maxime Ripard
@ 2013-11-16 18:17 ` Emilio López
  2013-11-16 23:37   ` Michal Suchanek
  2013-11-17  8:52   ` Maxime Ripard
  1 sibling, 2 replies; 9+ messages in thread
From: Emilio López @ 2013-11-16 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

U-Boot uses the ethernet0 alias to locate the right node to fill in
the MAC address of the first ethernet interface. This patch adds the
alias on all the sunxi SoCs with EMAC. In this way, people using
ethernet in U-Boot (eg, for tftp) can keep a consistent address on both
U-Boot and Linux with no additional effort.

Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
---

v1->v2:
   add to dtsi instead of dts as suggested by Maxime; it's easier to 
   maintain on the long run.

 arch/arm/boot/dts/sun4i-a10.dtsi  | 4 ++++
 arch/arm/boot/dts/sun5i-a10s.dtsi | 4 ++++
 arch/arm/boot/dts/sun7i-a20.dtsi  | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 09e7b43..23374da 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -15,6 +15,10 @@
 / {
 	interrupt-parent = <&intc>;
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 9326b64..e95ab43 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -16,6 +16,10 @@
 / {
 	interrupt-parent = <&intc>;
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	cpus {
 		cpu at 0 {
 			compatible = "arm,cortex-a8";
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index c645a0f..6bea2b84 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -16,6 +16,10 @@
 / {
 	interrupt-parent = <&gic>;
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-16 18:17 ` [PATCH v2] " Emilio López
@ 2013-11-16 23:37   ` Michal Suchanek
  2013-11-16 23:48     ` Emilio López
  2013-11-17  8:52   ` Maxime Ripard
  1 sibling, 1 reply; 9+ messages in thread
From: Michal Suchanek @ 2013-11-16 23:37 UTC (permalink / raw)
  To: linux-arm-kernel

Unfortunately,

a20 has two Ethernets so you can't alias both to ethernet0.

This has to be done on a per-board basis.

Thanks

Michal

On 16 November 2013 19:17, Emilio L?pez <emilio@elopez.com.ar> wrote:
> U-Boot uses the ethernet0 alias to locate the right node to fill in
> the MAC address of the first ethernet interface. This patch adds the
> alias on all the sunxi SoCs with EMAC. In this way, people using
> ethernet in U-Boot (eg, for tftp) can keep a consistent address on both
> U-Boot and Linux with no additional effort.
>
> Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
> ---
>
> v1->v2:
>    add to dtsi instead of dts as suggested by Maxime; it's easier to
>    maintain on the long run.
>
>  arch/arm/boot/dts/sun4i-a10.dtsi  | 4 ++++
>  arch/arm/boot/dts/sun5i-a10s.dtsi | 4 ++++
>  arch/arm/boot/dts/sun7i-a20.dtsi  | 4 ++++
>  3 files changed, 12 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
> index 09e7b43..23374da 100644
> --- a/arch/arm/boot/dts/sun4i-a10.dtsi
> +++ b/arch/arm/boot/dts/sun4i-a10.dtsi
> @@ -15,6 +15,10 @@
>  / {
>         interrupt-parent = <&intc>;
>
> +       aliases {
> +               ethernet0 = &emac;
> +       };
> +
>         cpus {
>                 #address-cells = <1>;
>                 #size-cells = <0>;
> diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
> index 9326b64..e95ab43 100644
> --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
> +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
> @@ -16,6 +16,10 @@
>  / {
>         interrupt-parent = <&intc>;
>
> +       aliases {
> +               ethernet0 = &emac;
> +       };
> +
>         cpus {
>                 cpu at 0 {
>                         compatible = "arm,cortex-a8";
> diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
> index c645a0f..6bea2b84 100644
> --- a/arch/arm/boot/dts/sun7i-a20.dtsi
> +++ b/arch/arm/boot/dts/sun7i-a20.dtsi
> @@ -16,6 +16,10 @@
>  / {
>         interrupt-parent = <&gic>;
>
> +       aliases {
> +               ethernet0 = &emac;
> +       };
> +
>         cpus {
>                 #address-cells = <1>;
>                 #size-cells = <0>;
> --
> 1.8.4.2
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-16 23:37   ` Michal Suchanek
@ 2013-11-16 23:48     ` Emilio López
  2013-11-17  8:38       ` Maxime Ripard
  0 siblings, 1 reply; 9+ messages in thread
From: Emilio López @ 2013-11-16 23:48 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

El 16/11/13 20:37, Michal Suchanek escribi?:
> Unfortunately,
>
> a20 has two Ethernets so you can't alias both to ethernet0.
>
> This has to be done on a per-board basis.
>

That was my first thought, and partly why I did it per-board on v1 (the 
other part being that some boards do not have a phy, so having an 
ethernet0 alias felt "wrong"). But after some quick testing, it appears 
that aliases are overridable, so we could just add ethernet0 = &gmac; on 
qualifying boards when the gmac support is ready.

Cheers,

Emilio

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-16 23:48     ` Emilio López
@ 2013-11-17  8:38       ` Maxime Ripard
  2013-11-18 13:07         ` Michal Suchanek
  0 siblings, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2013-11-17  8:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Sat, Nov 16, 2013 at 08:48:48PM -0300, Emilio L?pez wrote:
> Hi,
> 
> El 16/11/13 20:37, Michal Suchanek escribi?:
> >Unfortunately,
> >
> >a20 has two Ethernets so you can't alias both to ethernet0.
> >
> >This has to be done on a per-board basis.
> >
> 
> That was my first thought, and partly why I did it per-board on v1
> (the other part being that some boards do not have a phy, so having
> an ethernet0 alias felt "wrong"). But after some quick testing, it
> appears that aliases are overridable, so we could just add ethernet0
> = &gmac; on qualifying boards when the gmac support is ready.

Or we will just add it as ethernet1. U-boot is able to put the
mac-address in the DT for every ethernet* nodes for as much ethernet
nodes as you need.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131117/ffd0ff45/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-16 18:17 ` [PATCH v2] " Emilio López
  2013-11-16 23:37   ` Michal Suchanek
@ 2013-11-17  8:52   ` Maxime Ripard
  1 sibling, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2013-11-17  8:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 16, 2013 at 03:17:29PM -0300, Emilio L?pez wrote:
> U-Boot uses the ethernet0 alias to locate the right node to fill in
> the MAC address of the first ethernet interface. This patch adds the
> alias on all the sunxi SoCs with EMAC. In this way, people using
> ethernet in U-Boot (eg, for tftp) can keep a consistent address on both
> U-Boot and Linux with no additional effort.
> 
> Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>

Applied to my sunxi/dt-for-3.14 branch.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131117/346dec6e/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-17  8:38       ` Maxime Ripard
@ 2013-11-18 13:07         ` Michal Suchanek
  2013-11-18 13:14           ` Maxime Ripard
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Suchanek @ 2013-11-18 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 17 November 2013 09:38, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Sat, Nov 16, 2013 at 08:48:48PM -0300, Emilio L?pez wrote:
>> Hi,
>>
>> El 16/11/13 20:37, Michal Suchanek escribi?:
>> >Unfortunately,
>> >
>> >a20 has two Ethernets so you can't alias both to ethernet0.
>> >
>> >This has to be done on a per-board basis.
>> >
>>
>> That was my first thought, and partly why I did it per-board on v1
>> (the other part being that some boards do not have a phy, so having
>> an ethernet0 alias felt "wrong"). But after some quick testing, it
>> appears that aliases are overridable, so we could just add ethernet0
>> = &gmac; on qualifying boards when the gmac support is ready.
>
> Or we will just add it as ethernet1. U-boot is able to put the
> mac-address in the DT for every ethernet* nodes for as much ethernet
> nodes as you need.

I guess that would be fine for CT and CB2 which can have only one
physical ethernet (unless there are pins for adding another PHY) but
if there is ever board with two ethernets you want only one of them to
 get the mac address from u-boot.

Thanks

Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: sunxi: dt: add EMAC aliases
  2013-11-18 13:07         ` Michal Suchanek
@ 2013-11-18 13:14           ` Maxime Ripard
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2013-11-18 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 18, 2013 at 02:07:07PM +0100, Michal Suchanek wrote:
> >> That was my first thought, and partly why I did it per-board on v1
> >> (the other part being that some boards do not have a phy, so having
> >> an ethernet0 alias felt "wrong"). But after some quick testing, it
> >> appears that aliases are overridable, so we could just add ethernet0
> >> = &gmac; on qualifying boards when the gmac support is ready.
> >
> > Or we will just add it as ethernet1. U-boot is able to put the
> > mac-address in the DT for every ethernet* nodes for as much ethernet
> > nodes as you need.
> 
> I guess that would be fine for CT and CB2 which can have only one
> physical ethernet (unless there are pins for adding another PHY) but
> if there is ever board with two ethernets you want only one of them to
>  get the mac address from u-boot.

I'm not sure to get why. ethernet0 would get ethaddr, ethernet1 would
get eth1addr. How is that an issue?

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131118/6e37df2d/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-11-18 13:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 20:16 [PATCH] ARM: sunxi: dt: add EMAC aliases Emilio López
2013-11-16  6:32 ` Maxime Ripard
2013-11-16 18:17 ` [PATCH v2] " Emilio López
2013-11-16 23:37   ` Michal Suchanek
2013-11-16 23:48     ` Emilio López
2013-11-17  8:38       ` Maxime Ripard
2013-11-18 13:07         ` Michal Suchanek
2013-11-18 13:14           ` Maxime Ripard
2013-11-17  8:52   ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.