Skip to contentSkip to conversation

BCMRING: mtd nand umi driver support

PATCH In review Leo (Hao) Chen 2 participants 4 messages Aug 21, 2009 – Aug 28, 2009

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

PATCH v5 1/1 BCMRING: mtd nand umi driver support

Hi,

I'd submit the latest version of our patch to support mtd nand driver for bcmring arch. This patch is against the latest git tree and
passed the checkpatch.pl script. The patch set of bcmring arch. support has been accepted by Russell in linux-arm-kernel. Russell told me
that the mtd nand driver support of bcmring should go through the linux-mtd list. So, I submit my mtd nand driver patch here again.
Thanks for all the review comments before.
I've fixed all the bugs, coding style errors/warnings and split the inline functions into separate C file.

Please review it again and let us know if there is any other problem. If it is okay, can this patch be accepted?

Thanks,

Leo

From: Leo Chen <[email protected]>
Date: Tue, 4 Aug 2009 16:42:48 -0700
Subject: [PATCH 22/25] add bcmring mtd nand driver support

add mtd umi driver for bcmring arm arch.
add header files, register definition files
add entry in Kconfig and Makefile
mved nand_bcm_umi.h to drivers/mtd/nand

---
 arch/arm/mach-bcmring/include/mach/reg_nand.h |   66 ++
 arch/arm/mach-bcmring/include/mach/reg_umi.h  |  237 ++++++++
 drivers/mtd/nand/Kconfig                      |   16 +
 drivers/mtd/nand/Makefile                     |    1 +
 drivers/mtd/nand/bcm_umi_bch.c                |  212 +++++++
 drivers/mtd/nand/bcm_umi_nand.c               |  792 +++++++++++++++++++++++++
 drivers/mtd/nand/nand_bcm_umi.c               |  149 +++++
 drivers/mtd/nand/nand_bcm_umi.h               |  358 +++++++++++
 8 files changed, 1831 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-bcmring/include/mach/reg_nand.h
 create mode 100644 arch/arm/mach-bcmring/include/mach/reg_umi.h
 create mode 100644 drivers/mtd/nand/bcm_umi_bch.c
 create mode 100644 drivers/mtd/nand/bcm_umi_nand.c
 create mode 100644 drivers/mtd/nand/nand_bcm_umi.c
 create mode 100644 drivers/mtd/nand/nand_bcm_umi.h
arch/arm/mach-bcmring/include/mach/reg_nand.h new file +66 -0
new file mode 100644
index 0000000..387376f
@@ -0,0 +1,66 @@
+/*****************************************************************************
+* Copyright 2001 - 2008 Broadcom Corporation.  All rights reserved.
+*
+* Unless you and Broadcom execute a separate written software license
+* agreement governing use of this software, this software is licensed to you
+* under the terms of the GNU General Public License version 2, available at
+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
+*
+* Notwithstanding the above, under no circumstances may you combine this
+* software in any way with any other Broadcom software provided under a
+* license other than the GPL, without Broadcom's express prior written
+* consent.
+*****************************************************************************/
+
+/*
+*
+*****************************************************************************
+*
+*  REG_NAND.h
+*
+*  PURPOSE:
+*
+*     This file contains definitions for the nand registers:
+*
+*  NOTES:
+*
+*****************************************************************************/
+
+#if !defined(__ASM_ARCH_REG_NAND_H)
+#define __ASM_ARCH_REG_NAND_H
+
+/* ---- Include Files ---------------------------------------------------- */
+#include <csp/reg.h>
+#include <mach/reg_umi.h>
+
+/* ---- Constants and Types ---------------------------------------------- */
+
+#define HW_NAND_BASE       MM_IO_BASE_NAND	/* NAND Flash */
+
+/* DMA accesses by the bootstrap need hard nonvirtual addresses */
+#define REG_NAND_CMD            __REG16(HW_NAND_BASE + 0)
+#define REG_NAND_ADDR           __REG16(HW_NAND_BASE + 4)
+
+#define REG_NAND_PHYS_DATA16   (HW_NAND_BASE + 8)
+#define REG_NAND_PHYS_DATA8    (HW_NAND_BASE + 8)
+#define REG_NAND_DATA16         __REG16(REG_NAND_PHYS_DATA16)
+#define REG_NAND_DATA8          __REG8(REG_NAND_PHYS_DATA8)
+
+/* use appropriate offset to make sure it start at the 1K boundary */
+#define REG_NAND_PHYS_DATA_DMA   (HW_NAND_BASE + 0x400)
+#define REG_NAND_DATA_DMA         __REG32(REG_NAND_PHYS_DATA_DMA)
+
+/* Linux DMA requires physical address of the data register */
+#define REG_NAND_DATA16_PADDR    HW_IO_VIRT_TO_PHYS(REG_NAND_PHYS_DATA16)
+#define REG_NAND_DATA8_PADDR     HW_IO_VIRT_TO_PHYS(REG_NAND_PHYS_DATA8)
+#define REG_NAND_DATA_PADDR      HW_IO_VIRT_TO_PHYS(REG_NAND_PHYS_DATA_DMA)
+
+#define NAND_BUS_16BIT()        (0)
+#define NAND_BUS_8BIT()         (!NAND_BUS_16BIT())
+
+/* Register offsets */
+#define REG_NAND_CMD_OFFSET     (0)
+#define REG_NAND_ADDR_OFFSET    (4)
+#define REG_NAND_DATA8_OFFSET   (8)
+
+#endif
arch/arm/mach-bcmring/include/mach/reg_umi.h new file +237 -0

