public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] net: e1000: implement eth_write_hwaddr for DM_ETH
@ 2020-11-04 16:26 Sebastian Reichel
  2021-01-19 20:00 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Reichel @ 2020-11-04 16:26 UTC (permalink / raw)
  To: u-boot

From: Ian Ray <ian.ray@ge.com>

Implement programming MAC address to the hardware also for device model
configuration.

Fixes: b565b18a294f ("board: ge: bx50v3: Enable DM for PCI and ethernet")
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/net/e1000.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 8e6c755f6416..4e81b89220ae 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -869,7 +869,6 @@ e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,
 	return E1000_SUCCESS;
 }
 
-#ifndef CONFIG_DM_ETH
 /******************************************************************************
  *  e1000_write_eeprom_srwr - Write to Shadow Ram using EEWR
  *  @hw: pointer to the HW structure
@@ -1035,7 +1034,6 @@ static int32_t e1000_update_eeprom_checksum_i210(struct e1000_hw *hw)
 out:
 	return ret_val;
 }
-#endif
 
 /******************************************************************************
  * Verifies that the EEPROM has a valid checksum
@@ -5660,13 +5658,24 @@ e1000_poll(struct eth_device *nic)
 
 	return len ? 1 : 0;
 }
+#endif /* !CONFIG_DM_ETH */
 
+#ifdef CONFIG_DM_ETH
+static int e1000_write_hwaddr(struct udevice *dev)
+#else
 static int e1000_write_hwaddr(struct eth_device *dev)
+#endif
 {
 #ifndef CONFIG_E1000_NO_NVM
-	unsigned char *mac = dev->enetaddr;
 	unsigned char current_mac[6];
+#ifdef CONFIG_DM_ETH
+	struct eth_pdata *plat = dev_get_platdata(dev);
+	struct e1000_hw *hw = dev_get_priv(dev);
+	u8 *mac = plat->enetaddr;
+#else
 	struct e1000_hw *hw = dev->priv;
+	u8 *mac = dev->enetaddr;
+#endif
 	uint16_t data[3];
 	int ret_val, i;
 
@@ -5700,6 +5709,7 @@ static int e1000_write_hwaddr(struct eth_device *dev)
 #endif
 }
 
+#ifndef CONFIG_DM_ETH
 /**************************************************************************
 PROBE - Look for an adapter, this routine's visible to the outside
 You should omit the last argument struct pci_device * for a non-PCI NIC
@@ -5926,6 +5936,7 @@ static const struct eth_ops e1000_eth_ops = {
 	.recv	= e1000_eth_recv,
 	.stop	= e1000_eth_stop,
 	.free_pkt = e1000_free_pkt,
+	.write_hwaddr = e1000_write_hwaddr,
 };
 
 static const struct udevice_id e1000_eth_ids[] = {
-- 
2.28.0

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

* [PATCH] net: e1000: implement eth_write_hwaddr for DM_ETH
  2020-11-04 16:26 [PATCH] net: e1000: implement eth_write_hwaddr for DM_ETH Sebastian Reichel
@ 2021-01-19 20:00 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-01-19 20:00 UTC (permalink / raw)
  To: u-boot

On Wed, Nov 04, 2020 at 05:26:01PM +0100, Sebastian Reichel wrote:

> From: Ian Ray <ian.ray@ge.com>
> 
> Implement programming MAC address to the hardware also for device model
> configuration.
> 
> Fixes: b565b18a294f ("board: ge: bx50v3: Enable DM for PCI and ethernet")
> Signed-off-by: Ian Ray <ian.ray@ge.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210119/5fe7eb75/attachment.sig>

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

end of thread, other threads:[~2021-01-19 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-04 16:26 [PATCH] net: e1000: implement eth_write_hwaddr for DM_ETH Sebastian Reichel
2021-01-19 20:00 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox