public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* New board patch
@ 2001-04-25 22:54 Florian Schirmer / TayTron
  2001-04-26 15:09 ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Schirmer / TayTron @ 2001-04-25 22:54 UTC (permalink / raw)
  To: mtd

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

Hi folks,

can someone please commit the following patch to the cvs tree?

Changes:

- New board (Dbox2)
- (faked) support for Intel Std command set (kernel option)

Thanks a lot!
   Florian Schirmer

[-- Attachment #2: mtd-dbox2.diff --]
[-- Type: application/octet-stream, Size: 7988 bytes --]

diff -Naur mtd-cvs/drivers/mtd/chips/Config.in mtd/drivers/mtd/chips/Config.in
--- mtd-cvs/drivers/mtd/chips/Config.in	Fri Apr 20 17:27:37 2001
+++ mtd/drivers/mtd/chips/Config.in	Wed Apr 25 23:23:22 2001
@@ -28,6 +28,9 @@
   fi
 fi
 dep_tristate '    CFI support for Intel/Sharp Extended Commands' CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_CFI
+if [ "$CONFIG_MTD_CFI_INTELEXT" = "y" -o  "$CONFIG_MTD_CFI_INTELEXT" = "m" ]; then
+   bool '       CFI support for Intel/Sharp Standard Commands' CONFIG_MTD_CFI_INTELSTD
+fi
 dep_tristate '    CFI support for AMD/Fujitsu Standard Commands' CONFIG_MTD_CFI_AMDSTD $CONFIG_MTD_CFI
 dep_tristate '  AMD compatible flash chip support (non-CFI)' CONFIG_MTD_AMDSTD $CONFIG_MTD
 dep_tristate '  pre-CFI Sharp chip support' CONFIG_MTD_SHARP $CONFIG_MTD
diff -Naur mtd-cvs/drivers/mtd/chips/cfi_probe.c mtd/drivers/mtd/chips/cfi_probe.c
--- mtd-cvs/drivers/mtd/chips/cfi_probe.c	Wed Apr 25 18:22:52 2001
+++ mtd/drivers/mtd/chips/cfi_probe.c	Wed Apr 25 23:18:41 2001
@@ -364,6 +364,12 @@
 
 		/* Do any necessary byteswapping */
 		cfi.cfiq->P_ID = le16_to_cpu(cfi.cfiq->P_ID);
+
+#ifdef CONFIG_MTD_CFI_INTELSTD
+    		if (cfi.cfiq->P_ID == P_ID_INTEL_STD)
+			cfi.cfiq->P_ID = P_ID_INTEL_EXT;
+#endif
+
 		cfi.cfiq->P_ADR = le16_to_cpu(cfi.cfiq->P_ADR);
 		cfi.cfiq->A_ID = le16_to_cpu(cfi.cfiq->A_ID);
 		cfi.cfiq->A_ADR = le16_to_cpu(cfi.cfiq->A_ADR);
diff -Naur mtd-cvs/drivers/mtd/maps/Config.in mtd/drivers/mtd/maps/Config.in
--- mtd-cvs/drivers/mtd/maps/Config.in	Tue Apr 24 20:57:25 2001
+++ mtd/drivers/mtd/maps/Config.in	Wed Apr 25 23:24:26 2001
@@ -24,6 +24,7 @@
    dep_bool '    Support for RedBoot Partition tables on SA11x0' CONFIG_MTD_SA1100_REDBOOT_PARTITIONS $CONFIG_MTD_SA1100 $CONFIG_MTD_REDBOOT_PARTS
 dep_tristate '  CFI Flash device mapped on DC21285 Footbridge' CONFIG_MTD_DC21285 $CONFIG_MTD_CFI $CONFIG_ARCH_FOOTBRIDGE $CONFIG_MTD_PARTITIONS
 dep_tristate '  CFI Flash device mapped on the XScale IQ80310 board' CONFIG_MTD_IQ80310 $CONFIG_MTD_CFI $CONFIG_XSCALE_IQ80310
+dep_tristate '  CFI Flash device mapped on D-Box2' CONFIG_MTD_DBOX2 $CONFIG_MTD_CFI_INTELSTD $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_CFI_AMDSTD
 dep_tristate '  CFI and JEDEC Flash device mapping on custom board' CONFIG_MTD_CSTM_MIPS_IXX $CONFIG_MTD_CFI $CONFIG_MTD_JEDEC $CONFIG_MTD_PARTITIONS 
 if [ "$CONFIG_MTD_CSTM_MIPS_IXX" = "y" -o "$CONFIG_MTD_CSTM_MIPS_IXX" = "m" ]; then
    hex '    Physical start address of flash mapping' CONFIG_MTD_CSTM_MIPS_IXX_START 0x8000000
diff -Naur mtd-cvs/drivers/mtd/maps/GNUmakefile mtd/drivers/mtd/maps/GNUmakefile
--- mtd-cvs/drivers/mtd/maps/GNUmakefile	Tue Apr 24 20:58:26 2001
+++ mtd/drivers/mtd/maps/GNUmakefile	Wed Apr 25 23:20:18 2001
@@ -20,6 +20,7 @@
 CONFIG_MTD_SC520CDP := m
 # CONFIG_MTD_SUN_UFLASH := m
 CONFIG_MTD_VMAX := m
+CONFIG_MTD_DBOX2 := m
 
 CFLAGS_physmap.o := -DCONFIG_MTD_PHYSMAP_START=0x8000000 -DCONFIG_MTD_PHYSMAP_LEN=0x4000000 -DCONFIG_MTD_PHYSMAP_BUSWIDTH=2
 
diff -Naur mtd-cvs/drivers/mtd/maps/Makefile mtd/drivers/mtd/maps/Makefile
--- mtd-cvs/drivers/mtd/maps/Makefile	Tue Apr 24 20:55:31 2001
+++ mtd/drivers/mtd/maps/Makefile	Wed Apr 25 23:19:44 2001
@@ -22,5 +22,6 @@
 obj-$(CONFIG_MTD_SC520CDP)	+= sc520cdp.o
 obj-$(CONFIG_MTD_SUN_UFLASH)    += sun_uflash.o
 obj-$(CONFIG_MTD_VMAX)		+= vmax301.o
+obj-$(CONFIG_MTD_DBOX2)		+= dbox2-flash.o
 
 include $(TOPDIR)/Rules.make
diff -Naur mtd-cvs/drivers/mtd/maps/dbox2-flash.c mtd/drivers/mtd/maps/dbox2-flash.c
--- mtd-cvs/drivers/mtd/maps/dbox2-flash.c	Thu Jan  1 01:00:00 1970
+++ mtd/drivers/mtd/maps/dbox2-flash.c	Wed Apr 25 23:39:45 2001
@@ -0,0 +1,151 @@
+/*
+ * $Id: dbox2-flash.c,v 1.11 2001/03/17 19:08:45 dwmw2 Exp $
+ *
+ * Nokia / Sagem D-Box 2 flash driver
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <asm/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/config.h>
+
+/* partition_info gives details on the logical partitions that the split the
+ * single flash device into. If the size if zero we use up to the end of the
+ * device. */
+const static struct mtd_partition partition_info[]= {{name: "BR bootloader",		// raw
+						      size: 128 * 1024, 
+						      offset: 0,                  
+						      mask_flags: MTD_WRITEABLE},
+                                                     {name: "PPC bootloader",		// flfs
+						      size: 128 * 1024, 
+						      offset: MTDPART_OFS_APPEND, 
+						      mask_flags: 0},
+                                                     {name: "Kernel",			// idxfs
+						      size: 768 * 1024, 
+						      offset: MTDPART_OFS_APPEND, 
+						      mask_flags: 0},
+                                                     {name: "System",			// jffs
+						      size: MTDPART_SIZ_FULL, 
+						      offset: MTDPART_OFS_APPEND, 
+						      mask_flags: 0}};
+
+#define NUM_PARTITIONS (sizeof(partition_info) / sizeof(partition_info[0]))
+
+#define WINDOW_ADDR 0x10000000
+#define WINDOW_SIZE 0x800000
+
+static struct mtd_info *mymtd;
+
+__u8 dbox2_flash_read8(struct map_info *map, unsigned long ofs)
+{
+	return __raw_readb(map->map_priv_1 + ofs);
+}
+
+__u16 dbox2_flash_read16(struct map_info *map, unsigned long ofs)
+{
+	return __raw_readw(map->map_priv_1 + ofs);
+}
+
+__u32 dbox2_flash_read32(struct map_info *map, unsigned long ofs)
+{
+	return __raw_readl(map->map_priv_1 + ofs);
+}
+
+void dbox2_flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
+{
+	memcpy_fromio(to, map->map_priv_1 + from, len);
+}
+
+void dbox2_flash_write8(struct map_info *map, __u8 d, unsigned long adr)
+{
+	__raw_writeb(d, map->map_priv_1 + adr);
+	mb();
+}
+
+void dbox2_flash_write16(struct map_info *map, __u16 d, unsigned long adr)
+{
+	__raw_writew(d, map->map_priv_1 + adr);
+	mb();
+}
+
+void dbox2_flash_write32(struct map_info *map, __u32 d, unsigned long adr)
+{
+	__raw_writel(d, map->map_priv_1 + adr);
+	mb();
+}
+
+void dbox2_flash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
+{
+	memcpy_toio(map->map_priv_1 + to, from, len);
+}
+
+struct map_info dbox2_flash_map = {
+	name: "D-Box 2 flash memory",
+	size: WINDOW_SIZE,
+	buswidth: 4,
+	read8: dbox2_flash_read8,
+	read16: dbox2_flash_read16,
+	read32: dbox2_flash_read32,
+	copy_from: dbox2_flash_copy_from,
+	write8: dbox2_flash_write8,
+	write16: dbox2_flash_write16,
+	write32: dbox2_flash_write32,
+	copy_to: dbox2_flash_copy_to
+};
+
+#if LINUX_VERSION_CODE < 0x20212 && defined(MODULE)
+#define init_dbox2_flash init_module
+#define cleanup_dbox2_flash cleanup_module
+#endif
+
+mod_init_t init_dbox2_flash(void)
+{
+       	printk(KERN_NOTICE "D-Box 2 flash driver (size->0x%X mem->0x%X)\n", WINDOW_SIZE, WINDOW_ADDR);
+	dbox2_flash_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+
+	if (!dbox2_flash_map.map_priv_1) {
+		printk("Failed to ioremap\n");
+		return -EIO;
+	}
+
+	// Probe for dual Intel 28F320 or dual AMD
+	mymtd = do_cfi_probe(&dbox2_flash_map);
+	if (!mymtd) {
+	    // Probe for single Intel 28F640
+	    dbox2_flash_map.buswidth = 2;
+	
+	    mymtd = do_cfi_probe(&dbox2_flash_map);
+	}
+	    
+	if (mymtd) {
+		mymtd->module = THIS_MODULE;
+
+                /* Create MTD devices for each partition. */
+	        add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
+		
+		return 0;
+	}
+
+	iounmap((void *)dbox2_flash_map.map_priv_1);
+	return -ENXIO;
+}
+
+mod_exit_t cleanup_dbox2_flash(void)
+{
+	if (mymtd) {
+		del_mtd_partitions(mymtd);
+		map_destroy(mymtd);
+	}
+	if (dbox2_flash_map.map_priv_1) {
+		iounmap((void *)dbox2_flash_map.map_priv_1);
+		dbox2_flash_map.map_priv_1 = 0;
+	}
+}
+
+module_init(init_dbox2_flash);
+module_exit(cleanup_dbox2_flash);
+

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

* Re: New board patch
  2001-04-25 22:54 New board patch Florian Schirmer / TayTron
@ 2001-04-26 15:09 ` David Woodhouse
  2001-04-26 15:34   ` AW: " Florian Schirmer / TayTron
  0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2001-04-26 15:09 UTC (permalink / raw)
  To: Florian Schirmer / TayTron; +Cc: mtd


schirmer@taytron.net said:
>  - New board (Dbox2)

Absent Configure.help. 

For your penance, please provide text for at least one more of the other
missing entries :)

