2012-05-03 20:18:41 +00:00
|
|
|
--- a/arch/mips/bcm47xx/Makefile
|
|
|
|
+++ b/arch/mips/bcm47xx/Makefile
|
|
|
|
@@ -3,5 +3,5 @@
|
|
|
|
# under Linux.
|
|
|
|
#
|
|
|
|
|
2012-07-25 14:52:00 +00:00
|
|
|
-obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o
|
|
|
|
+obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o bus.o
|
2012-05-03 20:18:41 +00:00
|
|
|
obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/arch/mips/bcm47xx/bus.c
|
2012-08-18 14:08:35 +00:00
|
|
|
@@ -0,0 +1,86 @@
|
2012-05-03 20:18:41 +00:00
|
|
|
+/*
|
|
|
|
+ * BCM947xx nvram variable access
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2011 Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify it
|
|
|
|
+ * under the terms of the GNU General Public License as published by the
|
|
|
|
+ * Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
+ * option) any later version.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <bus.h>
|
|
|
|
+
|
2012-08-18 14:08:35 +00:00
|
|
|
+#ifdef CONFIG_BCM47XX_BCMA
|
2012-05-03 20:18:41 +00:00
|
|
|
+static int bcm47xx_sflash_bcma_read(struct bcm47xx_sflash *dev, u32 offset, u32 len, u8 *buf)
|
|
|
|
+{
|
|
|
|
+ return bcma_sflash_read(dev->bcc, offset, len, buf);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int bcm47xx_sflash_bcma_poll(struct bcm47xx_sflash *dev, u32 offset)
|
|
|
|
+{
|
|
|
|
+ return bcma_sflash_poll(dev->bcc, offset);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int bcm47xx_sflash_bcma_write(struct bcm47xx_sflash *dev, u32 offset, u32 len, const u8 *buf)
|
|
|
|
+{
|
|
|
|
+ return bcma_sflash_write(dev->bcc, offset, len, buf);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int bcm47xx_sflash_bcma_erase(struct bcm47xx_sflash *dev, u32 offset)
|
|
|
|
+{
|
|
|
|
+ return bcma_sflash_erase(dev->bcc, offset);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void bcm47xx_sflash_struct_bcma_init(struct bcm47xx_sflash *sflash, struct bcma_drv_cc *bcc)
|
|
|
|
+{
|
|
|
|
+ sflash->sflash_type = BCM47XX_BUS_TYPE_BCMA;
|
|
|
|
+ sflash->bcc = bcc;
|
|
|
|
+
|
|
|
|
+ sflash->read = bcm47xx_sflash_bcma_read;
|
|
|
|
+ sflash->poll = bcm47xx_sflash_bcma_poll;
|
|
|
|
+ sflash->write = bcm47xx_sflash_bcma_write;
|
|
|
|
+ sflash->erase = bcm47xx_sflash_bcma_erase;
|
|
|
|
+
|
|
|
|
+ sflash->blocksize = bcc->sflash.blocksize;
|
|
|
|
+ sflash->numblocks = bcc->sflash.numblocks;
|
|
|
|
+ sflash->size = bcc->sflash.size;
|
|
|
|
+}
|
2012-08-18 14:08:35 +00:00
|
|
|
+#endif
|
2012-05-03 20:18:41 +00:00
|
|
|
+
|
2012-08-18 14:08:35 +00:00
|
|
|
+#ifdef CONFIG_BCM47XX_SSB
|
2012-05-03 20:18:41 +00:00
|
|
|
+static int bcm47xx_sflash_ssb_read(struct bcm47xx_sflash *dev, u32 offset, u32 len, u8 *buf)
|
|
|
|
+{
|
|
|
|
+ return ssb_sflash_read(dev->scc, offset, len, buf);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int bcm47xx_sflash_ssb_poll(struct bcm47xx_sflash *dev, u32 offset)
|
|
|
|
+{
|
|
|
|
+ return ssb_sflash_poll(dev->scc, offset);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int bcm47xx_sflash_ssb_write(struct bcm47xx_sflash *dev, u32 offset, u32 len, const u8 *buf)
|
|
|
|
+{
|
|
|
|
+ return ssb_sflash_write(dev->scc, offset, len, buf);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int bcm47xx_sflash_ssb_erase(struct bcm47xx_sflash *dev, u32 offset)
|
|
|
|
+{
|
|
|
|
+ return ssb_sflash_erase(dev->scc, offset);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void bcm47xx_sflash_struct_ssb_init(struct bcm47xx_sflash *sflash, struct ssb_chipcommon *scc)
|
|
|
|
+{
|
|
|
|
+ sflash->sflash_type = BCM47XX_BUS_TYPE_SSB;
|
|
|
|
+ sflash->scc = scc;
|
|
|
|
+
|
|
|
|
+ sflash->read = bcm47xx_sflash_ssb_read;
|
|
|
|
+ sflash->poll = bcm47xx_sflash_ssb_poll;
|
|
|
|
+ sflash->write = bcm47xx_sflash_ssb_write;
|
|
|
|
+ sflash->erase = bcm47xx_sflash_ssb_erase;
|
|
|
|
+
|
|
|
|
+ sflash->blocksize = scc->sflash.blocksize;
|
|
|
|
+ sflash->numblocks = scc->sflash.numblocks;
|
|
|
|
+ sflash->size = scc->sflash.size;
|
|
|
|
+}
|
2012-08-18 14:08:35 +00:00
|
|
|
+#endif
|
2012-05-03 20:18:41 +00:00
|
|
|
--- a/arch/mips/bcm47xx/setup.c
|
|
|
|
+++ b/arch/mips/bcm47xx/setup.c
|
|
|
|
@@ -43,6 +43,8 @@ EXPORT_SYMBOL(bcm47xx_bus);
|
|
|
|
enum bcm47xx_bus_type bcm47xx_bus_type;
|
|
|
|
EXPORT_SYMBOL(bcm47xx_bus_type);
|
|
|
|
|
|
|
|
+struct bcm47xx_sflash bcm47xx_sflash;
|
|
|
|
+
|
|
|
|
static void bcm47xx_machine_restart(char *command)
|
|
|
|
{
|
|
|
|
printk(KERN_ALERT "Please stand by while rebooting the system...\n");
|
2012-07-25 14:52:00 +00:00
|
|
|
@@ -137,6 +139,9 @@ static void __init bcm47xx_register_ssb(
|
2012-05-03 20:18:41 +00:00
|
|
|
if (err)
|
|
|
|
panic("Failed to initialize SSB bus (err %d)", err);
|
|
|
|
|
|
|
|
+ if (bcm47xx_bus.ssb.chipco.flash_type == SSB_SFLASH)
|
|
|
|
+ bcm47xx_sflash_struct_ssb_init(&bcm47xx_sflash, &bcm47xx_bus.ssb.chipco);
|
|
|
|
+
|
|
|
|
mcore = &bcm47xx_bus.ssb.mipscore;
|
|
|
|
if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
|
|
|
|
if (strstr(buf, "console=ttyS1")) {
|
2012-07-25 14:52:00 +00:00
|
|
|
@@ -195,6 +200,9 @@ static void __init bcm47xx_register_bcma
|
2012-05-03 20:18:41 +00:00
|
|
|
if (err)
|
|
|
|
panic("Failed to initialize BCMA bus (err %d)", err);
|
2012-07-25 14:52:00 +00:00
|
|
|
|
2012-05-03 20:18:41 +00:00
|
|
|
+ if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_SFLASH)
|
|
|
|
+ bcm47xx_sflash_struct_bcma_init(&bcm47xx_sflash, &bcm47xx_bus.bcma.bus.drv_cc);
|
2012-07-25 14:52:00 +00:00
|
|
|
+
|
|
|
|
bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
|
2012-05-03 20:18:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/arch/mips/include/asm/mach-bcm47xx/bus.h
|
|
|
|
@@ -0,0 +1,36 @@
|
|
|
|
+/*
|
|
|
|
+ * BCM947xx nvram variable access
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2011 Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify it
|
|
|
|
+ * under the terms of the GNU General Public License as published by the
|
|
|
|
+ * Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
+ * option) any later version.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <linux/ssb/ssb.h>
|
|
|
|
+#include <linux/bcma/bcma.h>
|
|
|
|
+#include <bcm47xx.h>
|
|
|
|
+
|
|
|
|
+struct bcm47xx_sflash {
|
|
|
|
+ enum bcm47xx_bus_type sflash_type;
|
|
|
|
+ union {
|
|
|
|
+ struct ssb_chipcommon *scc;
|
|
|
|
+ struct bcma_drv_cc *bcc;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ int (*read)(struct bcm47xx_sflash *dev, u32 offset, u32 len, u8 *buf);
|
|
|
|
+ int (*poll)(struct bcm47xx_sflash *dev, u32 offset);
|
|
|
|
+ int (*write)(struct bcm47xx_sflash *dev, u32 offset, u32 len, const u8 *buf);
|
|
|
|
+ int (*erase)(struct bcm47xx_sflash *dev, u32 offset);
|
|
|
|
+
|
|
|
|
+ u32 blocksize; /* Block size */
|
|
|
|
+ u32 numblocks; /* Number of blocks */
|
|
|
|
+ u32 size; /* Total size in bytes */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+void bcm47xx_sflash_struct_bcma_init(struct bcm47xx_sflash *sflash, struct bcma_drv_cc *bcc);
|
|
|
|
+void bcm47xx_sflash_struct_ssb_init(struct bcm47xx_sflash *sflash, struct ssb_chipcommon *scc);
|
|
|
|
+
|
|
|
|
+extern struct bcm47xx_sflash bcm47xx_sflash;
|