Root/target/linux/ar71xx/patches-3.6/507-MIPS-ath79-prom-add-myloader-support.patch

1--- a/arch/mips/ath79/prom.c
2+++ b/arch/mips/ath79/prom.c
3@@ -16,6 +16,7 @@
4 
5 #include <asm/bootinfo.h>
6 #include <asm/addrspace.h>
7+#include <asm/fw/myloader/myloader.h>
8 
9 #include "common.h"
10 
11@@ -69,6 +70,37 @@ static const char * __init ath79_prom_fi
12     return ret;
13 }
14 
15+static int __init ath79_prom_init_myloader(void)
16+{
17+ struct myloader_info *mylo;
18+ char mac_buf[32];
19+ unsigned char *mac;
20+
21+ mylo = myloader_get_info();
22+ if (!mylo)
23+ return 0;
24+
25+ switch (mylo->did) {
26+ case DEVID_COMPEX_WP543:
27+ ath79_prom_append_cmdline("board", "WP543");
28+ break;
29+ case DEVID_COMPEX_WPE72:
30+ ath79_prom_append_cmdline("board", "WPE72");
31+ break;
32+ default:
33+ pr_warn("prom: unknown device id: %x\n", mylo->did);
34+ return 0;
35+ }
36+
37+ mac = mylo->macs[0];
38+ snprintf(mac_buf, sizeof(mac_buf), "%02x:%02x:%02x:%02x:%02x:%02x",
39+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
40+
41+ ath79_prom_append_cmdline("ethaddr", mac_buf);
42+
43+ return 1;
44+}
45+
46 static __init void ath79_prom_init_cmdline(int argc, char **argv)
47 {
48     int i;
49@@ -88,6 +120,9 @@ void __init prom_init(void)
50     const char *env;
51     char **envp;
52 
53+ if (ath79_prom_init_myloader())
54+ return;
55+
56     ath79_prom_init_cmdline(fw_arg0, (char **)fw_arg1);
57 
58     envp = (char **)fw_arg2;
59

Archive Download this file



interactive