summaryrefslogtreecommitdiff
path: root/target/linux/brcm47xx/patches-3.0/250-bcma-flash.patch
blob: 2b2f011066c5327eeb2f66e2136e34b79f6d12ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--- a/drivers/mtd/maps/bcm47xx-flash.c
+++ b/drivers/mtd/maps/bcm47xx-flash.c
@@ -46,11 +46,9 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
 #include <linux/crc32.h>
-#ifdef CONFIG_SSB
-#include <linux/ssb/ssb.h>
-#endif
 #include <asm/io.h>
 #include <asm/mach-bcm47xx/nvram.h>
+#include <asm/mach-bcm47xx/bcm47xx.h>
 #include <asm/fw/cfe/cfe_api.h>
 
 
@@ -90,9 +88,6 @@ struct trx_header {
 #define ROUTER_NETGEAR_WNR3500L        4
 #define ROUTER_SIMPLETECH_SIMPLESHARE  5
 
-#ifdef CONFIG_SSB
-extern struct ssb_bus ssb_bcm47xx;
-#endif
 static struct mtd_info *bcm47xx_mtd;
 
 static void bcm47xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
@@ -552,27 +547,42 @@ init_mtd_partitions(struct mtd_info *mtd
 
 int __init init_bcm47xx_map(void)
 {
-#ifdef CONFIG_SSB
-	struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
+#ifdef CONFIG_BCM47XX_SSB
+	struct ssb_mipscore *mcore_ssb;
+#endif
+#ifdef CONFIG_BCM47XX_BCMA
+	struct bcma_drv_mips *mcore_bcma;
 #endif
 	size_t size;
 	int ret = 0;
+	u32 window = 0;
+	u32 window_size = 0;
 	struct mtd_partition *parts;
 	int i;
 
-#ifdef CONFIG_SSB
-	u32 window = mcore->flash_window;
-	u32 window_size = mcore->flash_window_size;
+	switch (bcm47xx_active_bus_type) {
+#ifdef CONFIG_BCM47XX_SSB
+	case BCM47XX_BUS_TYPE_SSB:
+		mcore_ssb = &bcm47xx_bus.ssb.mipscore;
+		window = mcore_ssb->flash_window;
+		window_size = mcore_ssb->flash_window_size;
+		bcm47xx_map.bankwidth = mcore_ssb->flash_buswidth;
+		break;
+#endif
+#ifdef CONFIG_BCM47XX_BCMA
+	case BCM47XX_BUS_TYPE_BCMA:
+		mcore_bcma = &bcm47xx_bus.bcma.bus.drv_mips;
+		window = mcore_bcma->flash_window;
+		window_size = mcore_bcma->flash_window_size;
+		bcm47xx_map.bankwidth = mcore_bcma->flash_buswidth;
+		break;
+#endif
+	}
 
 	printk("flash init: 0x%08x 0x%08x\n", window, window_size);
 	bcm47xx_map.phys = window;
 	bcm47xx_map.size = window_size;
-	bcm47xx_map.bankwidth = mcore->flash_buswidth;
 	bcm47xx_map.virt = ioremap_nocache(window, window_size);
-#else
-	printk("flash init: 0x%08x 0x%08x\n", WINDOW_ADDR, WINDOW_SIZE);
-	bcm47xx_map.virt = ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
-#endif
 
 	if (!bcm47xx_map.virt) {
 		printk("Failed to ioremap\n");