diff options
Diffstat (limited to 'target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom')
3 files changed, 56 insertions, 0 deletions
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/Makefile b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/Makefile index d844b60..650be40 100644 --- a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/Makefile +++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/Makefile @@ -2,6 +2,7 @@ # Makefile for the ADMtek ADM5120 SoC specific parts of the kernel # +lib-y += admboot.o lib-y += bootbase.o lib-y += cfe.o lib-y += generic.o diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/admboot.c b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/admboot.c new file mode 100644 index 0000000..5d436f6 --- /dev/null +++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/admboot.c @@ -0,0 +1,46 @@ +/* + * ADMBoot specific prom routines + * + * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/errno.h> + +#include <asm/addrspace.h> +#include <asm/byteorder.h> + +#include <asm/mach-adm5120/adm5120_defs.h> +#include <prom/admboot.h> +#include "prom_read.h" + +#define ADMBOOT_MAGIC_MAC_BASE 0x636D676D /* 'mgmc' */ + +int __init admboot_get_mac_base(u32 offset, u32 len, u8 *mac) +{ + u8 *cfg; + int i; + + cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + offset); + for (i = 0; i < len; i += 4) { + u32 magic; + + magic = prom_read_le32(cfg + i); + if (magic == ADMBOOT_MAGIC_MAC_BASE) { + int j; + + for (j = 0; j < 6; j++) + mac[j] = cfg[i + 4 + j]; + + return 0; + } + } + + return -ENXIO; +} diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/bootbase.c b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/bootbase.c index 23f8e14..b6a94ff 100644 --- a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/bootbase.c +++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/prom/bootbase.c @@ -53,6 +53,14 @@ static inline u32 bootbase_get_bootext_addr(void) return prom_read_be32(&board_info->bootext_addr); } +static inline void bootbase_get_mac(u8 *mac) +{ + int i; + + for (i = 0; i < 6; i++) + mac[i] = board_info->mac[i]; +} + static inline u16 bootbase_get_vendor_id(void) { #define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0) @@ -102,6 +110,7 @@ int __init bootbase_present(void) bootbase_info.vendor_id = bootbase_get_vendor_id(); bootbase_info.board_id = bootbase_get_board_id(); + bootbase_get_mac(bootbase_info.mac); bootbase_found = 1; |