* [patch] mpc8560ads mtd map
@ 2005-03-15 19:05 Greg Weeks
2005-03-15 19:09 ` Mark A. Greer
0 siblings, 1 reply; 3+ messages in thread
From: Greg Weeks @ 2005-03-15 19:05 UTC (permalink / raw)
To: linuxppc-embedded
Add an MTD map for the flash on the mpc8560ads board.
Signed-off-by: Greg Weeks <greg.weeks@timesys.com>
--- /dev/null
+++ ppc-mpc8560ads/drivers/mtd/maps/mpc85xxads.c
@@ -0,0 +1,104 @@
+/*
+ * $Id$
+ *
+ * Mapping for Motorola MPC85xxADS flash
+ *
+ * Greg Weeks <greg.weeks@timesys.com>
+ *
+ * Copyright 2004 Timesys Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/config.h>
+#include <asm/io.h>
+#include <platforms/85xx/mpc85xx_ads_common.h>
+
+static struct mtd_info *flash;
+
+static struct map_info mpc85xxads_map = {
+ .name = "mpc85xxads-flash",
+ .size = MPC85XXADS_FLASH_SIZE,
+ .bankwidth = 4,
+};
+
+static struct mtd_partition mpc85xxads_partitions[] = {
+ {
+ .name = "Linux JFFS2 Filesystem",
+ .offset = 0x0,
+ .size = 0x00800000,
+ },
+ {
+ .name = "Linux Kernel",
+ .offset = 0x00800000,
+ .size = 0x00200000,
+ },
+ {
+ .name = "Linux INITRD",
+ .offset = 0x00a00000,
+ .size = 0x00580000,
+ },
+ {
+ .name = "Bootloader",
+ .offset = 0x00f80000,
+ .size = 0x00080000,
+ }
+};
+
+int __init mpc85xxads_map_init(void)
+{
+ unsigned long mpc85xxads_flash_base = MPC85XXADS_FLASH_BASE;
+
+ mpc85xxads_map.phys = mpc85xxads_flash_base;
+ mpc85xxads_map.virt = (unsigned
long)ioremap(mpc85xxads_flash_base, mpc85xxads_map.size);
+
+ if (!mpc85xxads_map.virt) {
+ printk("Failed to ioremap flash\n");
+ return -EIO;
+ }
+
+ simple_map_init(&mpc85xxads_map);
+
+ flash = do_map_probe("cfi_probe", &mpc85xxads_map);
+ if (flash) {
+ flash->owner = THIS_MODULE;
+ add_mtd_partitions(flash, mpc85xxads_partitions,
+ ARRAY_SIZE(mpc85xxads_partitions));
+ } else {
+ iounmap((void *)mpc85xxads_map.virt);
+ printk("map probe failed for flash\n");
+ return -ENXIO;
+ }
+
+ return 0;
+}
+
+static void __exit mpc85xxads_map_exit(void)
+{
+ if (flash) {
+ del_mtd_partitions(flash);
+ map_destroy(flash);
+ }
+
+ if (mpc85xxads_map.virt) {
+ iounmap((void *)mpc85xxads_map.virt);
+ mpc85xxads_map.virt = 0;
+ }
+}
+
+module_init(mpc85xxads_map_init);
+module_exit(mpc85xxads_map_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Greg Weeks <greg.weeks@timesys.com>");
+MODULE_DESCRIPTION("MTD map and partitions for Motorola MPC85xxADS");
--- ppc-mpc8560ads/arch/ppc/platforms/85xx/mpc85xx_ads_common.h-orig
+++ ppc-mpc8560ads/arch/ppc/platforms/85xx/mpc85xx_ads_common.h
@@ -47,4 +47,7 @@
#define MPC85XX_PCI1_IO_SIZE 0x01000000
+#define MPC85XXADS_FLASH_BASE 0xff000000
+#define MPC85XXADS_FLASH_SIZE 0x01000000
+
#endif /* __MACH_MPC85XX_ADS_H__ */
--- ppc-mpc8560ads/drivers/mtd/maps/Kconfig-orig
+++ ppc-mpc8560ads/drivers/mtd/maps/Kconfig
@@ -667,5 +667,12 @@
help
This enables access to the flash chip on the Sharp SL Series
of PDAs.
+config MTD_MPC85XXADS
+ tristate "Flash device mapped on the MPC85XXADS board"
+ depends on MTD_CFI && MTD_CFI_INTELEXT && MTD_PARTITIONS &&
MPC8560_ADS
+ help
+ This enables access to the Flash on the MPC85xxADS boards.
+ If you have such a board, say 'Y'.
+
endmenu
--- ppc-mpc8560ads/drivers/mtd/maps/Makefile-orig
+++ ppc-mpc8560ads/drivers/mtd/maps/Makefile
@@ -72,3 +72,4 @@
obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o
obj-$(CONFIG_MTD_DMV182) += dmv182.o
obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o
+obj-$(CONFIG_MTD_MPC85XXADS) += mpc85xxads.o
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch] mpc8560ads mtd map
2005-03-15 19:05 [patch] mpc8560ads mtd map Greg Weeks
@ 2005-03-15 19:09 ` Mark A. Greer
2005-03-15 19:23 ` Greg Weeks
0 siblings, 1 reply; 3+ messages in thread
From: Mark A. Greer @ 2005-03-15 19:09 UTC (permalink / raw)
To: Greg Weeks; +Cc: linuxppc-embedded
Greg Weeks wrote:
>
> Add an MTD map for the flash on the mpc8560ads board.
>
> Signed-off-by: Greg Weeks <greg.weeks@timesys.com>
<snip>
Most of the code in this patch can be eliminated if you set up the table
in your platform file and use the proper CONFIG_MTD_xxx options.
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] mpc8560ads mtd map
2005-03-15 19:09 ` Mark A. Greer
@ 2005-03-15 19:23 ` Greg Weeks
0 siblings, 0 replies; 3+ messages in thread
From: Greg Weeks @ 2005-03-15 19:23 UTC (permalink / raw)
To: linuxppc-embedded
Mark A. Greer wrote:
> Greg Weeks wrote:
>
>>
>> Add an MTD map for the flash on the mpc8560ads board.
>>
>> Signed-off-by: Greg Weeks <greg.weeks@timesys.com>
>
>
>
> <snip>
>
> Most of the code in this patch can be eliminated if you set up the
> table in your platform file and use the proper CONFIG_MTD_xxx options.
>
> Mark
>
Yep, I pulled this off our 2.6.4 kernel tree. I think it should be in
the platform code, but I've not tried moving it yet. That should get rid
of the map file and the Kconfig changes to support it.
Greg Weeks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-15 19:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-15 19:05 [patch] mpc8560ads mtd map Greg Weeks
2005-03-15 19:09 ` Mark A. Greer
2005-03-15 19:23 ` Greg Weeks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).