diff mbox

OMAP3: Zoom2: provide default MTD partitions

Message ID 1251374386-6733-1-git-send-email-mpetazzoni@mvista.com (mailing list archive)
State Changes Requested, archived
Delegated to: Tony Lindgren
Headers show

Commit Message

Maxime Petazzoni Aug. 27, 2009, 11:59 a.m. UTC
This change introduces default MTD partitions for the Zoom-II board
NAND, inspired by the OMAP3 Beagle partitions and the OMAP3 Zoom2
partitions defined in OmapZoom.org's OMAP kernel.

The size of the U-Boot environment partition was increased to 1MB, as
the previously smaller partition couldn't contain the U-Boot environment
correctly (erasing the next partition would erase the U-Boot env as
well).

Finally, the "system" partition gets an increased size of 256MB to take
advantage of the size of the flash on the Zoom-II board.

Signed-off-by: Maxime Petazzoni <mpetazzoni@mvista.com>
---
 arch/arm/mach-omap2/board-zoom2.c |   86 +++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

Comments

vikram pandita Aug. 27, 2009, 1:46 p.m. UTC | #1
Petazzoni/Vimal

>-----Original Message-----
>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Maxime
>Petazzoni
>Sent: Thursday, August 27, 2009 7:00 AM
>To: linux-omap@vger.kernel.org
>Subject: [PATCH] OMAP3: Zoom2: provide default MTD partitions
>
>This change introduces default MTD partitions for the Zoom-II board
>NAND, inspired by the OMAP3 Beagle partitions and the OMAP3 Zoom2
>partitions defined in OmapZoom.org's OMAP kernel.

Thanks for putting this together for zoom2, however I NAK for now.

Why?

I know of an implementation by Vimal Singh that introduces a common flash file for Zoom1 and Zoom2.
There is reuse of code there.

I have attached the patch by Vimal here (in-lining would be difficult)

Please discuss and get a converged approach on handling NAND partitions on Zoom1 and Zoom2.

Also the Systerm/User/Cache partition definitions are more from Android perspective.

Given that each system may have a different NAND partition requirement, 
have you looked at bootargs passing the MTD partition info: Eg: 

mtdparts=omap2-nand.0:512k@0(xloader),\
1536k@512k(bootloader),\
29m@2m(kernel),\
160m@32m(system),\
32m@192m(userdata),\
32m@224m(cache)


Lets discuss the final approach on this list and try to close this soon.

Thnx

