Skip to contentSkip to conversation

chip driver mar_ram.c never sets MTD_ERASE_DONE state

DISCUSSION Oliver Kühlert 3 participants 3 messages Jun 17, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello,

trying to erase on an mtd devices using the map_ram.c driver blocks the current process and never wakes up. (see mtdchar.c, ioctl func)

I believe, that this can be fixed by adding the marked line in map_ram.c:

static int mapram_erase (struct mtd_info *mtd, struct erase_info *instr)

{
        /* Yeah, it's inefficient. Who cares? It's faster than a _real_
           flash erase. */
        struct map_info *map = (struct map_info *)mtd->priv;
        unsigned long i;

        for (i=0; i<instr->len; i++)
                map_write8(map, 0xFF, instr->addr + i);

!!!!!!----> instr->state = MTD_ERASE_DONE; <----- !!!!!!

        if (instr->callback)
                instr->callback(instr);

        return 0;
}

Best regards, Oliver Kühlert

Signature · 5 lines
Dr. Oliver Kuehlert          SYSGO Real-Time Solutions AG
[email protected]
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com
#1 lore raw
Quoted 6 lines · Oliver Kühlert

Hello,

trying to erase on an mtd devices using the map_ram.c driver blocks the current process and never wakes up. (see mtdchar.c, ioctl func)

!!!!!!----> instr->state = MTD_ERASE_DONE; <----- !!!!!!

Thanks, fixed in CVS

Signature · 11 lines
Thomas
_____________________________________________________________________
From slash dot org
"When customers are visiting, engineers are not allowed to wear ties. 
That way the customer can tell who is the engineer and who is the 
salesman (and therefore whom to believe.). Ties cut off blood flow 
to the brain, making it easier for the salesmen to do their jobs." 
_____________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: [email protected]
#2 lore raw
In reply to Oliver Kühlert
Quoted 4 lines · Oliver Kühlert

trying to erase on an mtd devices using the map_ram.c driver blocks the current process and never wakes up. (see mtdchar.c, ioctl func)

I believe, that this can be fixed by adding the marked line in map_ram.c:

I believe that to be correct -- I posted a patch here quite some time ago
http://lists.infradead.org/pipermail/linux-mtd/2002-November/006436.html

Please could someone who has CVS access commit it? Perhaps I should also submit to the kernel list?

Ian.

%patch

drivers/mtd/chips/map_ram.c +2 -0
Index: q/drivers/mtd/chips/map_ram.c
===================================================================
@@ -109,6 +109,8 @@
 	for (i=0; i<instr->len; i++)
 		map_write8(map, 0xFF, instr->addr + i);
 
+	instr->state = MTD_ERASE_DONE;
+
 	if (instr->callback)
 		instr->callback(instr);
 

%diffstat

 map_ram.c |    2 ++
 1 files changed, 2 insertions(+)
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