public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Copy files to jffs2 partition have problem
@ 2004-02-04 17:15 Pham Huy Vu
  2004-02-04 19:53 ` Jonas Holmberg
  0 siblings, 1 reply; 6+ messages in thread
From: Pham Huy Vu @ 2004-02-04 17:15 UTC (permalink / raw)
  To: linux-mtd

Hi all,
I have used uClinux on my Samsung ARM7 board,
My flash (MX 29LV320TTC- 4MB) have
    + configurations:
    static const struct awtel_info awtel_flash_board_desc[PHYSMAP_NUMBER] =
            {   // DATA Flash configuration
                "MX FLASH",          // name
                0xE0000000,          // window_addr
                0x400000,              // window_size
                2,                          // buswidth 16 bits mode
                5,                          // num_partitions
        },
    +5 partitons:
                {
                        name: "Whole partition",
                        size: 0x400000,
                        offset: 0x000000,
                },
                {
                        name: "Bios partition",
                        size: 0x010000,
                        offset: 0x000000,
                },
                {
                        name: "Kernel partition",
                        size: 0x1e0000,
                        offset: 0x010000,
                },
                {
                        name: "Data partition", // jffs2 fs on this
partition
                        size: 0x1e0000,
                        offset: 0x200000,
                },
                {
                        name: "Configuration partition",
                        size: 0x010000,
                        offset: 0x3e0000,
                },

In amd_flash.c:
static const struct amd_flash_info table[] = {
....
    //This my flash setup
        mfr_id: MANUFACTURER_MX,
        dev_id: MX29LV320T,
        name: "MXIC MX29LV320T",
        size: 0x00400000,
        numeraseregions: 3,
        regions: {
            { offset: 0x000000, erasesize: 0x10000, numblocks: 48 },
            { offset: 0x300000, erasesize: 0x10000, numblocks: 15 },
            { offset: 0x3f0000, erasesize: 0x02000, numblocks:  8 },
        }
....
}

BUT I always go problem when copy files:
---------------------
Booting messages:
......
awtel_flash device: 400000 at e0000000
awtel_flash: ioremap is e0000000
buswidth is 2
MX FLASH: Probing for AMD compatible flash...
buswidth is 2
amd_flash.c:362:buswidth is 2
awtel_write16:0xe0000aaa, 0xaa
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xaa00aa
awtel_write16:0xe0000554, 0x55
amd_flash.c:198 flash WRITE addr=0x554, val=0x550055
awtel_write16:0xe0000aaa, 0xf0
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xf000f0
awtel_write16:0xe0000aaa, 0xaa
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xaa00aa
awtel_write16:0xe0000554, 0x55
amd_flash.c:198 flash WRITE addr=0x554, val=0x550055
awtel_write16:0xe0000aaa, 0x90
amd_flash.c:198 flash WRITE addr=0xaaa, val=0x900090
awtel_read16:0xe0000000
amd_flash.c:184 flash READ addr=0x0, val=0xc2
awtel_write16:0xe0000aaa, 0xaa
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xaa00aa
awtel_write16:0xe0000554, 0x55
amd_flash.c:198 flash WRITE addr=0x554, val=0x550055
awtel_write16:0xe0000aaa, 0xf0
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xf000f0
awtel_write16:0xe0000aaa, 0xaa
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xaa00aa
awtel_write16:0xe0000554, 0x55
amd_flash.c:198 flash WRITE addr=0x554, val=0x550055
awtel_write16:0xe0000aaa, 0x90
amd_flash.c:198 flash WRITE addr=0xaaa, val=0x900090
awtel_read16:0xe0000002
amd_flash.c:184 flash READ addr=0x2, val=0x22a7
amd_flash.c:385: buswidth:2, mfr_id=0xc2, dev_id=0x22a7
MX FLASH: Found 1 x 4MiB MXIC MX29LV320T at 0x0
awtel_write16:0xe0000aaa, 0xaa
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xaa00aa
awtel_write16:0xe0000554, 0x55
amd_flash.c:198 flash WRITE addr=0x554, val=0x550055
awtel_write16:0xe0000aaa, 0xf0
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xf0
phymap 0 amd_flash_probe: mymtd is 1fcf3a0
Creating 5 MTD partitions on "MX FLASH":
0x00000000-0x00400000 : "Whole partition"
mtd: Giving out device 0 to Whole partition
0x00000000-0x00010000 : "Bios partition"
mtd: Giving out device 1 to Bios partition
0x00010000-0x001f0000 : "Kernel partition"
mtd: Giving out device 2 to Kernel partition
0x00200000-0x003e0000 : "Voip partition"
mtd: Giving out device 3 to Voip partition
0x003e0000-0x003f0000 : "Configuration partition"
mtd: Giving out device 4 to Configuration partition
init_mtdchar: allocated major number 90.
init_mtdblock: allocated major number 131.
.....


#mkfs.jffs2 -l -r /tmp/data/ -o data.jffs2
#dd if=data.jffs2 of=/dev/mtd3 bs=64
#mount -t jffs2 /dev/mtdblock3 /var/flash
# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    3.1M      3.1M         0 100% /
/dev/rom0                 3.1M      3.1M         0 100% /
/dev/mtdblock3            1.9M      1.2M    664.0k  65% /var/flash

#ls  -la /tmp
-rwxrwxrwx    1 0        root       292756 abc

#cp /tmp/abc /var/flash/
cp: write: Input/output error

#ls -la /var/flash
-rwxr-xr-x    1 0        root        42749 abc
drwxr-xr-x    1 0        root           32 usr

# dmesg
......
awtel_write16:0xe0000aaa, 0xaa
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xaa00aa
awtel_write16:0xe0000554, 0x55
amd_flash.c:198 flash WRITE addr=0x554, val=0x550055
awtel_write16:0xe0000aaa, 0xa0
amd_flash.c:198 flash WRITE addr=0xaaa, val=0xa0
awtel_write16:0xe03a59c0, 0x10
amd_flash.c:198 flash WRITE addr=0x3a59c0, val=0x14000010
awtel_read16:0xe03a59c0
amd_flash.c:184 flash READ addr=0x3a59c0, val=0x10
awtel_read16:0xe03a59c0
amd_flash.c:184 flash READ addr=0x3a59c0, val=0x10
awtel_read16:0xe03a59c0
amd_flash.c:184 flash READ addr=0x3a59c0, val=0x10
MX FLASH: write to 0x3a59c0 failed. datum = 14000010, verify = 10
Write of 71 bytes at 0x001a597c failed. returned 0, retlen 68
jffs2_add_physical_node_ref(): Node at 0x1a597c, size 0x48
jffs2_mark_node_obsolete called with already obsolete node at 0x001a597c
jffs2_complete_reservation()
thread_should_wake(): nr_free_blocks 14, nr_erasing_blocks 0, dirty_size
0x184
jffs2_commit_write(): Not all bytes written. Marking page !uptodate
jffs2_commit_write() returning -5
.........

------------------------------
Please help me if someone overcomes these problem or give me some hints.

+ Why i got errors when i copy files to jffs2 partition even my free space
enough for Garbage collection ( 5*64k = 320k < 664.0k)?
+ "MX FLASH: write to 0x3a59c0 failed. datum = 14000010, verify = 10
    Write of 71 bytes at 0x001a597c failed. returned 0, retlen 68"
    =>Why it write 71 bytes?
+ Did I set up something wrong with my flash?
Thanks a lot.


----mark pham----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy files to jffs2 partition have problem
  2004-02-04 17:15 Copy files to jffs2 partition have problem Pham Huy Vu
@ 2004-02-04 19:53 ` Jonas Holmberg
  2004-02-06  4:34   ` Pham Huy Vu
  0 siblings, 1 reply; 6+ messages in thread
From: Jonas Holmberg @ 2004-02-04 19:53 UTC (permalink / raw)
  To: Pham Huy Vu; +Cc: linux-mtd

On Thu, Feb 05, 2004 at 01:15:52AM +0800, Pham Huy Vu wrote:
[snip]
> In amd_flash.c:
> static const struct amd_flash_info table[] = {
> ....
>     //This my flash setup
>         mfr_id: MANUFACTURER_MX,
>         dev_id: MX29LV320T,
>         name: "MXIC MX29LV320T",
>         size: 0x00400000,
>         numeraseregions: 3,
>         regions: {
>             { offset: 0x000000, erasesize: 0x10000, numblocks: 48 },
>             { offset: 0x300000, erasesize: 0x10000, numblocks: 15 },
>             { offset: 0x3f0000, erasesize: 0x02000, numblocks:  8 },

Hmm, I wonder why this isn't

	     { offset: 0x000000, erasesize: 0x10000, numblocks: 63 },
	     { offset: 0x3f0000, erasesize: 0x02000, numblocks:  8 },

Because of two banks? Make sure this layout is correct (check the 
datasheet). I have seen commits to the table in amd_flash.c that were 
wrong before. If your flash chip supports CFI, try using the 
CFI-driver. Otherwise try jedec_probe.c instead. amd_flash is 
obsolete.

Another piece of probably useless information:
I resently tested another, 64Mbit, MX-flash that didn't work with the 
CFI-driver because thay had gotten the number of eraseregions wrong in 
the CFI-table (in flash). A new, corrected version of the chip was 
released, but with exactly the same device ID, grrr. (Got any 
unused baseball bats left, David?)

[snap]
> MX FLASH: write to 0x3a59c0 failed. datum = 14000010, verify = 10

With buswidth 2 you can only write 16-bits. That's probably why verify 
is 0x0010. I don't know why jffs2 tries to write 0x14000010, though.

/Jonas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy files to jffs2 partition have problem
  2004-02-04 19:53 ` Jonas Holmberg
