public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] MTD: Add support for the MPC8xxADS boards
@ 2005-11-28 18:57 Vitaly Bordug
  2005-11-28 20:33 ` Thomas Gleixner
  2005-11-29  5:39 ` Vitaly Wool
  0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Bordug @ 2005-11-28 18:57 UTC (permalink / raw)
  To: linux-mtd

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

The following patch adds support for the JEDEC-compatible flashes on the MPC8xxADS boards.
Currently verified with MPC885ADS and MPC 866ADS. The patch is against MTD git tree.

Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>


-- 
Sincerely, 
Vitaly

[-- Attachment #2: 8xx_mtd_map2.patch --]
[-- Type: text/x-patch, Size: 2996 bytes --]

diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 846a533..1ece64c 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -284,6 +284,14 @@ config MTD_MBX860
 	  MBX860 board. If you have one of these boards and would like
 	  to use the flash chips on it, say 'Y'.
 
+config MTD_MPC8xxADS
+	tristate "JEDEC flash SIMM mapped on MPC8xxADS boards"
+	depends on (MPC885ADS || MPC86XADS) && MTD_PARTITIONS && MTD_JEDECPROBE && MTD_PHYSMAP && MTD_CFI_GEOMETRY && MTD_CFI_INTELEXT
+	help
+	  This enables access routines for the flash chips on the Freescale
+	  MPC8xxADS boards. If you have this board and would like
+	  to use the flash chips on it, say 'Y'.
+
 config MTD_DBOX2
 	tristate "CFI Flash device mapped on D-Box2"
 	depends on DBOX2 && MTD_CFI_INTELSTD && MTD_CFI_INTELEXT && MTD_CFI_AMDSTD
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 7d9e940..913def2 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -73,3 +73,4 @@ obj-$(CONFIG_MTD_OMAP_NOR)	+= omap_nor.o
 obj-$(CONFIG_MTD_PQ2FADS)	+= pq2fads.o
 obj-$(CONFIG_MTD_MTX1)		+= mtx-1_flash.o
 obj-$(CONFIG_MTD_TQM834x)	+= tqm834x.o
+obj-$(CONFIG_MTD_MPC8xxADS)	+= mpc8xxads.o
diff --git a/drivers/mtd/maps/mpc8xxads.c b/drivers/mtd/maps/mpc8xxads.c
new file mode 100644
index 0000000..192c4ea
--- /dev/null
+++ b/drivers/mtd/maps/mpc8xxads.c
@@ -0,0 +1,63 @@
+/*
+ * drivers/mtd/maps/mpc8xxads.c
+ *
+ * Mapping for Motorola mpc8xxads flash
+ *
+ * Author: source@mvista.com
+ *
+ * 2005 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <asm/io.h>
+#include <asm/ppcboot.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+
+#define MPC8xxADS_U_BOOT_SIZE		0x80000
+#define MPC8xxADS_FREE_AREA_OFFSET	MPC8xxADS_U_BOOT_SIZE
+
+static struct mtd_partition mpc8xxads_partitions[] = {
+	{
+		.name = "bootloader",
+		.size = MPC8xxADS_U_BOOT_SIZE,
+		.offset = 0,
+		.mask_flags   = MTD_WRITEABLE,  /* force read-only */
+	}, {
+		.name = "User FS",
+		.offset = MPC8xxADS_FREE_AREA_OFFSET
+	}
+};
+
+/* pointer to MPC885ADS board info data */
+extern unsigned char __res[];
+
+static int __init init_mpc8xxads_mtd(void)
+{
+	bd_t *bd = (bd_t *)__res;
+
+	physmap_configure(bd->bi_flashstart, bd->bi_flashsize, 4, NULL);
+	physmap_set_partitions(mpc8xxads_partitions,
+				sizeof (mpc8xxads_partitions) /
+				sizeof (mpc8xxads_partitions[0]));
+	return 0;
+}
+
+static void __exit cleanup_mpc8xxads_mtd(void)
+{
+}
+
+module_init(init_mpc8xxads_mtd);
+module_exit(cleanup_mpc8xxads_mtd);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("MTD map and partitions for MPC8xxADS boards");

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

* Re: [PATCH] MTD: Add support for the MPC8xxADS boards
  2005-11-28 18:57 [PATCH] MTD: Add support for the MPC8xxADS boards Vitaly Bordug
@ 2005-11-28 20:33 ` Thomas Gleixner
  2005-11-29  5:39 ` Vitaly Wool
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2005-11-28 20:33 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linux-mtd

On Mon, 2005-11-28 at 21:57 +0300, Vitaly Bordug wrote:
> The following patch adds support for the JEDEC-compatible flashes on
> the MPC8xxADS boards.

Can you please explain how this is supposed to work ?

In any case whether compiled as module or compiled in the init code of
the physmap driver is called before the init code of your board driver.
The physmap_configure() call is just bogus as it overwrites the compiled
in values of the physmap_map structure in physmap.c after the flash was
detected (or not detected) with the compiled in defaults.

Also this code was never compiled and used as a module. 

> Currently verified with MPC885ADS and MPC 866ADS. The patch is against
> MTD git tree.

Currently verified means: it compiles when the config switch is equal
"Y" and the resulting kernel does not oops, right ?


The physmap driver has to be either used with the compiled in address,
size and bankwidth settings or the values have to be set by the early
boot code of the board. Grep through arch/mips to find the two lonely,
but correct, users of physmap_configure().

The same applies for the pq2fads driver. The pq2fads driver is hereby
scheduled for removal.

	tglx

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

* Re: [PATCH] MTD: Add support for the MPC8xxADS boards
  2005-11-28 18:57 [PATCH] MTD: Add support for the MPC8xxADS boards Vitaly Bordug
  2005-11-28 20:33 ` Thomas Gleixner
@ 2005-11-29  5:39 ` Vitaly Wool
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Wool @ 2005-11-29  5:39 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linux-mtd

Hi Vitaly (no, I'm not talking to myself! :) ),

Vitaly Bordug wrote:

>+/* pointer to MPC885ADS board info data */
>+extern unsigned char __res[];
>+
>+static int __init init_mpc8xxads_mtd(void)
>+{
>+	bd_t *bd = (bd_t *)__res;
>  
>
I'd like to suggest using platform_data here instead of this global.
Please see how mainstone-flash.c is organized as an example.

Best regards,
   Vitaly

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

end of thread, other threads:[~2005-11-29  5:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-28 18:57 [PATCH] MTD: Add support for the MPC8xxADS boards Vitaly Bordug
2005-11-28 20:33 ` Thomas Gleixner
2005-11-29  5:39 ` Vitaly Wool

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