Waldemar Brodkorb | 121915c | 2010-06-08 19:06:01 +0200 | [diff] [blame] | 1 | /* |
Waldemar Brodkorb | 121915c | 2010-06-08 19:06:01 +0200 | [diff] [blame] | 2 | * This program is free software; you can redistribute it and/or modify it |
| 3 | * under the terms of the GNU General Public License as published by the |
| 4 | * Free Software Foundation; either version 2 of the License, or (at your |
| 5 | * option) any later version. |
| 6 | */ |
| 7 | |
Hauke Mehrtens | 111bd98 | 2012-12-26 19:51:14 +0000 | [diff] [blame] | 8 | #ifndef __BCM47XX_NVRAM_H |
| 9 | #define __BCM47XX_NVRAM_H |
Waldemar Brodkorb | 121915c | 2010-06-08 19:06:01 +0200 | [diff] [blame] | 10 | |
Arnd Bergmann | 0cb5133 | 2017-05-31 09:26:07 -0700 | [diff] [blame] | 11 | #include <linux/errno.h> |
Waldemar Brodkorb | 121915c | 2010-06-08 19:06:01 +0200 | [diff] [blame] | 12 | #include <linux/types.h> |
Hauke Mehrtens | 59833fc | 2010-11-27 17:46:00 +0100 | [diff] [blame] | 13 | #include <linux/kernel.h> |
Hante Meuleman | 55cab93b | 2015-05-21 15:27:23 +0200 | [diff] [blame] | 14 | #include <linux/vmalloc.h> |
Waldemar Brodkorb | 121915c | 2010-06-08 19:06:01 +0200 | [diff] [blame] | 15 | |
Rafał Miłecki | f6e734a | 2015-06-10 23:05:08 +0200 | [diff] [blame] | 16 | #ifdef CONFIG_BCM47XX_NVRAM |
Rafał Miłecki | 21400f2 | 2014-09-03 22:59:45 +0200 | [diff] [blame] | 17 | int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); |
Rafał Miłecki | 341097f | 2014-10-30 12:50:03 +0100 | [diff] [blame] | 18 | int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); |
Hauke Mehrtens | 62cf3bc | 2013-09-18 13:31:15 +0200 | [diff] [blame] | 19 | int bcm47xx_nvram_gpio_pin(const char *name); |
Hante Meuleman | 55cab93b | 2015-05-21 15:27:23 +0200 | [diff] [blame] | 20 | char *bcm47xx_nvram_get_contents(size_t *val_len); |
| 21 | static inline void bcm47xx_nvram_release_contents(char *nvram) |
| 22 | { |
| 23 | vfree(nvram); |
| 24 | }; |
Rafał Miłecki | 138173d | 2014-12-01 07:58:18 +0100 | [diff] [blame] | 25 | #else |
| 26 | static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) |
| 27 | { |
| 28 | return -ENOTSUPP; |
| 29 | }; |
| 30 | static inline int bcm47xx_nvram_getenv(const char *name, char *val, |
| 31 | size_t val_len) |
| 32 | { |
| 33 | return -ENOTSUPP; |
| 34 | }; |
| 35 | static inline int bcm47xx_nvram_gpio_pin(const char *name) |
| 36 | { |
| 37 | return -ENOTSUPP; |
| 38 | }; |
Hante Meuleman | 55cab93b | 2015-05-21 15:27:23 +0200 | [diff] [blame] | 39 | |
| 40 | static inline char *bcm47xx_nvram_get_contents(size_t *val_len) |
| 41 | { |
| 42 | return NULL; |
| 43 | }; |
| 44 | |
| 45 | static inline void bcm47xx_nvram_release_contents(char *nvram) |
| 46 | { |
| 47 | }; |
Rafał Miłecki | 138173d | 2014-12-01 07:58:18 +0100 | [diff] [blame] | 48 | #endif |
Hauke Mehrtens | 62cf3bc | 2013-09-18 13:31:15 +0200 | [diff] [blame] | 49 | |
Hauke Mehrtens | 111bd98 | 2012-12-26 19:51:14 +0000 | [diff] [blame] | 50 | #endif /* __BCM47XX_NVRAM_H */ |