@ 2004-02-06  4:34   ` Pham Huy Vu
  2004-02-06  7:51     ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Pham Huy Vu @ 2004-02-06  4:34 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: linux-mtd

Hi Jonas,
Thanks for your reply,

I select CFI to probe my flash, The kernel can detect it like below
...............
awtel_flash device: 400000 at e0000000
awtel_flash: ioremap is e0000000
buswidth is 2
Number of erase regions: 2
Primary Vendor Command Set: 0002 (AMD/Fujitsu Standard)
Primary Algorithm Table at 0040
Alternative Vendor Command Set: 0000 (None)
No Alternate Algorithm Table
Vcc Minimum: 2.7 V
Vcc Maximum: 3.6 V
No Vpp line
Typical byte/word write timeout: 16 µs
Maximum byte/word write timeout: 512 µs
Full buffer write not supported
Typical block erase timeout: 1024 µs
Maximum block erase timeout: 16384 µs
Chip erase not supported
Device size: 0x400000 bytes (4 MiB)
Flash Device Interface description: 0x0002
  - supports x8 and x16 via BYTE# with asynchronous interface
Max. bytes in buffer write: 0x1
Number of Erase Block Regions: 2
  Erase Region #0: BlockSize 0x2000 bytes, 8 blocks
  Erase Region #1: BlockSize 0x10000 bytes, 63 blocks
 Amd/Fujitsu Extended Query Table v1.1 at 0x0040
MX FLASH: Swapping erase regions for broken CFI table.
number of CFI chips: 1
phymap 0 cfi_probe: mymtd is 1fcb420
Creating 5 MTD partitions on "MX FLASH":
0x00000000-0x00400000 : "Whole partition"
mtd: Giving out device 0 to Whole partition
0x00000000-0x00010000 : "Bios partition"
mtd: Giving out device 1 to Bios partition
0x00010000-0x001f0000 : "Kernel partition"
mtd: Giving out device 2 to Kernel partition
0x00200000-0x003e0000 : "Voip partition"
mtd: Giving out device 3 to Voip partition
0x003e0000-0x003f0000 : "Configuration partition"
mtd: Giving out device 4 to Configuration partition
...............
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00400000 00010000 "Whole partition"
mtd1: 00010000 00010000 "Bios partition"
mtd2: 001e0000 00010000 "Kernel partition"
mtd3: 001e0000 00010000 "Voip partition"
mtd4: 00010000 00010000 "Configuration partition"
--------
I also got that problem ( cp: write: Input/output error ) when copy files
#cp /tmp/abc /var/flash/
cp: write: Input/output error
#dmesg
....
Last[3] is 10, datum is 14000010
Write of 71 bytes at 0x000fe494 failed. returned 0, retlen 68
.....
I think mtd driver is ok,
I just think the jffs2 fs or mkfs.jffs2 have bugs???

Please help me find out problem.

My uClinux:
#dmesg
Linux version 2.4.19-uc1 (vuph@devel.sunyard-vietnam.com) (gcc version
2.95.3 20
010315 (release)(ColdFire patches - 20010318 from
http://fiddes.net/coldfire/)(u
Clinux XIP and shared lib patches from http://www.snapgear.com/)) #1873
22:14:59
....
JFFS2 version 2.1. (C) 2001, 2002 Red Hat, Inc., designed by Axis
Communications
 AB.
....
# mkfs.jffs2 -v
mkfs.jffs2 revision 1.20

The mtd version 2002/03/22 07:10:34

Thanks.

----mark pham----

----- Original Message -----
From: "Jonas Holmberg" <jonas.holmberg@axis.com>
To: "Pham Huy Vu" <vuph@mail.cable.net.tw>
Cc: <linux-mtd@lists.infradead.org>
Sent: Thursday, February 05, 2004 3:53 AM
Subject: Re: Copy files to jffs2 partition have problem


> On Thu, Feb 05, 2004 at 01:15:52AM +0800, Pham Huy Vu wrote:
> [snip]
> > In amd_flash.c:
> > static const struct amd_flash_info table[] = {
> > ....
> >     //This my flash setup
> >         mfr_id: MANUFACTURER_MX,
> >         dev_id: MX29LV320T,
> >         name: "MXIC MX29LV320T",
> >         size: 0x00400000,
> >         numeraseregions: 3,
> >         regions: {
> >             { offset: 0x000000, erasesize: 0x10000, numblocks: 48 },
> >             { offset: 0x300000, erasesize: 0x10000, numblocks: 15 },
> >             { offset: 0x3f0000, erasesize: 0x02000, numblocks:  8 },
>
> Hmm, I wonder why this isn't
>
>      { offset: 0x000000, erasesize: 0x10000, numblocks: 63 },
>      { offset: 0x3f0000, erasesize: 0x02000, numblocks:  8 },
>
> Because of two banks? Make sure this layout is correct (check the
> datasheet). I have seen commits to the table in amd_flash.c that were
> wrong before. If your flash chip supports CFI, try using the
> CFI-driver. Otherwise try jedec_probe.c instead. amd_flash is
> obsolete.
>
> Another piece of probably useless information:
> I resently tested another, 64Mbit, MX-flash that didn't work with the
> CFI-driver because thay had gotten the number of eraseregions wrong in
> the CFI-table (in flash). A new, corrected version of the chip was
> released, but with exactly the same device ID, grrr. (Got any
> unused baseball bats left, David?)
>
> [snap]
> > MX FLASH: write to 0x3a59c0 failed. datum = 14000010, verify = 10
>
> With buswidth 2 you can only write 16-bits. That's probably why verify
> is 0x0010. I don't know why jffs2 tries to write 0x14000010, though.
>
> /Jonas
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy files to jffs2 partition have problem
  2004-02-06  4:34   ` Pham Huy Vu
