Skip to contentSkip to conversation

bcma: detect and register serial flash device

PATCH Superseded Rafał Miłecki 1 participant 2 messages Aug 10, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

PATCH 1/2 bcma: detect and register serial flash device

---
 drivers/bcma/Kconfig                        |    2 +-
 drivers/bcma/bcma_private.h                 |    1 +
 drivers/bcma/driver_chipcommon_sflash.c     |  122 ++++++++++++++++++++++++++-
 drivers/bcma/main.c                         |    9 ++
 include/linux/bcma/bcma_driver_chipcommon.h |   12 +++
 include/linux/bcma/bcma_regs.h              |    2 +
 6 files changed, 144 insertions(+), 4 deletions(-)
drivers/bcma/Kconfig +1 -1
index 8d1f777..c4252c4 100644
@@ -49,7 +49,7 @@ config BCMA_DRIVER_MIPS
 
 config BCMA_SFLASH
 	bool
-	depends on BCMA_DRIVER_MIPS && BROKEN
+	depends on BCMA_DRIVER_MIPS
 	default y
 
 config BCMA_NFLASH
drivers/bcma/bcma_private.h +1 -0
index 3cf9cc9..94bf07c 100644
@@ -54,6 +54,7 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc);
 #ifdef CONFIG_BCMA_SFLASH
 /* driver_chipcommon_sflash.c */
 int bcma_sflash_init(struct bcma_drv_cc *cc);
+extern struct platform_device bcma_sflash_dev;
 #else
 static inline int bcma_sflash_init(struct bcma_drv_cc *cc)
 {
drivers/bcma/driver_chipcommon_sflash.c +119 -3

134 lines not on this page · raw message

drivers/bcma/main.c +9 -0
index 10904aa4..648688a 100644
@@ -7,6 +7,7 @@
 
 #include "bcma_private.h"
 #include <linux/module.h>
+#include <linux/platform_device.h>
 #include <linux/bcma/bcma.h>
 #include <linux/slab.h>
 
@@ -136,6 +137,14 @@ static int bcma_register_cores(struct bcma_bus *bus)
 		dev_id++;
 	}
 
+#ifdef CONFIG_BCMA_SFLASH
+	if (bus->drv_cc.sflash.present) {
+		err = platform_device_register(&bcma_sflash_dev);
+		if (err)
+			bcma_err(bus, "Error registering serial flash\n");
+	}
+#endif
+
 	return 0;
 }
 
include/linux/bcma/bcma_driver_chipcommon.h +12 -0
index 16c266c..575af84 100644
@@ -516,6 +516,15 @@ struct bcma_pflash {
 	u32 window_size;
 };
 
+#ifdef CONFIG_BCMA_SFLASH
+struct bcma_sflash {
+	bool present;
+	u32 blocksize;
+	u16 numblocks;
+	u32 size;
+};
+#endif
+
 struct bcma_serial_port {
 	void *regs;
 	unsigned long clockspeed;
@@ -536,6 +545,9 @@ struct bcma_drv_cc {
 	struct bcma_chipcommon_pmu pmu;
 #ifdef CONFIG_BCMA_DRIVER_MIPS
 	struct bcma_pflash pflash;
+#ifdef CONFIG_BCMA_SFLASH
+	struct bcma_sflash sflash;
+#endif
 
 	int nr_serial_ports;
 	struct bcma_serial_port serial_ports[4];
include/linux/bcma/bcma_regs.h +2 -0
index a393e82..6c9cb93 100644
@@ -85,4 +85,6 @@
 							 * (2 ZettaBytes), high 32 bits
 							 */
 
+#define BCMA_SFLASH			0x1c000000
+
 #endif /* LINUX_BCMA_REGS_H_ */
Signature · 1 line
1.7.7
author maintainer
#1 lore raw

PATCH 2/2 mtd: bcma_sflash driver

---
This is only proof of concept, don't apply!

---
 drivers/mtd/devices/Makefile    |    1 +
 drivers/mtd/devices/b47sflash.c |  113 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/devices/b47sflash.c
drivers/mtd/devices/Makefile +1 -0
index a4dd1d8..b449760 100644
@@ -19,5 +19,6 @@ obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
 obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
 obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
 obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
+obj-y				+= b47sflash.o
 
 CFLAGS_docg3.o			+= -I$(src)
\ No newline at end of file
drivers/mtd/devices/b47sflash.c new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
1.7.7