From: Wang Jian <lark@linux.net.cn>
To: linux-kernel@vger.kernel.org
Cc: David Woodhouse <dwmw2@infradead.org>, Wang Jian <lark@linux.net.cn>
Subject: 2.6.26-rc8 nftl + nand(diskonchip) + powerpc = crash + no work
Date: Tue, 29 Jul 2008 17:58:34 +0800 [thread overview]
Message-ID: <20080729095834.GA3291@debian> (raw)
Hi,
I am off list so please CC: me.
I have problem when I try to make DOC2000 work on a powerpc dev board.
The DOC2000 is 8bit so I add
#elif defined(__powerpc__)
#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u8 *)(((unsigned long)adr)+(reg))))
#define WriteDOC_(d, adr, reg) do{ *(volatile __u8 *)(((unsigned long)adr)+((reg))) = (__u8)d; wmb();} while(0)
#define DOC_IOREMAP_LEN 0x2000
#else
to include/linux/mtd/doc2000.h. After this modification, the doc2000 can
be probed correctly.
But fdisk/mke2fs write on /dev/nftla will crash. I trace down to
driver/mtd/nftlcore.c
/*
* Write data and oob to flash
*/
static int nftl_write(struct mtd_info *mtd, loff_t offs, size_t len,
size_t *retlen, uint8_t *buf, uint8_t *oob)
{
struct mtd_oob_ops ops;
int res;
ops.mode = MTD_OOB_PLACE;
ops.ooboffs = offs;
// --> should be ops.ooboffs = offs & (mtd->writesize - 1); ???
ops.ooblen = mtd->oobsize;
ops.oobbuf = oob;
ops.datbuf = buf;
ops.len = len;
res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
*retlen = ops.retlen;
return res;
}
This is the only place that offs assigned to ops.ooboffs without
masking. Then in drivers/mtd/nand/nand_base.c
static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob,
struct mtd_oob_ops *ops)
{
------ snip ------
memcpy(chip->oob_poi + ops->ooboffs, oob, len);
------ snip ------
This triggers the crash.
Fixing this does prevent fdisk/mke2fs from crash, but fdisk/mke2fs can't
work either. Hexdump tells me that it is all zero after write.
The questions are:
1. The DOC2000 can be correctly probed, (size correctly reported), then
the doc2000.h modification is correct and enough?
2. ops.ooboffs = offs; is intended here, or actually a bug?
3. what I can do next to find why no data is written?
reply other threads:[~2008-07-29 10:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080729095834.GA3291@debian \
--to=lark@linux.net.cn \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox