[U-Boot] [PATCH v2 08/13] usb: gadget: ether: Provide a way to read MAC address

Vignesh R vigneshr at ti.com
Wed Jun 14 12:24:36 UTC 2017



On Tuesday 13 June 2017 07:36 PM, Marek Vasut wrote:
> On 06/13/2017 02:10 PM, Vignesh R wrote:
>> Provide a way to read MAC address for usb_ether device from board
>> function. Board files can override board_set_usbnet_devaddr() to
>> populate MAC address to be used by usb_ether as device address.
>>
>> Signed-off-by: Vignesh R <vigneshr at ti.com>
> 
> This patch is totally unrelated to this series. 

This series converts dwc3 peripheral to device model and the best way to
test this on TI platform to use it on ether gadget and test RNDIS boot.
Hence, I had to do patches 8 to 13. Therefore I posted them together for
completeness, if somebody wanted to test this out.

> Moreover, just set eth*addr using setenv() to achieve the same iirc .
>

eth*addr is used for regular ethernet interface and usually set by
regular ethernet driver, but I could not find a way to set MAC address
for usb ethernet interface
Board file will now override board_set_usbnet_devaddr() to read MAC and
then call setenv()

>> ---
>>  drivers/usb/gadget/ether.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
>> index 4137d76c42af..8854e8eb004a 100644
>> --- a/drivers/usb/gadget/ether.c
>> +++ b/drivers/usb/gadget/ether.c
>> @@ -2619,6 +2619,10 @@ int usb_eth_initialize(bd_t *bi)
>>  	return 0;
>>  }
>>  #else
>> +void __weak board_set_usbnet_devaddr(void)
>> +{
>> +}
>> +
>>  static int usb_eth_start(struct udevice *dev)
>>  {
>>  	struct ether_priv *priv = dev_get_priv(dev);
>> @@ -2683,6 +2687,8 @@ static int usb_eth_probe(struct udevice *dev)
>>  
>>  	priv->netdev = dev;
>>  	l_priv = priv;
>> +	/* Get MAC address for USB ETH interface */
>> +	board_set_usbnet_devaddr();
>>  
>>  	get_ether_addr(CONFIG_USBNET_DEVADDR, pdata->enetaddr);
>>  	eth_setenv_enetaddr("usbnet_devaddr", pdata->enetaddr);
>>
> 
> 

-- 
Regards
Vignesh


More information about the U-Boot mailing list