diff mbox

[U-Boot,3/4] sunxi: add stub EMAC device node in A83T device tree

Message ID 20170702070244.10539-4-icenowy@aosc.io
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Icenowy Zheng July 2, 2017, 7:02 a.m. UTC
The Allwinner A83T SoC has an EMAC which is already supported by
sun8i_emac driver in U-Boot now.

Add a stub device node for it.

The device node cannot work for Linux, because it now lacks the proper
clock definition; however, it can satisfy sun8i_emac driver in U-Boot.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/dts/sun8i-a83t.dtsi | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Maxime Ripard July 3, 2017, 6:52 a.m. UTC | #1
On Sun, Jul 02, 2017 at 03:02:43PM +0800, Icenowy Zheng wrote:
> The Allwinner A83T SoC has an EMAC which is already supported by
> sun8i_emac driver in U-Boot now.
> 
> Add a stub device node for it.
> 
> The device node cannot work for Linux, because it now lacks the proper
> clock definition; however, it can satisfy sun8i_emac driver in U-Boot.

Uh?

There is clock support in Linux.

Maxime
Icenowy Zheng July 3, 2017, 6:54 a.m. UTC | #2
于 2017年7月3日 GMT+08:00 下午2:52:00, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Sun, Jul 02, 2017 at 03:02:43PM +0800, Icenowy Zheng wrote:
>> The Allwinner A83T SoC has an EMAC which is already supported by
>> sun8i_emac driver in U-Boot now.
>> 
>> Add a stub device node for it.
>> 
>> The device node cannot work for Linux, because it now lacks the
>proper
>> clock definition; however, it can satisfy sun8i_emac driver in
>U-Boot.
>
>Uh?
>
>There is clock support in Linux.

But adding it will largely change U-Boot DT.

I may do it then, in a sync between Linux and U-Boot DT.

>
>Maxime
Maxime Ripard July 3, 2017, 8:46 p.m. UTC | #3
On Mon, Jul 03, 2017 at 02:54:17PM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年7月3日 GMT+08:00 下午2:52:00, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Sun, Jul 02, 2017 at 03:02:43PM +0800, Icenowy Zheng wrote:
> >> The Allwinner A83T SoC has an EMAC which is already supported by
> >> sun8i_emac driver in U-Boot now.
> >> 
> >> Add a stub device node for it.
> >> 
> >> The device node cannot work for Linux, because it now lacks the
> >proper
> >> clock definition; however, it can satisfy sun8i_emac driver in
> >U-Boot.
> >
> >Uh?
> >
> >There is clock support in Linux.
> 
> But adding it will largely change U-Boot DT.
> 
> I may do it then, in a sync between Linux and U-Boot DT.

Why not send the patches to Linux, and just sync the DT later?

Maxime
Icenowy Zheng July 4, 2017, 12:07 a.m. UTC | #4
于 2017年7月4日 GMT+08:00 上午4:46:17, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>On Mon, Jul 03, 2017 at 02:54:17PM +0800, Icenowy Zheng wrote:
>> 
>> 
>> 于 2017年7月3日 GMT+08:00 下午2:52:00, Maxime Ripard
><maxime.ripard@free-electrons.com> 写到:
>> >On Sun, Jul 02, 2017 at 03:02:43PM +0800, Icenowy Zheng wrote:
>> >> The Allwinner A83T SoC has an EMAC which is already supported by
>> >> sun8i_emac driver in U-Boot now.
>> >> 
>> >> Add a stub device node for it.
>> >> 
>> >> The device node cannot work for Linux, because it now lacks the
>> >proper
>> >> clock definition; however, it can satisfy sun8i_emac driver in
>> >U-Boot.
>> >
>> >Uh?
>> >
>> >There is clock support in Linux.
>> 
>> But adding it will largely change U-Boot DT.
>> 
>> I may do it then, in a sync between Linux and U-Boot DT.
>
>Why not send the patches to Linux, and just sync the DT later?

The U-Boot DT have already changed from the Linux one for a lot.

Maybe I need to use the DT of at least 4.14...

>
>Maxime
Maxime Ripard July 4, 2017, 9:21 p.m. UTC | #5
On Tue, Jul 04, 2017 at 08:07:42AM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年7月4日 GMT+08:00 上午4:46:17, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Mon, Jul 03, 2017 at 02:54:17PM +0800, Icenowy Zheng wrote:
> >> 
> >> 
> >> 于 2017年7月3日 GMT+08:00 下午2:52:00, Maxime Ripard
> ><maxime.ripard@free-electrons.com> 写到:
> >> >On Sun, Jul 02, 2017 at 03:02:43PM +0800, Icenowy Zheng wrote:
> >> >> The Allwinner A83T SoC has an EMAC which is already supported by
> >> >> sun8i_emac driver in U-Boot now.
> >> >> 
> >> >> Add a stub device node for it.
> >> >> 
> >> >> The device node cannot work for Linux, because it now lacks the
> >> >proper
> >> >> clock definition; however, it can satisfy sun8i_emac driver in
> >> >U-Boot.
> >> >
> >> >Uh?
> >> >
> >> >There is clock support in Linux.
> >> 
> >> But adding it will largely change U-Boot DT.
> >> 
> >> I may do it then, in a sync between Linux and U-Boot DT.
> >
> >Why not send the patches to Linux, and just sync the DT later?
> 
> The U-Boot DT have already changed from the Linux one for a lot.

