mirror of https://github.com/ipxe/ipxe.git
[smsc95xx] Fetch MAC from device tree for Raspberry Pi
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/94/head
parent
6dde0f60bf
commit
83e0f9f377
|
@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
#include <ipxe/profile.h>
|
#include <ipxe/profile.h>
|
||||||
#include <ipxe/base16.h>
|
#include <ipxe/base16.h>
|
||||||
#include <ipxe/smbios.h>
|
#include <ipxe/smbios.h>
|
||||||
|
#include <ipxe/fdt.h>
|
||||||
#include "smsc95xx.h"
|
#include "smsc95xx.h"
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
|
@ -158,6 +159,32 @@ static int smsc95xx_vm3_fetch_mac ( struct smscusb_device *smscusb ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch MAC address from device tree
|
||||||
|
*
|
||||||
|
* @v smscusb SMSC USB device
|
||||||
|
* @ret rc Return status code
|
||||||
|
*/
|
||||||
|
static int smsc95xx_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, "SMSC95XX %p using FDT MAC %s\n",
|
||||||
|
smscusb, eth_ntoa ( netdev->hw_addr ) );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch MAC address
|
* Fetch MAC address
|
||||||
*
|
*
|
||||||
|
@ -173,6 +200,10 @@ static int smsc95xx_fetch_mac ( struct smscusb_device *smscusb ) {
|
||||||
SMSC95XX_E2P_BASE ) ) == 0 )
|
SMSC95XX_E2P_BASE ) ) == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Read MAC address from device tree */
|
||||||
|
if ( ( rc = smsc95xx_fdt_fetch_mac ( smscusb ) ) == 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Construct MAC address for Honeywell VM3, if applicable */
|
/* Construct MAC address for Honeywell VM3, if applicable */
|
||||||
if ( ( rc = smsc95xx_vm3_fetch_mac ( smscusb ) ) == 0 )
|
if ( ( rc = smsc95xx_vm3_fetch_mac ( smscusb ) ) == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue