brcm47xx: add support for kernel 3.2
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.2 / 400-arch-bcm47xx.patch
1 --- a/arch/mips/bcm47xx/nvram.c
2 +++ b/arch/mips/bcm47xx/nvram.c
3 @@ -199,3 +199,30 @@ int nvram_getenv(char *name, char *val,
4 return NVRAM_ERR_ENVNOTFOUND;
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 + eq = strchr(var, '=');
24 + if (!eq)
25 + break;
26 + value = eq + 1;
27 + if ((eq - var) == strlen(name) && strncmp(var, name, (eq - var)) == 0)
28 + return value;
29 + }
30 +
31 + return NULL;
32 +}
33 +EXPORT_SYMBOL(nvram_get);
34 --- a/arch/mips/bcm47xx/setup.c
35 +++ b/arch/mips/bcm47xx/setup.c
36 @@ -469,3 +469,20 @@ static int __init bcm47xx_register_flash
37 return -1;
38 }
39 fs_initcall(bcm47xx_register_flash);
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);