Skip to contentSkip to conversation

MTD patches

PATCH Ian Campbell 2 participants 6 messages Aug 17, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi David,

I've had a couple of patches to MTD sitting in my 2.6 tree for a while now and wonder if you would consider including them.

All of the patches are against 2.6.8.1, although they have been applying unchanged for many versions now.

mtd-redboot-partition-fixes.patch

This patch has two parts.

The first is to factor out the offset to look at for the RedBoot partition table into a variable. This has no impact on the code as is, but makes it easier and clearer for platforms that have the partition table at some other offset to wrap a #ifdef CONFIG_ARCH_ around the variable rather than introducing errors by cloning the whole master->read call.

The second part looks for any partition name starting with "RedBoot" rather than looking for "RedBoot\0". On my platform RedBoot lives in a separate boot ROM, but the RedBoot config and partition table are in the main flash so we can find them.

mtd-add_full.patch

This patch adds a new api call add_mtd_device_full() that allows a device to be added to a specific minor number (if it is available). I use this in my platform drivers to ensure that the SRAM device is always minor 14 and the BIOS device is always minor 15, even if the user changes the redboot partitioning scheme and changes the number of flash partitions.

add_mtd_device now just calls _full with a minor of -1 to allocate any available device.

mtd-jedec-probe-parts

This patch adds a few new part numbers to jedec_probe.c. They are AMD AM29F002T, Hyundai HY29F002T and Macronix MX29FOO2T.

Cheers,
Ian.

Signature · 4 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200

%patch

drivers/mtd/redboot.c +5 -2
Index: linux-2.6-bk/drivers/mtd/redboot.c
===================================================================
@@ -49,6 +49,7 @@
 	char *nullname;
 	int namelen = 0;
 	int nulllen = 0;
+	unsigned long offset;
 #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
 	static char nullstring[] = "unallocated";
 #endif
@@ -59,7 +60,9 @@
 		return -ENOMEM;
 
 	/* Read the start of the last erase block */
-	ret = master->read(master, master->size - master->erasesize,
+	offset = master->size - master->erasesize;
+
+	ret = master->read(master, offset,
 			   master->erasesize, &retlen, (void *)buf);
 
 	if (ret)
@@ -72,7 +75,7 @@
 
 	/* RedBoot image could appear in any of the first three slots */
 	for (i = 0; i < 3; i++) {
-		if (!memcmp(buf[i].name, "RedBoot", 8))
+		if (!memcmp(buf[i].name, "RedBoot", 7))
 			break;
 	}
 	if (i == 3) {

%patch

drivers/mtd/mtdcore.c +36 -16

80 lines not on this page · raw message

include/linux/mtd/mtd.h +1 -0
Index: q/include/linux/mtd/mtd.h
===================================================================
@@ -238,6 +238,7 @@
 	/* Kernel-side ioctl definitions */
 
 extern int add_mtd_device(struct mtd_info *mtd);
+extern int add_mtd_device_full(struct mtd_info *mtd, int minor);
 extern int del_mtd_device (struct mtd_info *mtd);
 
 extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);

%diffstat

 drivers/mtd/mtdcore.c   |   52 +++++++++++++++++++++++++++++++++---------------
 include/linux/mtd/mtd.h |    1 
 2 files changed, 37 insertions(+), 16 deletions(-)

%description
Add support for a couple of BIOS ROM devices.

%patch

drivers/mtd/chips/jedec_probe.c +42 -2

68 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Ian Campbell

I've had a couple of patches to MTD sitting in my 2.6 tree for a while now and wonder if you would consider including them.

Thanks for these.

Quoted 10 lines

mtd-redboot-partition-fixes.patch

This patch has two parts.

The first is to factor out the offset to look at for the RedBoot partition table into a variable. This has no impact on the code as is, but makes it easier and clearer for platforms that have the partition table at some other offset to wrap a #ifdef CONFIG_ARCH_ around the variable rather than introducing errors by cloning the whole master->read call.

Hmmm. Isn't this why we introduced an extra argument to the partition parsers in the first place? The map code should be able to pass a suitable argument, rather than having ifdefs in the parser code? Gary?

Quoted 4 lines

The second part looks for any partition name starting with "RedBoot" rather than looking for "RedBoot\0". On my platform RedBoot lives in a separate boot ROM, but the RedBoot config and partition table are in the main flash so we can find them.

Seems reasonable.

Quoted 5 lines

mtd-add_full.patch

This patch adds a new api call add_mtd_device_full() that allows a device to be added to a specific minor number (if it is available).

Hmm. I don't like this much -- if you want stable device naming that's what udev is for. I don't want to accept this before the equivalent for fixed numbering of SCSI or IDE drives is accepted upstream. :)

Quoted 4 lines

mtd-jedec-probe-parts

This patch adds a few new part numbers to jedec_probe.c. They are AMD AM29F002T, Hyundai HY29F002T and Macronix MX29FOO2T.

OK, please apply this -- you have CVS access don't you?

Signature · 1 line
dwmw2
#2 lore raw

Hi,

I noticed that you had to moderate this message due to a suspicious header. Is this a false positive or can I do something to fix it? The message didn't say which header.

Quoted 17 lines · David Woodhouse
Quoted 2 lines · Ian Campbell

I've had a couple of patches to MTD sitting in my 2.6 tree for a while now and wonder if you would consider including them.

Thanks for these.

Quoted 10 lines

mtd-redboot-partition-fixes.patch

This patch has two parts.

The first is to factor out the offset to look at for the RedBoot partition table into a variable. This has no impact on the code as is, but makes it easier and clearer for platforms that have the partition table at some other offset to wrap a #ifdef CONFIG_ARCH_ around the variable rather than introducing errors by cloning the whole master->read call.

Quoted 3 lines

Hmmm. Isn't this why we introduced an extra argument to the partition parsers in the first place? The map code should be able to pass a suitable argument, rather than having ifdefs in the parser code? Gary?

I had a solution based on this idea for a bit, but I didn't like it in the end since mtd_parse_partitions only takes a single parameter which is passed to all the partition modules you might be using (I have command line then redboot in my setup). Hence it didn't seem to make sense to pass a redboot partition table specific parameter to this function.

Quoted 9 lines
Quoted 5 lines

mtd-add_full.patch

This patch adds a new api call add_mtd_device_full() that allows a device to be added to a specific minor number (if it is available).

Hmm. I don't like this much -- if you want stable device naming that's what udev is for. I don't want to accept this before the equivalent for fixed numbering of SCSI or IDE drives is accepted upstream. :)

Fair enough, I will carry it as my own patch til I figure embedded udev out.

Quoted 6 lines
Quoted 4 lines

mtd-jedec-probe-parts

This patch adds a few new part numbers to jedec_probe.c. They are AMD AM29F002T, Hyundai HY29F002T and Macronix MX29FOO2T.

OK, please apply this -- you have CVS access don't you?

I don't believe I do, one of my colleagues here at Arcom does (David Vrabel). I can ask him to commit this patch, or else I can send you whatever you need to get an account setup for me, just a ssh public key?.

I guess cvs.infradead.org is still IPv6 only, do you have any advice for a tunnel to use that will work from within a corporate firewall, or on a dynamic IPv4 cable modem address?

Ian.

Signature · 4 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200
#3 lore raw
Quoted 5 lines · Ian Campbell

Hi,

I noticed that you had to moderate this message due to a suspicious header. Is this a false positive or can I do something to fix it? The message didn't say which header.

All mail with attachments gets stopped for moderation. If you're posting only _one_ patch then inline it instead of attaching it -- if you're posting three then the only sane way would be to send it as three patches. Or just wait for moderation ;)

