<div style="padding:10px 7px; font-size:12px; line-height:1.4 font-family:Arial,Sans-serif; text-align:center;"><div><a href="http://www.google.com/calendar/"><img style="border-width:0" src="http://www.google.com/calendar/images/blue_beta_en.gif" alt="Google Calendar"></a></div>
<div style="width:370px; background:#D2E6D2; border-style:solid; border-color:#ccc; border-width:1px 1px 0 1px; padding:15px 15px 5px 15px; margin:0 auto"><p style="margin:0;color:#0">u-boot-users@lists.sourceforge.net,
you are invited to</p>
<h2 style="margin:5px 0; font-size:18px; line-height:1.4;color:#0">(No Subject)</h2>
<p style="margin:0 0 .5em;"><span style="color:#0">Sat Jul 12 11am – 12pm</span>
<br>
<span style="color:#676;">(Timezone:
Seoul)</span>
<br>
<span style="color:#0"></span>
<br>
<span style="color:#0">Calendar:
</span></p>
<p style="margin:0 0 1em;color:#0; white-space:pre-wrap !important; white-space:-moz-pre-wrap !important; white-space:-pre-wrap !important; white-space:-o-pre-wrap !important; white-space:pre; word-wrap:break-word;">
<br>
<br>On Sat, Jul 12, 2008 at 6:43 AM, Scott Wood <<a href="mailto:scottwood@freescale.com">scottwood@freescale.com</a>> wrote:
<br>> On Mon, Jul 07, 2008 at 11:22:56AM +0900, Kyungmin Park wrote:
<br>>> +static int part_validate_onenand(struct mtdids *id, struct part_info *part)
<br>>> +{
<br>>> +#if defined(CONFIG_CMD_ONENAND)
<br>>> +     /* info for OneNAND chips */
<br>>> +     struct mtd_info *mtd;
<br>>> +
<br>>> +     mtd = &onenand_mtd;
<br>>> +
<br>>> +     if ((unsigned long)(part->offset) % mtd->erasesize) {
<br>>> +             printf("%s%d: partition (%s) start offset"
<br>>> +                     "alignment incorrect\n",
<br>>> +                             MTD_DEV_TYPE(id->type), id->num, part->name);
<br>>> +             return 1;
<br>>> +     }
<br>>> +
<br>>> +     if (part->size % mtd->erasesize) {
<br>>> +             printf("%s%d: partition (%s) size alignment incorrect\n",
<br>>> +                             MTD_DEV_TYPE(id->type), id->num, part->name);
<br>>> +             return 1;
<br>>> +     }
<br>>> +
<br>>> +     return 0;
<br>>> +#else
<br>>> +     return 1;
<br>>> +#endif
<br>>> +}
<br>>
<br>> This looks like a duplicate of part_validate_nand (note that nand_info_t
<br>> is just an obfuscatory alias of struct mtd_info).
<br>>
<br>>> +static int read_onenand_cached(u32 off, u32 size, u_char *buf)
<br>>> +{
<br>>> +     u32 bytes_read = 0;
<br>>> +     size_t retlen;
<br>>> +     int cpy_bytes;
<br>>> +
<br>>> +     while (bytes_read < size) {
<br>>> +             if ((off + bytes_read < onenand_cache_off) ||
<br>>> +                 (off + bytes_read >= onenand_cache_off + ONENAND_CACHE_SIZE)) {
<br>>> +                     onenand_cache_off = (off + bytes_read) & ONENAND_PAGE_MASK;
<br>>> +                     if (!onenand_cache) {
<br>>> +                             /* This memory never gets freed but 'cause
<br>>> +                                it's a bootloader, nobody cares */
<br>>> +                             onenand_cache = malloc(ONENAND_CACHE_SIZE);
<br>>> +                             if (!onenand_cache) {
<br>>> +                                     printf("read_onenand_cached: can't alloc cache size %d bytes\n",
<br>>> +                                            ONENAND_CACHE_SIZE);
<br>>> +                                     return -1;
<br>>> +                             }
<br>>> +                     }
<br>>> +
<br>>> +                     retlen = ONENAND_CACHE_SIZE;
<br>>> +                     if (onenand_read(&onenand_mtd, onenand_cache_off, retlen,
<br>>> +                                             &retlen, onenand_cache) != 0 ||
<br>>> +                                     retlen != ONENAND_CACHE_SIZE) {
<br>>> +                             printf("read_onenand_cached: error reading nand off %#x size %d bytes\n",
<br>>> +                                     onenand_cache_off, ONENAND_CACHE_SIZE);
<br>>> +                             return -1;
<br>>> +                     }
<br>>> +             }
<br>>> +             cpy_bytes = onenand_cache_off + ONENAND_CACHE_SIZE - (off + bytes_read);
<br>>> +             if (cpy_bytes > size - bytes_read)
<br>>> +                     cpy_bytes = size - bytes_read;
<br>>> +             memcpy(buf + bytes_read,
<br>>> +                    onenand_cache + off + bytes_read - onenand_cache_off,
<br>>> +                    cpy_bytes);
<br>>> +             bytes_read += cpy_bytes;
<br>>> +     }
<br>>> +     return bytes_read;
<br>>> +}
<br>>
<br>> I really would rather not duplicate all of this, which looks extremely
<br>> similar to regular NAND.  Is there reason why we don't use the mtd_info
<br>> function pointer interface?
<br>
<br>Agreed, It's almost same as NAND code.
<br>Now nand code uses two modes, legacy and mtd. Because I don't want to break the NAND code , I used the duplicated code.
<br>Basically it should be used the common mtd style code except legacy.
<br>
<br>So first it added the current code, next time it tries to use the common interface and some code clean up.
<br>
<br>Thank you,
<br>Kyungmin Park<br><a href="http://www.google.com/calendar/event?action=VIEW&eid=NDlrY25wdnZubGJwdTRtdHJmcjdjZGV0aW8gdS1ib290LXVzZXJzQGxpc3RzLnNvdXJjZWZvcmdlLm5ldA&tok=MjAja3l1bmdtaW43OEBnbWFpbC5jb20zZjU2NzIzMmFjMTNiYmFjNzI3MjcyYTNiM2IzYzM0ZjE5ZTE0ZWZl&ctz=Asia%2FSeoul&hl=en">More event details»</a></p>
<div style="margin:.5em 0 0; text-align:center;color:#0"><strong>Will you attend?</strong></div>
<div style="margin:4px 0 0; text-align:center;"><span style="background:#fff; border:1px solid #676; padding:3px 5px; line-height:1.5;"><a href="http://www.google.com/calendar/event?action=RESPOND&eid=NDlrY25wdnZubGJwdTRtdHJmcjdjZGV0aW8gdS1ib290LXVzZXJzQGxpc3RzLnNvdXJjZWZvcmdlLm5ldA&rst=1&tok=MjAja3l1bmdtaW43OEBnbWFpbC5jb20zZjU2NzIzMmFjMTNiYmFjNzI3MjcyYTNiM2IzYzM0ZjE5ZTE0ZWZl&ctz=Asia%2FSeoul&hl=en">Yes</a>
|<a href="http://www.google.com/calendar/event?action=RESPOND&eid=NDlrY25wdnZubGJwdTRtdHJmcjdjZGV0aW8gdS1ib290LXVzZXJzQGxpc3RzLnNvdXJjZWZvcmdlLm5ldA&rst=3&tok=MjAja3l1bmdtaW43OEBnbWFpbC5jb20zZjU2NzIzMmFjMTNiYmFjNzI3MjcyYTNiM2IzYzM0ZjE5ZTE0ZWZl&ctz=Asia%2FSeoul&hl=en">Maybe</a>
|<a href="http://www.google.com/calendar/event?action=RESPOND&eid=NDlrY25wdnZubGJwdTRtdHJmcjdjZGV0aW8gdS1ib290LXVzZXJzQGxpc3RzLnNvdXJjZWZvcmdlLm5ldA&rst=2&tok=MjAja3l1bmdtaW43OEBnbWFpbC5jb20zZjU2NzIzMmFjMTNiYmFjNzI3MjcyYTNiM2IzYzM0ZjE5ZTE0ZWZl&ctz=Asia%2FSeoul&hl=en">No</a></span></div></div>
<div><img src="http://www.google.com/calendar/images/envelope.gif" style="background:#D2E6D2; width:420px height:95px" alt=""></div><p style="margin:-15px 0 0;"> </p>
<p style="color:#676;">You are receiving this courtesy email at the account u-boot-users@lists.sourceforge.net because you are an attendee of this event.</p><p style="color:#676;">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.</p></div>