| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* |
| 3 | */ |
| 4 | |
| 5 | #ifndef __BCM47XX_NVRAM_H |
| 6 | #define __BCM47XX_NVRAM_H |
| 7 | |
| 8 | #include <linux/errno.h> |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/vmalloc.h> |
| 11 | |
| 12 | #ifdef CONFIG_BCM47XX_NVRAM |
| 13 | int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size); |
| 14 | int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); |
| 15 | int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); |
| 16 | int bcm47xx_nvram_gpio_pin(const char *name); |
| 17 | char *bcm47xx_nvram_get_contents(size_t *val_len); |
| 18 | static inline void bcm47xx_nvram_release_contents(char *nvram) |
| 19 | { |
| 20 | vfree(addr: nvram); |
| 21 | }; |
| 22 | #else |
| 23 | static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, |
| 24 | size_t res_size) |
| 25 | { |
| 26 | return -ENOTSUPP; |
| 27 | } |
| 28 | static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) |
| 29 | { |
| 30 | return -ENOTSUPP; |
| 31 | }; |
| 32 | static inline int bcm47xx_nvram_getenv(const char *name, char *val, |
| 33 | size_t val_len) |
| 34 | { |
| 35 | return -ENOTSUPP; |
| 36 | }; |
| 37 | static inline int bcm47xx_nvram_gpio_pin(const char *name) |
| 38 | { |
| 39 | return -ENOTSUPP; |
| 40 | }; |
| 41 | |
| 42 | static inline char *bcm47xx_nvram_get_contents(size_t *val_len) |
| 43 | { |
| 44 | return NULL; |
| 45 | }; |
| 46 | |
| 47 | static inline void bcm47xx_nvram_release_contents(char *nvram) |
| 48 | { |
| 49 | }; |
| 50 | #endif |
| 51 | |
| 52 | #endif /* __BCM47XX_NVRAM_H */ |
| 53 | |