diff options
Diffstat (limited to 'arch/mips/bcm47xx/setup.c')
-rw-r--r-- | arch/mips/bcm47xx/setup.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index dfc580aae958..f48aa5aa9bf0 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c | |||
@@ -27,9 +27,11 @@ | |||
27 | 27 | ||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/ssb/ssb.h> | 29 | #include <linux/ssb/ssb.h> |
30 | #include <asm/bootinfo.h> | ||
30 | #include <asm/reboot.h> | 31 | #include <asm/reboot.h> |
31 | #include <asm/time.h> | 32 | #include <asm/time.h> |
32 | #include <bcm47xx.h> | 33 | #include <bcm47xx.h> |
34 | #include <asm/fw/cfe/cfe_api.h> | ||
33 | 35 | ||
34 | struct ssb_bus ssb_bcm47xx; | 36 | struct ssb_bus ssb_bcm47xx; |
35 | EXPORT_SYMBOL(ssb_bcm47xx); | 37 | EXPORT_SYMBOL(ssb_bcm47xx); |
@@ -53,12 +55,55 @@ static void bcm47xx_machine_halt(void) | |||
53 | cpu_relax(); | 55 | cpu_relax(); |
54 | } | 56 | } |
55 | 57 | ||
58 | static void str2eaddr(char *str, char *dest) | ||
59 | { | ||
60 | int i = 0; | ||
61 | |||
62 | if (str == NULL) { | ||
63 | memset(dest, 0, 6); | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | for (;;) { | ||
68 | dest[i++] = (char) simple_strtoul(str, NULL, 16); | ||
69 | str += 2; | ||
70 | if (!*str++ || i == 6) | ||
71 | break; | ||
72 | } | ||
73 | } | ||
74 | |||
56 | static int bcm47xx_get_invariants(struct ssb_bus *bus, | 75 | static int bcm47xx_get_invariants(struct ssb_bus *bus, |
57 | struct ssb_init_invariants *iv) | 76 | struct ssb_init_invariants *iv) |
58 | { | 77 | { |
59 | /* TODO: fill ssb_init_invariants using boardtype/boardrev | 78 | char buf[100]; |
60 | * CFE environment variables. | 79 | |
61 | */ | 80 | /* Fill boardinfo structure */ |
81 | memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); | ||
82 | |||
83 | if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0) | ||
84 | iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); | ||
85 | if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0) | ||
86 | iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); | ||
87 | if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0) | ||
88 | iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0); | ||
89 | |||
90 | /* Fill sprom structure */ | ||
91 | memset(&(iv->sprom), 0, sizeof(struct ssb_sprom)); | ||
92 | iv->sprom.revision = 3; | ||
93 | |||
94 | if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0) | ||
95 | str2eaddr(buf, iv->sprom.r1.et0mac); | ||
96 | if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0) | ||
97 | str2eaddr(buf, iv->sprom.r1.et1mac); | ||
98 | if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) | ||
99 | iv->sprom.r1.et0phyaddr = simple_strtoul(buf, NULL, 10); | ||
100 | if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) | ||
101 | iv->sprom.r1.et1phyaddr = simple_strtoul(buf, NULL, 10); | ||
102 | if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0) | ||
103 | iv->sprom.r1.et0mdcport = simple_strtoul(buf, NULL, 10); | ||
104 | if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0) | ||
105 | iv->sprom.r1.et1mdcport = simple_strtoul(buf, NULL, 10); | ||
106 | |||
62 | return 0; | 107 | return 0; |
63 | } | 108 | } |
64 | 109 | ||