qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/net: npcm7xx_emc: set MAC in register space
@ 2022-09-21 23:46 Patrick Venture
  2022-09-22 12:35 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Patrick Venture @ 2022-09-21 23:46 UTC (permalink / raw)
  To: hskinnemoen, kfting; +Cc: qemu-arm, qemu-devel, Patrick Venture, Hao Wu

The MAC address set from Qemu wasn't being saved into the register space.

Reviewed-by: Hao Wu <wuhaotsh@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
---
 hw/net/npcm7xx_emc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
index 7c86bb52e5..6be1008529 100644
--- a/hw/net/npcm7xx_emc.c
+++ b/hw/net/npcm7xx_emc.c
@@ -96,6 +96,9 @@ static const char *emc_reg_name(int regno)
 #undef REG
 }
 
+static void npcm7xx_emc_write(void *opaque, hwaddr offset,
+                              uint64_t v, unsigned size);
+
 static void emc_reset(NPCM7xxEMCState *emc)
 {
     trace_npcm7xx_emc_reset(emc->emc_num);
@@ -112,6 +115,18 @@ static void emc_reset(NPCM7xxEMCState *emc)
 
     emc->tx_active = false;
     emc->rx_active = false;
+
+    /* Set the MAC address in the register space. */
+    uint32_t value = (emc->conf.macaddr.a[0] << 24) |
+        (emc->conf.macaddr.a[1] << 16) |
+        (emc->conf.macaddr.a[2] << 8) |
+        emc->conf.macaddr.a[3];
+    npcm7xx_emc_write(emc, REG_CAMM_BASE * sizeof(uint32_t), value,
+                      sizeof(uint32_t));
+
+    value = (emc->conf.macaddr.a[4] << 24) | (emc->conf.macaddr.a[5] << 16);
+    npcm7xx_emc_write(emc, REG_CAML_BASE * sizeof(uint32_t), value,
+                      sizeof(uint32_t));
 }
 
 static void npcm7xx_emc_reset(DeviceState *dev)
-- 
2.37.3.998.g577e59143f-goog



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

end of thread, other threads:[~2022-09-30  2:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21 23:46 [PATCH] hw/net: npcm7xx_emc: set MAC in register space Patrick Venture
2022-09-22 12:35 ` Peter Maydell
2022-09-23  3:21   ` Jason Wang
2022-09-23 23:42     ` Patrick Venture
2022-09-24  9:10       ` Peter Maydell
2022-09-26 15:45         ` Patrick Venture
2022-09-29 15:28           ` Patrick Venture
2022-09-29 15:54             ` Peter Maydell
2022-09-30  2:05               ` Patrick Venture

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).