Skip to contentSkip to conversation

Integrated Flash Controller support

PATCH In review [email protected] 5 participants 12 messages Oct 31, 2011 – Dec 17, 2011

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 mtd/nand : set Nand flash page address to FBAR and FPAR correctly

In reply to [email protected]

From: Liu Shuo <[email protected]>

If we use the Nand flash chip whose number of pages in a block is greater than 64(for large page), we must treat the low bit of FBAR as being the high bit of the page address due to the limitation of FCM, it simply uses the low 6-bits (for large page) of the combined block/page address as the FPAR component, rather than considering the actual block size.

---
 drivers/mtd/nand/fsl_elbc_nand.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
drivers/mtd/nand/fsl_elbc_nand.c +10 -3
index 33d8aad..681d8c5 100644
@@ -167,15 +167,22 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
 
 	elbc_fcm_ctrl->page = page_addr;
 
-	out_be32(&lbc->fbar,
-	         page_addr >> (chip->phys_erase_shift - chip->page_shift));
-
 	if (priv->page_size) {
+		/*
+		 * large page size chip : FPAR[PI] save the lowest 6 bits,
+		 *                        FBAR[BLK] save the other bits.
+		 */
+		out_be32(&lbc->fbar, page_addr >> 6);
 		out_be32(&lbc->fpar,
 		         ((page_addr << FPAR_LP_PI_SHIFT) & FPAR_LP_PI) |
 		         (oob ? FPAR_LP_MS : 0) | column);
 		buf_num = (page_addr & 1) << 2;
 	} else {
+		/*
+		 * small page size chip : FPAR[PI] save the lowest 5 bits,
+		 *                        FBAR[BLK] save the other bits.
+		 */
+		out_be32(&lbc->fbar, page_addr >> 5);
 		out_be32(&lbc->fpar,
 		         ((page_addr << FPAR_SP_PI_SHIFT) & FPAR_SP_PI) |
 		         (oob ? FPAR_SP_MS : 0) | column);
Signature · 1 line
1.7.1
#0 lore raw

PATCH v2 1/1 Integrated Flash Controller support

From: Liu Shuo <[email protected]>

Integrated Flash Controller supports various flashes like NOR, NAND and other devices using NOR, NAND and GPCM Machine available on it. IFC supports four chip selects.

---
 arch/powerpc/Kconfig               |    4 +
 arch/powerpc/include/asm/fsl_ifc.h |  834 ++++++++++++++++++++++++++++++++++++
 arch/powerpc/sysdev/Makefile       |    1 +
 arch/powerpc/sysdev/fsl_ifc.c      |  322 ++++++++++++++
 4 files changed, 1161 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/include/asm/fsl_ifc.h
 create mode 100644 arch/powerpc/sysdev/fsl_ifc.c
arch/powerpc/Kconfig +4 -0
index f8e578b..3cd1e64 100644
@@ -688,6 +688,10 @@ config FSL_LBC
 	  controller.  Also contains some common code used by
 	  drivers for specific local bus peripherals.
 
+config FSL_IFC
+	bool
+        depends on FSL_SOC
+
 config FSL_GTM
 	bool
 	depends on PPC_83xx || QUICC_ENGINE || CPM2
arch/powerpc/include/asm/fsl_ifc.h new file +834 -0

834 lines not on this page · raw message

arch/powerpc/sysdev/Makefile +1 -0
index cf736ca..c71a63b 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
 obj-$(CONFIG_FSL_PCI)		+= fsl_pci.o $(fsl-msi-obj-y)
 obj-$(CONFIG_FSL_PMC)		+= fsl_pmc.o
 obj-$(CONFIG_FSL_LBC)		+= fsl_lbc.o
+obj-$(CONFIG_FSL_IFC)		+= fsl_ifc.o
 obj-$(CONFIG_FSL_GTM)		+= fsl_gtm.o
 obj-$(CONFIG_MPC8xxx_GPIO)	+= mpc8xxx_gpio.o
 obj-$(CONFIG_FSL_85XX_CACHE_SRAM)	+= fsl_85xx_l2ctlr.o fsl_85xx_cache_sram.o
arch/powerpc/sysdev/fsl_ifc.c new file +322 -0

322 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 NAND Machine support for Integrated Flash Controller

From: Liu Shuo <[email protected]>

Integrated Flash Controller(IFC) can be used to hook NAND Flash chips using NAND Flash Machine available on it.

---
 drivers/mtd/nand/Kconfig        |   10 +
 drivers/mtd/nand/Makefile       |    1 +
 drivers/mtd/nand/fsl_ifc_nand.c | 1076 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 1087 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/fsl_ifc_nand.c
drivers/mtd/nand/Kconfig +10 -0
index 4c34252..126d9cc 100644
@@ -456,6 +456,16 @@ config MTD_NAND_FSL_ELBC
 	  Enabling this option will enable you to use this to control
 	  external NAND devices.
 
+config MTD_NAND_FSL_IFC
+	tristate "NAND support for Freescale IFC controller"
+	depends on MTD_NAND && FSL_SOC
+	select FSL_IFC
+	help
+	  Various Freescale chips e.g P1010, include a NAND Flash machine
+	  with built-in hardware ECC capabilities.
+	  Enabling this option will enable you to use this to control
+	  external NAND devices.
+
 config MTD_NAND_FSL_UPM
 	tristate "Support for NAND on Freescale UPM"
 	depends on PPC_83xx || PPC_85xx
drivers/mtd/nand/Makefile +1 -0
index 5745d83..3094131 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_MTD_ALAUDA)		+= alauda.o
 obj-$(CONFIG_MTD_NAND_PASEMI)		+= pasemi_nand.o
 obj-$(CONFIG_MTD_NAND_ORION)		+= orion_nand.o
 obj-$(CONFIG_MTD_NAND_FSL_ELBC)		+= fsl_elbc_nand.o
