Skip to contentSkip to conversation

MTD: Add support for the PM82x Boards.

PATCH In review Heiko Schocher 4 participants 8 messages Nov 21, 2005 – Nov 24, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD: Add support for the PM82x Boards.

Hello,

the following Patch (against 2.6 kernel.org tree, COMMIT_ID:
f093182d313edde9b1f86dbdaf40ba4da2dbd0e7) adds support for the NOR flashes and for the DiskOnChip on the PM82X Boards from Microsys.

---
 drivers/mtd/chips/jedec_probe.c |   50 +++++
 drivers/mtd/devices/docprobe.c  |    4
 drivers/mtd/maps/Kconfig        |    6 +
 drivers/mtd/maps/Makefile       |    1
 drivers/mtd/maps/pm82x.c        |  360
+++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/diskonchip.c   |    4
 6 files changed, 425 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/mtd/chips/jedec_probe.c
index edb306c..e230127 100644

drivers/mtd/chips/jedec_probe.c +50 -0

62 lines not on this page · raw message

drivers/mtd/devices/docprobe.c +4 -0
index 13178b9..b051bc7 100644
@@ -81,7 +81,11 @@ static unsigned long __initdata doc_loca
 	0xe8000, 0xea000, 0xec000, 0xee000,
 #endif /*  CONFIG_MTD_DOCPROBE_HIGH */
 #elif defined(__PPC__)
+#if defined(CONFIG_PM82X)
+	0xff800000,
+#else
 	0xe4000000,
+#endif
 #elif defined(CONFIG_MOMENCO_OCELOT)
 	0x2f000000,
         0xff000000,
drivers/mtd/maps/Kconfig +6 -0
index 846a533..237abe8 100644
@@ -256,6 +256,12 @@ config MTD_SBC8240
           Flash access on the SBC8240 board from Wind River.  See
           <http://www.windriver.com/products/sbc8240/>
 
+config MTD_PM82X
+	tristate "Flash device on PM82X Boards"
+	depends on PPC32 && 6xx && 8260 && MTD_COMPLEX_MAPPINGS && MTD_PARTITIONS
+	help
+	  Flash access on the PM82X boards from Microsys.
+
 config MTD_TQM8XXL
 	tristate "CFI Flash device mapped on TQM8XXL"
 	depends on MTD_CFI && TQM8xxL
drivers/mtd/maps/Makefile +1 -0
index 7d9e940..ecdc515 100644
@@ -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_PM82X)	+= pm82x.o
drivers/mtd/maps/pm82x.c new file +360 -0

360 lines not on this page · raw message

drivers/mtd/nand/diskonchip.c +4 -0
index 21d4e8f..bf7cf54 100644
@@ -55,7 +55,11 @@ static unsigned long __initdata doc_loca
 	0xe8000, 0xea000, 0xec000, 0xee000,
 #endif /*  CONFIG_MTD_DOCPROBE_HIGH */
 #elif defined(__PPC__)
+#if defined(CONFIG_PM82X)
+	0xff800000,
+#else
 	0xe4000000,
+#endif
 #elif defined(CONFIG_MOMENCO_OCELOT)
 	0x2f000000,
         0xff000000,

!-------------------------------------------------------------flip-

#1 lore raw
Quoted 6 lines · Heiko Schocher

Hello,

the following Patch (against 2.6 kernel.org tree, COMMIT_ID:
f093182d313edde9b1f86dbdaf40ba4da2dbd0e7) adds support for the NOR flashes and for the DiskOnChip on the PM82X Boards from Microsys.

Please use the new DiskOnChip driver in drivers/mtd/nand/ not the old one.

Signature · 1 line
dwmw2
#2 lore raw

Hello,

Quoted 7 lines · David Woodhouse
Quoted 4 lines

the following Patch (against 2.6 kernel.org tree, COMMIT_ID:
f093182d313edde9b1f86dbdaf40ba4da2dbd0e7) adds support for the NOR flashes and for the DiskOnChip on the PM82X Boards from Microsys.