@ 2004-02-06  7:51     ` David Woodhouse
  2004-02-07  5:18       ` Pham Huy Vu
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2004-02-06  7:51 UTC (permalink / raw)
  To: Pham Huy Vu; +Cc: Jonas Holmberg, linux-mtd

On Fri, 2004-02-06 at 12:34 +0800, Pham Huy Vu wrote:
> Hi Jonas,
> Thanks for your reply,

Your last message to the list was rejected, partly because you
top-posted. Yet you repeated the offence.

Do it again and you get a personal entry in the blacklist.

> Last[3] is 10, datum is 14000010
> Write of 71 bytes at 0x000fe494 failed. returned 0, retlen 68
> .....
> I think mtd driver is ok,
> I just think the jffs2 fs or mkfs.jffs2 have bugs???

It's the other way around. The error you see is in the flash driver. We
really shouldn't have the top bits set in 'datum' if buswidth is 2. I
have a recollection of this bug having been fixed already. What version
of drivers/mtd/chips/cfi_cmdset_0002.c do you have? (The $ID:... $ tag
near the top of the file).

-- 
dwmw2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy files to jffs2 partition have problem
  2004-02-06  7:51     ` David Woodhouse
@ 2004-02-07  5:18       ` Pham Huy Vu
  2004-02-11  4:22         ` Pham Huy Vu
  0 siblings, 1 reply; 6+ messages in thread
From: Pham Huy Vu @ 2004-02-07  5:18 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

Hi David Woodhouse,
I use this version:
* $Id: cfi_cmdset_0002.c,v 1.52 2001/10/24 09:37:30 dwmw2 Exp $
This version have fixed this bug or not? Please give me your hints.
Thanks.
----mark pham----

----- Original Message -----
From: "David Woodhouse" <postmaster@infradead.org>
To: "Pham Huy Vu" <vuph@mail.cable.net.tw>
Cc: "Jonas Holmberg" <jonas.holmberg@axis.com>;
<linux-mtd@lists.infradead.org>
Sent: Friday, February 06, 2004 3:51 PM
Subject: Re: Copy files to jffs2 partition have problem


> On Fri, 2004-02-06 at 12:34 +0800, Pham Huy Vu wrote:
> > Hi Jonas,
> > Thanks for your reply,
>
> Your last message to the list was rejected, partly because you
> top-posted. Yet you repeated the offence.
>
> Do it again and you get a personal entry in the blacklist.
>
> > Last[3] is 10, datum is 14000010
> > Write of 71 bytes at 0x000fe494 failed. returned 0, retlen 68
> > .....
> > I think mtd driver is ok,
> > I just think the jffs2 fs or mkfs.jffs2 have bugs???
>
> It's the other way around. The error you see is in the flash driver. We
> really shouldn't have the top bits set in 'datum' if buswidth is 2. I
> have a recollection of this bug having been fixed already. What version
> of drivers/mtd/chips/cfi_cmdset_0002.c do you have? (The $ID:... $ tag
> near the top of the file).
>
> --
> dwmw2
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy files to jffs2 partition have problem
  2004-02-07  5:18       ` Pham Huy Vu