+obj-$(CONFIG_MTD_NAND_FSL_IFC)		+= fsl_ifc_nand.o
 obj-$(CONFIG_MTD_NAND_FSL_UPM)		+= fsl_upm.o
 obj-$(CONFIG_MTD_NAND_SH_FLCTL)		+= sh_flctl.o
 obj-$(CONFIG_MTD_NAND_MXC)		+= mxc_nand.o
drivers/mtd/nand/fsl_ifc_nand.c new file +1076 -0

1,076 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw
In reply to [email protected]
Quoted 10 lines · On Oct 31, 2011, at 4:38 AM, <[email protected]> <[email protected]>…

From: Liu Shuo <[email protected]>

Integrated Flash Controller supports various flashes like NOR, NAND and other devices using NOR, NAND and GPCM Machine available on it. IFC supports four chip selects.

Quoted 8 lines

---

arch/powerpc/Kconfig               |    4 +
arch/powerpc/include/asm/fsl_ifc.h |  834 ++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/Makefile       |    1 +
arch/powerpc/sysdev/fsl_ifc.c      |  322 ++++++++++++++
4 files changed, 1161 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/include/asm/fsl_ifc.h create mode 100644 arch/powerpc/sysdev/fsl_ifc.c

Guys,

How are we handling this patchset since it touches drivers/mtd/nand?

- k

#4 lore raw
Quoted 22 lines · Kumar Gala
Quoted 10 lines · On Oct 31, 2011, at 4:38 AM, <[email protected]> <[email protected]>…

From: Liu Shuo <[email protected]>

Integrated Flash Controller supports various flashes like NOR, NAND and other devices using NOR, NAND and GPCM Machine available on it. IFC supports four chip selects.

Quoted 8 lines

---

arch/powerpc/Kconfig               |    4 +
arch/powerpc/include/asm/fsl_ifc.h |  834 ++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/Makefile       |    1 +
arch/powerpc/sysdev/fsl_ifc.c      |  322 ++++++++++++++
4 files changed, 1161 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/include/asm/fsl_ifc.h create mode 100644 arch/powerpc/sysdev/fsl_ifc.c

Quoted 3 lines

Guys,

How are we handling this patchset since it touches drivers/mtd/nand?

Artem,

thoughts?

- k

#11 lore raw
In reply to [email protected]
Quoted 4 lines · On Mon, 2011-10-31 at 17:38 +0800, [email protected] wrote:
arch/powerpc/sysdev/fsl_ifc.c new file +4 -0
+/*
+ * fsl_ifc_ctrl_probe
+ *
+ * called by device layer when it finds a device matching

arch/powerpc/sysdev/fsl_ifc.c line 218

Quoted 10 lines
arch/powerpc/sysdev/fsl_ifc.c new file +10 -0
+ * one our driver can handled. This code allocates all of
+ * the resources needed for the controller only.  The
+ * resources for the NAND banks themselves are allocated
+ * in the chip probe function.
+*/
+static int __devinit fsl_ifc_ctrl_probe(struct platform_device *dev)
+{
+	int ret = 0;
+
+

... snip ...

I am concerned about the error path in this function

arch/powerpc/sysdev/fsl_ifc.c line 268

Quoted 9 lines
arch/powerpc/sysdev/fsl_ifc.c new file +9 -0
+	init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
+
+	ret = request_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_irq, IRQF_SHARED,
+			  "fsl-ifc", fsl_ifc_ctrl_dev);
+	if (ret != 0) {
+		dev_err(&dev->dev, "failed to install irq (%d)\n",
+			fsl_ifc_ctrl_dev->irq);
+		goto err;
+	}

