Skip to contentSkip to conversation

ftgmac100: Allow target board to override MAC address

PATCH In review Timothy Pearson 2 participants 2 messages Mar 21, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ftgmac100: Allow target board to override MAC address

read function

Upstream-Status: Pending

---
 drivers/net/ftgmac100.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/net/ftgmac100.c +20 -0
index 5595f48bbfa..e5373053e58 100644
@@ -257,6 +257,11 @@ static void ftgmac100_reset(struct ftgmac100_data *priv)
 		;
 }
 
+int __weak ftgmac100_target_fetch_mac(unsigned char *enetaddr)
+{
+	return -1;
+}
+
 /*
  * Set MAC address
  */
@@ -642,6 +647,20 @@ static int ftgmac100_remove(struct udevice *dev)
 	return 0;
 }
 
+static int ftgmac100_read_rom_mac(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+	int ret;
+
+	if (!pdata)
+		return -ENOSYS;
+
+	/* Attempt to read the MAC using a target specific access method */
+	ret = ftgmac100_target_fetch_mac(pdata->enetaddr);
+
+	return ret;
+}
+
 static const struct eth_ops ftgmac100_ops = {
 	.start	= ftgmac100_start,
 	.send	= ftgmac100_send,
@@ -649,6 +668,7 @@ static const struct eth_ops ftgmac100_ops = {
 	.stop	= ftgmac100_stop,
 	.free_pkt = ftgmac100_free_pkt,
 	.write_hwaddr = ftgmac100_write_hwaddr,
+	.read_rom_hwaddr    = ftgmac100_read_rom_mac,
 };
 
 static const struct udevice_id ftgmac100_ids[] = {
Signature · 1 line
2.39.5
#1 lore raw

Hello,

Quoted 1 line · Timothy Pearson

read function

That's some incomplete commit message.

What kind of function do you envision here and for what kind of overriding and with what rationale?

Please explain why you need that instead of using e.g. NVMEM subsystem or having the bootloader set it in DT.