Skip to contentSkip to conversation

mtd: basic (read only) driver for BCMA serial flash

RFC PATCH New Rafał Miłecki 1 participant 1 message Aug 30, 2012 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mtd: basic (read only) driver for BCMA serial flash

This registers MTD driver for serial flash platform device. Right now it supports reading only, writing still has to be implemented. At this point it's marked as BROKEN, because it requires code present in net tree that wasn't mainlined yet.
---
As you can see, this driver can't be enabled yet, because it requires some code that is present in net tree only right now.
Is this OK to take this anyway, and enable it later?

With this code I was able to succesfully scan my serial flash for parts:

[    0.956000] 10 bcm47xxpart partitions found on MTD device bcm47xxsflash
[    0.964000] Creating 10 MTD partitions on "bcm47xxsflash":
[    0.968000] 0x000000000000-0x000000150000 : "boot"
[    0.976000] 0x000000150000-0x000000160000 : "ML"
[    0.984000] 0x000000160000-0x000000170000 : "ML"
[    0.988000] 0x000000170000-0x000000180000 : "ML"
[    0.996000] 0x000000180000-0x000000190000 : "ML"
[    1.004000] 0x000000190000-0x0000001a0000 : "ML"
[    1.012000] 0x0000001a0000-0x0000001d0000 : "ML"
[    1.016000] 0x0000001d0000-0x0000001e0000 : "POT"
[    1.024000] 0x0000001e0000-0x0000001f0000 : "board_data"
[    1.032000] 0x0000001f0000-0x000000200000 : "nvram"

I have two questions, could you help me with them?

1) Is the following warning a valid one? How I can fix that?
WARNING: static const char * array should probably be static const char * const #64: FILE: drivers/mtd/devices/bcm47xxsflash.c:11:
+static const char *probes[] = { "bcm47xxpart", NULL };

2) I alloc memory for mtd: sflash->mtd but don't free it. This is because it's platform device that live "always", doesn't support unloading. Is that alright?

---
 drivers/mtd/devices/Kconfig         |    8 +++
 drivers/mtd/devices/Makefile        |    1 +
 drivers/mtd/devices/bcm47xxsflash.c |  120 +++++++++++++++++++++++++++++++++++
 3 files changed, 129 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/devices/bcm47xxsflash.c
drivers/mtd/devices/Kconfig +8 -0
index 4cdb2af..4b4f7d2 100644
@@ -120,6 +120,14 @@ config MTD_SST25L
 	  Set up your spi devices with the right board-specific platform data,
 	  if you want to specify device partitioning.
 
+config MTD_BCM47XXSFLASH
+	tristate "Support for serial flash on BCMA bus"
+	depends on BCMA_SFLASH && BROKEN
+	help
+	  BCMA bus can have various flash memories attached, they are
+	  registered by bcma as platform devices. This enables driver for
+	  serial flash memories.
+
 config MTD_SLRAM
 	tristate "Uncached system RAM"
 	help
drivers/mtd/devices/Makefile +1 -0
index a4dd1d8..395733a 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-$(CONFIG_MTD_BCM47XXSFLASH)	+= bcm47xxsflash.o
 
 CFLAGS_docg3.o			+= -I$(src)
\ No newline at end of file
drivers/mtd/devices/bcm47xxsflash.c new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
1.7.7