Skip to contentSkip to conversation

bcma: export PLL reading function

PATCH Superseded Rafał Miłecki 2 participants 8 messages Sep 27, 2012 – Oct 11, 2012

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

PATCH 1/6 bcma: export PLL reading function

This is required by NAND flash driver for initializing wait counters.

---
0001-bcma-export-PLL-reading-function.patch
Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

---
 drivers/bcma/driver_chipcommon_pmu.c |    3 ++-
 include/linux/bcma/bcma.h            |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/bcma/driver_chipcommon_pmu.c +2 -1
index 8b8f2f3..c7d94b47 100644
@@ -13,12 +13,13 @@
 #include <linux/export.h>
 #include <linux/bcma/bcma.h>
 
-static u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
+u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
 {
 	bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
 	bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
 	return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
 }
+EXPORT_SYMBOL_GPL(bcma_chipco_pll_read);
 
 void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value)
 {
include/linux/bcma/bcma.h +1 -0
index 1954a4e..b58fae0 100644
@@ -345,6 +345,7 @@ extern void bcma_core_set_clockmode(struct bcma_device *core,
 				    enum bcma_clkmode clkmode);
 extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
 			      bool on);
+extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
 #define BCMA_DMA_TRANSLATION_MASK	0xC0000000
 #define  BCMA_DMA_TRANSLATION_NONE	0x00000000
 #define  BCMA_DMA_TRANSLATION_DMA32_CMT	0x40000000 /* Client Mode Translation for 32-bit DMA */
Signature · 1 line
1.7.7
author maintainer
#1 lore raw

PATCH 2/6 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.

---
0002-mtd-prepare-place-for-BCMA-NAND-flash-driver-s.patch
Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #33: FILE: drivers/mtd/nand/Kconfig:492:
+config MTD_NAND_BCM47XXNFLASH

WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #113: FILE: drivers/mtd/nand/bcm47xxnflash/main.c:24:
+static const char *probes[] = { "bcm47xxpart", NULL };

I believe that Kconfig description is OK, and I don't anything wrong with my probes. Other drivers define probes in the same way.

---
 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 4883139..6ba1988 100644
@@ -446,6 +446,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 "R/O support for NAND flash on BCMA bus"
+	depends on BCMA_NFLASH
+	help
+	  BCMA bus can have various flash memories attached, they are
+	  registered by bcma as platform devices. This enables driver for
+	  NAND flash memories. For now only read mode is implemented.
+
 config MTD_NAND_PLATFORM
 	tristate "Support for generic platform NAND driver"
 	depends on HAS_IOMEM
drivers/mtd/nand/Makefile +1 -0
index 2cbd091..01f39f87c 100644
@@ -53,5 +53,6 @@ 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_XWAY)		+= xway_nand.o
+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
author maintainer
#2 lore raw

PATCH 3/6 mtd: bcm47xxnflash: init NAND on BCM4706

In reply to Rafał Miłecki

---
0003-mtd-bcm47xxnflash-init-NAND-on-BCM4706.patch
Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

---
 drivers/mtd/nand/bcm47xxnflash/Makefile      |    1 +
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c |  111 ++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
drivers/mtd/nand/bcm47xxnflash/Makefile +1 -0
index 1d0693a..4f688f9 100644
@@ -1,3 +1,4 @@
 bcm47xxnflash-y				+= main.o
+bcm47xxnflash-				+= ops_bcm4706.o
 
 obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)	+= bcm47xxnflash.o
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
1.7.7
author maintainer
#3 lore raw

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

In reply to Rafał Miłecki

---
0004-mtd-bcm47xxnflash-support-for-NAND_CMD_READID-comman.patch Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

WARNING:LONG_LINE: line over 80 characters
#120: FILE: drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c:106:
+ b47n->id_data[i] = bcma_cc_read32(b47n->cc, BCMA_CC_NFLASH_DATA) & 0xFF;

I avoid lines over 80 chars, but in this single case I left it to make it easier to read the code (don't like having that code in 3 lines)

---
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |    5 +
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |   99 ++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 0 deletions(-)
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h +5 -0
index 2e8864a..cc71400 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];
 };
 
 #endif /* BCM47XXNFLASH */
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c +99 -0

123 lines not on this page · raw message

Signature · 1 line
1.7.7
author maintainer
#4 lore raw

PATCH 5/6 mtd: bcm47xxnflash: implement reading

In reply to Rafał Miłecki

---
0005-mtd-bcm47xxnflash-implement-reading.patch
Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

---
 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 cc71400..264aec4 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

154 lines not on this page · raw message

Signature · 1 line
1.7.7
author maintainer
#5 lore raw

PATCH 6/6 bcm47xxnflash: enable BCM4706 driver

In reply to Rafał Miłecki

---
0006-bcm47xxnflash-enable-BCM4706-driver.patch
Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

---
 drivers/mtd/nand/bcm47xxnflash/Makefile        |    2 +-
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |    2 ++
 drivers/mtd/nand/bcm47xxnflash/main.c          |    4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/nand/bcm47xxnflash/Makefile +1 -1
index 4f688f9..f05b119 100644
@@ -1,4 +1,4 @@
 bcm47xxnflash-y				+= main.o
-bcm47xxnflash-				+= ops_bcm4706.o
+bcm47xxnflash-y				+= ops_bcm4706.o
 
 obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)	+= bcm47xxnflash.o
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h +2 -0
index 264aec4..0bdb2ce 100644
@@ -17,4 +17,6 @@ struct bcm47xxnflash {
 	u8 id_data[8];
 };
 
+int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n);
+
 #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;
Signature · 1 line
1.7.7
#7 lore raw
In reply to Rafał Miłecki
Quoted 6 lines · Rafał Miłecki

This is required by NAND flash driver for initializing wait counters.

---
0001-bcma-export-PLL-reading-function.patch
Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

I think you did not enable the driver in the defconfig.

Tested the patch(es) on top of the following commits:
e3134a5 Quick fixes - applied by aiaiai
a7c1993 mtd: fsl_elbc_nand: remove unnecessary badblock_pattern 03ba2bf mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions() c525349 mtd: m25p80: add support for the windbond w25q256 chip

--------------------------------------------------------------------------------

Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", results:

after_patching.log renamed from before_patching.log +0 -0
@@ @@
+drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c: In function 'bcm47xxnflash_ops_bcm4706_init':
+drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c:253:6: warning: variable 'col_mask' set but not used [-Wunused-but-set-variable]

--------------------------------------------------------------------------------

checkpatch.pl has some complaints:

--------------------------------------------------------------------------------

checkpatch.pl results for patch "[PATCH 2/6] mtd: prepare place for BCMA NAND flash driver(s)"

WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #33: FILE: drivers/mtd/nand/Kconfig:449:
+config MTD_NAND_BCM47XXNFLASH

WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #113: FILE: drivers/mtd/nand/bcm47xxnflash/main.c:24:
+static const char *probes[] = { "bcm47xxpart", NULL };

total: 0 errors, 2 warnings, 145 lines checked

--------------------------------------------------------------------------------

checkpatch.pl results for patch "[PATCH 4/6] mtd: bcm47xxnflash: support for NAND_CMD_READID command"

WARNING:LONG_LINE: line over 80 characters
#120: FILE: drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c:106:
+ b47n->id_data[i] = bcma_cc_read32(b47n->cc, BCMA_CC_NFLASH_DATA) & 0xFF;

total: 0 errors, 1 warnings, 134 lines checked

--------------------------------------------------------------------------------

Signature · 2 lines
Best Regards,
Artem Bityutskiy