--
dwmw2




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

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

* AW: New board patch
  2001-04-26 15:09 ` David Woodhouse
@ 2001-04-26 15:34   ` Florian Schirmer / TayTron
  2001-04-26 15:42     ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Schirmer / TayTron @ 2001-04-26 15:34 UTC (permalink / raw)
  To: David Woodhouse; +Cc: mtd

Hi!

>Absent Configure.help.
>
>For your penance, please provide text for at least one more of the other
>missing entries :)

Allright. I will provide some help stuff. The mtd tree seems to be w.i.p. at
the moment. As soon as it will compile again i will commit the things. Do
you have any idea when it will be working again?

Thanks
  Florian Schirmer



To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

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

* Re: AW: New board patch
  2001-04-26 15:34   ` AW: " Florian Schirmer / TayTron
@ 2001-04-26 15:42     ` David Woodhouse
  0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2001-04-26 15:42 UTC (permalink / raw)
  To: Florian Schirmer / TayTron; +Cc: mtd



schirmer@taytron.net said:
>  Allright. I will provide some help stuff. 

Cool, thanks. (Wow, it worked!)

> The mtd tree seems to be w.i.p. at the moment. As soon as it will 
> compile again i will commit the things. Do you have any idea when it
> will be working again?

Working on it. Hopefully this afternoon. I thought I'd committed the fixes 
to the map drivers yesterday, but it seems I hadn't - it had complained about 
something being !uptodate. 

It's being horribly slow at the moment. I have a new machine set up here in
my new office, to which I'm probably going to switch CVS and the mailing
list some time soon.

--
dwmw2




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

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

end of thread, other threads:[~2001-04-26 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-25 22:54 New board patch Florian Schirmer / TayTron
2001-04-26 15:09 ` David Woodhouse
2001-04-26 15:34   ` AW: " Florian Schirmer / TayTron
2001-04-26 15:42     ` David Woodhouse

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