aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-10-28 08:30:23 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 01:44:59 -0500
commit7177efc5b030012c54c2e217c9d6decc0bcc1c53 (patch)
treede7286cacf84e4936905451e6278e9f726b9cca8
parent21400f252a97755579b43a4dc95dd02cd7f0ca75 (diff)
MIPS: BCM47XX: Make bcma init NVRAM instead of bcm47xx polling it
This drops ssb/bcma dependency and will allow us to make it a standalone driver. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Cc: linux-mips@linux-mips.org Cc: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: https://patchwork.linux-mips.org/patch/8233/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/bcm47xx/nvram.c42
-rw-r--r--drivers/bcma/driver_mips.c13
2 files changed, 13 insertions, 42 deletions
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index fecc5aeddd46..21712fb40d72 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -121,48 +121,10 @@ int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
121 return err; 121 return err;
122} 122}
123 123
124#ifdef CONFIG_BCM47XX_BCMA
125static int nvram_init_bcma(void)
126{
127 struct bcma_drv_cc *cc = &bcm47xx_bus.bcma.bus.drv_cc;
128 u32 base;
129 u32 lim;
130
131#ifdef CONFIG_BCMA_NFLASH
132 if (cc->nflash.boot) {
133 base = BCMA_SOC_FLASH1;
134 lim = BCMA_SOC_FLASH1_SZ;
135 } else
136#endif
137 if (cc->pflash.present) {
138 base = cc->pflash.window;
139 lim = cc->pflash.window_size;
140#ifdef CONFIG_BCMA_SFLASH
141 } else if (cc->sflash.present) {
142 base = cc->sflash.window;
143 lim = cc->sflash.size;
144#endif
145 } else {
146 pr_err("Couldn't find supported flash memory\n");
147 return -ENXIO;
148 }
149
150 return bcm47xx_nvram_init_from_mem(base, lim);
151}
152#endif
153
154static int nvram_init(void) 124static int nvram_init(void)
155{ 125{
156 switch (bcm47xx_bus_type) { 126 /* TODO: Look for MTD "nvram" partition */
157#ifdef CONFIG_BCM47XX_SSB 127
158 case BCM47XX_BUS_TYPE_SSB:
159 break;
160#endif
161#ifdef CONFIG_BCM47XX_BCMA
162 case BCM47XX_BUS_TYPE_BCMA:
163 return nvram_init_bcma();
164#endif
165 }
166 return -ENXIO; 128 return -ENXIO;
167} 129}
168 130
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index 004d6aa671ce..8a653dc49029 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -20,6 +20,9 @@
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
22#include <linux/time.h> 22#include <linux/time.h>
23#ifdef CONFIG_BCM47XX
24#include <bcm47xx_nvram.h>
25#endif
23 26
24enum bcma_boot_dev { 27enum bcma_boot_dev {
25 BCMA_BOOT_DEV_UNK = 0, 28 BCMA_BOOT_DEV_UNK = 0,
@@ -323,10 +326,16 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
323 switch (boot_dev) { 326 switch (boot_dev) {
324 case BCMA_BOOT_DEV_PARALLEL: 327 case BCMA_BOOT_DEV_PARALLEL:
325 case BCMA_BOOT_DEV_SERIAL: 328 case BCMA_BOOT_DEV_SERIAL:
326 /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */ 329#ifdef CONFIG_BCM47XX
330 bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH2,
331 BCMA_SOC_FLASH2_SZ);
332#endif
327 break; 333 break;
328 case BCMA_BOOT_DEV_NAND: 334 case BCMA_BOOT_DEV_NAND:
329 /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */ 335#ifdef CONFIG_BCM47XX
336 bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH1,
337 BCMA_SOC_FLASH1_SZ);
338#endif
330 break; 339 break;
331 default: 340 default:
332 break; 341 break;