Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
of_net.c File Reference
#include <linux/etherdevice.h>
#include <linux/kernel.h>
#include <linux/of_net.h>
#include <linux/phy.h>
#include <linux/export.h>

Go to the source code of this file.

Functions

const int of_get_phy_mode (struct device_node *np)
 
 EXPORT_SYMBOL_GPL (of_get_phy_mode)
 
const voidof_get_mac_address (struct device_node *np)
 
 EXPORT_SYMBOL (of_get_mac_address)
 

Function Documentation

EXPORT_SYMBOL ( of_get_mac_address  )
EXPORT_SYMBOL_GPL ( of_get_phy_mode  )
const void* of_get_mac_address ( struct device_node np)

Search the device tree for the best MAC address to use. 'mac-address' is checked first, because that is supposed to contain to "most recent" MAC address. If that isn't set, then 'local-mac-address' is checked next, because that is the default address. If that isn't set, then the obsolete 'address' is checked, just in case we're using an old device tree.

Note that the 'address' property is supposed to contain a virtual address of the register set, but some DTS files have redefined that property to be the MAC address.

All-zero MAC addresses are rejected, because those could be properties that exist in the device tree, but were not set by U-Boot. For example, the DTS could define 'mac-address' and 'local-mac-address', with zero MAC addresses. Some older U-Boots only initialized 'local-mac-address'. In this case, the real MAC is in 'local-mac-address', and 'mac-address' exists but is all zeros.

Definition at line 76 of file of_net.c.

const int of_get_phy_mode ( struct device_node np)

of_get_phy_mode - Get phy mode for given device_node : Pointer to the given device_node

The function gets phy interface string from property 'phy-mode', and return its index in phy_modes table, or errno in error case.

Definition at line 41 of file of_net.c.