Skip to contentSkip to conversation

OMAP: SDP: Introducing 'board-sdp-flash.c' for flash init

PATCH Applied Vimal Singh 2 participants 3 messages Feb 8, 2010

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

PATCH v2 2/3 OMAP: SDP: Introducing 'board-sdp-flash.c' for flash init

Quoted 1 line

From e586d2fbbecc60bc66687c4e6d4798913bb33b7a Mon Sep 17 00:00:00 2001

From: Vimal Singh <[email protected]>
Date: Mon, 8 Feb 2010 05:02:45 +0530
Subject: [PATCH 2/3] OMAP: SDP: Introducing 'board-sdp-flash.c' for flash init

This patch adds 'board-sdp-flash.c', which could be utilized by boards similar to 3430SDP. (For ex: 2430sdp, 36030sdp).

This file does initialization for all three flash devices present in SDP boards (NOR, NAND, OneNAND), by finding there 'cs' number dynamically using switch setting information (S8: 1-4). This also expects partition information from core board files (for
ex: board-3430sdp.c). Which allows to choose different default partitions for different boards.

A new structure is created for this purpose: 'flash_partitions' in 'mach/board-sdp.h'. This has two members:
1. struct mtd_partition *parts
2. int nr_parts

A board file is expected to fill this structure and pass it to 'sdp-flsash-init'. Partition information should be passed in structure array of 'flash_partitions'. Partition information should be passed in below sequence in array:
NOR
OneNAND
NAND

---
 arch/arm/mach-omap2/board-sdp-flash.c        |  295 ++++++++++++++++++++++++++
 arch/arm/mach-omap2/include/mach/board-sdp.h |   22 ++
 arch/arm/plat-omap/include/plat/gpmc.h       |    2 +
 3 files changed, 319 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-sdp-flash.c
 create mode 100644 arch/arm/mach-omap2/include/mach/board-sdp.h
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-sdp-flash.c
new file mode 100644
index 0000000..54ef19f

arch/arm/mach-omap2/board-sdp-flash.c new file +295 -0

295 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/mach-omap2/include/mach/board-sdp.h
new file mode 100644
index 0000000..a2f7ba2

arch/arm/mach-omap2/include/mach/board-sdp.h new file +22 -0
@@ -0,0 +1,22 @@
+/*
+ *  board-sdp.h
+ *
+ *  Information structures for SDP-specific board config data
+ *
+ *  Copyright (C) 2009 Nokia Corporation
+ *  Copyright (C) 2009 Texas Instruments
+ *
+ * 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/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+struct flash_partitions {
+	struct mtd_partition *parts;
+	int nr_parts;
+};
+
+extern void sdp_flash_init(struct flash_partitions []);
+
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/gpmc.h
index e081338..4090749 100644

arch/arm/plat-omap/include/plat/gpmc.h +2 -0
@@ -27,6 +27,8 @@
 
 #define GPMC_CONFIG		0x50
 #define GPMC_STATUS		0x54
+#define GPMC_CS0_BASE		0x60
+#define GPMC_CS_SIZE		0x30
 
 #define GPMC_CONFIG1_WRAPBURST_SUPP     (1 << 31)
 #define GPMC_CONFIG1_READMULTIPLE_SUPP  (1 << 30)
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 6 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +0 -0
new file mode 100644
index 0000000..54ef19f

[snip]

Quoted 11 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +11 -0
+static void omap_set_vpp(struct map_info *map, int enable)
+{
+	static int      count;
+	u32 l;
+
+	if (cpu_class_is_omap1()) {
+		if (enable) {
+			if (count++ == 0) {
+				l = omap_readl(EMIFS_CONFIG);
+				l |= OMAP_EMIFS_CONFIG_WP;
+				omap_writel(l, EMIFS_CONFIG);

arch/arm/mach-omap2/board-sdp-flash.c line 75

Quoted 10 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +10 -0
+			}
+		} else {
+			if (count && (--count == 0)) {
+				l = omap_readl(EMIFS_CONFIG);
+				l &= ~OMAP_EMIFS_CONFIG_WP;
+				omap_writel(l, EMIFS_CONFIG);
+			}
+		}
+	}
+}

Hmm, as you are adding files into arch/arm/mach-omap2 directory, is there a chance cpu_class_is_omap1() ever returns non-zero?

arch/arm/mach-omap2/board-sdp-flash.c line 80

Quoted 4 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +4 -0
+static struct physmap_flash_data sdp_nor_data = {
+	.width		= 2,
+	.set_vpp	= omap_set_vpp,
+};

... and in case there is not, just leave set_vpp set to NULL and delete this incarnation of omap_set_vpp.

#2 lore raw
Quoted 32 lines · Ladislav Michl
Quoted 6 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +0 -0
new file mode 100644
index 0000000..54ef19f

[snip]

Quoted 11 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +11 -0
+static void omap_set_vpp(struct map_info *map, int enable)
+{
+     static int      count;
+     u32 l;
+
+     if (cpu_class_is_omap1()) {
+             if (enable) {
+                     if (count++ == 0) {
+                             l = omap_readl(EMIFS_CONFIG);
+                             l |= OMAP_EMIFS_CONFIG_WP;
+                             omap_writel(l, EMIFS_CONFIG);

arch/arm/mach-omap2/board-sdp-flash.c line 75

Quoted 10 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +10 -0
+                     }
+             } else {
+                     if (count && (--count == 0)) {
+                             l = omap_readl(EMIFS_CONFIG);
+                             l &= ~OMAP_EMIFS_CONFIG_WP;
+                             omap_writel(l, EMIFS_CONFIG);
+                     }
+             }
+     }
+}

Hmm, as you are adding files into arch/arm/mach-omap2 directory, is there a chance cpu_class_is_omap1() ever returns non-zero?

Quoted 8 lines

arch/arm/mach-omap2/board-sdp-flash.c line 80

Quoted 4 lines
arch/arm/mach-omap2/board-sdp-flash.c new file +4 -0
+static struct physmap_flash_data sdp_nor_data = {
+     .width          = 2,
+     .set_vpp        = omap_set_vpp,
+};

... and in case there is not, just leave set_vpp set to NULL and delete this incarnation of omap_set_vpp.

My bad. I just did not look into that.
I'll fix it as per your suggestion.

Signature · 6 lines
Regards,
Vimal Singh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html