From: Markus Brunner <super.firetwister@googlemail.com>
To: dwmw2@infradead.org
Cc: Mark Jonas <toertel@gmail.com>, linux-mtd@lists.infradead.org
Subject: [PATCH] Magic Panel (SH3-DSP board) MTD mapping
Date: Mon, 20 Aug 2007 08:37:08 +0200 [thread overview]
Message-ID: <200708200837.08856.super.firetwister@gmail.com> (raw)
Hi,
this adds a MTD mapping for the onboard NOR flash on the Magic Panel R2.
The mapping module is based on the solutionengine mapping module.
How are the chances for inclusion in 2.6.24?
Signed-off by: Markus Brunner <super.firetwister@gmail.com>
Signed-off by: Mark Jonas <toertel@gmail.com>
---
Kconfig | 6 +++
Makefile | 1
magicpanelr2.c | 98
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 105 insertions(+)
--- sh-2.6-intc/drivers/mtd/maps/Kconfig 2007-07-31 12:11:48.000000000 +0200
+++ sh-2.6/drivers/mtd/maps/Kconfig 2007-08-16 16:24:29.000000000 +0200
@@ -407,6 +407,12 @@ config MTD_SOLUTIONENGINE
This enables access to the flash chips on the Hitachi SolutionEngine and
similar boards. Say 'Y' if you are building a kernel for such a board.
+config MTD_MAGICPANELR2
+ tristate "CFI Flash device mapped on Magic Panel R2"
+ depends on SUPERH && MTD_CFI && MTD_REDBOOT_PARTS
+ help
+ This enables access to the flash chip on the Magic Panel R2.
+
config MTD_ARM_INTEGRATOR
tristate "CFI Flash device mapped on ARM Integrator/P720T"
depends on ARM && MTD_CFI
--- sh-2.6-intc/drivers/mtd/maps/magicpanelr2.c 1970-01-01 01:00:00.000000000
+0100
+++ sh-2.6/drivers/mtd/maps/magicpanelr2.c 2007-08-17 14:30:37.000000000 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2007 Markus Brunner, Mark Jonas
+ *
+ * Flash on Magic Panel R2 board.
+ *
+ * Based on solutionengine.c
+ *
+ * (C) 2001 Red Hat, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/errno.h>
+#include <asm/magicpanelr2.h>
+
+static struct mtd_info *flash_mtd;
+
+struct map_info mpr2_flash_map = {
+ .name = "Magic Panel R2 Flash",
+ .size = 0x2000000UL,
+ .bankwidth = 2,
+};
+static struct mtd_partition *parsed_parts;
+
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+
+static struct mtd_partition mpr2_partitions[] = {
+ /* Reserved for bootloader, read-only */
+ {
+ .name = "Bootloader",
+ .offset = 0x00000000UL,
+ .size = MPR2_MTD_BOOTLOADER_SIZE,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ /* Reserved for kernel image */
+ {
+ .name = "Kernel Image",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = MPR2_MTD_KERNEL_SIZE,
+ },
+ /* Rest is used for Flash FS */
+ {
+ .name = "Flash FS",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = MTDPART_SIZ_FULL,
+ }
+};
+
+static int __init init_mpr2_maps(void)
+{
+ int nr_parts = 0;
+
+ /* Probe at offset 0 */
+ mpr2_flash_map.phys = 0x00000000UL;
+ mpr2_flash_map.virt = (void __iomem *)P2SEGADDR(0x00000000UL);
+ simple_map_init(&mpr2_flash_map);
+
+ flash_mtd = do_map_probe("cfi_probe", &mpr2_flash_map);
+
+ flash_mtd->owner = THIS_MODULE;
+
+ /* Check if there is a partition table */
+ nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);
+
+ /* If there is no partition table, used the hard coded table */
+ if (nr_parts <= 0) {
+ parsed_parts = mpr2_partitions;
+ nr_parts = sizeof(mpr2_partitions)/sizeof(*parsed_parts);
+ }
+
+ /* Add partitions */
+ add_mtd_partitions(flash_mtd, parsed_parts, nr_parts);
+
+ return 0;
+}
+
+static void __exit cleanup_mpr2_maps(void)
+{
+ del_mtd_partitions(flash_mtd);
+ map_destroy(flash_mtd);
+}
+
+module_init(init_mpr2_maps);
+module_exit(cleanup_mpr2_maps);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mark Jonas <toertel@gmail.com>");
+MODULE_DESCRIPTION("MTD map driver for Magic Panel R2");
--- sh-2.6-intc/drivers/mtd/maps/Makefile 2007-07-31 12:11:48.000000000 +0200
+++ sh-2.6/drivers/mtd/maps/Makefile 2007-08-14 13:23:32.000000000 +0200
@@ -71,3 +71,4 @@ obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
+obj-$(CONFIG_MTD_MAGICPANELR2) += magicpanelr2.o
\ No newline at end of file
next reply other threads:[~2007-08-20 6:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 6:37 Markus Brunner [this message]
2007-08-20 7:35 ` [PATCH] Magic Panel (SH3-DSP board) MTD mapping David Woodhouse
2007-08-21 20:12 ` Markus Brunner
2007-09-17 10:09 ` [PATCH] Magic Panel MTD mapping update Markus Brunner
2007-09-21 6:25 ` Paul Mundt
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=200708200837.08856.super.firetwister@gmail.com \
--to=super.firetwister@googlemail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=toertel@gmail.com \
/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