Please use the new DiskOnChip driver in drivers/mtd/nand/ not the old one.

I use the new driver.
I made the changes in drivers/mtd/devices/docprobe.c, because I ported it from the 2.4 Kernel. Should I delete this and resubmit the patch?

thanks
Heiko

#3 lore raw
Quoted 7 lines · Heiko Schocher
Quoted 2 lines

Please use the new DiskOnChip driver in drivers/mtd/nand/ not the old one.

I use the new driver.
I made the changes in drivers/mtd/devices/docprobe.c, because I ported it from the 2.4 Kernel. Should I delete this and resubmit the patch?

Yes, please.

tglx

#4 lore raw

PATCH 1/1 MTD: Add P3P440 MTD support

In reply to Heiko Schocher

This patch adds MTD support (NOR FLASH) for the Prodrive P3P440 (440GP) PMC module.

Best regards,
Stefan

This patch adds MTD support (NOR FLASH) for the Prodrive P3P440 (440GP) PMC module.

---
commit 5bca0cf9bea1ea8f04e7292266da040ef8a13b80
tree 70398872c104f16d34eb64a8560029d3839e46ad
parent 1778d55edb62753a92b979fa57072c2e1ff3d062
author Stefan Roese <[email protected]> Wed, 23 Nov 2005 13:09:39 +0100 committer Stefan Roese <[email protected]> Wed, 23 Nov 2005 13:09:39 +0100

 drivers/mtd/maps/Kconfig  |    8 +++
 drivers/mtd/maps/Makefile |    1 
 drivers/mtd/maps/p3p440.c |  135 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+), 0 deletions(-)
drivers/mtd/maps/Kconfig +8 -0
index 846a533..4f618eb 100644
@@ -339,6 +339,14 @@ config MTD_OCOTEA
 	  Ocotea board. If you have one of these boards and would like to
 	  use the flash chips on it, say 'Y'.
 
+config MTD_P3P440
+	tristate "Flash devices mapped on Prodrive P3P440"
+	depends on MTD_CFI && P3P440
+	help
+	  This enables access routined for the flash chips on the Prodrive
+	  P3P440 board.  If you have this board and would like to use the
+	  flash chips on it, say 'Y'.
+
 config MTD_REDWOOD
 	tristate "CFI Flash devices mapped on IBM Redwood"
 	depends on MTD_CFI && ( REDWOOD_4 || REDWOOD_5 || REDWOOD_6 )
drivers/mtd/maps/Makefile +1 -0
index 7d9e940..73a681a 100644
@@ -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_P3P440)	+= p3p440.o
drivers/mtd/maps/p3p440.c new file +135 -0

135 lines not on this page · raw message

!-------------------------------------------------------------flip-

#5 lore raw

Re: [PATCH] MTD: Add P3P440 MTD support

drivers/mtd/maps/Kconfig config MTD_OCOTEA · line 346

Quoted 10 lines · Stefan Roese

This patch adds MTD support (NOR FLASH) for the Prodrive P3P440 (440GP) PMC module.

drivers/mtd/maps/Kconfig +5 -0
+config MTD_P3P440
+       tristate "Flash devices mapped on Prodrive P3P440"
+       depends on MTD_CFI && P3P440
+       help
+         This enables access routined for the flash chips on the Prodrive

routined ?

Quoted 11 lines
drivers/mtd/maps/p3p440.c new file +11 -0
+         P3P440 board.  If you have this board and would like to use the
+         flash chips on it, say 'Y'.
+
+#define RW_PART0_OF    0
+#define RW_PART0_SZ    0x180000
+#define RW_PART1_OF    RW_PART0_OF + RW_PART0_SZ
+#define RW_PART1_SZ    0x280000
+#define RW_PART2_OF    RW_PART1_OF + RW_PART1_SZ
+/* Partition 2 will be autosized dynamically... */
+#define RW_PART3_SZ    0x40000
+#define RW_PART4_SZ    0x40000

