diff mbox series

[U-Boot] net: mvneta: support setting hardware address

Message ID 20180327171825.12742-1-mpelland@starry.com
State Accepted
Commit 0a85f02
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: mvneta: support setting hardware address | expand

Commit Message

Matt Pelland March 27, 2018, 5:18 p.m. UTC
mvneta already supports setting the MAC address but this was only done
internally when some other part of U-Boot tries to actually use the
interface. This commit exposes this functionality to the ethernet core
code so that the MAC addresses of all interfaces are configured
correctly even if they are not used before loading Linux.

Signed-off-by: Matt Pelland <mpelland@starry.com>
---
 drivers/net/mvneta.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Stefan Roese April 12, 2018, 10:20 a.m. UTC | #1
Hi Matt,

(added Joe as network custodian to Cc)

On 27.03.2018 19:18, Matt Pelland wrote:
> mvneta already supports setting the MAC address but this was only done
> internally when some other part of U-Boot tries to actually use the
> interface. This commit exposes this functionality to the ethernet core
> code so that the MAC addresses of all interfaces are configured
> correctly even if they are not used before loading Linux.
> 
> Signed-off-by: Matt Pelland <mpelland@starry.com>
> ---
>   drivers/net/mvneta.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index 83e3153768..fdff772178 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -890,6 +890,16 @@ static void mvneta_mac_addr_set(struct mvneta_port *pp, unsigned char *addr,
>   	mvneta_set_ucast_addr(pp, addr[5], queue);
>   }
>   
> +static int mvneta_write_hwaddr(struct udevice *dev)
> +{
> +	mvneta_mac_addr_set(
> +		dev_get_priv(dev),
> +		((struct eth_pdata *)dev_get_platdata(dev))->enetaddr,
> +		rxq_def);
> +
> +	return 0;
> +}
> +
>   /* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */
>   static void mvneta_rx_desc_fill(struct mvneta_rx_desc *rx_desc,
>   				u32 phys_addr, u32 cookie)
> @@ -1753,6 +1763,7 @@ static const struct eth_ops mvneta_ops = {
>   	.send		= mvneta_send,
>   	.recv		= mvneta_recv,
>   	.stop		= mvneta_stop,
> +	.write_hwaddr	= mvneta_write_hwaddr,
>   };
>   
>   static int mvneta_ofdata_to_platdata(struct udevice *dev)
> 

Reviewed-by: Stefan Roese <sr@denx.de>

Joe, will you pick this one up (if you have no objections)? Or should I
push it via the Marvell repo?

Thanks,
Stefan
Joe Hershberger April 12, 2018, 4:36 p.m. UTC | #2
On Tue, Mar 27, 2018 at 12:18 PM, Matt Pelland <mpelland@starry.com> wrote:
> mvneta already supports setting the MAC address but this was only done
> internally when some other part of U-Boot tries to actually use the
> interface. This commit exposes this functionality to the ethernet core
> code so that the MAC addresses of all interfaces are configured
> correctly even if they are not used before loading Linux.
>
> Signed-off-by: Matt Pelland <mpelland@starry.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger April 12, 2018, 4:36 p.m. UTC | #3
On Thu, Apr 12, 2018 at 5:20 AM, Stefan Roese <sr@denx.de> wrote:
> Hi Matt,
>
> (added Joe as network custodian to Cc)
>
>
> On 27.03.2018 19:18, Matt Pelland wrote:
>>
>> mvneta already supports setting the MAC address but this was only done
>> internally when some other part of U-Boot tries to actually use the
>> interface. This commit exposes this functionality to the ethernet core
>> code so that the MAC addresses of all interfaces are configured
>> correctly even if they are not used before loading Linux.
>>
>> Signed-off-by: Matt Pelland <mpelland@starry.com>
>> ---
>>   drivers/net/mvneta.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
>> index 83e3153768..fdff772178 100644
>> --- a/drivers/net/mvneta.c
>> +++ b/drivers/net/mvneta.c
>> @@ -890,6 +890,16 @@ static void mvneta_mac_addr_set(struct mvneta_port
>> *pp, unsigned char *addr,
>>         mvneta_set_ucast_addr(pp, addr[5], queue);
>>   }
>>   +static int mvneta_write_hwaddr(struct udevice *dev)
>> +{
>> +       mvneta_mac_addr_set(
>> +               dev_get_priv(dev),
>> +               ((struct eth_pdata *)dev_get_platdata(dev))->enetaddr,
>> +               rxq_def);
>> +
>> +       return 0;
>> +}
>> +
>>   /* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */
>>   static void mvneta_rx_desc_fill(struct mvneta_rx_desc *rx_desc,
>>                                 u32 phys_addr, u32 cookie)
>> @@ -1753,6 +1763,7 @@ static const struct eth_ops mvneta_ops = {
>>         .send           = mvneta_send,
>>         .recv           = mvneta_recv,
>>         .stop           = mvneta_stop,
>> +       .write_hwaddr   = mvneta_write_hwaddr,
>>   };
>>     static int mvneta_ofdata_to_platdata(struct udevice *dev)
>>
>
> Reviewed-by: Stefan Roese <sr@denx.de>
>
> Joe, will you pick this one up (if you have no objections)? Or should I
> push it via the Marvell repo?

I'll take it.

Cheers,
-Joe
Joe Hershberger April 15, 2018, 4:15 a.m. UTC | #4
Hi Matt,

https://patchwork.ozlabs.org/patch/891783/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 83e3153768..fdff772178 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -890,6 +890,16 @@  static void mvneta_mac_addr_set(struct mvneta_port *pp, unsigned char *addr,
 	mvneta_set_ucast_addr(pp, addr[5], queue);
 }
 
+static int mvneta_write_hwaddr(struct udevice *dev)
+{
+	mvneta_mac_addr_set(
+		dev_get_priv(dev),
+		((struct eth_pdata *)dev_get_platdata(dev))->enetaddr,
+		rxq_def);
+
+	return 0;
+}
+
 /* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */
 static void mvneta_rx_desc_fill(struct mvneta_rx_desc *rx_desc,
 				u32 phys_addr, u32 cookie)
@@ -1753,6 +1763,7 @@  static const struct eth_ops mvneta_ops = {
 	.send		= mvneta_send,
 	.recv		= mvneta_recv,
 	.stop		= mvneta_stop,
+	.write_hwaddr	= mvneta_write_hwaddr,
 };
 
 static int mvneta_ofdata_to_platdata(struct udevice *dev)