>
>The size of the U-Boot environment partition was increased to 1MB, as
>the previously smaller partition couldn't contain the U-Boot environment
>correctly (erasing the next partition would erase the U-Boot env as
>well).
>
>Finally, the "system" partition gets an increased size of 256MB to take
>advantage of the size of the flash on the Zoom-II board.
>
>Signed-off-by: Maxime Petazzoni <mpetazzoni@mvista.com>
>---
> arch/arm/mach-omap2/board-zoom2.c |   86 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 86 insertions(+), 0 deletions(-)
>
>diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
>index 4d295d5..ce5a4d8 100644
>--- a/arch/arm/mach-omap2/board-zoom2.c
>+++ b/arch/arm/mach-omap2/board-zoom2.c
>@@ -16,16 +16,101 @@
> #include <linux/gpio.h>
> #include <linux/i2c/twl4030.h>
> #include <linux/regulator/machine.h>
>+#include <linux/mtd/mtd.h>
>+#include <linux/mtd/partitions.h>
>+#include <linux/mtd/nand.h>
>
> #include <asm/mach-types.h>
> #include <asm/mach/arch.h>
>
> #include <mach/common.h>
>+#include <mach/nand.h>
> #include <mach/usb.h>
> #include <mach/keypad.h>
>
> #include "mmc-twl4030.h"
>
>+#define LDP3430_NAND_CS	0
>+#define GPMC_CS0_BASE	0x60
>+#define GPMC_CS_SIZE	0x30
>+
>+static struct mtd_partition zoom2_nand_partitions[] = {
>+	{
>+		.name		= "X-Loader-NAND",
>+		.offset		= 0,
>+		.size		= 4 * (64 * 2048),	/* 512kB */
>+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
>+	},
>+	{
>+		.name		= "U-Boot-NAND",
>+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
>+		.size		= 4 * (64 * 2048),	/* 512kB */
>+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
>+	},
>+	{
>+		.name		= "Boot Env-NAND",
>+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x100000 */
>+		.size		= 8 * (64 * 2048),	/* 1MB */
>+	},
>+	{
>+		.name		= "Kernel-NAND",
>+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x200000 */
>+		.size		= 32 * (64 * 2048),	/* 4MB */
>+	},
>+	{
>+		.name		= "system",
>+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x600000 */
>+		.size		= 2048 * (64 * 2048),	/* 256MB */
>+	},
>+	{
>+		.name		= "userdata",
>+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x10600000 */
>+		.size		= 512 * (64 * 2048),	/* 64MB */
>+	},
>+	{
>+		.name		= "cache",
>+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x14600000 */
>+		.size		= 512 * (64 * 2048),	/* 64MB */
>+	},
>+};
>+
>+/* NAND chip access: 16 bit */
>+static struct omap_nand_platform_data zoom2_nand_data = {
>+	.parts		= zoom2_nand_partitions,
>+	.nr_parts	= ARRAY_SIZE(zoom2_nand_partitions),
>+	.nand_setup	= NULL,
>+	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
>+	.dev_ready	= NULL,
>+};
>+
>+static struct resource zoom2_nand_resource = {
>+	.flags		= IORESOURCE_MEM,
>+};
>+
>+static struct platform_device zoom2_nand_device = {
>+	.name		= "omap2-nand",
>+	.id		= 0,
>+	.dev		= {
>+		.platform_data = &zoom2_nand_data,
>+	},
>+	.num_resources	= 1,
>+	.resource	= &zoom2_nand_resource,
>+};
>+
>+static void __init zoom2_flash_init(void)
>+{
>+	u8 nandcs = LDP3430_NAND_CS;
>+	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
>+
>+	zoom2_nand_data.cs = nandcs;
>+	zoom2_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
>+			GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
>+	zoom2_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
>+
>+	if (platform_device_register(&zoom2_nand_device) < 0)
>+		printk(KERN_ERR "Unable to register NAND device!\n");
>+}
>+
> /* Zoom2 has Qwerty keyboard*/
> static int zoom2_twl4030_keymap[] = {
> 	KEY(0, 0, KEY_E),
>@@ -271,6 +356,7 @@ static void __init omap_zoom2_init(void)
> 	omap_serial_init(&zoom2_uart_config);
> 	omap_zoom2_debugboard_init();
> 	usb_musb_init();
>+	zoom2_flash_init();
> }
>
> static void __init omap_zoom2_map_io(void)
>--
>1.6.3.3.210.g29cb3
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
vimal singh Aug. 27, 2009, 2:03 p.m. UTC | #2
Hi,

On Thu, Aug 27, 2009 at 7:16 PM, Pandita, Vikram<vikram.pandita@ti.com> wrote:
> Petazzoni/Vimal
>
>>-----Original Message-----
>>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Maxime
>>Petazzoni
>>Sent: Thursday, August 27, 2009 7:00 AM
>>To: linux-omap@vger.kernel.org
>>Subject: [PATCH] OMAP3: Zoom2: provide default MTD partitions
>>
>>This change introduces default MTD partitions for the Zoom-II board
>>NAND, inspired by the OMAP3 Beagle partitions and the OMAP3 Zoom2
>>partitions defined in OmapZoom.org's OMAP kernel.
>
> Thanks for putting this together for zoom2, however I NAK for now.
>
> Why?
>
> I know of an implementation by Vimal Singh that introduces a common flash file for Zoom1 and Zoom2.
> There is reuse of code there.
>
> I have attached the patch by Vimal here (in-lining would be difficult)

I am attaching an updated patch, which is prepared on top of the patch
which I submitted for flash supports for OMAP2/3 SDP board:
http://marc.info/?l=linux-omap&m=125065707704826&w=2

-vimal

