aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-04-02 02:33:14 -0400
committerEric Miao <eric.miao@marvell.com>2009-04-03 22:26:34 -0400
commit22a0200b18b8526043d3014efdaf839b01767111 (patch)
tree5438a411a8382ae10a6ed99577ad65d54bed660e /arch/arm
parent50f6bb0ab75794ad02cb5db503cc8c99465ceaf4 (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')
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c6
-rw-r--r--arch/arm/mach-pxa/colibri-pxa320.c5
-rw-r--r--arch/arm/mach-pxa/colibri-pxa3xx.c35
-rw-r--r--arch/arm/mach-pxa/include/mach/colibri.h4
4 files changed, 46 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index 10c2eaf93230..0964eda4dcf4 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -32,12 +32,13 @@
32 32
33#if defined(CONFIG_AX88796) 33#if defined(CONFIG_AX88796)
34#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) 34#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
35
35/* 36/*
36 * Asix AX88796 Ethernet 37 * Asix AX88796 Ethernet
37 */ 38 */
38static struct ax_plat_data colibri_asix_platdata = { 39static struct ax_plat_data colibri_asix_platdata = {
39 .flags = AXFLG_MAC_FROMDEV, 40 .flags = 0, /* defined later */
40 .wordlength = 2 41 .wordlength = 2,
41}; 42};
42 43
43static struct resource colibri_asix_resource[] = { 44static struct resource colibri_asix_resource[] = {
@@ -70,6 +71,7 @@ static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
70 71
71static void __init colibri_pxa300_init_eth(void) 72static void __init colibri_pxa300_init_eth(void)
72{ 73{
74 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
73 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); 75 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
74 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); 76 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
75 platform_device_register(&asix_device); 77 platform_device_register(&asix_device);
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index 55b74a7a6151..8a742b779e05 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -38,8 +38,8 @@
38 * Asix AX88796 Ethernet 38 * Asix AX88796 Ethernet
39 */ 39 */
40static struct ax_plat_data colibri_asix_platdata = { 40static struct ax_plat_data colibri_asix_platdata = {
41 .flags = AXFLG_MAC_FROMDEV, 41 .flags = 0, /* defined later */
42 .wordlength = 2 42 .wordlength = 2,
43}; 43};
44 44
45static struct resource colibri_asix_resource[] = { 45static struct resource colibri_asix_resource[] = {
@@ -72,6 +72,7 @@ static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
72 72
73static void __init colibri_pxa320_init_eth(void) 73static void __init colibri_pxa320_init_eth(void)
74{ 74{
75 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
75 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config)); 76 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
76 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); 77 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
77 platform_device_register(&asix_device); 78 platform_device_register(&asix_device);
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c
index 12d0afc54aa5..ea34e34f8cd8 100644
--- a/arch/arm/mach-pxa/colibri-pxa3xx.c
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/etherdevice.h>
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <mach/hardware.h> 19#include <mach/hardware.h>
19#include <asm/sizes.h> 20#include <asm/sizes.h>
@@ -28,6 +29,40 @@
28#include "generic.h" 29#include "generic.h"
29#include "devices.h" 30#include "devices.h"
30 31
32#if defined(CONFIG_AX88796)
33#define ETHER_ADDR_LEN 6
34static u8 ether_mac_addr[ETHER_ADDR_LEN];
35
36void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)
37{
38 int i;
39 u64 serial = ((u64) system_serial_high << 32) | system_serial_low;
40
41 /*
42 * If the bootloader passed in a serial boot tag, which contains a
43 * valid ethernet MAC, pass it to the interface. Toradex ships the
44 * modules with their own bootloader which provides a valid MAC
45 * this way.
46 */
47
48 for (i = 0; i < ETHER_ADDR_LEN; i++) {
49 ether_mac_addr[i] = serial & 0xff;
50 serial >>= 8;
51 }
52
53 if (is_valid_ether_addr(ether_mac_addr)) {
54 plat_data->flags |= AXFLG_MAC_FROMPLATFORM;
55 plat_data->mac_addr = ether_mac_addr;
56 printk(KERN_INFO "%s(): taking MAC from serial boot tag\n",
57 __func__);
58 } else {
59 plat_data->flags |= AXFLG_MAC_FROMDEV;
60 printk(KERN_INFO "%s(): no valid serial boot tag found, "
61 "taking MAC from device\n", __func__);
62 }
63}
64#endif
65
31#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 66#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
32static int mmc_detect_pin; 67static int mmc_detect_pin;
33 68
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h
index 3f2a01d6a03c..306ad64409be 100644
--- a/arch/arm/mach-pxa/include/mach/colibri.h
+++ b/arch/arm/mach-pxa/include/mach/colibri.h
@@ -16,6 +16,10 @@ extern void colibri_pxa3xx_init_lcd(int bl_pin);
16static inline void colibri_pxa3xx_init_lcd(int) {} 16static inline void colibri_pxa3xx_init_lcd(int) {}
17#endif 17#endif
18 18
19#if defined(CONFIG_AX88796)
20extern void colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data);
21#endif
22
19/* physical memory regions */ 23/* physical memory regions */
20#define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */ 24#define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */
21 25