irq_dispose_mapping() on error path?

arch/powerpc/sysdev/fsl_ifc.c line 275

Quoted 7 lines
arch/powerpc/sysdev/fsl_ifc.c new file +7 -0
+
+	ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq, 0,
+			  "fsl-ifc-nand", fsl_ifc_ctrl_dev);
+	if (ret != 0) {
+		dev_err(&dev->dev, "failed to install irq (%d)\n",
+			fsl_ifc_ctrl_dev->nand_irq);
+		goto err;

free_irq() on error path?

Quoted 18 lines
arch/powerpc/sysdev/fsl_ifc.c new file +16 -0
+	}
+
+	return 0;
+
+err:
+	return ret;
+}
 
 
+static __init int fsl_ifc_init(void)
+{
+	int ret;
+
+	ret = platform_driver_register(&fsl_ifc_ctrl_driver);
+	if (ret)
+		printk(KERN_ERR "fsl-ifc: Failed to register platform"
+				"driver\n");
+

arch/powerpc/sysdev/fsl_ifc.c line 318

Quoted 10 lines
arch/powerpc/sysdev/fsl_ifc.c new file +10 -0
+	return ret;
+}
+
+static void __exit fsl_ifc_exit(void)
+{
+	platform_driver_unregister(&fsl_ifc_ctrl_driver);
+}
+
+module_init(fsl_ifc_init);
+module_exit(fsl_ifc_exit);

How about using module_platform_driver() instead?

#5 lore raw
In reply to Kumar Gala
Quoted 24 lines · Kumar Gala
Quoted 22 lines · Kumar Gala
Quoted 18 lines · On Oct 31, 2011, at 4:38 AM, <[email protected]> <[email protected]>…

From: Liu Shuo <[email protected]>

Integrated Flash Controller supports various flashes like NOR, NAND and other devices using NOR, NAND and GPCM Machine available on it. IFC supports four chip selects.

---

arch/powerpc/Kconfig               |    4 +
arch/powerpc/include/asm/fsl_ifc.h |  834 ++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/Makefile       |    1 +
arch/powerpc/sysdev/fsl_ifc.c      |  322 ++++++++++++++
4 files changed, 1161 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/include/asm/fsl_ifc.h create mode 100644 arch/powerpc/sysdev/fsl_ifc.c

Quoted 3 lines
Quoted 3 lines

Guys,

How are we handling this patchset since it touches drivers/mtd/nand?

I do not see it touching MTD from the diffstat above. I am a little bit confused why a flash controller is added to arch/powerpc/sysdev/fsl_ifc.c ?

Artem.

#6 lore raw
Quoted 25 lines · Artem Bityutskiy
Quoted 24 lines · Kumar Gala
Quoted 22 lines · Kumar Gala
Quoted 18 lines · On Oct 31, 2011, at 4:38 AM, <[email protected]> <[email protected]>…

From: Liu Shuo <[email protected]>

Integrated Flash Controller supports various flashes like NOR, NAND and other devices using NOR, NAND and GPCM Machine available on it. IFC supports four chip selects.

---

arch/powerpc/Kconfig               |    4 +
arch/powerpc/include/asm/fsl_ifc.h |  834 ++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/Makefile       |    1 +
arch/powerpc/sysdev/fsl_ifc.c      |  322 ++++++++++++++
4 files changed, 1161 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/include/asm/fsl_ifc.h create mode 100644 arch/powerpc/sysdev/fsl_ifc.c

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Guys,

How are we handling this patchset since it touches drivers/mtd/nand?

I do not see it touching MTD from the diffstat above. I am a little bit confused why a flash controller is added to arch/powerpc/sysdev/fsl_ifc.c ?

It's really a bus controller, with NOR, NAND, and general-purpose modes settable per chipselect. The actual NAND driver goes in drivers/mtd/nand, and is apparently in a separate patch (probably due to separate maintenance domains).

It's the same situation as arch/powerpc/sysdev/fsl_lbc.c versus drivers/mtd/nand/fsl_elbc_nand.c and drivers/mtd/nand/fsl_upm.c.