drivers/mtd/maps/p3p440.c line 50

Quoted 10 lines
drivers/mtd/maps/p3p440.c new file +10 -0
+
+static struct mtd_partition p3p440_flash_partitions[] = {
+       {
+               .name = "kernel",
+               .offset = RW_PART0_OF,
+               .size = RW_PART0_SZ
+       },
+       {
+               .name = "root",
+               .offset = RW_PART1_OF,

Please use .offset = MTDPART_OFS_APPEND,

drivers/mtd/maps/p3p440.c line 55

Quoted 5 lines
drivers/mtd/maps/p3p440.c new file +5 -0
+               .size = RW_PART1_SZ,
+       },
+       {
+               .name = "user",
+               .offset = RW_PART2_OF,

Please use .offset = MTDPART_OFS_APPEND,

drivers/mtd/maps/p3p440.c line 60

Quoted 5 lines
drivers/mtd/maps/p3p440.c new file +5 -0
+/*             .size = RW_PART2_SZ */ /* will be adjusted dynamically */
+       },
+       {
+               .name = "env",
+/*             .offset = RW_PART3_OF, */ /* will be adjusted dynamically */

Please use .offset = MTDPART_OFS_APPEND,

drivers/mtd/maps/p3p440.c line 65

Quoted 5 lines
drivers/mtd/maps/p3p440.c new file +5 -0
+               .size = RW_PART3_SZ,
+       },
+       {
+               .name = "u-boot",
+/*             .offset = RW_PART4_OF, */ /* will be adjusted dynamically */

Please use .offset = MTDPART_OFS_APPEND,

drivers/mtd/maps/p3p440.c line 70

Quoted 5 lines
drivers/mtd/maps/p3p440.c new file +5 -0
+               .size = RW_PART4_SZ,
+       }
+};
+
+struct map_info p3p440_flash_map = {

static

drivers/mtd/maps/p3p440.c line 77

Quoted 7 lines
drivers/mtd/maps/p3p440.c new file +7 -0
+       .name = "p3p440-flash",
+       .bankwidth = 2,
+};
+
+static struct mtd_info *p3p440_mtd;
+
+int __init init_p3p440_flash(void)

static

Quoted 5 lines
drivers/mtd/maps/p3p440.c new file +5 -0
+{
+       unsigned long long flash_base;
+       unsigned long flash_size;
+
+       flash_base = __res.bi_flashstart | 0x0000000100000000LL;

drivers/mtd/maps/p3p440.c line 92

Quoted 10 lines
drivers/mtd/maps/p3p440.c new file +10 -0
+       flash_size = __res.bi_flashsize;
+
+       p3p440_flash_map.size = flash_size;
+       p3p440_flash_map.phys = flash_base;
+       p3p440_flash_map.virt = ioremap64(flash_base,
+                                         p3p440_flash_map.size);
+
+
+       if (!p3p440_flash_map.virt) {
+               printk("init_p3p440_flash: failed to ioremap\n");

printk log level missing

drivers/mtd/maps/p3p440.c line 100

Quoted 8 lines
drivers/mtd/maps/p3p440.c new file +8 -0
+               return -EIO;
+       }
+
+       /*
+        * Adjust partitions to flash size
+        */
+       p3p440_flash_partitions[2].size = p3p440_flash_map.size -
+               RW_PART0_SZ - RW_PART1_SZ - RW_PART3_SZ - RW_PART4_SZ;

<NOT_NECESSARY_WITH_MTD_OFS_APPEND>

drivers/mtd/maps/p3p440.c line 105

Quoted 5 lines
drivers/mtd/maps/p3p440.c new file +5 -0
+       p3p440_flash_partitions[3].offset = p3p440_flash_partitions[2].size +
+               RW_PART2_OF;
+       p3p440_flash_partitions[4].offset = p3p440_flash_partitions[3].size +
+               p3p440_flash_partitions[3].offset;
+

</NOT_NECESSARY_WITH_MTD_OFS_APPEND>

Quoted 9 lines
drivers/mtd/maps/p3p440.c new file +9 -0
+       simple_map_init(&p3p440_flash_map);
+
+       p3p440_mtd = do_map_probe("cfi_probe", &p3p440_flash_map);
+
+       if (p3p440_mtd) {
+               p3p440_mtd->owner = THIS_MODULE;
+               return add_mtd_partitions(p3p440_mtd,
+                                         p3p440_flash_partitions,
+                                         ARRAY_SIZE(p3p440_flash_partitions));

drivers/mtd/maps/p3p440.c line 124

Quoted 10 lines
drivers/mtd/maps/p3p440.c new file +10 -0
+       }
+
+       return -ENXIO;
+}
+
+static void __exit cleanup_p3p440_flash(void)
+{
+       if (p3p440_mtd) {
+               del_mtd_partitions(p3p440_mtd);
+               /* moved iounmap after map_destroy - armin */

Is this comment relevant for understanding the code ?

drivers/mtd/maps/p3p440.c line 126

Quoted 2 lines
drivers/mtd/maps/p3p440.c new file +2 -0
+               map_destroy(p3p440_mtd);
+               iounmap((void *)p3p440_flash_map.virt);

Bogus type cast of void* to void*

drivers/mtd/maps/p3p440.c line 135

Quoted 9 lines
drivers/mtd/maps/p3p440.c new file +9 -0
+       }
+}
+
+module_init(init_p3p440_flash);
+module_exit(cleanup_p3p440_flash);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Stefan Roese <[email protected]>");
+MODULE_DESCRIPTION("MTD map and partitions for Prodrive P3P440 board");

tglx

#6 lore raw

Re: [PATCH] MTD: Add P3P440 MTD support

Quoted 6 lines · Thomas Gleixner
Quoted 5 lines · Stefan Roese

This patch adds MTD support (NOR FLASH) for the Prodrive P3P440 (440GP) PMC module.

Quoted 8 lines
Quoted 6 lines
(quoted diff) +5 -0
+config MTD_P3P440
+       tristate "Flash devices mapped on Prodrive P3P440"
+       depends on MTD_CFI && P3P440
+       help
+         This enables access routined for the flash chips on the

Prodrive

routined ?

Fixed.

Quoted 15 lines
Quoted 15 lines
(quoted diff) +15 -0
+         P3P440 board.  If you have this board and would like to use the
+         flash chips on it, say 'Y'.
+
+#define RW_PART0_OF    0
+#define RW_PART0_SZ    0x180000
+#define RW_PART1_OF    RW_PART0_OF + RW_PART0_SZ
+#define RW_PART1_SZ    0x280000
+#define RW_PART2_OF    RW_PART1_OF + RW_PART1_SZ
+/* Partition 2 will be autosized dynamically... */
+#define RW_PART3_SZ    0x40000
+#define RW_PART4_SZ    0x40000
+
+static struct mtd_partition p3p440_flash_partitions[] = {
+       {
+               .name = "kernel",
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+               .offset = RW_PART0_OF,
+               .size = RW_PART0_SZ
+       },
+       {
+               .name = "root",
+               .offset = RW_PART1_OF,

Please use .offset = MTDPART_OFS_APPEND,

Done. Thanks for the tip.

<snip>

Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+               .size = RW_PART4_SZ,
+       }
+};
+
+struct map_info p3p440_flash_map = {

static

Done.

Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+       .name = "p3p440-flash",
+       .bankwidth = 2,
+};
+
+static struct mtd_info *p3p440_mtd;
+
+int __init init_p3p440_flash(void)

static

Dito.

