From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from motgate8.mot.com ([129.188.136.8]) by pentafluge.infradead.org with esmtp (Exim 4.30 #5 (Red Hat Linux)) id 1AinNu-0004L1-Gj for linux-mtd@lists.infradead.org; Tue, 20 Jan 2004 04:21:02 +0000 Received: from il06exr02.mot.com (il06exr02.mot.com [129.188.137.132]) by motgate8.mot.com (Motorola/Motgate3) with ESMTP id i0K4Ik7u014514 for ; Mon, 19 Jan 2004 21:18:46 -0700 (MST) Received: from zch07exm04.corp.mot.com (ZCH07EXM04.corp.mot.com [200.3.1.210]) by il06exr02.mot.com (Motorola/il06exr02) with ESMTP id i0K4HN7O017036 for ; Mon, 19 Jan 2004 22:17:25 -0600 From: Li Yang To: David Woodhouse In-Reply-To: <1074510244.14499.49.camel@imladris.demon.co.uk> References: <01139FC052A0D411900B00508B9535FC0F0D25BB@ZCH07EXM04.corp.mot.com> <1074503876.14499.40.camel@imladris.demon.co.uk> <1074509881.14564.3.camel@Gundam> <1074510244.14499.49.camel@imladris.demon.co.uk> Content-Type: text/plain Message-Id: <1074572447.14559.23.camel@Gundam> Mime-Version: 1.0 Date: 20 Jan 2004 12:20:47 +0800 Content-Transfer-Encoding: 7bit cc: linux-mtd@lists.infradead.org Subject: Re: jffs2+mtd+big endian problem Reply-To: leoli@motorola.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 2004-01-19 at 19:04, David Woodhouse wrote: > On Mon, 2004-01-19 at 18:58 +0800, Li Yang wrote: > > I have some problem accessing CVS from the damned corporate network. > > How strange. I can make the machine available for dialin if you want -- > it's funny how a few international phone calls make managers suddenly > want to lean on incompetent IS staff to fix broken firewalls :) Well, I hope i can do so. But I have to get a modem first. =) > > If you really can't even use CONNECT through an HTTP proxy, there are > nightly snapshots at ftp://ftp.uk.linux.org/pub/people/dwmw2/mtd/cvs/ No, I can't use CONNECT through an HTTP proxy. I think they intend to do so due to some *security* reason, anyway, the network is absolutely not secure in my opinion. It's so kind of you to provide the snapshot. > > > The image generated by mkfs.jffs2 with -b seems ok, but it's not all > > right after I done some operations on the target. In the bottom is the > > log of these operations. > > > > Yes, I have examined a section which is formatted by the target board. > > The first several bytes of the section are: > > > > fe3c0000: 03208519 0c000000 98dc60f0 ffffffff . ........`..... > > fe3c0010: ffffffff ffffffff ffffffff ffffffff ................ > > > > They are all 32-bit swapped. I traced into the JFFS2 code, and know it > > use mtd->write to write data into flash. Which function is it turned > > out to be finally? Is it the write defined in the drivers/mtd/maps/ > > files? I used __raw_write*() at the very beginning, it shouldn't be > > like this. > > This sounds like you're using byte-swapping operations in your map > driver. You should be using __raw_write*() not write*(). You said you > were 'at the very beginning'... are you still doing that now? I have verified my maps/ file. I'm using __raw_write*() now. Here is part of my maps file, I don't know if the memcpy_toio() matters. #define WINDOW_ADDR 0xfe000000 #define WINDOW_SIZE 0x800000 static struct mtd_partition physmap_partitions[] = { /* Put your own partition definitions here */ { name: "JFFS2", size: 0x600000, offset: 0, }, { name: "uImage", size: 0x100000, offset: 0x600000, mask_flags: MTD_WRITEABLE, /* force read-only */ }, { name: "u-boot", size: 0x40000, offset: 0x700000, mask_flags: MTD_WRITEABLE, /* force read-only */ }, { name: "u-boot env", size: 0x40000, offset: 0x740000, mask_flags: MTD_WRITEABLE, /* force read-only */ } }; #define NUM_PARTITIONS (sizeof(physmap_partitions)/sizeof(struct mtd_partition)) static struct mtd_info *mymtd; __u8 ads_read8(struct map_info *map, unsigned long ofs) { return __raw_readb(map->map_priv_1 + ofs); } __u16 ads_read16(struct map_info *map, unsigned long ofs) { return __raw_readw(map->map_priv_1 + ofs); } __u32 ads_read32(struct map_info *map, unsigned long ofs) { return __raw_readl(map->map_priv_1 + ofs); } void ads_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) { memcpy_fromio(to, (void *)(map->map_priv_1 + from), len); } void ads_write8(struct map_info *map, __u8 d, unsigned long adr) { __raw_writeb(d, map->map_priv_1 + adr); mb(); } void ads_write16(struct map_info *map, __u16 d, unsigned long adr) { __raw_writew(d, map->map_priv_1 + adr); mb(); } void ads_write32(struct map_info *map, __u32 d, unsigned long adr) { __raw_writel(d, map->map_priv_1 + adr); mb(); } void ads_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) { memcpy_toio((void *)(map->map_priv_1 + to), from, len); } struct map_info ads_map = { name: "Flash SIMM", size: WINDOW_SIZE, buswidth: 4, read8: ads_read8, read16: ads_read16, read32: ads_read32, copy_from: ads_copy_from, write8: ads_write8, write16: ads_write16, write32: ads_write32, copy_to: ads_copy_to }; -- Thank you Leo