* [PATCH] net: ks8851: Implement EEPROM MAC address readout
@ 2020-10-08 13:14 Marek Vasut
2020-11-04 12:27 ` Marek Vasut
2020-11-09 22:19 ` Tom Rini
0 siblings, 2 replies; 5+ messages in thread
From: Marek Vasut @ 2020-10-08 13:14 UTC (permalink / raw
To: u-boot
In case there is an EEPROM attached to the KS8851 MAC and the EEPROM
contains a valid MAC address, the MAC address is loaded into the NIC
registers on power on. Read the MAC address out of the NIC registers
and provide it to U-Boot.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
drivers/net/ks8851_mll.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index d22668446d..58e065cdcc 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -622,6 +622,34 @@ static int ks8851_write_hwaddr(struct udevice *dev)
return 0;
}
+static int ks8851_read_rom_hwaddr(struct udevice *dev)
+{
+ struct ks_net *ks = dev_get_priv(dev);
+ struct eth_pdata *pdata = dev_get_platdata(dev);
+ u16 addrl, addrm, addrh;
+
+ /* No EEPROM means no valid MAC address. */
+ if (!(ks_rdreg16(ks, KS_CCR) & CCR_EEPROM))
+ return -EINVAL;
+
+ /*
+ * If the EEPROM contains valid MAC address, it is loaded into
+ * the NIC on power on. Read the MAC out of the NIC registers.
+ */
+ addrl = ks_rdreg16(ks, KS_MARL);
+ addrm = ks_rdreg16(ks, KS_MARM);
+ addrh = ks_rdreg16(ks, KS_MARH);
+
+ pdata->enetaddr[0] = (addrh >> 8) & 0xff;
+ pdata->enetaddr[1] = addrh & 0xff;
+ pdata->enetaddr[2] = (addrm >> 8) & 0xff;
+ pdata->enetaddr[3] = addrm & 0xff;
+ pdata->enetaddr[4] = (addrl >> 8) & 0xff;
+ pdata->enetaddr[5] = addrl & 0xff;
+
+ return !is_valid_ethaddr(pdata->enetaddr);
+}
+
static int ks8851_bind(struct udevice *dev)
{
return device_set_name(dev, dev->name);
@@ -654,6 +682,7 @@ static const struct eth_ops ks8851_ops = {
.send = ks8851_send,
.recv = ks8851_recv,
.write_hwaddr = ks8851_write_hwaddr,
+ .read_rom_hwaddr = ks8851_read_rom_hwaddr,
};
static const struct udevice_id ks8851_ids[] = {
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] net: ks8851: Implement EEPROM MAC address readout
2020-10-08 13:14 [PATCH] net: ks8851: Implement EEPROM MAC address readout Marek Vasut
@ 2020-11-04 12:27 ` Marek Vasut
2020-11-04 13:22 ` Tom Rini
2020-11-09 22:19 ` Tom Rini
1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2020-11-04 12:27 UTC (permalink / raw
To: u-boot
On 10/8/20 3:14 PM, Marek Vasut wrote:
> In case there is an EEPROM attached to the KS8851 MAC and the EEPROM
> contains a valid MAC address, the MAC address is loaded into the NIC
> registers on power on. Read the MAC address out of the NIC registers
> and provide it to U-Boot.
Any news on this patch? It has been on the list for a month with zero
feedback.
[...]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: ks8851: Implement EEPROM MAC address readout
2020-11-04 12:27 ` Marek Vasut
@ 2020-11-04 13:22 ` Tom Rini
2020-11-04 13:59 ` Marek Vasut
0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2020-11-04 13:22 UTC (permalink / raw
To: u-boot
On Wed, Nov 04, 2020 at 01:27:28PM +0100, Marek Vasut wrote:
> On 10/8/20 3:14 PM, Marek Vasut wrote:
> > In case there is an EEPROM attached to the KS8851 MAC and the EEPROM
> > contains a valid MAC address, the MAC address is loaded into the NIC
> > registers on power on. Read the MAC address out of the NIC registers
> > and provide it to U-Boot.
>
> Any news on this patch? It has been on the list for a month with zero
> feedback.
Probably time to put together a PR for me then, 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/20201104/008d4a27/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: ks8851: Implement EEPROM MAC address readout
2020-11-04 13:22 ` Tom Rini
@ 2020-11-04 13:59 ` Marek Vasut
0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-11-04 13:59 UTC (permalink / raw
To: u-boot
On 11/4/20 2:22 PM, Tom Rini wrote:
> On Wed, Nov 04, 2020 at 01:27:28PM +0100, Marek Vasut wrote:
>> On 10/8/20 3:14 PM, Marek Vasut wrote:
>>> In case there is an EEPROM attached to the KS8851 MAC and the EEPROM
>>> contains a valid MAC address, the MAC address is loaded into the NIC
>>> registers on power on. Read the MAC address out of the NIC registers
>>> and provide it to U-Boot.
>>
>> Any news on this patch? It has been on the list for a month with zero
>> feedback.
>
> Probably time to put together a PR for me then, thanks.
It's a single patch, so feel free to just pick it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: ks8851: Implement EEPROM MAC address readout
2020-10-08 13:14 [PATCH] net: ks8851: Implement EEPROM MAC address readout Marek Vasut
2020-11-04 12:27 ` Marek Vasut
@ 2020-11-09 22:19 ` Tom Rini
1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2020-11-09 22:19 UTC (permalink / raw
To: u-boot
On Thu, Oct 08, 2020 at 03:14:17PM +0200, Marek Vasut wrote:
> In case there is an EEPROM attached to the KS8851 MAC and the EEPROM
> contains a valid MAC address, the MAC address is loaded into the NIC
> registers on power on. Read the MAC address out of the NIC registers
> and provide it to U-Boot.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Eugen Hristev <eugen.hristev@microchip.com>
> Cc: Joe Hershberger <joe.hershberger@ni.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/20201109/be15edba/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-09 22:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-08 13:14 [PATCH] net: ks8851: Implement EEPROM MAC address readout Marek Vasut
2020-11-04 12:27 ` Marek Vasut
2020-11-04 13:22 ` Tom Rini
2020-11-04 13:59 ` Marek Vasut
2020-11-09 22:19 ` Tom Rini
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.