Quoted 10 lines
Quoted 3 lines

Hmmm. Isn't this why we introduced an extra argument to the partition parsers in the first place? The map code should be able to pass a suitable argument, rather than having ifdefs in the parser code? Gary?

I had a solution based on this idea for a bit, but I didn't like it in the end since mtd_parse_partitions only takes a single parameter which is passed to all the partition modules you might be using (I have command line then redboot in my setup). Hence it didn't seem to make sense to pass a redboot partition table specific parameter to this function.

True. I'm growing to hate our partitioning code. I think it all needs rewriting.

Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

mtd-jedec-probe-parts

This patch adds a few new part numbers to jedec_probe.c. They are AMD AM29F002T, Hyundai HY29F002T and Macronix MX29FOO2T.

OK, please apply this -- you have CVS access don't you?

I don't believe I do, one of my colleagues here at Arcom does (David Vrabel). I can ask him to commit this patch, or else I can send you whatever you need to get an account setup for me, just a ssh public key?.

Yep.

Quoted 3 lines

I guess cvs.infradead.org is still IPv6 only, do you have any advice for a tunnel to use that will work from within a corporate firewall, or on a dynamic IPv4 cable modem address?

If you have a public IPv4 address of any kind, that's sufficient. If it's got initscripts like Red Hat/Fedora then add the four config lines shown at http://www.linux-mtd.infradead.org/ and it should just work. Other distributions are similarly trivial.

If you have an account on a box _anywhere_ with both IPv6 and IPv4, you can use that in conjunction with SSH's 'ProxyCommand' option which makes it run a command and use stdin/stdout instead of trying to connect directly. I have this in my ~/.ssh/config at work, where there's no IPv6:

Host cvs.infradead.org phoenix.infradead.org phoenix
ProxyCommand ssh pentafluge.infradead.org nc -6 %h %p

Signature · 1 line
dwmw2
#4 lore raw
In reply to David Woodhouse
Quoted 6 lines · David Woodhouse
Quoted 4 lines

mtd-jedec-probe-parts

This patch adds a few new part numbers to jedec_probe.c. They are AMD AM29F002T, Hyundai HY29F002T and Macronix MX29FOO2T.

OK, please apply this

What is the procedure WRT updating upstream when committing to CVS? Should I commit and then send a patch via Linus or do you like to bundle up changes and send them all together?

Ian.

Signature · 9 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200
-- 
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200
#5 lore raw
Quoted 3 lines · Ian Campbell

What is the procedure WRT updating upstream when committing to CVS? Should I commit and then send a patch via Linus or do you like to bundle up changes and send them all together?

It depends -- in general I prefer changes to go to Linus _via_ CVS, so that the $Id$ change gets to Linus too, and then it's easier for me to later work out what changes have been made in Linus' tree by comparing against the version in CVS with matching $Id$.

In this case, however, there have been other changes to that file since I last merged with Linus, which probably want a little more testing before they're sent upstream. So if you're desperate for it to go upstream immediately, just send it without the ident change (and _also_ commit to CVS).

Signature · 1 line
dwmw2