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 --- a/arch/mips/bcm47xx/nvram.c
22 +++ b/arch/mips/bcm47xx/nvram.c
24 static char nvram_buf[NVRAM_SPACE];
25 static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
27 -static u32 find_nvram_size(u32 end)
28 +static u32 find_nvram_size(void __iomem *end)
30 - struct nvram_header *header;
31 + struct nvram_header __iomem *header;
34 for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
35 - header = (struct nvram_header *)KSEG1ADDR(end - nvram_sizes[i]);
36 + header = (struct nvram_header *)(end - nvram_sizes[i]);
37 if (header->magic == NVRAM_HEADER)
38 return nvram_sizes[i];
40 @@ -38,35 +38,39 @@ static u32 find_nvram_size(u32 end)
43 /* Probe for NVRAM header */
44 -static int nvram_find_and_copy(u32 base, u32 lim)
45 +static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
47 - struct nvram_header *header;
48 + struct nvram_header __iomem *header;
55 + pr_warn("nvram already initialized\n");
59 /* TODO: when nvram is on nand flash check for bad blocks first. */
62 /* Windowed flash access */
63 - size = find_nvram_size(base + off);
64 + size = find_nvram_size(iobase + off);
66 - header = (struct nvram_header *)KSEG1ADDR(base + off -
68 + header = (struct nvram_header *)(iobase + off - size);
74 /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
75 - header = (struct nvram_header *) KSEG1ADDR(base + 4096);
76 + header = (struct nvram_header *)(iobase + 4096);
77 if (header->magic == NVRAM_HEADER) {
82 - header = (struct nvram_header *) KSEG1ADDR(base + 1024);
83 + header = (struct nvram_header *)(iobase + 1024);
84 if (header->magic == NVRAM_HEADER) {
87 @@ -94,6 +98,22 @@ found:
91 +static int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
93 + void __iomem *iobase;
96 + iobase = ioremap_nocache(base, lim);
100 + err = nvram_find_and_copy(iobase, lim);
107 #ifdef CONFIG_BCM47XX_SSB
108 static int nvram_init_ssb(void)
110 @@ -109,7 +129,7 @@ static int nvram_init_ssb(void)
114 - return nvram_find_and_copy(base, lim);
115 + return bcm47xx_nvram_init_from_mem(base, lim);
119 @@ -139,7 +159,7 @@ static int nvram_init_bcma(void)
123 - return nvram_find_and_copy(base, lim);
124 + return bcm47xx_nvram_init_from_mem(base, lim);