Skip to contentSkip to conversation

mtd: prepare place for BCMA NAND flash driver(s)

PATCH In review Rafał Miłecki 2 participants 8 messages Sep 12, 2012 – Sep 26, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mtd: prepare place for BCMA NAND flash driver(s)

BCMA bus can contain NAND flash memory, it's registered in system as platform device. This adds required hooks and place for controler specific drivers.
At this point it doesn't work yet, so it's marked as BROKEN.

---
 drivers/mtd/nand/Kconfig                       |    8 ++
 drivers/mtd/nand/Makefile                      |    1 +
 drivers/mtd/nand/bcm47xxnflash/Makefile        |    3 +
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |   14 +++
 drivers/mtd/nand/bcm47xxnflash/main.c          |  108 ++++++++++++++++++++++++
 5 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/bcm47xxnflash/Makefile
 create mode 100644 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
 create mode 100644 drivers/mtd/nand/bcm47xxnflash/main.c
drivers/mtd/nand/Kconfig +8 -0
index 8ca4176..7460ac2 100644
@@ -489,6 +489,14 @@ config MTD_NAND_GPMI_NAND
 	 block, such as SD card. So pay attention to it when you enable
 	 the GPMI.
 
+config MTD_NAND_BCM47XXNFLASH
+	tristate "Support for NAND flash on BCMA bus"
+	depends on BCMA_NFLASH && BROKEN
+	help
+	  BCMA bus can have various flash memories attached, they are
+	  registered by bcma as platform devices. This enables driver for
+	  NAND flash memories.
+
 config MTD_NAND_PLATFORM
 	tristate "Support for generic platform NAND driver"
 	depends on HAS_IOMEM
drivers/mtd/nand/Makefile +1 -0
index d4b4d87..8aa55d8 100644
@@ -51,5 +51,6 @@ obj-$(CONFIG_MTD_NAND_MPC5121_NFC)	+= mpc5121_nfc.o
 obj-$(CONFIG_MTD_NAND_RICOH)		+= r852.o
 obj-$(CONFIG_MTD_NAND_JZ4740)		+= jz4740_nand.o
 obj-$(CONFIG_MTD_NAND_GPMI_NAND)	+= gpmi-nand/
+obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)	+= bcm47xxnflash/
 
 nand-objs := nand_base.o nand_bbt.o
drivers/mtd/nand/bcm47xxnflash/Makefile new file +3 -0
new file mode 100644
index 0000000..1d0693a
@@ -0,0 +1,3 @@
+bcm47xxnflash-y				+= main.o
+
+obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)	+= bcm47xxnflash.o
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h new file +14 -0
new file mode 100644
index 0000000..2e8864a
@@ -0,0 +1,14 @@
+#ifndef __BCM47XXNFLASH_H
+#define __BCM47XXNFLASH_H
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+
+struct bcm47xxnflash {
+	struct bcma_drv_cc *cc;
+
+	struct nand_chip nand_chip;
+	struct mtd_info mtd;
+};
+
+#endif /* BCM47XXNFLASH */
drivers/mtd/nand/bcm47xxnflash/main.c new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
1.7.7
#1 lore raw

PATCH 2/4 mtd: bcm47xxnflash: init NAND on BCM4706

---
 drivers/mtd/nand/bcm47xxnflash/Makefile        |    1 +
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |    2 +
 drivers/mtd/nand/bcm47xxnflash/main.c          |    4 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  110 ++++++++++++++++++++++++
 4 files changed, 115 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
drivers/mtd/nand/bcm47xxnflash/Makefile +1 -0
index 1d0693a..f05b119 100644
@@ -1,3 +1,4 @@
 bcm47xxnflash-y				+= main.o
+bcm47xxnflash-y				+= ops_bcm4706.o
 
 obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)	+= bcm47xxnflash.o
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h +2 -0
index 2e8864a..149b74f 100644
@@ -11,4 +11,6 @@ struct bcm47xxnflash {
 	struct mtd_info mtd;
 };
 
+int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *bcm47xxnflash);
+
 #endif /* BCM47XXNFLASH */
drivers/mtd/nand/bcm47xxnflash/main.c +2 -2
index fc9139d..2b8b05b 100644
@@ -40,8 +40,8 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
 	b47n->mtd.priv = &b47n->nand_chip; /* Required */
 	b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
 
-	if (0) {
-		/* TODO: init device */
+	if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
+		err = bcm47xxnflash_ops_bcm4706_init(b47n);
 	} else {
 		pr_err("Device not supported\n");
 		err = -ENOTSUPP;
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
1.7.7
#2 lore raw

PATCH 3/4 mtd: bcm47xxnflash: support for NAND_CMD_READID command

In reply to Rafał Miłecki
---
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |    5 ++
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |   90 ++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 0 deletions(-)
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h +5 -0
index 149b74f..53fb2ea 100644
@@ -9,6 +9,11 @@ struct bcm47xxnflash {
 
 	struct nand_chip nand_chip;
 	struct mtd_info mtd;
+
+	unsigned curr_command;
+	int curr_column;
+
+	u8 id_data[8];
 };
 
 int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *bcm47xxnflash);
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c +90 -0

