1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-03-09 19:09:11 +02:00
juhosg b06573b702 [adm5120] experimental support for 2.6.27
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12863 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-10-05 11:07:49 +00:00

47 lines
943 B
C

/*
* 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;
}