ar71xx: Add support for ath79_gpio_function_* on QCA955X
[openwrt.git] / target / linux / ar71xx / patches-4.1 / 506-MIPS-ath79-prom-parse-redboot-args.patch
1 --- a/arch/mips/ath79/prom.c
2 +++ b/arch/mips/ath79/prom.c
3 @@ -22,10 +22,39 @@
4  
5  #include "common.h"
6  
7 +static char ath79_cmdline_buf[COMMAND_LINE_SIZE] __initdata;
8 +
9 +static void __init ath79_prom_append_cmdline(const char *name,
10 +                                             const char *value)
11 +{
12 +       snprintf(ath79_cmdline_buf, sizeof(ath79_cmdline_buf),
13 +                " %s=%s", name, value);
14 +       strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
15 +}
16 +
17  void __init prom_init(void)
18  {
19 +       const char *env;
20 +
21         fw_init_cmdline();
22  
23 +       env = fw_getenv("ethaddr");
24 +       if (env)
25 +               ath79_prom_append_cmdline("ethaddr", env);
26 +
27 +       env = fw_getenv("board");
28 +       if (env) {
29 +               /* Workaround for buggy bootloaders */
30 +               if (strcmp(env, "RouterStation") == 0 ||
31 +                   strcmp(env, "Ubiquiti AR71xx-based board") == 0)
32 +                       env = "UBNT-RS";
33 +
34 +               if (strcmp(env, "RouterStation PRO") == 0)
35 +                       env = "UBNT-RSPRO";
36 +
37 +               ath79_prom_append_cmdline("board", env);
38 +       }
39 +
40  #ifdef CONFIG_BLK_DEV_INITRD
41         /* Read the initrd address from the firmware environment */
42         initrd_start = fw_getenvl("initrd_start");