>
> Please discuss and get a converged approach on handling NAND partitions on Zoom1 and Zoom2.
>
> Also the Systerm/User/Cache partition definitions are more from Android perspective.
>
> Given that each system may have a different NAND partition requirement,
> have you looked at bootargs passing the MTD partition info: Eg:
>
> mtdparts=omap2-nand.0:512k@0(xloader),\
> 1536k@512k(bootloader),\
> 29m@2m(kernel),\
> 160m@32m(system),\
> 32m@192m(userdata),\
> 32m@224m(cache)
>
>
> Lets discuss the final approach on this list and try to close this soon.
>
> Thnx
>
>>
>>The size of the U-Boot environment partition was increased to 1MB, as
>>the previously smaller partition couldn't contain the U-Boot environment
>>correctly (erasing the next partition would erase the U-Boot env as
>>well).
>>
>>Finally, the "system" partition gets an increased size of 256MB to take
>>advantage of the size of the flash on the Zoom-II board.
>>
>>Signed-off-by: Maxime Petazzoni <mpetazzoni@mvista.com>
>>---
>> arch/arm/mach-omap2/board-zoom2.c |   86 +++++++++++++++++++++++++++++++++++++
>> 1 files changed, 86 insertions(+), 0 deletions(-)
>>
>>diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
>>index 4d295d5..ce5a4d8 100644
>>--- a/arch/arm/mach-omap2/board-zoom2.c
>>+++ b/arch/arm/mach-omap2/board-zoom2.c
>>@@ -16,16 +16,101 @@
>> #include <linux/gpio.h>
>> #include <linux/i2c/twl4030.h>
>> #include <linux/regulator/machine.h>
>>+#include <linux/mtd/mtd.h>
>>+#include <linux/mtd/partitions.h>
>>+#include <linux/mtd/nand.h>
>>
>> #include <asm/mach-types.h>
>> #include <asm/mach/arch.h>
>>
>> #include <mach/common.h>
>>+#include <mach/nand.h>
>> #include <mach/usb.h>
>> #include <mach/keypad.h>
>>
>> #include "mmc-twl4030.h"
>>
>>+#define LDP3430_NAND_CS       0
>>+#define GPMC_CS0_BASE 0x60
>>+#define GPMC_CS_SIZE  0x30
>>+
>>+static struct mtd_partition zoom2_nand_partitions[] = {
>>+      {
>>+              .name           = "X-Loader-NAND",
>>+              .offset         = 0,
>>+              .size           = 4 * (64 * 2048),      /* 512kB */
>>+              .mask_flags     = MTD_WRITEABLE,        /* force read-only */
>>+      },
>>+      {
>>+              .name           = "U-Boot-NAND",
>>+              .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x80000 */
>>+              .size           = 4 * (64 * 2048),      /* 512kB */
>>+              .mask_flags     = MTD_WRITEABLE,        /* force read-only */
>>+      },
>>+      {
>>+              .name           = "Boot Env-NAND",
>>+              .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x100000 */
>>+              .size           = 8 * (64 * 2048),      /* 1MB */
>>+      },
>>+      {
>>+              .name           = "Kernel-NAND",
>>+              .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x200000 */
>>+              .size           = 32 * (64 * 2048),     /* 4MB */
>>+      },
>>+      {
>>+              .name           = "system",
>>+              .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x600000 */
>>+              .size           = 2048 * (64 * 2048),   /* 256MB */
>>+      },
>>+      {
>>+              .name           = "userdata",
>>+              .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x10600000 */
>>+              .size           = 512 * (64 * 2048),    /* 64MB */
>>+      },
>>+      {
>>+              .name           = "cache",
>>+              .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x14600000 */
>>+              .size           = 512 * (64 * 2048),    /* 64MB */
>>+      },
>>+};
>>+
>>+/* NAND chip access: 16 bit */
>>+static struct omap_nand_platform_data zoom2_nand_data = {
>>+      .parts          = zoom2_nand_partitions,
>>+      .nr_parts       = ARRAY_SIZE(zoom2_nand_partitions),
>>+      .nand_setup     = NULL,
>>+      .dma_channel    = -1,           /* disable DMA in OMAP NAND driver */
>>+      .dev_ready      = NULL,
>>+};
>>+
>>+static struct resource zoom2_nand_resource = {
>>+      .flags          = IORESOURCE_MEM,
>>+};
>>+
>>+static struct platform_device zoom2_nand_device = {
>>+      .name           = "omap2-nand",
>>+      .id             = 0,
>>+      .dev            = {
>>+              .platform_data = &zoom2_nand_data,
>>+      },
>>+      .num_resources  = 1,
>>+      .resource       = &zoom2_nand_resource,
>>+};
>>+
>>+static void __init zoom2_flash_init(void)
>>+{
>>+      u8 nandcs = LDP3430_NAND_CS;
>>+      u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
>>+
>>+      zoom2_nand_data.cs = nandcs;
>>+      zoom2_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
>>+                      GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
>>+      zoom2_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
>>+
>>+      if (platform_device_register(&zoom2_nand_device) < 0)
>>+              printk(KERN_ERR "Unable to register NAND device!\n");
>>+}
>>+
>> /* Zoom2 has Qwerty keyboard*/
>> static int zoom2_twl4030_keymap[] = {
>>       KEY(0, 0, KEY_E),
>>@@ -271,6 +356,7 @@ static void __init omap_zoom2_init(void)
>>       omap_serial_init(&zoom2_uart_config);
>>       omap_zoom2_debugboard_init();
>>       usb_musb_init();
>>+      zoom2_flash_init();
>> }
>>
>> static void __init omap_zoom2_map_io(void)
>>--
>>1.6.3.3.210.g29cb3
>>
>>--
>>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
Maxime Petazzoni Aug. 27, 2009, 2:06 p.m. UTC | #3
Hi,

