5d436f62f6f7bd4627030934256da72c0b4dbd5b
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' */
25 int __init
admboot_get_mac_base(u32 offset
, u32 len
, u8
*mac
)
30 cfg
= (u8
*) KSEG1ADDR(ADM5120_SRAM0_BASE
+ offset
);
31 for (i
= 0; i
< len
; i
+= 4) {
34 magic
= prom_read_le32(cfg
+ i
);
35 if (magic
== ADMBOOT_MAGIC_MAC_BASE
) {
38 for (j
= 0; j
< 6; j
++)
39 mac
[j
] = cfg
[i
+ 4 + j
];