patch-2.4.19 linux-2.4.19/drivers/mtd/maps/solutionengine.c

Next file: linux-2.4.19/drivers/mtd/maps/tsunami_flash.c
Previous file: linux-2.4.19/drivers/mtd/maps/sc520cdp.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/drivers/mtd/maps/solutionengine.c linux-2.4.19/drivers/mtd/maps/solutionengine.c
@@ -1,5 +1,5 @@
 /*
- * $Id: solutionengine.c,v 1.3 2001/10/02 15:05:14 dwmw2 Exp $
+ * $Id: solutionengine.c,v 1.4 2001/11/07 01:20:59 jsiegel Exp $
  *
  * Flash and EPROM on Hitachi Solution Engine and similar boards.
  *
@@ -15,6 +15,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
+#include <linux/config.h>
 
 
 extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts);
@@ -57,20 +58,38 @@
 	write32: soleng_write32,
 };
 
+#ifdef CONFIG_MTD_SUPERH_RESERVE
+static struct mtd_partition superh_se_partitions[] = {
+	/* Reserved for boot code, read-only */
+	{
+		name: "flash_boot",
+		offset: 0x00000000,
+		size: CONFIG_MTD_SUPERH_RESERVE,
+		mask_flags: MTD_WRITEABLE,
+	},
+	/* All else is writable (e.g. JFFS) */
+	{
+		name: "Flash FS",
+		offset: MTDPART_OFS_NXTBLK,
+		size: MTDPART_SIZ_FULL,
+	}
+};
+#endif /* CONFIG_MTD_SUPERH_RESERVE */
+
 static int __init init_soleng_maps(void)
 {
-	int nr_parts;
+	int nr_parts = 0;
 
 	/* First probe at offset 0 */
 	soleng_flash_map.map_priv_1 = P2SEGADDR(0);
-	soleng_eprom_map.map_priv_1 = P1SEGADDR(0x400000);
+	soleng_eprom_map.map_priv_1 = P1SEGADDR(0x01000000);
 
-	printk(KERN_NOTICE "Probing for flash chips at 0x000000:\n");
+	printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n");
 	flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
 	if (!flash_mtd) {
 		/* Not there. Try swapping */
-		printk(KERN_NOTICE "Probing for flash chips at 0x400000:\n");
-		soleng_flash_map.map_priv_1 = P2SEGADDR(0x400000);
+		printk(KERN_NOTICE "Probing for flash chips at 0x01000000:\n");
+		soleng_flash_map.map_priv_1 = P2SEGADDR(0x01000000);
 		soleng_eprom_map.map_priv_1 = P1SEGADDR(0);
 		flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
 		if (!flash_mtd) {
@@ -90,9 +109,23 @@
 		add_mtd_device(eprom_mtd);
 	}
 
+#ifdef CONFIG_MTD_REDBOOT_PARTS
 	nr_parts = parse_redboot_partitions(flash_mtd, &parsed_parts);
+	if (nr_parts > 0)
+		printk(KERN_NOTICE "Found RedBoot partition table.\n");
+	else if (nr_parts < 0)
+		printk(KERN_NOTICE "Error looking for RedBoot partitions.\n");
+#endif /* CONFIG_MTD_REDBOOT_PARTS */
+#if CONFIG_MTD_SUPERH_RESERVE
+	if (nr_parts == 0) {
+		printk(KERN_NOTICE "Using configured partition at 0x%08x.\n",
+		       CONFIG_MTD_SUPERH_RESERVE);
+		parsed_parts = superh_se_partitions;
+		nr_parts = sizeof(superh_se_partitions)/sizeof(*parsed_parts);
+	}
+#endif /* CONFIG_MTD_SUPERH_RESERVE */
 
-	if (nr_parts)
+	if (nr_parts > 0)
 		add_mtd_partitions(flash_mtd, parsed_parts, nr_parts);
 	else
 		add_mtd_device(flash_mtd);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)