public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4]: OMAP: ZOOM: Introducing 'board-zoom-flash.c' for NAND init in ZOOM boards
@ 2009-12-03 14:15 Vimal Singh
  2009-12-03 16:06 ` Grazvydas Ignotas
  0 siblings, 1 reply; 3+ messages in thread
From: Vimal Singh @ 2009-12-03 14:15 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

>From 948584f4157a9eb99ba085968d23add28cbfd160 Mon Sep 17 00:00:00 2001
From: Vimal Singh <vimalsingh@ti.com>
Date: Tue, 1 Dec 2009 11:36:56 +0530
Subject: [PATCH] OMAP: ZOOM: Introducing 'board-zoom-flash.c'

This patch adds 'board-zoom-flash.c', which could be utilized
by boards similar to ZOOM2. (For ex: LDP, ZOOM2, ZOOM3).

This does initialization for NAND device based on the 'cs' number
and partition information passed from board file (ex: board-zoom2.c).

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
---
 arch/arm/mach-omap2/board-zoom-flash.c        |   59 +++++++++++++++++++++++++
 arch/arm/mach-omap2/include/mach/board-zoom.h |   11 +++++
 2 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-zoom-flash.c

diff --git a/arch/arm/mach-omap2/board-zoom-flash.c
b/arch/arm/mach-omap2/board-zoom-flash.c
new file mode 100644
index 0000000..b3e66ca
--- /dev/null
+++ b/arch/arm/mach-omap2/board-zoom-flash.c
@@ -0,0 +1,59 @@
+/*
+ * board-zoom-flash.c
+ *
+ * Copyright (C) 2009 Texas Instruments Inc.
+ * Vimal Singh <vimalsingh@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/nand.h>
+#include <linux/types.h>
+#include <linux/io.h>
+
+#include <asm/mach/flash.h>
+#include <plat/board.h>
+#include <plat/gpmc.h>
+#include <plat/nand.h>
+
+#include <mach/board-zoom.h>
+
+#if defined(CONFIG_MTD_NAND_OMAP2) || \
+		defined(CONFIG_MTD_NAND_OMAP2_MODULE)
+/* NAND chip access: 16 bit */
+static struct omap_nand_platform_data zoom_nand_data = {
+	.nand_setup	= NULL,
+	.dma_channel	= -1,	/* disable DMA in OMAP NAND driver */
+	.dev_ready	= NULL,
+	.devsize	= 1,	/* '0' for 8-bit, '1' for 16-bit device */
+};
+
+/**
+ * zoom_flash_init - Identify devices connected to GPMC and register.
+ *
+ * @return - void.
+ */
+void __init zoom_flash_init(struct flash_partitions zoom_nand_parts[], int cs)
+{
+	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
+
+	zoom_nand_data.cs		= cs;
+	zoom_nand_data.parts		= zoom_nand_parts[0].parts;
+	zoom_nand_data.nr_parts		= zoom_nand_parts[0].nr_parts;
+	zoom_nand_data.gpmc_baseaddr	= (void *)(gpmc_base_add);
+	zoom_nand_data.gpmc_cs_baseaddr	= (void *)(gpmc_base_add +
+						GPMC_CS0_BASE +
+						cs * GPMC_CS_SIZE);
+	gpmc_nand_init(&zoom_nand_data);
+}
+#else
+void __init zoom_flash_init(struct flash_partitions zoom_nand_parts[], int cs)
+{
+}
+#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
+
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h
b/arch/arm/mach-omap2/include/mach/board-zoom.h
index c93b29e..f4469d3 100644
--- a/arch/arm/mach-omap2/include/mach/board-zoom.h
+++ b/arch/arm/mach-omap2/include/mach/board-zoom.h
@@ -1,5 +1,16 @@
 /*
  * Defines for zoom boards
  */
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+struct flash_partitions {
+	struct mtd_partition *parts;
+	int nr_parts;
+};
+
+#define ZOOM_NAND_CS	0
+
+extern void __init zoom_flash_init(struct flash_partitions [], int);
 extern int __init zoom_debugboard_init(void);
 extern void __init zoom_peripherals_init(void);
-- 
1.5.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/4]: OMAP: ZOOM: Introducing 'board-zoom-flash.c' for NAND init in ZOOM boards
  2009-12-03 14:15 [PATCH 1/4]: OMAP: ZOOM: Introducing 'board-zoom-flash.c' for NAND init in ZOOM boards Vimal Singh
@ 2009-12-03 16:06 ` Grazvydas Ignotas
  2009-12-04 22:19   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Grazvydas Ignotas @ 2009-12-03 16:06 UTC (permalink / raw)
  To: Vimal Singh; +Cc: linux-omap, Tony Lindgren

On Thu, Dec 3, 2009 at 4:15 PM, Vimal Singh <vimal.newwork@gmail.com> wrote:
> From 948584f4157a9eb99ba085968d23add28cbfd160 Mon Sep 17 00:00:00 2001
> From: Vimal Singh <vimalsingh@ti.com>
> Date: Tue, 1 Dec 2009 11:36:56 +0530
> Subject: [PATCH] OMAP: ZOOM: Introducing 'board-zoom-flash.c'
>
> This patch adds 'board-zoom-flash.c', which could be utilized
> by boards similar to ZOOM2. (For ex: LDP, ZOOM2, ZOOM3).

So it's not really zoom specific, i.e. can be used by other boards
with NAND like beagleboard and pandora? If that's the case, perhaps
the file could be named something like omap3-nand.c or simply just
nand.c .

>
> This does initialization for NAND device based on the 'cs' number
> and partition information passed from board file (ex: board-zoom2.c).
>
> Signed-off-by: Vimal Singh <vimalsingh@ti.com>
> ---
>  arch/arm/mach-omap2/board-zoom-flash.c        |   59 +++++++++++++++++++++++++
>  arch/arm/mach-omap2/include/mach/board-zoom.h |   11 +++++
>  2 files changed, 70 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-zoom-flash.c
>
> diff --git a/arch/arm/mach-omap2/board-zoom-flash.c
> b/arch/arm/mach-omap2/board-zoom-flash.c
> new file mode 100644
> index 0000000..b3e66ca
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-zoom-flash.c
> @@ -0,0 +1,59 @@
> +/*
> + * board-zoom-flash.c
> + *
> + * Copyright (C) 2009 Texas Instruments Inc.
> + * Vimal Singh <vimalsingh@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/delay.h>
> +#include <linux/platform_device.h>
> +#include <linux/mtd/nand.h>
> +#include <linux/types.h>
> +#include <linux/io.h>
> +
> +#include <asm/mach/flash.h>
> +#include <plat/board.h>
> +#include <plat/gpmc.h>
> +#include <plat/nand.h>
> +
> +#include <mach/board-zoom.h>
> +
> +#if defined(CONFIG_MTD_NAND_OMAP2) || \
> +               defined(CONFIG_MTD_NAND_OMAP2_MODULE)
> +/* NAND chip access: 16 bit */
> +static struct omap_nand_platform_data zoom_nand_data = {
> +       .nand_setup     = NULL,
> +       .dma_channel    = -1,   /* disable DMA in OMAP NAND driver */
> +       .dev_ready      = NULL,
> +       .devsize        = 1,    /* '0' for 8-bit, '1' for 16-bit device */
> +};
> +
> +/**
> + * zoom_flash_init - Identify devices connected to GPMC and register.
> + *
> + * @return - void.
> + */
> +void __init zoom_flash_init(struct flash_partitions zoom_nand_parts[], int cs)
> +{
> +       u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
> +
> +       zoom_nand_data.cs               = cs;
> +       zoom_nand_data.parts            = zoom_nand_parts[0].parts;
> +       zoom_nand_data.nr_parts         = zoom_nand_parts[0].nr_parts;
> +       zoom_nand_data.gpmc_baseaddr    = (void *)(gpmc_base_add);
> +       zoom_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
> +                                               GPMC_CS0_BASE +
> +                                               cs * GPMC_CS_SIZE);
> +       gpmc_nand_init(&zoom_nand_data);
> +}
> +#else
> +void __init zoom_flash_init(struct flash_partitions zoom_nand_parts[], int cs)
> +{
> +}
> +#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
> +
> diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h
> b/arch/arm/mach-omap2/include/mach/board-zoom.h
> index c93b29e..f4469d3 100644
> --- a/arch/arm/mach-omap2/include/mach/board-zoom.h
> +++ b/arch/arm/mach-omap2/include/mach/board-zoom.h
> @@ -1,5 +1,16 @@
>  /*
>  * Defines for zoom boards
>  */
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +
> +struct flash_partitions {
> +       struct mtd_partition *parts;
> +       int nr_parts;
> +};
> +
> +#define ZOOM_NAND_CS   0
> +
> +extern void __init zoom_flash_init(struct flash_partitions [], int);

These could have their include file, it would be odd to include
board-zoom.h and call zoom_flash_init() for pandora, for example.

>  extern int __init zoom_debugboard_init(void);
>  extern void __init zoom_peripherals_init(void);
> --
> 1.5.5
> --
> 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
>
--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/4]: OMAP: ZOOM: Introducing 'board-zoom-flash.c' for NAND init in ZOOM boards
  2009-12-03 16:06 ` Grazvydas Ignotas
@ 2009-12-04 22:19   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-12-04 22:19 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: Vimal Singh, linux-omap

* Grazvydas Ignotas <notasas@gmail.com> [091203 08:05]:
> On Thu, Dec 3, 2009 at 4:15 PM, Vimal Singh <vimal.newwork@gmail.com> wrote:
> > From 948584f4157a9eb99ba085968d23add28cbfd160 Mon Sep 17 00:00:00 2001
> > From: Vimal Singh <vimalsingh@ti.com>
> > Date: Tue, 1 Dec 2009 11:36:56 +0530
> > Subject: [PATCH] OMAP: ZOOM: Introducing 'board-zoom-flash.c'
> >
> > This patch adds 'board-zoom-flash.c', which could be utilized
> > by boards similar to ZOOM2. (For ex: LDP, ZOOM2, ZOOM3).
> 
> So it's not really zoom specific, i.e. can be used by other boards
> with NAND like beagleboard and pandora? If that's the case, perhaps
> the file could be named something like omap3-nand.c or simply just
> nand.c .
> 
> >
> > This does initialization for NAND device based on the 'cs' number
> > and partition information passed from board file (ex: board-zoom2.c).
> >
> > Signed-off-by: Vimal Singh <vimalsingh@ti.com>
> > ---
> >  arch/arm/mach-omap2/board-zoom-flash.c        |   59 +++++++++++++++++++++++++
> >  arch/arm/mach-omap2/include/mach/board-zoom.h |   11 +++++
> >  2 files changed, 70 insertions(+), 0 deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-zoom-flash.c
> >
> > diff --git a/arch/arm/mach-omap2/board-zoom-flash.c
> > b/arch/arm/mach-omap2/board-zoom-flash.c
> > new file mode 100644
> > index 0000000..b3e66ca
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/board-zoom-flash.c

<snip>

> > +void __init zoom_flash_init(struct flash_partitions zoom_nand_parts[], int cs)
> > +{
> > +       u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
> > +
> > +       zoom_nand_data.cs               = cs;
> > +       zoom_nand_data.parts            = zoom_nand_parts[0].parts;
> > +       zoom_nand_data.nr_parts         = zoom_nand_parts[0].nr_parts;
> > +       zoom_nand_data.gpmc_baseaddr    = (void *)(gpmc_base_add);
> > +       zoom_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
> > +                                               GPMC_CS0_BASE +
> > +                                               cs * GPMC_CS_SIZE);
> > +       gpmc_nand_init(&zoom_nand_data);
> > +}

And here too you should use gpmc_cs_request().

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-04 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-03 14:15 [PATCH 1/4]: OMAP: ZOOM: Introducing 'board-zoom-flash.c' for NAND init in ZOOM boards Vimal Singh
2009-12-03 16:06 ` Grazvydas Ignotas
2009-12-04 22:19   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox