public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: dedekind@infradead.org, linux-omap@vger.kernel.org,
	adrian.hunter@nokia.com
Subject: [PATCH 5/4] onenand init: Debug patch to print out the onenand partitions from bootloader
Date: Wed, 29 Apr 2009 14:54:48 -0700	[thread overview]
Message-ID: <20090429215447.GA12986@atomide.com> (raw)
In-Reply-To: <20090429215037.13138.62993.stgit@localhost>

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

FYI, here's the debug patch I used to dump the ATAG partitions.

Tony

[-- Attachment #2: dump-atag-partitions.patch --]
[-- Type: text/x-diff, Size: 3650 bytes --]

>From b65441b89ae7003adb983ac2f225f0bc1ddfba76 Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 29 Apr 2009 14:52:20 -0700
Subject: [PATCH] onenand init: Debug patch to print out the onenand partitions from bootloader

Not for merging

diff --git a/arch/arm/mach-omap2/board-n800.c b/arch/arm/mach-omap2/board-n800.c
index e882e4b..e69b3b2 100644
--- a/arch/arm/mach-omap2/board-n800.c
+++ b/arch/arm/mach-omap2/board-n800.c
@@ -726,6 +726,7 @@ static struct omap_onenand_platform_data board_onenand_data = {
 
 static void __init board_onenand_init(void)
 {
+	gpmc_set_atag_partitions(onenand_partitions, ONENAND_MAX_PARTITIONS);
 	gpmc_onenand_init(&board_onenand_data);
 }
 
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 2d53315..664b732 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -519,6 +519,7 @@ static struct omap_onenand_platform_data board_onenand_data = {
 
 static void __init board_onenand_init(void)
 {
+	gpmc_set_atag_partitions(onenand_partitions, ONENAND_MAX_PARTITIONS);
 	gpmc_onenand_init(&board_onenand_data);
 }
 
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 9f5c191..dbf2096 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -327,3 +327,30 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
 		return;
 	}
 }
+
+void __init gpmc_set_atag_partitions(struct mtd_partition *parts, int nr_parts)
+{
+	const struct omap_partition_config *part;
+	int i = 0;
+
+	while ((part = omap_get_nr_config(OMAP_TAG_PARTITION,
+				struct omap_partition_config, i)) != NULL) {
+		struct mtd_partition *mpart;
+
+		mpart = parts;
+		mpart->name = (char *)part->name;
+		mpart->size = part->size;
+		mpart->offset = part->offset;
+		mpart->mask_flags = part->mask_flags;
+		printk(KERN_INFO "Partition%i\n", i);
+		printk(KERN_INFO "\t{\n");
+		printk(KERN_INFO "\t\t.name\t\t= \"%s\",\n", mpart->name);
+		printk(KERN_INFO "\t\t.offset\t\t= 0x%llx,\n", mpart->offset);
+		printk(KERN_INFO "\t\t.size\t\t= 0x%llx,\n", mpart->size);
+		printk(KERN_INFO "\t\t.mask_flags\t= 0x%x,\n",
+							mpart->mask_flags);
+		printk(KERN_INFO "\t},\n");
+		i++;
+		parts++;
+	}
+}
diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h
index 4d8d10a..ae8c2db 100644
--- a/arch/arm/plat-omap/include/mach/board.h
+++ b/arch/arm/plat-omap/include/mach/board.h
@@ -125,6 +125,14 @@ struct omap_tmp105_config {
 	int (* set_power)(int enable);
 };
 
+struct omap_partition_config {
+	char name[16];
+	unsigned int size;
+	unsigned int offset;
+	/* same as in include/linux/mtd/partitions.h */
+	unsigned int mask_flags;
+};
+
 struct omap_flash_part_str_config {
 	char part_table[0];
 };
diff --git a/arch/arm/plat-omap/include/mach/onenand.h b/arch/arm/plat-omap/include/mach/onenand.h
index 2a391fa..f6a5320 100644
--- a/arch/arm/plat-omap/include/mach/onenand.h
+++ b/arch/arm/plat-omap/include/mach/onenand.h
@@ -30,6 +30,8 @@ int omap2_onenand_rephase(void);
 #if defined(CONFIG_MTD_ONENAND_OMAP2) || defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
 
 extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
+extern void gpmc_set_atag_partitions(struct mtd_partition *parts,
+								int nr_parts);
 
 #else
 
@@ -43,5 +45,10 @@ static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
 {
 }
 
+static inline void gpmc_set_atag_partitions(struct mtd_partition *parts,
+								int nr_parts)
+{
+}
+
 #endif
 #endif

  reply	other threads:[~2009-04-29 21:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 21:49 [PATCH 0/4] Generic gpmc-onenand initialization, v2 Tony Lindgren
2009-04-29 21:50 ` [PATCH 1/4] onenand init: Rename board-n800-flash.c to gpmc-onenand.c Tony Lindgren
2009-04-29 21:50 ` [PATCH 2/4] onenand init: Build gpmc-onenand.o based on CONFIG_MTD_ONENAND_OMAP2 Tony Lindgren
2009-04-29 21:50 ` [PATCH 3/4] onenand init: Rename n800_* functions to gpmc_onenand_* functions Tony Lindgren
2009-04-29 21:50 ` [PATCH 4/4] onenand init: Pass configuration data from board-*.c files Tony Lindgren
2009-04-29 21:54   ` Tony Lindgren [this message]
2009-04-30  5:53   ` Adrian Hunter
2009-04-30 14:01     ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090429215447.GA12986@atomide.com \
    --to=tony@atomide.com \
    --cc=adrian.hunter@nokia.com \
    --cc=dedekind@infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox