Skip to contentSkip to conversation

physmap-concat map platform driver

PATCH In review Anton Vorontsov 4 participants 7 messages May 26, 2007 – Feb 1, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 physmap-concat map platform driver

This is physmap-concat driver, which is plain sa1100-flash.c with factored out arch-specific code. This driver is essential for boards using multiple nonindentical chips on the board.

---
 drivers/mtd/maps/Kconfig      |   13 ++
 drivers/mtd/maps/Makefile     |    1 +
 drivers/mtd/maps/physmapcc.c  |  385 +++++++++++++++++++++++++++++++++++++++++
 include/linux/mtd/physmapcc.h |   39 ++++
 4 files changed, 438 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/maps/physmapcc.c
 create mode 100644 include/linux/mtd/physmapcc.h
drivers/mtd/maps/Kconfig +13 -0
index b665e4a..9ed9eb5 100644
@@ -101,6 +101,19 @@ config MTD_PMC_MSP_RAMROOT
 	  This provides support for the embedded root file system
           on PMC MSP devices.  This memory is mapped as a MTD block device.
 
+config MTD_PHYSMAP_CONCAT
+	tristate "Multiple flash devices in physical memory map"
+	depends on MTD
+	help
+	  This provides a 'mapping' driver which allows the NOR Flash and
+	  ROM driver code to communicate with chips which are mapped
+	  physically into the CPU's memory. You will need to configure
+	  the physical address and size of the flash chips on your
+	  particular board as well as the bus width.
+
+	  Note, this driver differs from standard PHYSMAP driver in
+	  sense that it supports multiple nonidentical flash chips.
+
 config MTD_SUN_UFLASH
 	tristate "Sun Microsystems userflash support"
 	depends on SPARC && MTD_CFI
drivers/mtd/maps/Makefile +1 -0
index 3acbb5d..cba3d33 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_MTD_CEIVA)		+= ceiva.o
 obj-$(CONFIG_MTD_OCTAGON)	+= octagon-5066.o
 obj-$(CONFIG_MTD_PHYSMAP)	+= physmap.o
 obj-$(CONFIG_MTD_PHYSMAP_OF)	+= physmap_of.o
+obj-$(CONFIG_MTD_PHYSMAP_CONCAT)+= physmapcc.o
 obj-$(CONFIG_MTD_PMC_MSP_EVM)   += pmcmsp-flash.o
 obj-$(CONFIG_MTD_PMC_MSP_RAMROOT)+= pmcmsp-ramroot.o
 obj-$(CONFIG_MTD_PNC2000)	+= pnc2000.o
drivers/mtd/maps/physmapcc.c new file +385 -0

385 lines not on this page · raw message

include/linux/mtd/physmapcc.h new file +39 -0
new file mode 100644
index 0000000..66e8f09
@@ -0,0 +1,39 @@
+/*
+ * Generic configurable MTD map driver with concat support
+ *
+ * Based on sa1100-flash driver
+ *
+ * Copyright (c) 2007 Anton Vorontsov <[email protected]>
+ * Copyright (c) 2003 Russell King, All Rights Reserved.
+ * Copyright (c) 2000 Nicolas Pitre <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef MTD_PHYSMAPCC_H
+#define MTD_PHYSMAPCC_H
+
+struct mtd_partition;
+
+/*
+ * map_name:  the map probe function name
+ * name:      flash device name (eg, as used with mtdparts=)
+ * init:      method called at driver/device initialisation
+ * exit:      method called at driver/device removal
+ * set_vpp:   method called to enable or disable VPP
+ * parts:     optional array of mtd_partitions for static partitioning
+ * nr_parts:  number of mtd_partitions for static partitoning
+ */
+struct physmapcc_platform_data {
+	const char *map_name;
+	const char *name;
+	int (*init)(void);
+	void (*exit)(void);
+	void (*set_vpp)(int on);
+	struct mtd_partition *parts;
+	unsigned int nr_parts;
+};
+
+#endif /* MTD_PHYSMAPCC_H */
Signature · 1 line
1.5.1.1-dirty
#1 lore raw
Quoted 3 lines · Anton Vorontsov

This is physmap-concat driver, which is plain sa1100-flash.c with factored out arch-specific code. This driver is essential for boards using multiple nonindentical chips on the board.

Doesn't physmap also support multiple nonidentical chips?

What physmap doesn't support is multiple discontiguous memory regions. Maybe it makes more sense to add that support to physmap instead?

#2 lore raw
Quoted 7 lines · Lennert Buytenhek
Quoted 3 lines · Anton Vorontsov

This is physmap-concat driver, which is plain sa1100-flash.c with factored out arch-specific code. This driver is essential for boards using multiple nonindentical chips on the board.

Doesn't physmap also support multiple nonidentical chips?

Nope. E.g. if I have two chips, 32M + 16M, second chip will be visible as 32M, which is wrong. As "workaround" I can register two physmap devices for each chip. But then I can't concat them, i.e. use two chips for one partition.

Quoted 2 lines

What physmap doesn't support is multiple discontiguous memory regions.

Yes, this is another disadvantage of current physmap.

Quoted 2 lines

Maybe it makes more sense to add that support to physmap instead?

Well.. more easier solution would be merging physmap-concat to physmap, trying make physmap-concat platform_data-compatible.

I can try implement that.

Thanks,

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.org/bd2
#3 lore raw
Quoted 8 lines · Anton Vorontsov
Quoted 5 lines
Quoted 3 lines

This is physmap-concat driver, which is plain sa1100-flash.c with factored out arch-specific code. This driver is essential for boards using multiple nonindentical chips on the board.

Doesn't physmap also support multiple nonidentical chips?

Nope. E.g. if I have two chips, 32M + 16M, second chip will be visible as 32M, which is wrong.

OK, why is that? Is that easily fixable?

Quoted 10 lines
Quoted 2 lines

What physmap doesn't support is multiple discontiguous memory regions.

Yes, this is another disadvantage of current physmap.

Quoted 2 lines

Maybe it makes more sense to add that support to physmap instead?

Well.. more easier solution would be merging physmap-concat to physmap, trying make physmap-concat platform_data-compatible.

Hmmm, isn't that more or less what I said? What's the difference?

thanks,
Lennert

#4 lore raw
Quoted 6 lines · Lennert Buytenhek
Quoted 4 lines · Anton Vorontsov
Quoted 4 lines
Quoted 3 lines

This is physmap-concat driver, which is plain sa1100-flash.c with factored out arch-specific code. This driver is essential for boards using multiple nonindentical chips on the board.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Doesn't physmap also support multiple nonidentical chips?

Nope. E.g. if I have two chips, 32M + 16M, second chip will be visible as 32M, which is wrong.

OK, why is that? Is that easily fixable?

Don't know why, David said it's what expected in such setup, and that's indeed what I'm observing. I'm unsure that it needs any fixups though. For now I'm just registering two physmap devices, per each chip.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

What physmap doesn't support is multiple discontiguous memory regions.

Yes, this is another disadvantage of current physmap.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Maybe it makes more sense to add that support to physmap instead?

Well.. more easier solution would be merging physmap-concat to physmap, trying make physmap-concat platform_data-compatible.

Hmmm, isn't that more or less what I said? What's the difference?

That's exactly what you've said. I was in hurry and misread your initial message. Sorry.

Quoted 2 lines

thanks,
Lennert

Thanks,

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.org/bd2
#5 lore raw
In reply to Anton Vorontsov

Hi Anton,

Quoted 7 lines · Anton Vorontsov
Quoted 2 lines

Maybe it makes more sense to add that support to physmap instead?

Well.. more easier solution would be merging physmap-concat to physmap, trying make physmap-concat platform_data-compatible.

I can try implement that.

Did you make any progress here? Just checking, since I have the same problem supporting the Intel 48F4400 which consists of two non-identical NOR chips with different geometries. If you don't have anything yet, I'll come up with a patch to extend the physmap driver to support multiple regions.

Thanks.

Best regards,
Stefan

#6 lore raw
Quoted 6 lines · Stefan Roese

Hi Anton,

Quoted 3 lines · Anton Vorontsov
Quoted 2 lines

Maybe it makes more sense to add that support to physmap instead?

Quoted 6 lines
Quoted 4 lines

Well.. more easier solution would be merging physmap-concat to physmap, trying make physmap-concat platform_data-compatible.

I can try implement that.

Did you make any progress here?

Nope, sorry. I needed this for some ARM machine, but recently had no time to work on it.

Quoted 4 lines

Just checking, since I have the same problem
supporting the Intel 48F4400 which consists of two non-identical NOR chips with different geometries. If you don't have anything yet, I'll come up with a patch to extend the physmap driver to support multiple regions.

That would be great.

Thanks,

p.s. removing [email protected] from Cc: since it's dead for months for unknown reason.

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2