Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223345
b: refs/heads/master
c: 59833fc
h: refs/heads/master
i:
  223343: 271acbf
v: v3
  • Loading branch information
Hauke Mehrtens authored and Ralf Baechle committed Dec 16, 2010
1 parent d2bfbad commit 9e80cca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2aa088d6fd8a6c6e6020ea46b70141f0b7ccf5d2
refs/heads/master: 59833fcf48ee7b7c8a01e590aa7b7212305c3077
23 changes: 3 additions & 20 deletions trunk/arch/mips/bcm47xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,6 @@ static void bcm47xx_machine_halt(void)
cpu_relax();
}

static void str2eaddr(char *str, char *dest)
{
int i = 0;

if (str == NULL) {
memset(dest, 0, 6);
return;
}

for (;;) {
dest[i++] = (char) simple_strtoul(str, NULL, 16);
str += 2;
if (!*str++ || i == 6)
break;
}
}

#define READ_FROM_NVRAM(_outvar, name, buf) \
if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
sprom->_outvar = simple_strtoul(buf, NULL, 0);
Expand All @@ -87,11 +70,11 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
sprom->revision = 1; /* Fallback: Old hardware does not define this. */
READ_FROM_NVRAM(revision, "sromrev", buf);
if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
str2eaddr(buf, sprom->il0mac);
nvram_parse_macaddr(buf, sprom->il0mac);
if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
str2eaddr(buf, sprom->et0mac);
nvram_parse_macaddr(buf, sprom->et0mac);
if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
str2eaddr(buf, sprom->et1mac);
nvram_parse_macaddr(buf, sprom->et1mac);
READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
READ_FROM_NVRAM(et0mdcport, "et0mdcport", buf);
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/mips/include/asm/mach-bcm47xx/nvram.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define __NVRAM_H

#include <linux/types.h>
#include <linux/kernel.h>

struct nvram_header {
u32 magic;
Expand All @@ -36,4 +37,10 @@ struct nvram_header {

extern int nvram_getenv(char *name, char *val, size_t val_len);

static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
{
sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
&macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
}

#endif

0 comments on commit 9e80cca

Please sign in to comment.