Skip to contentSkip to conversation

bcma: detect and register serial flash device

PATCH New Rafał Miłecki 1 participant 1 message Aug 10, 2012 Broadcom specific amba driver (bcma)

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

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

---
V2: add "u32 window" in sflash struct. It's needed for early boot when
we have to access flash but we don't have platform device yet.

---
 drivers/bcma/Kconfig                        |    2 +-
 drivers/bcma/bcma_private.h                 |    1 +
 drivers/bcma/driver_chipcommon_sflash.c     |  123 ++++++++++++++++++++++++++-
 drivers/bcma/main.c                         |    9 ++
 include/linux/bcma/bcma_driver_chipcommon.h |   13 +++
 include/linux/bcma/bcma_regs.h              |    2 +
 6 files changed, 146 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 +120 -3

135 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 +13 -0
index 16c266c..799e4200 100644
@@ -516,6 +516,16 @@ struct bcma_pflash {
 	u32 window_size;
 };
 
+#ifdef CONFIG_BCMA_SFLASH
+struct bcma_sflash {
+	bool present;
+	u32 window;
+	u32 blocksize;
+	u16 numblocks;
+	u32 size;
+};
+#endif
+
 struct bcma_serial_port {
 	void *regs;
 	unsigned long clockspeed;
@@ -536,6 +546,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