Yes, and we had a good reason, the ethernet binding wasn't there
yet. Fortunately, this isn't the case anymore, so there's no reason to
diverge anymore.

> Maybe I need to use the DT of at least 4.14...

Merging something that is in linux-next is definitely ok.

Maxime
Andre Przywara July 6, 2017, 10:09 a.m. UTC | #6
Hi,

On 02/07/17 08:02, Icenowy Zheng wrote:
> The Allwinner A83T SoC has an EMAC which is already supported by
> sun8i_emac driver in U-Boot now.
> 
> Add a stub device node for it.
> 
> The device node cannot work for Linux, because it now lacks the proper
> clock definition; however, it can satisfy sun8i_emac driver in U-Boot.

if you rebase your series on top of mine [1], you should be able to
directly use mainline Linux DT nodes, namely ...

> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  arch/arm/dts/sun8i-a83t.dtsi | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm/dts/sun8i-a83t.dtsi b/arch/arm/dts/sun8i-a83t.dtsi
> index 0fe73e173f..9aac3a7929 100644
> --- a/arch/arm/dts/sun8i-a83t.dtsi
> +++ b/arch/arm/dts/sun8i-a83t.dtsi
> @@ -52,6 +52,10 @@
>  / {
>  	interrupt-parent = <&gic>;
>  
> +	aliases {
> +		ethernet0 = &emac;
> +	};
> +
>  	cpus {
>  		#address-cells = <1>;
>  		#size-cells = <0>;
> @@ -166,6 +170,17 @@
>  			#interrupt-cells = <3>;
>  			#gpio-cells = <3>;
>  
> +			emac_rgmii_pins: emac-rgmii {
> +				allwinner,pins = "PD2", "PD3", "PD4", "PD5",
> +						"PD6", "PD7", "PD11",
> +						"PD12", "PD13", "PD14",
> +						"PD18", "PD19", "PD21",
> +						"PD22", "PD23";
> +				allwinner,function = "emac";
> +				allwinner,drive = <SUN4I_PINCTRL_40_MA>;
> +				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;

... using the new generic pinctrl bindings here ...

> +			};
> +
>  			mmc0_pins_a: mmc0@0 {
>  				allwinner,pins = "PF0", "PF1", "PF2",
>  						 "PF3", "PF4", "PF5";
> @@ -214,6 +229,16 @@
>  			status = "disabled";
>  		};
>  
> +		emac: ethernet@1c30000 {
> +			compatible = "allwinner,sun8i-a83t-emac";
> +			reg = <0x01c30000 0x104>, <0x01c00030 0x4>;
> +			reg-names = "emac", "syscon";
> +			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			status = "disabled";

... and using the new binding scheme here, with a "syscon" property, for
instance.

Also the Linux binding requires an mdio child node, which should be
introduced here.

Cheers,
Andre.


> +		};
> +
>  		gic: interrupt-controller@01c81000 {
>  			compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
>  			reg = <0x01c81000 0x1000>,
>
diff mbox

Patch

diff --git a/arch/arm/dts/sun8i-a83t.dtsi b/arch/arm/dts/sun8i-a83t.dtsi
index 0fe73e173f..9aac3a7929 100644
--- a/arch/arm/dts/sun8i-a83t.dtsi
+++ b/arch/arm/dts/sun8i-a83t.dtsi
@@ -52,6 +52,10 @@ 
 / {
 	interrupt-parent = <&gic>;
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -166,6 +170,17 @@ 
 			#interrupt-cells = <3>;
 			#gpio-cells = <3>;
 
+			emac_rgmii_pins: emac-rgmii {
+				allwinner,pins = "PD2", "PD3", "PD4", "PD5",
+						"PD6", "PD7", "PD11",
+						"PD12", "PD13", "PD14",
+						"PD18", "PD19", "PD21",
+						"PD22", "PD23";
+				allwinner,function = "emac";
+				allwinner,drive = <SUN4I_PINCTRL_40_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			mmc0_pins_a: mmc0@0 {
 				allwinner,pins = "PF0", "PF1", "PF2",
 						 "PF3", "PF4", "PF5";
@@ -214,6 +229,16 @@ 
 			status = "disabled";
 		};
 
+		emac: ethernet@1c30000 {
+			compatible = "allwinner,sun8i-a83t-emac";
+			reg = <0x01c30000 0x104>, <0x01c00030 0x4>;
+			reg-names = "emac", "syscon";
+			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		gic: interrupt-controller@01c81000 {
 			compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
 			reg = <0x01c81000 0x1000>,