000e4b5ac4891b00e0cf3cf191cc0f7ca9a3dc94
[openwrt/staging/robimarko.git] /
1 From 7177efc5b030012c54c2e217c9d6decc0bcc1c53 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Tue, 28 Oct 2014 13:30:23 +0100
4 Subject: [PATCH 156/158] MIPS: BCM47XX: Make bcma init NVRAM instead of
5 bcm47xx polling it
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This drops ssb/bcma dependency and will allow us to make it a standalone
11 driver.
12
13 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
14 Cc: linux-mips@linux-mips.org
15 Cc: Hauke Mehrtens <hauke@hauke-m.de>
16 Patchwork: https://patchwork.linux-mips.org/patch/8233/
17 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
18 ---
19 arch/mips/bcm47xx/nvram.c | 42 ++----------------------------------------
20 drivers/bcma/driver_mips.c | 13 +++++++++++--
21 2 files changed, 13 insertions(+), 42 deletions(-)
22
23 --- a/arch/mips/bcm47xx/nvram.c
24 +++ b/arch/mips/bcm47xx/nvram.c
25 @@ -121,48 +121,10 @@ int bcm47xx_nvram_init_from_mem(u32 base
26 return err;
27 }
28
29 -#ifdef CONFIG_BCM47XX_BCMA
30 -static int nvram_init_bcma(void)
31 -{
32 - struct bcma_drv_cc *cc = &bcm47xx_bus.bcma.bus.drv_cc;
33 - u32 base;
34 - u32 lim;
35 -
36 -#ifdef CONFIG_BCMA_NFLASH
37 - if (cc->nflash.boot) {
38 - base = BCMA_SOC_FLASH1;
39 - lim = BCMA_SOC_FLASH1_SZ;
40 - } else
41 -#endif
42 - if (cc->pflash.present) {
43 - base = cc->pflash.window;
44 - lim = cc->pflash.window_size;
45 -#ifdef CONFIG_BCMA_SFLASH
46 - } else if (cc->sflash.present) {
47 - base = cc->sflash.window;
48 - lim = cc->sflash.size;
49 -#endif
50 - } else {
51 - pr_err("Couldn't find supported flash memory\n");
52 - return -ENXIO;
53 - }
54 -
55 - return bcm47xx_nvram_init_from_mem(base, lim);
56 -}
57 -#endif
58 -
59 static int nvram_init(void)
60 {
61 - switch (bcm47xx_bus_type) {
62 -#ifdef CONFIG_BCM47XX_SSB
63 - case BCM47XX_BUS_TYPE_SSB:
64 - break;
65 -#endif
66 -#ifdef CONFIG_BCM47XX_BCMA
67 - case BCM47XX_BUS_TYPE_BCMA:
68 - return nvram_init_bcma();
69 -#endif
70 - }
71 + /* TODO: Look for MTD "nvram" partition */
72 +
73 return -ENXIO;
74 }
75
76 --- a/drivers/bcma/driver_mips.c
77 +++ b/drivers/bcma/driver_mips.c
78 @@ -20,6 +20,9 @@
79 #include <linux/serial_core.h>
80 #include <linux/serial_reg.h>
81 #include <linux/time.h>
82 +#ifdef CONFIG_BCM47XX
83 +#include <bcm47xx_nvram.h>
84 +#endif
85
86 enum bcma_boot_dev {
87 BCMA_BOOT_DEV_UNK = 0,
88 @@ -316,10 +319,16 @@ static void bcma_core_mips_flash_detect(
89 switch (boot_dev) {
90 case BCMA_BOOT_DEV_PARALLEL:
91 case BCMA_BOOT_DEV_SERIAL:
92 - /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */
93 +#ifdef CONFIG_BCM47XX
94 + bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH2,
95 + BCMA_SOC_FLASH2_SZ);
96 +#endif
97 break;
98 case BCMA_BOOT_DEV_NAND:
99 - /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */
100 +#ifdef CONFIG_BCM47XX
101 + bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH1,
102 + BCMA_SOC_FLASH1_SZ);
103 +#endif
104 break;
105 default:
106 break;