1 From 8d602dd0f984e8488ab891344ebdb6e1f3128c4a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Wed, 3 Sep 2014 22:51:06 +0200
4 Subject: [PATCH 154/158] MIPS: BCM47XX: Get rid of calls to KSEG1ADDR
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 We should be using ioremap_nocache helper which handles remaps in a
12 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
13 Cc: linux-mips@linux-mips.org
14 Cc: Hauke Mehrtens <hauke@hauke-m.de>
15 Patchwork: http://patchwork.linux-mips.org/patch/7611/
16 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
18 arch/mips/bcm47xx/nvram.c | 44 ++++++++++++++++++++++++++++++++------------
19 1 file changed, 32 insertions(+), 12 deletions(-)
21 diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
22 index 2bed73a..e07976b 100644
23 --- a/arch/mips/bcm47xx/nvram.c
24 +++ b/arch/mips/bcm47xx/nvram.c
26 static char nvram_buf[NVRAM_SPACE];
27 static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
29 -static u32 find_nvram_size(u32 end)
30 +static u32 find_nvram_size(void __iomem *end)
32 - struct nvram_header *header;
33 + struct nvram_header __iomem *header;
36 for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
37 - header = (struct nvram_header *)KSEG1ADDR(end - nvram_sizes[i]);
38 + header = (struct nvram_header *)(end - nvram_sizes[i]);
39 if (header->magic == NVRAM_HEADER)
40 return nvram_sizes[i];
42 @@ -38,35 +38,39 @@ static u32 find_nvram_size(u32 end)
45 /* Probe for NVRAM header */
46 -static int nvram_find_and_copy(u32 base, u32 lim)
47 +static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
49 - struct nvram_header *header;
50 + struct nvram_header __iomem *header;
57 + pr_warn("nvram already initialized\n");
61 /* TODO: when nvram is on nand flash check for bad blocks first. */
64 /* Windowed flash access */
65 - size = find_nvram_size(base + off);
66 + size = find_nvram_size(iobase + off);
68 - header = (struct nvram_header *)KSEG1ADDR(base + off -
70 + header = (struct nvram_header *)(iobase + off - size);
76 /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
77 - header = (struct nvram_header *) KSEG1ADDR(base + 4096);
78 + header = (struct nvram_header *)(iobase + 4096);
79 if (header->magic == NVRAM_HEADER) {
84 - header = (struct nvram_header *) KSEG1ADDR(base + 1024);
85 + header = (struct nvram_header *)(iobase + 1024);
86 if (header->magic == NVRAM_HEADER) {
89 @@ -94,6 +98,22 @@ found:
93 +static int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
95 + void __iomem *iobase;
98 + iobase = ioremap_nocache(base, lim);
102 + err = nvram_find_and_copy(iobase, lim);
109 #ifdef CONFIG_BCM47XX_SSB
110 static int nvram_init_ssb(void)
112 @@ -109,7 +129,7 @@ static int nvram_init_ssb(void)
116 - return nvram_find_and_copy(base, lim);
117 + return bcm47xx_nvram_init_from_mem(base, lim);
121 @@ -139,7 +159,7 @@ static int nvram_init_bcma(void)
125 - return nvram_find_and_copy(base, lim);
126 + return bcm47xx_nvram_init_from_mem(base, lim);