summaryrefslogtreecommitdiff
path: root/target/linux/adm5120/files-2.6.26
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-08-13 19:52:25 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-08-13 19:52:25 +0000
commit4bf320faced13536aa49b203035e2bc12e8a44ee (patch)
treeae862da810ab96e9b423c52dd8af869f109d5729 /target/linux/adm5120/files-2.6.26
parentdc08bcee1a4681be4726db572da8dd2c27b5baaa (diff)
[adm5120] load board's mac address on Compex devices
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12302 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120/files-2.6.26')
-rw-r--r--target/linux/adm5120/files-2.6.26/arch/mips/adm5120/compex/compex.c20
-rw-r--r--target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/myloader.c7
-rw-r--r--target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/prom/myloader.h1
3 files changed, 27 insertions, 1 deletions
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/compex/compex.c b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/compex/compex.c
index adc765f5e0..10120d6226 100644
--- a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/compex/compex.c
+++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/compex/compex.c
@@ -11,15 +11,19 @@
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/gpio.h>
#include <asm/bootinfo.h>
-#include <linux/gpio.h>
#include <asm/mach-adm5120/adm5120_info.h>
#include <asm/mach-adm5120/adm5120_board.h>
#include <asm/mach-adm5120/adm5120_platform.h>
#include <asm/mach-adm5120/adm5120_irq.h>
+#include <asm/mach-adm5120/prom/myloader.h>
+
+#include "compex.h"
+
#define COMPEX_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
static void switch_bank_gpio5(unsigned bank)
@@ -34,6 +38,18 @@ static void switch_bank_gpio5(unsigned bank)
}
}
+void __init compex_mac_setup(void)
+{
+ int i, j;
+
+ if (!myloader_present())
+ return;
+
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 6; j++)
+ adm5120_eth_macs[i][j] = myloader_info.macs[i][j];
+}
+
void __init compex_generic_setup(void)
{
gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
@@ -43,4 +59,6 @@ void __init compex_generic_setup(void)
adm5120_add_device_flash(0);
adm5120_add_device_gpio(COMPEX_GPIO_DEV_MASK);
+
+ compex_mac_setup();
}
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/myloader.c b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/myloader.c
index 737c15dea2..939422681b 100644
--- a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/myloader.c
+++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/myloader.c
@@ -36,6 +36,7 @@ int __init myloader_present(void)
struct mylo_system_params *sysp;
struct mylo_board_params *boardp;
struct mylo_partition_table *parts;
+ int i;
if (myloader_found)
goto out;
@@ -55,6 +56,12 @@ int __init myloader_present(void)
myloader_info.svid = le32_to_cpu(sysp->svid);
myloader_info.sdid = le32_to_cpu(sysp->sdid);
+ for (i = 0; i < MYLO_ETHADDR_COUNT; i++) {
+ int j;
+ for (j = 0; j < 6; j++)
+ myloader_info.macs[i][j] = boardp->addr[i].mac[j];
+ }
+
myloader_found = 1;
out:
diff --git a/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/prom/myloader.h b/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/prom/myloader.h
index 2c40aa4056..ea8db81ed3 100644
--- a/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/prom/myloader.h
+++ b/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/prom/myloader.h
@@ -170,6 +170,7 @@ struct myloader_info {
u32 did;
u32 svid;
u32 sdid;
+ uint8_t macs[MYLO_ETHADDR_COUNT][6];
};
extern struct myloader_info myloader_info;