* Pandita, Vikram <vikram.pandita@ti.com> [2009-08-27 19:16:27]:

> Why?
> 
> I know of an implementation by Vimal Singh that introduces a common
> flash file for Zoom1 and Zoom2.
> There is reuse of code there.

Thanks for your comments.

There are indeed other implentations around using a common flash file
for Zoom1 and Zoom2 boards. I didn't know of this specific
implementation by Vimal Singh, but we use something very similar
internally.

Since linux-omap didn't had any MTD partitions definitions for either
boards, I decided to go for the smallest change: only partitions for
Zoom2.

> Please discuss and get a converged approach on handling NAND
> partitions on Zoom1 and Zoom2.

Agreed. We should use a common file for Zoom1 and Zoom2 flash, with
Zoom2 specific partition sizes. But I'm not sure I deserve the right to
propose Vimal Singh's patch (by the way, why hasn't it been merged in
the linux-omap tree?). How should we proceed then?

> Also the Systerm/User/Cache partition definitions are more from Android perspective.
> 
> Given that each system may have a different NAND partition requirement, 
> have you looked at bootargs passing the MTD partition info: Eg: 
> 
> mtdparts=omap2-nand.0:512k@0(xloader),\
> 1536k@512k(bootloader),\
> 29m@2m(kernel),\
> 160m@32m(system),\
> 32m@192m(userdata),\
> 32m@224m(cache)

Yes, I am aware of the mtdparts command line arguments, which works
great. I think a "default", sensible partition layout for the Zoom2
would be nice though.

- Maxime
vikram pandita Aug. 27, 2009, 2:08 p.m. UTC | #4
Vimal

>-----Original Message-----
>From: vimal singh [mailto:vimal.newwork@gmail.com]
>Sent: Thursday, August 27, 2009 9:03 AM
>To: Pandita, Vikram
>Cc: Maxime Petazzoni; Singh, Vimal; linux-omap@vger.kernel.org; Rix, Tom
>Subject: Re: [PATCH] OMAP3: Zoom2: provide default MTD partitions
>
>Hi,
>>
>> Also the Systerm/User/Cache partition definitions are more from Android perspective.
>>
>> Given that each system may have a different NAND partition requirement,
>> have you looked at bootargs passing the MTD partition info: Eg:
>>
>> mtdparts=omap2-nand.0:512k@0(xloader),\
>> 1536k@512k(bootloader),\
>> 29m@2m(kernel),\
>> 160m@32m(system),\
>> 32m@192m(userdata),\
>> 32m@224m(cache)


