ar71xx: Add QCA955X GPIO mux and function definitions
[openwrt.git] / target / linux / ar71xx / patches-4.1 / 507-MIPS-ath79-prom-add-myloader-support.patch
1 --- a/arch/mips/ath79/prom.c
2 +++ b/arch/mips/ath79/prom.c
3 @@ -19,6 +19,7 @@
4  #include <asm/bootinfo.h>
5  #include <asm/addrspace.h>
6  #include <asm/fw/fw.h>
7 +#include <asm/fw/myloader/myloader.h>
8  
9  #include "common.h"
10  
11 @@ -32,10 +33,44 @@ static void __init ath79_prom_append_cmd
12         strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
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  void __init prom_init(void)
47  {
48         const char *env;
49  
50 +       if (ath79_prom_init_myloader())
51 +               return;
52 +
53         fw_init_cmdline();
54  
55         env = fw_getenv("ethaddr");