237 lines not on this page · raw message

drivers/mtd/nand/Kconfig +16 -0
index ce96c09..571a75d 100644
@@ -186,6 +186,22 @@ config MTD_NAND_S3C2410_CLKSTOP
 	  when the is NAND chip selected or released, but will save
 	  approximately 5mA of power when there is nothing happening.
 
+config MTD_NAND_BCM_UMI
+	tristate "NAND Flash support for BCM Reference Boards"
+	depends on ARCH_BCMRING && MTD_NAND
+	help
+	  This enables the NAND flash controller on the BCM UMI block.
+
+	  No board specfic support is done by this driver, each board
+	  must advertise a platform_device for the driver to attach.
+
+config MTD_NAND_BCM_UMI_HWCS
+	bool "BCM UMI NAND Hardware CS"
+	depends on MTD_NAND_BCM_UMI
+	help
+	  Enable the use of the BCM UMI block's internal CS using NAND.
+	  This should only be used if you know the external NAND CS can toggle.
+
 config MTD_NAND_DISKONCHIP
 	tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
drivers/mtd/nand/Makefile +1 -0
index f3a786b..dffda59 100644
@@ -40,5 +40,6 @@ obj-$(CONFIG_MTD_NAND_SH_FLCTL)		+= sh_flctl.o
 obj-$(CONFIG_MTD_NAND_MXC)		+= mxc_nand.o
 obj-$(CONFIG_MTD_NAND_SOCRATES)		+= socrates_nand.o
 obj-$(CONFIG_MTD_NAND_TXX9NDFMC)	+= txx9ndfmc.o
+obj-$(CONFIG_MTD_NAND_BCM_UMI)	+= bcm_umi_nand.o nand_bcm_umi.o
 
 nand-objs := nand_base.o nand_bbt.o
drivers/mtd/nand/bcm_umi_bch.c new file +212 -0

212 lines not on this page · raw message

drivers/mtd/nand/bcm_umi_nand.c new file +792 -0

792 lines not on this page · raw message

drivers/mtd/nand/nand_bcm_umi.c new file +149 -0

149 lines not on this page · raw message

drivers/mtd/nand/nand_bcm_umi.h new file +358 -0

358 lines not on this page · raw message

Signature · 6 lines
1.6.0.6

-- 
Leo Hao Chen
Software Engineer
Broadcom Canada Inc.
#1 lore raw

Hi,

As our bcmring code have been merged by Russell into linux-next repo, we really need this mtd driver be merged into the kenrel as well to get a
working system.
So, I just want to know if our patch for bcmring mtd driver is accepted or not. If not, what shall we improve? If yes, when can we get our code into linux-next repos? Or we have to submit the patch to any tracking system?

Thanks for your advice.

best,

Leo

Quoted 19 lines · Leo (Hao) Chen

Hi,

I'd submit the latest version of our patch to support mtd nand driver for bcmring arch. This patch is against the latest git tree and
passed the checkpatch.pl script. The patch set of bcmring arch. support has been accepted by Russell in linux-arm-kernel. Russell told me
that the mtd nand driver support of bcmring should go through the linux-mtd list. So, I submit my mtd nand driver patch here again.
Thanks for all the review comments before.
I've fixed all the bugs, coding style errors/warnings and split the inline functions into separate C file.

Please review it again and let us know if there is any other problem. If it is okay, can this patch be accepted?

Thanks,

Leo

#2 lore raw
Quoted 9 lines · Leo (Hao) Chen

Hi,

As our bcmring code have been merged by Russell into linux-next repo, we really need this mtd driver be merged into the kenrel as well to get a
working system.
So, I just want to know if our patch for bcmring mtd driver is accepted or not. If not, what shall we improve? If yes, when can we get our code into linux-next repos? Or we have to submit the patch to any tracking system?

You should bug David Woodhouse. I've added your driver to my l2-mtd-2.6 tree, so he should take a look at it at some point:
http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/eef42e4b8b0de71f3fdac4577c0eea0537ce0386

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#3 lore raw

Got it. Thanks.

David, would you please include my mtd driver patch in your tree? Our other 23 patches for bcmring support in arch/arm are wating for this patch, so that we can get the defconfig build in linux-next. Let me know if there is any improvement needed. Thanks a lot.

Br,

Leo

Quoted 20 lines · Artem Bityutskiy
Quoted 9 lines · Leo (Hao) Chen

Hi,

As our bcmring code have been merged by Russell into linux-next repo, we really need this mtd driver be merged into the kenrel as well to get a
working system.
So, I just want to know if our patch for bcmring mtd driver is accepted or not. If not, what shall we improve? If yes, when can we get our code into linux-next repos? Or we have to submit the patch to any tracking system?

You should bug David Woodhouse. I've added your driver to my l2-mtd-2.6 tree, so he should take a look at it at some point:
http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/eef42e4b8b0de71f3fdac4577c0eea0537ce0386

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
Signature · 3 lines
Leo Hao Chen
Software Engineer
Broadcom Canada Inc.