The patch add support for Edimax PS-2207SUg router.

The image should be further processed using "cvimg" tool from
http://edimax.com/images/Image/OpenSourceCode/Wire/Printer-server/PS-2207SU/PS2207-GPL.zip
,
which prepend "magic code" to it.

Signed-off-by: Dawid Marcin Grzesiak <[email protected]>
Index: target/linux/rdc/files/drivers/mtd/maps/ps2207sug.c
===================================================================
--- target/linux/rdc/files/drivers/mtd/maps/ps2207sug.c	(revision 0)
+++ target/linux/rdc/files/drivers/mtd/maps/ps2207sug.c	(revision 0)
@@ -0,0 +1,106 @@
+/*
+ * Flash memory access on Edimax PS-2207SUg Print Server and Storage Server (NAS)
+ *
+ * (c)2009 Dawid Marcin Grzesiak
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/io.h>
+
+//#include <linux/init.h>
+
+static struct map_info ps_2207SUg_map = {
+	.name		= "MX29LV320B Flash",
+	.size		= 0x400000,
+	.bankwidth	= 2
+};
+
+struct mtd_partition ps_2207SUg_partitions[] = {
+	{
+		.name =	"config",
+		.size =	0x00008000, // 32 KB
+		.offset = 0x00000000,
+        },{
+                .name = "kernel",
+                .size = 0x000C8000, // 800 KB
+		//.offset = MTDPART_OFS_APPEND,
+		.offset = 0x00008000,
+        },{
+                .name = "rootfs",
+		.size = 0x00320000, // 4 MB - (32 + 800 + 64) KB = 3200 KB, flash is 64k chunk granulated
+		//.offset = MTDPART_OFS_APPEND,
+		.offset = 0x000d0000,
+        },{
+		.name = "RedBoot",
+		.size = 0x10000, // 64 KB
+		//.offset = MTDPART_OFS_APPEND,
+		.offset = 0x003f0000,
+		.mask_flags = MTD_WRITEABLE // make it read-only
+        },{
+                .name = "config+kernel",
+                .size = 0x000d0000,
+		//.offset = MTDPART_OFS_APPEND,
+		.offset = 0x00000000,
+        },{
+                .name = "space",
+                .size = 0x003F0000,
+                //.offset = MTDPART_OFS_APPEND,
+                .offset = 0x00000000,
+	}
+};
+
+static struct mtd_info *mymtd;
+
+
+//__setup("root=", "/dev/mtdblock2 ro");
+
+
+int __init init_mtd_mx29lv320b(void)
+{
+	ps_2207SUg_map.phys = -ps_2207SUg_map.size;
+	printk(KERN_NOTICE "MX29LV320B flash device: 0x\%08x at 0x\%08x\n", ps_2207SUg_map.size, ps_2207SUg_map.phys);
+
+	ps_2207SUg_map.map_priv_1 = (unsigned long)(ps_2207SUg_map.virt = ioremap_nocache(ps_2207SUg_map.phys, ps_2207SUg_map.size));
+	
+	if (!ps_2207SUg_map.map_priv_1) {
+                printk(KERN_ERR "Failed to ioremap\n");
+                return -EIO;
+	}
+
+	mymtd = do_map_probe("cfi_probe", &ps_2207SUg_map);
+
+	if (mymtd) {
+		add_mtd_partitions(mymtd, ps_2207SUg_partitions, ARRAY_SIZE(ps_2207SUg_partitions));
+		mymtd->owner = THIS_MODULE;
+		printk(KERN_NOTICE "MX29LV320B flash device initialized\n");
+		return 0;
+	} else {
+		iounmap(ps_2207SUg_map.virt);
+		printk(KERN_NOTICE "MX29LV320B flash initialization failed\n");
+		return -ENXIO;
+	}
+}
+
+static void __exit cleanup_mtd_mx29lv320b(void)
+{
+	if (mymtd) {
+		del_mtd_partitions(mymtd);
+		map_destroy(mymtd);
+		iounmap(ps_2207SUg_map.virt);
+	}
+}
+
+module_init(init_mtd_mx29lv320b);
+module_exit(cleanup_mtd_mx29lv320b);
+
+MODULE_AUTHOR("Dawid Marcin Grzesiak <[email protected]>");
+MODULE_DESCRIPTION("Edimax PS-2207SUg MTD flash driver");
+MODULE_LICENSE("GPL");

Property changes on: target/linux/rdc/files/drivers/mtd/maps/ps2207sug.c
___________________________________________________________________
Added: svn:mergeinfo

Index: target/linux/rdc/image/Makefile
===================================================================
--- target/linux/rdc/image/Makefile	(revision 18250)
+++ target/linux/rdc/image/Makefile	(working copy)
@@ -68,6 +68,13 @@
 	$(STAGING_DIR_HOST)/bin/makeamitbin -o $(BIN_DIR)/openwrt-$(BOARD)-$(1)-ar360w3g.bin -1 ALK_ATG001 -2 Atropos linux3g $(KDIR)/bzImage ramdisk3g $(KDIR)/root.$(1)
 endef
 
+define Image/Build/ps2207sug
+	touch $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img
+	dd if=$(KDIR)/root.$(1) of=$(KDIR)/root.tmp $(call trxalign/$(1)) conv=sync
+	mv $(KDIR)/root.tmp $(KDIR)/root.$(1)
+	$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/onlyrootfs-$(BOARD)-$(1)-$(2).img
+endef
+
 define Image/Build/Initramfs
 	$(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-ramfs.bzImage
 endef
Index: target/linux/rdc/patches-2.6.28/009-ps2207sug_flash_map.patch
===================================================================
--- target/linux/rdc/patches-2.6.28/009-ps2207sug_flash_map.patch	(revision 0)
+++ target/linux/rdc/patches-2.6.28/009-ps2207sug_flash_map.patch	(revision 0)
@@ -0,0 +1,27 @@
+--- a/drivers/mtd/maps/Kconfig
++++ b/drivers/mtd/maps/Kconfig
+@@ -162,6 +162,12 @@
+ 	help
+ 	  Flash support for the RDC R8610 evaluation board.
+ 
++config MTD_PS2207SUG
++	tristate "CFI flash device mapped on Edimax PS-2207SUg"
++	depends on X86 && MTD_CFI && MTD_PARTITIONS
++	help
++	  Flash support for the Edimax PS-2207SUg router.
++
+ config MTD_SC520CDP
+ 	tristate "CFI Flash device mapped on AMD SC520 CDP"
+ 	depends on X86 && MTD_CFI && MTD_CONCAT
+
+--- a/drivers/mtd/maps/Makefile
++++ b/drivers/mtd/maps/Makefile
+@@ -29,6 +29,7 @@
+ obj-$(CONFIG_MTD_PCMCIA)	+= pcmciamtd.o
+ obj-$(CONFIG_MTD_RDC3210)	+= rdc3210.o
+ obj-$(CONFIG_MTD_R8610)		+= r8610.o
++obj-$(CONFIG_MTD_PS2207SUG)	+= ps2207sug.o
+ obj-$(CONFIG_MTD_RPXLITE)	+= rpxlite.o
+ obj-$(CONFIG_MTD_TQM8XXL)	+= tqm8xxl.o
+ obj-$(CONFIG_MTD_SA1100)	+= sa1100-flash.o
+
Index: target/linux/rdc/profiles/PS-2207SUG.mk
===================================================================
--- target/linux/rdc/profiles/PS-2207SUG.mk	(revision 0)
+++ target/linux/rdc/profiles/PS-2207SUG.mk	(revision 0)
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/ps2207sug
+  NAME:=Edimax PS-2207SUg
+  PACKAGES:=kmod-rt61-pci kmod-r6040 kmod-usb-core kmod-usb-ohci kmod-usb2
+endef
+$(eval $(call Profile,ps2207sug))
Index: target/linux/rdc/config/profile-ps2207sug
===================================================================
--- target/linux/rdc/config/profile-ps2207sug	(revision 0)
+++ target/linux/rdc/config/profile-ps2207sug	(revision 0)
@@ -0,0 +1,7 @@
+# CONFIG_MTD_RDC3210 is not set
+# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set
+# CONFIG_MTD_RDC3210_STATIC_MAP is not set
+CONFIG_MTD_PS2207SUG=y
+CONFIG_CMDLINE="root=/dev/mtdblock2 ro"
+CONFIG_CMDLINE_BOOL=y
+
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to