2 * ADMBoot specific prom routines
4 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/errno.h>
16 #include <asm/addrspace.h>
17 #include <asm/byteorder.h>
19 #include <asm/mach-adm5120/adm5120_defs.h>
20 #include <prom/admboot.h>
21 #include "prom_read.h"
23 #define ADMBOOT_MAGIC_MAC_BASE 0x636D676D /* 'mgmc' */
24 #define ADMBOOT_MAGIC_MAC_BASE_BR6104XX 0x31305348 /* 'HS01' */
26 int __init admboot_get_mac_base(u32 offset, u32 len, u8 *mac)
31 cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + offset);
32 for (i = 0; i < len; i += 4) {
35 magic = prom_read_le32(cfg + i);
36 if (magic == ADMBOOT_MAGIC_MAC_BASE) {
39 for (j = 0; j < 6; j++)
40 mac[j] = cfg[i + 4 + j];
44 if (magic == ADMBOOT_MAGIC_MAC_BASE_BR6104XX) {
47 for (j = 0; j < 6; j++)
48 mac[j] = cfg[i + 7 + j];