What about this bootargs nand partition specification approach? 


>>
>>
>> Lets discuss the final approach on this list and try to close this soon.
>>
>> Thnx
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rix, Tom Aug. 28, 2009, 4:26 p.m. UTC | #5
The bootloader perspective..

The minimum set needed are for xloader, u-boot and the environment. 
xloader is very static.
u-boot at 1.25m should be big enough
environment is very static and should be big enough..
This is consistent with the bootloader.

The rest can be done with mtdparts and the differences between ldp and zoom2
flash layout can be separated in their respective environment files. 

The bootloader flashing utility 'fastboot' depends on the kernel layout.
There is a change pending to decouple using an mtdparts-like mechanism. 
See 'Runtime Partitions' toward the bottom of..

https://omapzoom.org/gf/project/omapzoom/wiki/?pagename=FAQ-8%3A+Zoom-II+Android%C2%A0fastboot

Tom
vimal singh Sept. 1, 2009, 7:04 a.m. UTC | #6
On Thu, Aug 27, 2009 at 7:36 PM, Maxime Petazzoni<mpetazzoni@mvista.com> wrote:
> Hi,
>
> * Pandita, Vikram <vikram.pandita@ti.com> [2009-08-27 19:16:27]:
>
>> Why?
>>
>> I know of an implementation by Vimal Singh that introduces a common
>> flash file for Zoom1 and Zoom2.
>> There is reuse of code there.
>
> Thanks for your comments.
>
> There are indeed other implentations around using a common flash file
> for Zoom1 and Zoom2 boards. I didn't know of this specific
> implementation by Vimal Singh, but we use something very similar
> internally.
>
> Since linux-omap didn't had any MTD partitions definitions for either
> boards, I decided to go for the smallest change: only partitions for
> Zoom2.
>
>> Please discuss and get a converged approach on handling NAND
>> partitions on Zoom1 and Zoom2.
>
> Agreed. We should use a common file for Zoom1 and Zoom2 flash, with
> Zoom2 specific partition sizes. But I'm not sure I deserve the right to
> propose Vimal Singh's patch (by the way, why hasn't it been merged in
> the linux-omap tree?). How should we proceed then?
>
>> Also the Systerm/User/Cache partition definitions are more from Android perspective.
>>
>> Given that each system may have a different NAND partition requirement,
>> have you looked at bootargs passing the MTD partition info: Eg:
>>
>> mtdparts=omap2-nand.0:512k@0(xloader),\
>> 1536k@512k(bootloader),\
>> 29m@2m(kernel),\
>> 160m@32m(system),\
>> 32m@192m(userdata),\
>> 32m@224m(cache)
>
> Yes, I am aware of the mtdparts command line arguments, which works
> great. I think a "default", sensible partition layout for the Zoom2
> would be nice though.

I agree. Keeping it in the mind that mtdparts command line arguments
will be given higher precedence anyway...

-vimal

>
> - Maxime
>
> --
> Maxime Petazzoni
> Linux kernel & software dev
> MontaVista Software, Inc
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkqWktkACgkQ7KsOe4Pmrg28zwCdHvKdX9NDgWVoUOx6Mc8kA6+7
> rx8An1NMQg5aEUHrEgGBZM/1YoFTvQtz
> =4L+0
> -----END PGP SIGNATURE-----
>
>
Maxime Petazzoni Sept. 1, 2009, 7:12 a.m. UTC | #7
* vimal singh <vimal.newwork@gmail.com> [2009-09-01 12:34:26]:

> > Yes, I am aware of the mtdparts command line arguments, which works
> > great. I think a "default", sensible partition layout for the Zoom2
> > would be nice though.
> 
> I agree. Keeping it in the mind that mtdparts command line arguments
> will be given higher precedence anyway...

Exactly. I would recommend that your patch gets merged in. Although I'm
a bit curious of the rationale behind a 30M kernel partition?

Also, given a 512MB NAND, we could easily affect 256MB or more to the
system partition (as well as a bit more space for the userdata
partition).

But that's just nitpicking. As we said, mtdparts can be used to take
precedence over the default settings if they don't match the
user/system's needs.

