MIPS: BCM47XX: Make bcma init NVRAM instead of bcm47xx polling it
authorRafał Miłecki <zajec5@gmail.com>
Tue, 28 Oct 2014 12:30:23 +0000 (13:30 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 24 Nov 2014 06:44:59 +0000 (07:44 +0100)
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>
arch/mips/bcm47xx/nvram.c
drivers/bcma/driver_mips.c

index fecc5aeddd46a1b7866d75a0d8d58a78acf8a024..21712fb40d723a7b53cd98f1c66fbdda8a277d08 100644 (file)
@@ -121,48 +121,10 @@ int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
        return err;
 }
 
-#ifdef CONFIG_BCM47XX_BCMA
-static int nvram_init_bcma(void)
-{
-       struct bcma_drv_cc *cc = &bcm47xx_bus.bcma.bus.drv_cc;
-       u32 base;
-       u32 lim;
-
-#ifdef CONFIG_BCMA_NFLASH
-       if (cc->nflash.boot) {
-               base = BCMA_SOC_FLASH1;
-               lim = BCMA_SOC_FLASH1_SZ;
-       } else
-#endif
-       if (cc->pflash.present) {
-               base = cc->pflash.window;
-               lim = cc->pflash.window_size;
-#ifdef CONFIG_BCMA_SFLASH
-       } else if (cc->sflash.present) {
-               base = cc->sflash.window;
-               lim = cc->sflash.size;
-#endif
-       } else {
-               pr_err("Couldn't find supported flash memory\n");
-               return -ENXIO;
-       }
-
-       return bcm47xx_nvram_init_from_mem(base, lim);
-}
-#endif
-
 static int nvram_init(void)
 {
-       switch (bcm47xx_bus_type) {
-#ifdef CONFIG_BCM47XX_SSB
-       case BCM47XX_BUS_TYPE_SSB:
-               break;
-#endif
-#ifdef CONFIG_BCM47XX_BCMA
-       case BCM47XX_BUS_TYPE_BCMA:
-               return nvram_init_bcma();
-#endif
-       }
+       /* TODO: Look for MTD "nvram" partition */
+
        return -ENXIO;
 }
 
index 004d6aa671cecbf82f0df9da6078f868683de361..8a653dc49029a6162e4a2c91819ddbec60ed2313 100644 (file)
@@ -20,6 +20,9 @@
 #include <linux/serial_core.h>
 #include <linux/serial_reg.h>
 #include <linux/time.h>
+#ifdef CONFIG_BCM47XX
+#include <bcm47xx_nvram.h>
+#endif
 
 enum bcma_boot_dev {
        BCMA_BOOT_DEV_UNK = 0,
@@ -323,10 +326,16 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
        switch (boot_dev) {
        case BCMA_BOOT_DEV_PARALLEL:
        case BCMA_BOOT_DEV_SERIAL:
-               /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */
+#ifdef CONFIG_BCM47XX
+               bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH2,
+                                           BCMA_SOC_FLASH2_SZ);
+#endif
                break;
        case BCMA_BOOT_DEV_NAND:
-               /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */
+#ifdef CONFIG_BCM47XX
+               bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH1,
+                                           BCMA_SOC_FLASH1_SZ);
+#endif
                break;
        default:
                break;