114 lines not on this page · raw message

Signature · 1 line
1.7.7
#3 lore raw

PATCH 4/4 mtd: bcm47xxnflash: implement reading

In reply to Rafał Miłecki
---
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |    1 +
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  106 ++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 0 deletions(-)
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h +1 -0
index 53fb2ea..e1cfdc5 100644
@@ -11,6 +11,7 @@ struct bcm47xxnflash {
 	struct mtd_info mtd;
 
 	unsigned curr_command;
+	int curr_page_addr;
 	int curr_column;
 
 	u8 id_data[8];
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c +106 -0

148 lines not on this page · raw message

Signature · 1 line
1.7.7
#4 lore raw
In reply to Rafał Miłecki

drivers/mtd/nand/Kconfig config MTD_NAND_GPMI_NAND · line 498

Quoted 7 lines · Rafał Miłecki
drivers/mtd/nand/Kconfig +7 -0
+config MTD_NAND_BCM47XXNFLASH
+	tristate "Support for NAND flash on BCMA bus"
+	depends on BCMA_NFLASH && BROKEN
+	help
+	  BCMA bus can have various flash memories attached, they are
+	  registered by bcma as platform devices. This enables driver for
+	  NAND flash memories.

Could we please merge only non-broken stuff upstream. I understand your intentions to merge something non-working first with a promise to make it working later, but I do not think this is an acceptable approach.

Why exactly you mark this one as broken? If it is R/O so far, and reading works, and you tested it (how?), we can merge it I guess, just make it clear that it is R/O in Kconfig help text.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#7 lore raw
In reply to Rafał Miłecki
Quoted 6 lines · Rafał Miłecki

BCMA bus can contain NAND flash memory, it's registered in system as platform device. This adds required hooks and place for controler specific drivers.
At this point it doesn't work yet, so it's marked as BROKEN.

If you send the next version of this, would you please base it on l2-mtd.git tree, to make my job simpler, because otherwise I have to solve small conflicts.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#5 lore raw
In reply to Artem Bityutskiy

2012/9/26 Artem Bityutskiy <[email protected]>:

Quoted 9 lines · Rafał Miłecki

drivers/mtd/nand/Kconfig config MTD_NAND_GPMI_NAND · line 498

Quoted 7 lines
drivers/mtd/nand/Kconfig +7 -0
+config MTD_NAND_BCM47XXNFLASH
+     tristate "Support for NAND flash on BCMA bus"
+     depends on BCMA_NFLASH && BROKEN
+     help
+       BCMA bus can have various flash memories attached, they are
+       registered by bcma as platform devices. This enables driver for
+       NAND flash memories.
Quoted 7 lines

Could we please merge only non-broken stuff upstream. I understand your intentions to merge something non-working first with a promise to make it working later, but I do not think this is an acceptable approach.

Why exactly you mark this one as broken? If it is R/O so far, and reading works, and you tested it (how?), we can merge it I guess, just make it clear that it is R/O in Kconfig help text.

Yes, BROKEN can be dropped from this. I'll resend correct patchset after checking it with verify/aiaiai (i'm almost done! :) )

Signature · 1 line
Rafał
#6 lore raw
Quoted 14 lines · Rafał Miłecki

2012/9/26 Artem Bityutskiy <[email protected]>:

Quoted 13 lines · Rafał Miłecki

drivers/mtd/nand/Kconfig config MTD_NAND_GPMI_NAND · line 498

Quoted 7 lines
drivers/mtd/nand/Kconfig +7 -0
+config MTD_NAND_BCM47XXNFLASH
+     tristate "Support for NAND flash on BCMA bus"
+     depends on BCMA_NFLASH && BROKEN
+     help
+       BCMA bus can have various flash memories attached, they are
+       registered by bcma as platform devices. This enables driver for
+       NAND flash memories.

Could we please merge only non-broken stuff upstream. I understand your intentions to merge something non-working first with a promise to make it working later, but I do not think this is an acceptable approach.

Quoted 6 lines
Quoted 3 lines

Why exactly you mark this one as broken? If it is R/O so far, and reading works, and you tested it (how?), we can merge it I guess, just make it clear that it is R/O in Kconfig help text.

Yes, BROKEN can be dropped from this. I'll resend correct patchset after checking it with verify/aiaiai (i'm almost done! :) )

Great, thanks. Do not forget to tell about R/O in the Kconfig text please!

Signature · 2 lines
Best Regards,
Artem Bityutskiy