- Maxime
vimal singh Sept. 1, 2009, 7:22 a.m. UTC | #8
On Tue, Sep 1, 2009 at 12:42 PM, Maxime Petazzoni<mpetazzoni@mvista.com> wrote:
> * vimal singh <vimal.newwork@gmail.com> [2009-09-01 12:34:26]:
>
>> > Yes, I am aware of the mtdparts command line arguments, which works
>> > great. I think a "default", sensible partition layout for the Zoom2
>> > would be nice though.
>>
>> I agree. Keeping it in the mind that mtdparts command line arguments
>> will be given higher precedence anyway...
>
> Exactly. I would recommend that your patch gets merged in. Although I'm
> a bit curious of the rationale behind a 30M kernel partition?
>
> Also, given a 512MB NAND, we could easily affect 256MB or more to the
> system partition (as well as a bit more space for the userdata
> partition).
>
> But that's just nitpicking. As we said, mtdparts can be used to take
> precedence over the default settings if they don't match the
> user/system's needs.

I'll re-submit this patch along with one that I mentioned earlier:
http://marc.info/?l=linux-omap&m=125065707704826&w=2

in a series of patches.
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index 4d295d5..ce5a4d8 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -16,16 +16,101 @@ 
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/regulator/machine.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/nand.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
 #include <mach/common.h>
+#include <mach/nand.h>
 #include <mach/usb.h>
 #include <mach/keypad.h>
 
 #include "mmc-twl4030.h"
 
+#define LDP3430_NAND_CS	0
+#define GPMC_CS0_BASE	0x60
+#define GPMC_CS_SIZE	0x30
+
+static struct mtd_partition zoom2_nand_partitions[] = {
+	{
+		.name		= "X-Loader-NAND",
+		.offset		= 0,
+		.size		= 4 * (64 * 2048),	/* 512kB */
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
+		.size		= 4 * (64 * 2048),	/* 512kB */
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "Boot Env-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x100000 */
+		.size		= 8 * (64 * 2048),	/* 1MB */
+	},
+	{
+		.name		= "Kernel-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x200000 */
+		.size		= 32 * (64 * 2048),	/* 4MB */
+	},
+	{
+		.name		= "system",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x600000 */
+		.size		= 2048 * (64 * 2048),	/* 256MB */
+	},
+	{
+		.name		= "userdata",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x10600000 */
+		.size		= 512 * (64 * 2048),	/* 64MB */
+	},
+	{
+		.name		= "cache",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x14600000 */
+		.size		= 512 * (64 * 2048),	/* 64MB */
+	},
+};
+
+/* NAND chip access: 16 bit */
+static struct omap_nand_platform_data zoom2_nand_data = {
+	.parts		= zoom2_nand_partitions,
+	.nr_parts	= ARRAY_SIZE(zoom2_nand_partitions),
+	.nand_setup	= NULL,
+	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
+	.dev_ready	= NULL,
+};
+
+static struct resource zoom2_nand_resource = {
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device zoom2_nand_device = {
+	.name		= "omap2-nand",
+	.id		= 0,
+	.dev		= {
+		.platform_data = &zoom2_nand_data,
+	},
+	.num_resources	= 1,
+	.resource	= &zoom2_nand_resource,
+};
+
+static void __init zoom2_flash_init(void)
+{
+	u8 nandcs = LDP3430_NAND_CS;
+	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
+
+	zoom2_nand_data.cs = nandcs;
+	zoom2_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
+			GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
+	zoom2_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
+
+	if (platform_device_register(&zoom2_nand_device) < 0)
+		printk(KERN_ERR "Unable to register NAND device!\n");
+}
+
 /* Zoom2 has Qwerty keyboard*/
 static int zoom2_twl4030_keymap[] = {
 	KEY(0, 0, KEY_E),
@@ -271,6 +356,7 @@  static void __init omap_zoom2_init(void)
 	omap_serial_init(&zoom2_uart_config);
 	omap_zoom2_debugboard_init();
 	usb_musb_init();
+	zoom2_flash_init();
 }
 
 static void __init omap_zoom2_map_io(void)