1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Date: Thu, 11 Mar 2021 08:24:44 +0100
3 Subject: [PATCH] firmware: bcm47xx_nvram: support init from IO memory
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
8 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
10 drivers/firmware/broadcom/bcm47xx_nvram.c | 17 +++++++++++++++++
11 include/linux/bcm47xx_nvram.h | 6 ++++++
12 2 files changed, 23 insertions(+)
14 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c
15 +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
16 @@ -110,6 +110,23 @@ found:
20 +int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size)
23 + pr_warn("nvram already initialized\n");
27 + if (!bcm47xx_nvram_is_valid(nvram_start)) {
28 + pr_err("No valid NVRAM found\n");
32 + bcm47xx_nvram_copy(nvram_start, res_size);
38 * On bcm47xx we need access to the NVRAM very early, so we can't use mtd
39 * subsystem to access flash. We can't even use platform device / driver to
40 --- a/include/linux/bcm47xx_nvram.h
41 +++ b/include/linux/bcm47xx_nvram.h
43 #include <linux/vmalloc.h>
45 #ifdef CONFIG_BCM47XX_NVRAM
46 +int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size);
47 int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
48 int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
49 int bcm47xx_nvram_gpio_pin(const char *name);
50 @@ -20,6 +21,11 @@ static inline void bcm47xx_nvram_release
54 +static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start,
59 static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)