-Scott

#7 lore raw
Quoted 39 lines · Scott Wood
Quoted 25 lines · Artem Bityutskiy
Quoted 24 lines · Kumar Gala
Quoted 22 lines · Kumar Gala
Quoted 18 lines · On Oct 31, 2011, at 4:38 AM, <[email protected]> <[email protected]>…

From: Liu Shuo <[email protected]>

Integrated Flash Controller supports various flashes like NOR, NAND and other devices using NOR, NAND and GPCM Machine available on it. IFC supports four chip selects.

---

arch/powerpc/Kconfig               |    4 +
arch/powerpc/include/asm/fsl_ifc.h |  834 ++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/Makefile       |    1 +
arch/powerpc/sysdev/fsl_ifc.c      |  322 ++++++++++++++
4 files changed, 1161 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/include/asm/fsl_ifc.h create mode 100644 arch/powerpc/sysdev/fsl_ifc.c

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Guys,

How are we handling this patchset since it touches drivers/mtd/nand?

I do not see it touching MTD from the diffstat above. I am a little bit confused why a flash controller is added to arch/powerpc/sysdev/fsl_ifc.c ?

It's really a bus controller, with NOR, NAND, and general-purpose modes settable per chipselect. The actual NAND driver goes in drivers/mtd/nand, and is apparently in a separate patch (probably due to separate maintenance domains).

Quoted 4 lines

It's the same situation as arch/powerpc/sysdev/fsl_lbc.c versus drivers/mtd/nand/fsl_elbc_nand.c and drivers/mtd/nand/fsl_upm.c.

-Scott

As Scott said, I was more asking about the 2nd patch in the sequence which did touch MTD. Since that one is dependent on this patch, wondering how we wanted to handle them.

- k

#8 lore raw
Quoted 3 lines · Kumar Gala

As Scott said, I was more asking about the 2nd patch in the sequence which did touch MTD. Since that one is dependent on this patch, wondering how we wanted to handle them.

I do not have time to review it, but it looks OK, so I'd suggest to merge it vie the same tree as the rest of the patches.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#9 lore raw
Quoted 9 lines

-----Original Message-----
From: Artem Bityutskiy [mailto:[email protected]]
Sent: Wednesday, November 30, 2011 4:51 PM
To: Kumar Gala
Cc: Wood Scott-B07421; Li Yang-R58472; Liu Shuo-B35362; linux- [email protected] Kernel; [email protected]; Andrew Morton; David Woodhouse; [email protected] list
Subject: Re: [PATCH v2] Integrated Flash Controller support

Quoted 7 lines
Quoted 3 lines · Kumar Gala

As Scott said, I was more asking about the 2nd patch in the sequence which did touch MTD. Since that one is dependent on this patch, wondering how we wanted to handle them.

I do not have time to review it, but it looks OK, so I'd suggest to merge it vie the same tree as the rest of the patches.

Hi Artem,

So what is your suggestion on this patch? Can we regard your previous email as an ACK and merge it through the powerpc tree? Or do you prefer to merge them through the MTD tree with Kumar's ACK instead?

- Leo ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#10 lore raw
Quoted 15 lines · On Wed, 2011-12-14 at 11:13 +0000, Li Yang-R58472 wrote:
Quoted 11 lines

-----Original Message-----
From: Artem Bityutskiy [mailto:[email protected]]
Sent: Wednesday, November 30, 2011 4:51 PM
To: Kumar Gala
Cc: Wood Scott-B07421; Li Yang-R58472; Liu Shuo-B35362; linux- [email protected] Kernel; [email protected]; Andrew Morton; David Woodhouse; [email protected] list
Subject: Re: [PATCH v2] Integrated Flash Controller support

Quoted 1 line · Kumar Gala

As Scott said, I was more asking about the 2nd patch in the

sequence

Quoted 3 lines
Quoted 2 lines

which did touch MTD. Since that one is dependent on this patch, wondering how we wanted to handle them.

Quoted 8 lines
Quoted 2 lines

I do not have time to review it, but it looks OK, so I'd suggest to merge it vie the same tree as the rest of the patches.

Hi Artem,

So what is your suggestion on this patch? Can we regard your previous email as an ACK and merge it through the powerpc tree? Or do you prefer to merge them through the MTD tree with Kumar's ACK instead?

I am fine if it is merged via PPC tree. I do not have bandwith to look at it closely, so I cannot ack it, although I also do not have reasons to nack it :-)

Signature · 2 lines
Best Regards,
Artem Bityutskiy