Alberto Embedded & Open experience

Notes on my experience on Open Source Embedded Systems

Posts Tagged ‘mx31pdk

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 , ,