mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 02:36:02 +00:00
a5be5ce0e2
Provide NVMEM content to the NVRAM driver from a simple memory resource. This is necessary to use NVRAM in a memory- mapped flash device. Patch taken from OpenWrts development tree. This patch makes it possible to use memory-mapped NVRAM on the D-Link DWL-8610AP and the D-Link DIR-890L. Cc: Hauke Mehrtens <hauke@hauke-m.de> Cc: linux-mips@vger.kernel.org Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Rafał Miłecki <rafal@milecki.pl> [Added an export for modules potentially using the init symbol] Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20221103082529.359084-1-linus.walleij@linaro.org Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
*/
|
|
|
|
#ifndef __BCM47XX_NVRAM_H
|
|
#define __BCM47XX_NVRAM_H
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/vmalloc.h>
|
|
|
|
#ifdef CONFIG_BCM47XX_NVRAM
|
|
int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size);
|
|
int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
|
|
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
|
|
int bcm47xx_nvram_gpio_pin(const char *name);
|
|
char *bcm47xx_nvram_get_contents(size_t *val_len);
|
|
static inline void bcm47xx_nvram_release_contents(char *nvram)
|
|
{
|
|
vfree(nvram);
|
|
};
|
|
#else
|
|
static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start,
|
|
size_t res_size)
|
|
{
|
|
return -ENOTSUPP;
|
|
}
|
|
static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
|
|
{
|
|
return -ENOTSUPP;
|
|
};
|
|
static inline int bcm47xx_nvram_getenv(const char *name, char *val,
|
|
size_t val_len)
|
|
{
|
|
return -ENOTSUPP;
|
|
};
|
|
static inline int bcm47xx_nvram_gpio_pin(const char *name)
|
|
{
|
|
return -ENOTSUPP;
|
|
};
|
|
|
|
static inline char *bcm47xx_nvram_get_contents(size_t *val_len)
|
|
{
|
|
return NULL;
|
|
};
|
|
|
|
static inline void bcm47xx_nvram_release_contents(char *nvram)
|
|
{
|
|
};
|
|
#endif
|
|
|
|
#endif /* __BCM47XX_NVRAM_H */
|