public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kyungmin Park <kyungmin78@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [Invitation] (No Subject) @ Sat Jul 12 11am – 12pm ()
Date: Fri, 11 Jul 2008 18:47:36 -0700	[thread overview]
Message-ID: <001636283794b5bc410451c9d7a3@google.com> (raw)

u-boot-users at lists.sourceforge.net, you are invited to

Title: (No Subject)
Time: Sat Jul 12 11am ? 12pm (Timezone: Seoul)
Calendar: 
Description: 

On Sat, Jul 12, 2008 at 6:43 AM, Scott Wood  wrote:
&gt; On Mon, Jul 07, 2008 at 11:22:56AM +0900, Kyungmin Park wrote:
&gt;&gt; +static int part_validate_onenand(struct mtdids *id, struct part_info *part)
&gt;&gt; +{
&gt;&gt; +#if defined(CONFIG_CMD_ONENAND)
&gt;&gt; + ? ? /* info for OneNAND chips */
&gt;&gt; + ? ? struct mtd_info *mtd;
&gt;&gt; +
&gt;&gt; + ? ? mtd = &onenand_mtd;
&gt;&gt; +
&gt;&gt; + ? ? if ((unsigned long)(part-&gt;offset) % mtd-&gt;erasesize) {
&gt;&gt; + ? ? ? ? ? ? printf("%s%d: partition (%s) start offset"
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? "alignment incorrect\n",
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? MTD_DEV_TYPE(id-&gt;type), id-&gt;num, part-&gt;name);
&gt;&gt; + ? ? ? ? ? ? return 1;
&gt;&gt; + ? ? }
&gt;&gt; +
&gt;&gt; + ? ? if (part-&gt;size % mtd-&gt;erasesize) {
&gt;&gt; + ? ? ? ? ? ? printf("%s%d: partition (%s) size alignment incorrect\n",
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? MTD_DEV_TYPE(id-&gt;type), id-&gt;num, part-&gt;name);
&gt;&gt; + ? ? ? ? ? ? return 1;
&gt;&gt; + ? ? }
&gt;&gt; +
&gt;&gt; + ? ? return 0;
&gt;&gt; +#else
&gt;&gt; + ? ? return 1;
&gt;&gt; +#endif
&gt;&gt; +}
&gt;
&gt; This looks like a duplicate of part_validate_nand (note that nand_info_t
&gt; is just an obfuscatory alias of struct mtd_info).
&gt;
&gt;&gt; +static int read_onenand_cached(u32 off, u32 size, u_char *buf)
&gt;&gt; +{
&gt;&gt; + ? ? u32 bytes_read = 0;
&gt;&gt; + ? ? size_t retlen;
&gt;&gt; + ? ? int cpy_bytes;
&gt;&gt; +
&gt;&gt; + ? ? while (bytes_read &lt; size) {
&gt;&gt; + ? ? ? ? ? ? if ((off + bytes_read &lt; onenand_cache_off) ||
&gt;&gt; + ? ? ? ? ? ? ? ? (off + bytes_read &gt;= onenand_cache_off + ONENAND_CACHE_SIZE)) {
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? onenand_cache_off = (off + bytes_read) & ONENAND_PAGE_MASK;
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? if (!onenand_cache) {
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* This memory never gets freed but 'cause
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?it's a bootloader, nobody cares */
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? onenand_cache = malloc(ONENAND_CACHE_SIZE);
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (!onenand_cache) {
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printf("read_onenand_cached: can't alloc cache size %d bytes\n",
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ONENAND_CACHE_SIZE);
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return -1;
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? }
&gt;&gt; +
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? retlen = ONENAND_CACHE_SIZE;
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? if (onenand_read(&onenand_mtd, onenand_cache_off, retlen,
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &retlen, onenand_cache) != 0 ||
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? retlen != ONENAND_CACHE_SIZE) {
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? printf("read_onenand_cached: error reading nand off %#x size %d bytes\n",
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? onenand_cache_off, ONENAND_CACHE_SIZE);
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? return -1;
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? }
&gt;&gt; + ? ? ? ? ? ? }
&gt;&gt; + ? ? ? ? ? ? cpy_bytes = onenand_cache_off + ONENAND_CACHE_SIZE - (off + bytes_read);
&gt;&gt; + ? ? ? ? ? ? if (cpy_bytes &gt; size - bytes_read)
&gt;&gt; + ? ? ? ? ? ? ? ? ? ? cpy_bytes = size - bytes_read;
&gt;&gt; + ? ? ? ? ? ? memcpy(buf + bytes_read,
&gt;&gt; + ? ? ? ? ? ? ? ? ? ?onenand_cache + off + bytes_read - onenand_cache_off,
&gt;&gt; + ? ? ? ? ? ? ? ? ? ?cpy_bytes);
&gt;&gt; + ? ? ? ? ? ? bytes_read += cpy_bytes;
&gt;&gt; + ? ? }
&gt;&gt; + ? ? return bytes_read;
&gt;&gt; +}
&gt;
&gt; I really would rather not duplicate all of this, which looks extremely
&gt; similar to regular NAND. ?Is there reason why we don't use the mtd_info
&gt; function pointer interface?

Agreed, It's almost same as NAND code.
Now nand code uses two modes, legacy and mtd. Because I don't want to break the NAND code , I used the duplicated code.
Basically it should be used the common mtd style code except legacy.

So first it added the current code, next time it tries to use the common interface and some code clean up.

Thank you,
Kyungmin Park

You can view this event at http://www.google.com/calendar/event?action=VIEW&eid=NDlrY25wdnZubGJwdTRtdHJmcjdjZGV0aW8gdS1ib290LXVzZXJzQGxpc3RzLnNvdXJjZWZvcmdlLm5ldA&tok=MjAja3l1bmdtaW43OEBnbWFpbC5jb20zZjU2NzIzMmFjMTNiYmFjNzI3MjcyYTNiM2IzYzM0ZjE5ZTE0ZWZl&ctz=Asia%2FSeoul&hl=en



You are receiving this courtesy email at the account u-boot-users at lists.sourceforge.net because you are an attendee of this event.

To stop receiving future notifications for this event, decline this event. Alternatively you can sign up for a Google account at http://www.google.com/calendar/ and control your notification settings for your entire calendar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080711/3cccfa38/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/calendar
Size: 5084 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080711/3cccfa38/attachment.icz 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: invite.ics
Type: application/ics
Size: 5084 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080711/3cccfa38/attachment.bin 

                 reply	other threads:[~2008-07-12  1:47 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=001636283794b5bc410451c9d7a3@google.com \
    --to=kyungmin78@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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