linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARC: AXS10x/HSDK: Allow U-Boot to pass MAC-address to the kernel
@ 2018-08-02 10:19 Alexey Brodkin
  2018-08-02 21:58 ` Vineet Gupta
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Brodkin @ 2018-08-02 10:19 UTC (permalink / raw)
  To: linux-snps-arc
  Cc: linux-kernel, Vineet Gupta, Alexey Brodkin, Rob Herring, stable,
	devicetree

Otherwise kernel uses random MAC which is not very conveniet.
With that change in place use might set desired MAC in U-Boot
with "setenv ethaddr 11:22:33:44:55:66", save environment and
then from boot to boot the same MAC will be used by the kernel.

One other note for this to happen it's required to pass
board's .dtb in U-Boot's "bootm" command like that:
------------------->8-----------------
bootm 0x82000000 - 0x84000000
------------------->8-----------------

Here 0x82000000 is location of uImage while
0x80000000 is location of either axs10x.dtb or hsdk.dtb
previously loaded from SD-card, USB storage or TFTP server.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: stable@vger.kernel.org # 4.14
Cc: devicetree@vger.kernel.org
---
 arch/arc/boot/dts/axs10x_mb.dtsi | 7 ++++++-
 arch/arc/boot/dts/hsdk.dts       | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 47b74fbc403c..37bafd44e36d 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -9,6 +9,10 @@
  */
 
 / {
+	aliases {
+		ethernet = &gmac;
+	};
+
 	axs10x_mb {
 		compatible = "simple-bus";
 		#address-cells = <1>;
@@ -68,7 +72,7 @@
 			};
 		};
 
-		ethernet@0x18000 {
+		gmac: ethernet@0x18000 {
 			#interrupt-cells = <1>;
 			compatible = "snps,dwmac";
 			reg = < 0x18000 0x2000 >;
@@ -81,6 +85,7 @@
 			max-speed = <100>;
 			resets = <&creg_rst 5>;
 			reset-names = "stmmaceth";
+			mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
 		};
 
 		ehci@0x40000 {
diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
index 006aa3de5348..d00f283094d3 100644
--- a/arch/arc/boot/dts/hsdk.dts
+++ b/arch/arc/boot/dts/hsdk.dts
@@ -25,6 +25,10 @@
 		bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1";
 	};
 
+	aliases {
+		ethernet = &gmac;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -163,7 +167,7 @@
 			#clock-cells = <0>;
 		};
 
-		ethernet@8000 {
+		gmac: ethernet@8000 {
 			#interrupt-cells = <1>;
 			compatible = "snps,dwmac";
 			reg = <0x8000 0x2000>;
@@ -176,6 +180,7 @@
 			phy-handle = <&phy0>;
 			resets = <&cgu_rst HSDK_ETH_RESET>;
 			reset-names = "stmmaceth";
+			mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
 
 			mdio {
 				#address-cells = <1>;
-- 
2.17.1


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

* Re: [PATCH] ARC: AXS10x/HSDK: Allow U-Boot to pass MAC-address to the kernel
  2018-08-02 10:19 [PATCH] ARC: AXS10x/HSDK: Allow U-Boot to pass MAC-address to the kernel Alexey Brodkin
@ 2018-08-02 21:58 ` Vineet Gupta
  2018-08-06 13:24   ` Eugeniy Paltsev
  0 siblings, 1 reply; 3+ messages in thread
From: Vineet Gupta @ 2018-08-02 21:58 UTC (permalink / raw)
  To: Alexey Brodkin, linux-snps-arc
  Cc: linux-kernel, Rob Herring, stable, devicetree

On 08/02/2018 03:19 AM, Alexey Brodkin wrote:
> Otherwise kernel uses random MAC which is not very conveniet.

Curious what exactly is the issue - why does the user care what MAC is assigned ?

> With that change in place use might set desired MAC in U-Boot
> with "setenv ethaddr 11:22:33:44:55:66", save environment and
> then from boot to boot the same MAC will be used by the kernel.
>

And what if one is running without uboot - it will resort to all zeros vs. random
yet working MAC ?



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

* Re: [PATCH] ARC: AXS10x/HSDK: Allow U-Boot to pass MAC-address to the kernel
  2018-08-02 21:58 ` Vineet Gupta
@ 2018-08-06 13:24   ` Eugeniy Paltsev
  0 siblings, 0 replies; 3+ messages in thread
From: Eugeniy Paltsev @ 2018-08-06 13:24 UTC (permalink / raw)
  To: Vineet.Gupta1, Alexey.Brodkin, linux-snps-arc
  Cc: linux-kernel, stable, robh+dt, devicetree

Hi Vineet,

On Thu, 2018-08-02 at 21:58 +0000, Vineet Gupta wrote:
> On 08/02/2018 03:19 AM, Alexey Brodkin wrote:
> > Otherwise kernel uses random MAC which is not very conveniet.
> 
> Curious what exactly is the issue - why does the user care what MAC is assigned ?
> 
> > With that change in place use might set desired MAC in U-Boot
> > with "setenv ethaddr 11:22:33:44:55:66", save environment and
> > then from boot to boot the same MAC will be used by the kernel.
> > 
> 
> And what if one is running without uboot - it will resort to all zeros vs. random
> yet working MAC ?
> 

If one is running without u-boot - it will resort to random MAC as we don't treat 
"00:00:00:00:00:00" as a valid Ethernet address.

Look at following link for more details.
https://elixir.bootlin.com/linux/v4.18-rc8/source/include/linux/etherdevice.h#L184


BTW:
Tested-by: Evgeniy Paltsev <paltsev@synopsys.com>

> 
> _______________________________________________
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-2Dsnps-2Darc&d=DwICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=ZlJN
> 1MriPUTkBKCrPSx67GmaplEUGcAEk9yPtCLdUXI&m=pEe31Mq4FC20ZBQ1SMGdCpesPmQFyaQCdpY9-N_aWRc&s=lwI7vTqAmbVPHdfMz_FlOzfBDvtYCQDL-6s-Z2FFr_Y&e=
-- 
 Eugeniy Paltsev

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

end of thread, other threads:[~2018-08-06 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02 10:19 [PATCH] ARC: AXS10x/HSDK: Allow U-Boot to pass MAC-address to the kernel Alexey Brodkin
2018-08-02 21:58 ` Vineet Gupta
2018-08-06 13:24   ` Eugeniy Paltsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).