@ 2004-02-11  4:22         ` Pham Huy Vu
  0 siblings, 0 replies; 6+ messages in thread
From: Pham Huy Vu @ 2004-02-11  4:22 UTC (permalink / raw)
  To: Pham Huy Vu; +Cc: linux-mtd

Hi all,
I already fixed my bugs. Flash driver for amd can not handle alignment well.
Thank David Woodhouse, Jonas and mtd list.
Thanks.

----Mark Pham----

----- Original Message -----
From: "Pham Huy Vu" <vuph@mail.cable.net.tw>
To: "David Woodhouse" <postmaster@infradead.org>
Cc: <linux-mtd@lists.infradead.org>
Sent: Saturday, February 07, 2004 1:18 PM
Subject: Re: Copy files to jffs2 partition have problem


> Hi David Woodhouse,
> I use this version:
> * $Id: cfi_cmdset_0002.c,v 1.52 2001/10/24 09:37:30 dwmw2 Exp $
> This version have fixed this bug or not? Please give me your hints.
> Thanks.
> ----mark pham----
>
> ----- Original Message -----
> From: "David Woodhouse" <postmaster@infradead.org>
> To: "Pham Huy Vu" <vuph@mail.cable.net.tw>
> Cc: "Jonas Holmberg" <jonas.holmberg@axis.com>;
> <linux-mtd@lists.infradead.org>
> Sent: Friday, February 06, 2004 3:51 PM
> Subject: Re: Copy files to jffs2 partition have problem
>
>
> > On Fri, 2004-02-06 at 12:34 +0800, Pham Huy Vu wrote:
> > > Hi Jonas,
> > > Thanks for your reply,
> >
> > Your last message to the list was rejected, partly because you
> > top-posted. Yet you repeated the offence.
> >
> > Do it again and you get a personal entry in the blacklist.
> >
> > > Last[3] is 10, datum is 14000010
> > > Write of 71 bytes at 0x000fe494 failed. returned 0, retlen 68
> > > .....
> > > I think mtd driver is ok,
> > > I just think the jffs2 fs or mkfs.jffs2 have bugs???
> >
> > It's the other way around. The error you see is in the flash driver. We
> > really shouldn't have the top bits set in 'datum' if buswidth is 2. I
> > have a recollection of this bug having been fixed already. What version
> > of drivers/mtd/chips/cfi_cmdset_0002.c do you have? (The $ID:... $ tag
> > near the top of the file).
> >
> > --
> > dwmw2
> >
> >
> > ______________________________________________________
> > Linux MTD discussion mailing list
> > http://lists.infradead.org/mailman/listinfo/linux-mtd/
> >
>
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-02-11  4:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-04 17:15 Copy files to jffs2 partition have problem Pham Huy Vu
2004-02-04 19:53 ` Jonas Holmberg
2004-02-06  4:34   ` Pham Huy Vu
2004-02-06  7:51     ` David Woodhouse
2004-02-07  5:18       ` Pham Huy Vu
2004-02-11  4:22         ` Pham Huy Vu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox