brcm47xx: prepare brcm47xx patches for sending to mainline.
[openwrt.git] / target / linux / brcm47xx / patches-2.6.34 / 400-arch-bcm47xx.patch
1 --- a/arch/mips/bcm47xx/nvram.c
2 +++ b/arch/mips/bcm47xx/nvram.c
3 @@ -92,3 +92,30 @@ int nvram_getenv(char *name, char *val, 
4         return 1;
5  }
6  EXPORT_SYMBOL(nvram_getenv);
7 +
8 +char *nvram_get(const char *name)
9 +{
10 +       char *var, *value, *end, *eq;
11 +
12 +       if (!name)
13 +               return NULL;
14 +
15 +       if (!nvram_buf[0])
16 +               early_nvram_init();
17 +
18 +       /* Look for name=value and return value */
19 +       var = &nvram_buf[sizeof(struct nvram_header)];
20 +       end = nvram_buf + sizeof(nvram_buf) - 2;
21 +       end[0] = end[1] = '\0';
22 +       for (; *var; var = value + strlen(value) + 1) {
23 +               if (!(eq = strchr(var, '=')))
24 +                       break;
25 +               value = eq + 1;
26 +               if ((eq - var) == strlen(name) && strncmp(var, name, (eq - var)) == 0)
27 +                       return value;
28 +       }
29 +
30 +       return NULL;
31 +}
32 +
33 +EXPORT_SYMBOL(nvram_get);
34 --- a/arch/mips/bcm47xx/setup.c
35 +++ b/arch/mips/bcm47xx/setup.c
36 @@ -226,3 +226,20 @@ void __init plat_mem_setup(void)
37         _machine_halt = bcm47xx_machine_halt;
38         pm_power_off = bcm47xx_machine_halt;
39  }
40 +
41 +static int __init bcm47xx_register_gpiodev(void)
42 +{
43 +       static struct resource res = {
44 +               .start = 0xFFFFFFFF,
45 +       };
46 +       struct platform_device *pdev;
47 +
48 +       pdev = platform_device_register_simple("GPIODEV", 0, &res, 1);
49 +       if (!pdev) {
50 +               printk(KERN_ERR "bcm47xx: GPIODEV init failed\n");
51 +               return -ENODEV;
52 +       }
53 +
54 +       return 0;
55 +}
56 +device_initcall(bcm47xx_register_gpiodev);