Quoted 9 lines
Quoted 9 lines
(quoted diff) +9 -0
+{
+       unsigned long long flash_base;
+       unsigned long flash_size;
+
+       flash_base = __res.bi_flashstart | 0x0000000100000000LL;
+       flash_size = __res.bi_flashsize;
+
+       p3p440_flash_map.size = flash_size;
+       p3p440_flash_map.phys = flash_base;
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+       p3p440_flash_map.virt = ioremap64(flash_base,
+                                         p3p440_flash_map.size);
+
+
+       if (!p3p440_flash_map.virt) {
+               printk("init_p3p440_flash: failed to ioremap\n");

printk log level missing

Done.

Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+               return -EIO;
+       }
+
+       /*
+        * Adjust partitions to flash size
+        */
+       p3p440_flash_partitions[2].size = p3p440_flash_map.size -
+               RW_PART0_SZ - RW_PART1_SZ - RW_PART3_SZ - RW_PART4_SZ;

<NOT_NECESSARY_WITH_MTD_OFS_APPEND>

Quoted 8 lines
Quoted 6 lines

+ p3p440_flash_partitions[3].offset =
p3p440_flash_partitions[2].size + + RW_PART2_OF;
+ p3p440_flash_partitions[4].offset =
p3p440_flash_partitions[3].size + +
p3p440_flash_partitions[3].offset;
+

</NOT_NECESSARY_WITH_MTD_OFS_APPEND>

Removed.

Quoted 13 lines
Quoted 13 lines
(quoted diff) +9 -0
+       simple_map_init(&p3p440_flash_map);
+
+       p3p440_mtd = do_map_probe("cfi_probe", &p3p440_flash_map);
+
+       if (p3p440_mtd) {
+               p3p440_mtd->owner = THIS_MODULE;
+               return add_mtd_partitions(p3p440_mtd,
+                                         p3p440_flash_partitions,
+                                        

ARRAY_SIZE(p3p440_flash_partitions)); + }

(quoted diff) +3 -0
+
+       return -ENXIO;
+}
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+
+static void __exit cleanup_p3p440_flash(void)
+{
+       if (p3p440_mtd) {
+               del_mtd_partitions(p3p440_mtd);
+               /* moved iounmap after map_destroy - armin */

Is this comment relevant for understanding the code ?

Relict from "copy and paste". Removed.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+               map_destroy(p3p440_mtd);
+               iounmap((void *)p3p440_flash_map.virt);

Bogus type cast of void* to void*

Fixed.

Please let me know, if this version is still not acceptable:

This patch adds MTD support (NOR FLASH) for the Prodrive P3P440 (440GP) PMC module.

Best regards,
Stefan

drivers/mtd/maps/Kconfig +8 -0
index 846a533..97c37ec 100644
@@ -339,6 +339,14 @@ config MTD_OCOTEA
 	  Ocotea board. If you have one of these boards and would like to
 	  use the flash chips on it, say 'Y'.
 
+config MTD_P3P440
+	tristate "Flash devices mapped on Prodrive P3P440"
+	depends on MTD_CFI && P3P440
+	help
+	  This enables access routines for the flash chips on the Prodrive
+	  P3P440 board.  If you have this board and would like to use the
+	  flash chips on it, say 'Y'.
+
 config MTD_REDWOOD
 	tristate "CFI Flash devices mapped on IBM Redwood"
 	depends on MTD_CFI && ( REDWOOD_4 || REDWOOD_5 || REDWOOD_6 )
drivers/mtd/maps/Makefile +1 -0
index 7d9e940..73a681a 100644
@@ -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_P3P440)	+= p3p440.o
drivers/mtd/maps/p3p440.c new file +126 -0

126 lines not on this page · raw message

#7 lore raw

Re: [PATCH] MTD: Add P3P440 MTD support

Quoted 1 line · Stefan Roese

Please let me know, if this version is still not acceptable:

Looks good. Thanks for cooperation.

Enqueued into the pending patch queue, which gets committed in the next days.

tglx

PS: One really nitpicking comment

+/* .size = RW_PART2_SZ */ /* will be adjusted dynamically */

looks ugly and twists my brain :)