1 From fb009cbdd0693bd633f11e99526617b3d392cfad Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Mon, 8 Mar 2021 10:03:16 +0100
4 Subject: [PATCH] firmware: bcm47xx_nvram: rename finding function and its
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 1. Use "bcm47xx_" function name prefix for consistency
11 2. It takes flash start as argument so s/iobase/flash_start/
12 3. "off" was used for finding flash end so just call it "flash_size"
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
17 drivers/firmware/broadcom/bcm47xx_nvram.c | 24 ++++++++++++-----------
18 1 file changed, 13 insertions(+), 11 deletions(-)
20 diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c
21 index 835ece9c00f1..b04007adc79f 100644
22 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c
23 +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
24 @@ -48,11 +48,13 @@ static u32 find_nvram_size(void __iomem *end)
28 -/* Probe for NVRAM header */
29 -static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
31 + * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it
33 +static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size)
35 struct nvram_header __iomem *header;
41 @@ -61,25 +63,25 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
44 /* TODO: when nvram is on nand flash check for bad blocks first. */
46 - while (off <= lim) {
47 + flash_size = FLASH_MIN;
48 + while (flash_size <= res_size) {
49 /* Windowed flash access */
50 - size = find_nvram_size(iobase + off);
51 + size = find_nvram_size(flash_start + flash_size);
53 - header = (struct nvram_header *)(iobase + off - size);
54 + header = (struct nvram_header *)(flash_start + flash_size - size);
61 /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
62 - header = (struct nvram_header *)(iobase + 4096);
63 + header = (struct nvram_header *)(flash_start + 4096);
64 if (header->magic == NVRAM_MAGIC) {
69 - header = (struct nvram_header *)(iobase + 1024);
70 + header = (struct nvram_header *)(flash_start + 1024);
71 if (header->magic == NVRAM_MAGIC) {
74 @@ -124,7 +126,7 @@ int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
78 - err = nvram_find_and_copy(iobase, lim);
79 + err = bcm47xx_nvram_find_and_copy(iobase, lim);