a616fcc0e01b594f79051afcdb93a796044f227e
[openwrt/staging/ansuel.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 diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
24 index fecc5ae..21712fb 100644
25 --- a/arch/mips/bcm47xx/nvram.c
26 +++ b/arch/mips/bcm47xx/nvram.c
27 @@ -121,48 +121,10 @@ int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
28 return err;
29 }
30
31 -#ifdef CONFIG_BCM47XX_BCMA
32 -static int nvram_init_bcma(void)
33 -{
34 - struct bcma_drv_cc *cc = &bcm47xx_bus.bcma.bus.drv_cc;
35 - u32 base;
36 - u32 lim;
37 -
38 -#ifdef CONFIG_BCMA_NFLASH
39 - if (cc->nflash.boot) {
40 - base = BCMA_SOC_FLASH1;
41 - lim = BCMA_SOC_FLASH1_SZ;
42 - } else
43 -#endif
44 - if (cc->pflash.present) {
45 - base = cc->pflash.window;
46 - lim = cc->pflash.window_size;
47 -#ifdef CONFIG_BCMA_SFLASH
48 - } else if (cc->sflash.present) {
49 - base = cc->sflash.window;
50 - lim = cc->sflash.size;
51 -#endif
52 - } else {
53 - pr_err("Couldn't find supported flash memory\n");
54 - return -ENXIO;
55 - }
56 -
57 - return bcm47xx_nvram_init_from_mem(base, lim);
58 -}
59 -#endif
60 -
61 static int nvram_init(void)
62 {
63 - switch (bcm47xx_bus_type) {
64 -#ifdef CONFIG_BCM47XX_SSB
65 - case BCM47XX_BUS_TYPE_SSB:
66 - break;
67 -#endif
68 -#ifdef CONFIG_BCM47XX_BCMA
69 - case BCM47XX_BUS_TYPE_BCMA:
70 - return nvram_init_bcma();
71 -#endif
72 - }
73 + /* TODO: Look for MTD "nvram" partition */
74 +
75 return -ENXIO;
76 }
77
78 diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
79 index 004d6aa..8a653dc 100644
80 --- a/drivers/bcma/driver_mips.c
81 +++ b/drivers/bcma/driver_mips.c
82 @@ -20,6 +20,9 @@
83 #include <linux/serial_core.h>
84 #include <linux/serial_reg.h>
85 #include <linux/time.h>
86 +#ifdef CONFIG_BCM47XX
87 +#include <bcm47xx_nvram.h>
88 +#endif
89
90 enum bcma_boot_dev {
91 BCMA_BOOT_DEV_UNK = 0,
92 @@ -316,10 +319,16 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
93 switch (boot_dev) {
94 case BCMA_BOOT_DEV_PARALLEL:
95 case BCMA_BOOT_DEV_SERIAL:
96 - /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */
97 +#ifdef CONFIG_BCM47XX
98 + bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH2,
99 + BCMA_SOC_FLASH2_SZ);
100 +#endif
101 break;
102 case BCMA_BOOT_DEV_NAND:
103 - /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */
104 +#ifdef CONFIG_BCM47XX
105 + bcm47xx_nvram_init_from_mem(BCMA_SOC_FLASH1,
106 + BCMA_SOC_FLASH1_SZ);
107 +#endif
108 break;
109 default:
110 break;
111 --
112 1.8.4.5
113