All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>
Cc: Mario Six <mario.six@gdsys.cc>,
	Ramon Fried <rfried.dev@gmail.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Sean Anderson <sean.anderson@seco.com>
Subject: [PATCH v3 04/13] sandbox: net: Remove fake-host-hwaddr
Date: Mon, 18 Apr 2022 15:36:50 -0400	[thread overview]
Message-ID: <20220418193659.3677824-5-sean.anderson@seco.com> (raw)
In-Reply-To: <20220418193659.3677824-1-sean.anderson@seco.com>

Instead of reading a pseudo-rom mac address from the device tree, just use
whatever we get from write_hwaddr. This has the effect of using the mac
address from the environment (or from the device tree, if it is
specified).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ramon Fried <rfried.dev@gmail.com>
---

(no changes since v1)

 arch/sandbox/dts/sandbox.dts   |  1 -
 arch/sandbox/dts/sandbox64.dts |  1 -
 arch/sandbox/dts/test.dts      |  6 ------
 drivers/net/sandbox.c          | 10 ++--------
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 127f168f02..840b8b503f 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -63,7 +63,6 @@
 	eth@10002000 {
 		compatible = "sandbox,eth";
 		reg = <0x10002000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 00];
 	};
 
 	i2c_0: i2c@0 {
diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts
index ec53106af9..3eb0457089 100644
--- a/arch/sandbox/dts/sandbox64.dts
+++ b/arch/sandbox/dts/sandbox64.dts
@@ -58,7 +58,6 @@
 	eth@10002000 {
 		compatible = "sandbox,eth";
 		reg = <0x0 0x10002000 0x0 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 00];
 	};
 
 	i2c_0: i2c@0 {
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index e480f6aff9..9c3a19f576 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -512,31 +512,26 @@
 	eth@10002000 {
 		compatible = "sandbox,eth";
 		reg = <0x10002000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 00];
 	};
 
 	eth_5: eth@10003000 {
 		compatible = "sandbox,eth";
 		reg = <0x10003000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 11];
 	};
 
 	eth_3: sbe5 {
 		compatible = "sandbox,eth";
 		reg = <0x10005000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 33];
 	};
 
 	eth@10004000 {
 		compatible = "sandbox,eth";
 		reg = <0x10004000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 22];
 	};
 
 	phy_eth0: phy-test-eth {
 		compatible = "sandbox,eth";
 		reg = <0x10007000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 77];
 		phy-handle = <&ethphy1>;
 		phy-mode = "2500base-x";
 	};
@@ -544,7 +539,6 @@
 	dsa_eth0: dsa-test-eth {
 		compatible = "sandbox,eth";
 		reg = <0x10006000 0x1000>;
-		fake-host-hwaddr = [00 00 66 44 22 66];
 	};
 
 	dsa-test {
diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
index 37459dfa0a..13022addb6 100644
--- a/drivers/net/sandbox.c
+++ b/drivers/net/sandbox.c
@@ -395,9 +395,11 @@ static void sb_eth_stop(struct udevice *dev)
 static int sb_eth_write_hwaddr(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_plat(dev);
+	struct eth_sandbox_priv *priv = dev_get_priv(dev);
 
 	debug("eth_sandbox %s: Write HW ADDR - %pM\n", dev->name,
 	      pdata->enetaddr);
+	memcpy(priv->fake_host_hwaddr, pdata->enetaddr, ARP_HLEN);
 	return 0;
 }
 
@@ -419,16 +421,8 @@ static int sb_eth_of_to_plat(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_plat(dev);
 	struct eth_sandbox_priv *priv = dev_get_priv(dev);
-	const u8 *mac;
 
 	pdata->iobase = dev_read_addr(dev);
-
-	mac = dev_read_u8_array_ptr(dev, "fake-host-hwaddr", ARP_HLEN);
-	if (!mac) {
-		printf("'fake-host-hwaddr' is missing from the DT\n");
-		return -EINVAL;
-	}
-	memcpy(priv->fake_host_hwaddr, mac, ARP_HLEN);
 	priv->disabled = false;
 	priv->tx_handler = sb_default_handler;
 
-- 
2.35.1.1320.gc452695387.dirty


  parent reply	other threads:[~2022-04-18 19:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 19:36 [PATCH v3 00/13] Add support for NVMEM API Sean Anderson
2022-04-18 19:36 ` [PATCH v3 01/13] sandbox: net: Add aliases for ethernet devices Sean Anderson
2022-04-29 14:48   ` Tom Rini
2022-04-18 19:36 ` [PATCH v3 02/13] sandbox: net: Add mac address for eth8 to environment Sean Anderson
2022-04-18 19:36 ` [PATCH v3 03/13] test: eth: Add test for ethernet addresses Sean Anderson
2022-04-18 19:36 ` Sean Anderson [this message]
2022-04-18 19:36 ` [PATCH v3 05/13] sandbox: Remove eth2addr from environment Sean Anderson
2022-04-18 19:36 ` [PATCH v3 06/13] sandbox: Move some mac addresses to device tree Sean Anderson
2022-04-18 19:36 ` [PATCH v3 07/13] misc: i2c_eeprom: Make i2c_eeprom_write use a const buf Sean Anderson
2022-04-18 19:36 ` [PATCH v3 08/13] misc: Add support for nvmem cells Sean Anderson
2022-04-25  5:48   ` Simon Glass
2022-04-25 15:24     ` Sean Anderson
2022-04-29 19:40       ` Sean Anderson
2022-05-03  8:50         ` Simon Glass
2022-05-05 15:26           ` Sean Anderson
2022-04-18 19:36 ` [PATCH v3 09/13] sandbox: Enable NVMEM Sean Anderson
2022-04-18 19:36 ` [PATCH v3 10/13] net: Add support for reading mac addresses from nvmem cells Sean Anderson
2022-04-29 14:48   ` Tom Rini
2022-04-18 19:36 ` [PATCH v3 11/13] test: Load mac address with i2c eeprom Sean Anderson
2022-04-18 19:36 ` [PATCH v3 12/13] test: Load mac address using RTC Sean Anderson
2022-04-29 14:48   ` Tom Rini
2022-04-18 19:36 ` [PATCH v3 13/13] test: Load mac address using misc device Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220418193659.3677824-5-sean.anderson@seco.com \
    --to=sean.anderson@seco.com \
    --cc=joe.hershberger@ni.com \
    --cc=mario.six@gdsys.cc \
    --cc=rfried.dev@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.