1 commit e49ec29e2da1fd7cdd6d966f389add031a1027a9
2 Author: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Wed Sep 18 13:31:15 2013 +0200
5 MIPS: BCM47XX: Get GPIO pin from nvram configuration
7 The nvram contains some gpio configuration for boards. It is stored in
8 a gpio<number>=name format e.g.
12 This patches adds a function to parse these entries, so other driver
15 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
16 Cc: linux-mips@linux-mips.org
17 Patchwork: https://patchwork.linux-mips.org/patch/5841/
18 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
20 --- a/arch/mips/bcm47xx/nvram.c
21 +++ b/arch/mips/bcm47xx/nvram.c
22 @@ -190,3 +190,23 @@ int bcm47xx_nvram_getenv(char *name, cha
25 EXPORT_SYMBOL(bcm47xx_nvram_getenv);
27 +int bcm47xx_nvram_gpio_pin(const char *name)
33 + for (i = 0; i < 16; i++) {
34 + err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
37 + err = bcm47xx_nvram_getenv(nvram_var, buf, sizeof(buf));
40 + if (!strcmp(name, buf))
45 +EXPORT_SYMBOL(bcm47xx_nvram_gpio_pin);
46 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
47 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
48 @@ -48,4 +48,6 @@ static inline void bcm47xx_nvram_parse_m
49 printk(KERN_WARNING "Can not parse mac address: %s\n", buf);
52 +int bcm47xx_nvram_gpio_pin(const char *name);
54 #endif /* __BCM47XX_NVRAM_H */