37 #include <linux/module.h>
38 #include <linux/kernel.h>
40 #include <linux/string.h>
43 #include <linux/slab.h>
45 #include <asm/addrspace.h>
46 #include <asm/bootinfo.h>
65 static char msp_default_features[] =
66 #if defined(CONFIG_PMC_MSP4200_EVAL) \
67 || defined(CONFIG_PMC_MSP4200_GW)
69 #elif defined(CONFIG_PMC_MSP7120_EVAL) \
70 || defined(CONFIG_PMC_MSP7120_GW)
72 #elif defined(CONFIG_PMC_MSP7120_FPGA)
77 static inline unsigned char str2hexnum(
unsigned char c)
79 if (c >=
'0' && c <=
'9')
81 if (c >=
'a' && c <=
'f')
89 unsigned char num = 0;
91 while (*str !=
'\0') {
92 if ((*str ==
'.') || (*str ==
':')) {
110 static inline unsigned long str2hex(
unsigned char *str)
125 #if defined(CONFIG_PMC_MSP4200_EVAL)
126 return "PMC-Sierra MSP4200 Eval Board";
127 #elif defined(CONFIG_PMC_MSP4200_GW)
128 return "PMC-Sierra MSP4200 VoIP Gateway";
129 #elif defined(CONFIG_PMC_MSP7120_EVAL)
130 return "PMC-Sierra MSP7120 Eval Board";
131 #elif defined(CONFIG_PMC_MSP7120_GW)
132 return "PMC-Sierra MSP7120 Residential Gateway";
133 #elif defined(CONFIG_PMC_MSP7120_FPGA)
134 return "PMC-Sierra MSP7120 FPGA";
136 #error "What is the type of *your* MSP?"
150 if (
str2eaddr(ethernet_addr, ethaddr_str) == -1) {
152 ethaddr_name, ethaddr_str);
159 for (i = 0; i < 5; i++)
161 (
unsigned char)*(ethernet_addr+i));
169 static char *get_features(
void)
173 if (feature ==
NULL) {
175 feature = msp_default_features;
181 static char test_feature(
char c)
183 char *feature = get_features();
198 if (deviceid ==
NULL)
201 return str2hex(deviceid);
239 static char identify_enetfeature(
char key,
unsigned long interface_num)
241 char *feature = get_features();
244 if (*feature++ == key && interface_num-- == 0)
254 return identify_enetfeature(
ENET_KEY, interface_num);
260 return identify_enetfeature(
ENETTXD_KEY, interface_num);
297 if (
strncmp(env_name, *var, i) == 0) {
298 return (*var +
strlen(env_name) + 1);
327 static int __init prom_memtype_classify(
unsigned int type)
349 type = prom_memtype_classify(p->
type);
372 for (argc = 0; argc <
prom_argc; argc++) {
373 len +=
sizeof(
char *);
376 len +=
sizeof(
char *);
379 ptr = (
char *) &argv[prom_argc + 1];
381 for (argc = 0; argc <
prom_argc; argc++) {
394 len +=
sizeof(
char *);
397 len +=
sizeof(
char *);
400 ptr = (
char *) &envp[i+1];
402 for (argc = 0; argc <
i; argc++) {
422 static char memsz_env[]
__initdata =
"memsize";
423 static char heaptop_env[] __initdata =
"heaptop";
426 unsigned int heaptop;
431 ppfinit(
"memsize not set in boot prom, "
432 "set to default (32Mb)\n");
433 memsize = 0x02000000;
439 memsize = 0x02000000;
449 ppfinit(
"heaptop not set in boot prom, "
450 "set to default 0x%08x\n", heaptop);
470 mdesc[
i].base = 0x00000000;