Openwrt/target/linux/brcm47xx/patches-3.0/250-bcma-flash.patch

79 lines
2.2 KiB
Diff
Raw Normal View History

--- 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");