From: David Brownell <david-b@pacbell.net>
To: Nicolas Pitre <nico@cam.org>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] MTD: fix dataflash 64-bit divisions
Date: Wed, 17 Dec 2008 09:47:38 -0800 [thread overview]
Message-ID: <200812170947.38709.david-b@pacbell.net> (raw)
In-Reply-To: <alpine.LFD.2.00.0812171205290.30035@xanadu.home>
On Wednesday 17 December 2008, Nicolas Pitre wrote:
> On Wed, 17 Dec 2008, Artem Bityutskiy wrote:
>
> > - if ((instr->addr + instr->len) > mtd->size
> > - || (instr->len % priv->page_size) != 0
> > - || (instr->addr % priv->page_size) != 0)
> > + if (instr->addr + instr->len > mtd->size)
> > + return -EINVAL;
> > + tmp = instr->len;
> > + if (do_div(tmp, priv->page_size))
> > + return -EINVAL;
> > + tmp = instr->addr;
> > + if (do_div(tmp, priv->page_size))
> > return -EINVAL;
>
> Is it possible to have priv->page_size not a power of two?
Yes, and in fact it's probably more common to have some
extra bytes at the end of a page. See the table right
before dataflash_probe(); the one before jedec_probe()
lists parts that can be made to use binary page sizes.
If these were NAND chips you'd think of it as OOB area ...
except it's addressible the normal way. In particular,
the common "read all bytes starting at page N" operation
include those extra bytes. And you *do* want to use
those primitives, to avoid a roundtrip over SPI for each
1056 or 528 (etc) page.
next prev parent reply other threads:[~2008-12-17 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-17 16:50 [PATCH] MTD: fix dataflash 64-bit divisions Artem Bityutskiy
2008-12-17 17:15 ` Nicolas Pitre
2008-12-17 17:47 ` David Brownell [this message]
2008-12-18 6:20 ` Artem Bityutskiy
2008-12-17 17:56 ` David Brownell
2008-12-18 6:26 ` Artem Bityutskiy
2008-12-18 6:59 ` David Brownell
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=200812170947.38709.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=nico@cam.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