net: mvneta: read MAC address from hardware when available
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 4 Jun 2013 04:52:23 +0000 (04:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jun 2013 00:23:51 +0000 (17:23 -0700)
commit8cc3e439ab920703264a62e1b19559b39e20d77e
tree8b7d54d8bf13c18df4085a03e6fe2abf0e13a528
parent93baf4c615584fa02c21aa78f305428fc7060656
net: mvneta: read MAC address from hardware when available

This patch improves the logic used by the mvneta driver to find a MAC
address for a particular interface. Until now, it was only looking at
the Device Tree, and if no address was found, was falling back to
generating a random MAC address.

This patch adds the intermediate solution of reading the MAC address
from the hardware registers, in case it has been set by the
bootloader. So the order is now:

 1) MAC address from the Device Tree
 2) MAC address from the hardware registers
 3) Random MAC address

This requires moving the MAC address initialization a little bit later
in the ->probe() code, because it now requires the hardware registers
to be remapped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c