Alberto Embedded & Open experience

Notes on my experience on Open Source Embedded Systems

Posts Tagged ‘NAND

NAND Flash Support

leave a comment »

In the CPU board there is a 2 Gb NAND Flash chip organized in :

1 Device = (2K+64)Bytes x 64Pages x 2048 Blocks = 2112Mbits

This chip is connected to the i.MX31 Application Processor through the Nand Flash Controller Interface with an 8 bit data bus. The in kernel driver “drivers/mtd/nand/mxc_nand.c” can easily support it registering the nand device in the machine code with the follow platform data:

static struct mxc_nand_platform_data imx31pdk_nand_flash_pdata = {
       .width          = 1, /* 1 Byte data bus */
       .hw_ecc         = 1, /* No suppress hardware ECC */
};

The mxc_nand.c driver is enabled by default with a $ make mx3_defconfig

What can be enabled is the MTD Partitioning support with support for RedBoot partition table parsing where the Location of RedBoot partition table is the number of the Flash page where it is stored the RedBoot “FIS directory” that for me start at 0x80000, so it is the fourth page (4).

The resulting patch:

Subject: [PATCH 2/2] MXC: imx31pdk: Add support for on board NAND Flash.

Signed-off-by: Alberto Panizzo <alberto.panizzo@gmail.com>
---
arch/arm/mach-mx3/mx31pdk.c |   10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mx3/mx31pdk.c b/arch/arm/mach-mx3/mx31pdk.c
index 0f7a2f0..ca1fe5d 100644
--- a/arch/arm/mach-mx3/mx31pdk.c
+++ b/arch/arm/mach-mx3/mx31pdk.c
@@ -34,6 +34,7 @@
#include <mach/board-mx31pdk.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
+#include <mach/mxc_nand.h>
#include "devices.h"

/*!
@@ -53,6 +54,14 @@ static int mx31pdk_pins[] = {
IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO),
};

+/*
+ * NAND Flash
+ */
+static struct mxc_nand_platform_data imx31pdk_nand_flash_pdata = {
+    .width        = 1,
+    .hw_ecc        = 1,
+};
+
static struct imxuart_platform_data uart_pdata = {
.flags = IMXUART_HAVE_RTSCTS,
};
@@ -241,6 +250,7 @@ static void __init mxc_board_init(void)
"mx31pdk");

mxc_register_device(&mxc_uart_device0, &uart_pdata);
+    mxc_register_device(&mxc_nand_device, &imx31pdk_nand_flash_pdata);

if (!mx31pdk_init_expio())
platform_device_register(&smsc911x_device);
--
1.6.3.3
Advertisements

Written by Alberto!

04/12/2009 at 4:45 pm

Posted in imx31pdk

Tagged with , ,

Updates, NOR and NAND flash support.

leave a comment »

Modifications on mx3fb driver are not to be accepted because of the maintainer won’t add machine specific code in that file.. Nevermind, I keep the patch in my hand waiting for another solution 🙂

In those days I worked on NOR & NAND flash support:
NOR flash device is mounted on the CPU credit card and it works well with physmap mapping driver.
NAND flash device is mounted on the motherboard and supporting it was a bit harder:
In tree there is a NAND flash driver for MXC architecture mxc_nand.c derived from original freescale driver and corrected over coding style and kernel way of doing by Sascha Hauer . Unfortunately this driver do not support flash devices with large page size (2kB wide, over 512 B of small page size devices) and upgrading it was over my capability..
The solution came from a graceful guy called Vladimir Barinov from linux-mtd list where I posted the problem. He gave me the right patch that merged with my work make the NAND flash device working!

So now I can store data in all memory devices mounted on the board! Great!

Alberto!

Written by Alberto!

25/05/2009 at 12:52 pm

Posted in Armadillo

Tagged with , , , ,