diff options
author | Daniel Mack <daniel@caiaq.de> | 2009-04-02 08:33:14 +0200 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-04-04 10:26:34 +0800 |
commit | 22a0200b18b8526043d3014efdaf839b01767111 (patch) | |
tree | 5438a411a8382ae10a6ed99577ad65d54bed660e /arch/arm/mach-pxa/colibri-pxa3xx.c | |
parent | 50f6bb0ab75794ad02cb5db503cc8c99465ceaf4 (diff) |
[ARM] pxa/colibri: provide MAC address from ATAG_SERIAL
In 67fca028f1535e510689d2e444b0289e264e05c1, the ax88796 ethernet driver
learned a way to let the platform data hand in the MAC address. Use it
here as the original Colibri bootloader passes in a MAC address via
ATAG_SERIAL.
Reported-by: Matthias Meier <matthias.j.meier@gmx.net>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa3xx.c')
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa3xx.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c index 12d0afc54aa..ea34e34f8cd 100644 --- a/arch/arm/mach-pxa/colibri-pxa3xx.c +++ b/arch/arm/mach-pxa/colibri-pxa3xx.c @@ -14,6 +14,7 @@ #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/gpio.h> +#include <linux/etherdevice.h> #include <asm/mach-types.h> #include <mach/hardware.h> #include <asm/sizes.h> @@ -28,6 +29,40 @@ #include "generic.h" #include "devices.h" +#if defined(CONFIG_AX88796) +#define ETHER_ADDR_LEN 6 +static u8 ether_mac_addr[ETHER_ADDR_LEN]; + +void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data) +{ + int i; + u64 serial = ((u64) system_serial_high << 32) | system_serial_low; + + /* + * If the bootloader passed in a serial boot tag, which contains a + * valid ethernet MAC, pass it to the interface. Toradex ships the + * modules with their own bootloader which provides a valid MAC + * this way. + */ + + for (i = 0; i < ETHER_ADDR_LEN; i++) { + ether_mac_addr[i] = serial & 0xff; + serial >>= 8; + } + + if (is_valid_ether_addr(ether_mac_addr)) { + plat_data->flags |= AXFLG_MAC_FROMPLATFORM; + plat_data->mac_addr = ether_mac_addr; + printk(KERN_INFO "%s(): taking MAC from serial boot tag\n", + __func__); + } else { + plat_data->flags |= AXFLG_MAC_FROMDEV; + printk(KERN_INFO "%s(): no valid serial boot tag found, " + "taking MAC from device\n", __func__); + } +} +#endif + #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) static int mmc_detect_pin; |