mirror of
https://github.com/ipxe/ipxe
synced 2025-12-31 06:49:20 +03:00
[smscusb] Fetch MAC from device tree for Raspberry Pi Model B+
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <ipxe/usbnet.h>
|
||||
#include <ipxe/ethernet.h>
|
||||
#include <ipxe/profile.h>
|
||||
#include <ipxe/fdt.h>
|
||||
#include "smscusb.h"
|
||||
|
||||
/** @file
|
||||
@@ -439,6 +440,39 @@ int smscusb_otp_fetch_mac ( struct smscusb_device *smscusb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Device tree
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetch MAC address from device tree
|
||||
*
|
||||
* @v smscusb SMSC USB device
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int smscusb_fdt_fetch_mac ( struct smscusb_device *smscusb ) {
|
||||
struct net_device *netdev = smscusb->netdev;
|
||||
unsigned int offset;
|
||||
int rc;
|
||||
|
||||
/* Look for "ethernet[0]" alias */
|
||||
if ( ( rc = fdt_alias ( "ethernet", &offset ) != 0 ) &&
|
||||
( rc = fdt_alias ( "ethernet0", &offset ) != 0 ) ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Fetch MAC address */
|
||||
if ( ( rc = fdt_mac ( offset, netdev ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
DBGC ( smscusb, "SMSCUSB %p using FDT MAC %s\n",
|
||||
smscusb, eth_ntoa ( netdev->hw_addr ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* MII access
|
||||
|
||||
Reference in New Issue
Block a user