Skip to contentSkip to conversation

Initial OneNAND support

PATCH New Kyungmin Park 3 participants 10 messages Mar 14, 2007 – Mar 15, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Initial OneNAND support

Hi

This patch supports OneNAND device on U-Boot. The most codes are based on OneNAND MTD in kernel.

For better performance I added 32-bytes aligned memcpy32. Pleae check it.

The OneNAND has been used for a long time. But not officially. This patch was tested apollon board. The apollon board patch is also sent soon.

Any comments are welcome.

Thank you,
Kyungmin Park
-------------- next part --------------
A non-text attachment was scrubbed...
Name: u-boot-1.2.0-onenand1.patch
Type: application/octet-stream
Size: 34721 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070314/91413160/attachment.obj

#3 lore raw

PATCH 1/3 Initial OneNAND support

In reply to Kyungmin Park

Dear Kyungmin Park,

Quoted 3 lines · in message <[email protected]> you…

This patch supports OneNAND device on U-Boot. The most codes are based on OneNAND MTD in kernel.

Your patches have a few cosing style issues (indentation not by TAB's, trailing white space). Please clean up and resubmet; see also
http://www.denx.de/wiki/UBoot/CodingStyle

Also, please restrict your line length no around 70 characters or so.

And can you please add a GPL license header to onenand/onenand_bbt.c, include/linux/mtd/bbm.h

Quoted 2 lines

For better performance I added 32-bytes aligned memcpy32. Pleae check it.

Did you measure how much of performance this gains? Is it really worth the effort? In any case, the file needs a GPL license header.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It's not an optical illusion, it just looks like one.   -- Phil White
#4 lore raw

PATCH 1/3 Initial OneNAND support

Dear Wolfgang Denk,

Quoted 7 lines
Quoted 3 lines

This patch supports OneNAND device on U-Boot. The most codes are based on OneNAND MTD in kernel.

Your patches have a few cosing style issues (indentation not by TAB's, trailing white space). Please clean up and resubmet; see also http://www.denx.de/wiki/UBoot/CodingStyle

Thank you, I use the 'indent' programe to fix indentation

Quoted 2 lines

Also, please restrict your line length no around 70 characters or so.

Since its code based on kernel and consistent with kernel. it has almost same syntax.

Quoted 3 lines

And can you please add a GPL license header to
onenand/onenand_bbt.c, include/linux/mtd/bbm.h

I added it.

Quoted 7 lines
Quoted 3 lines

For better performance I added 32-bytes aligned memcpy32. Pleae check it.

Did you measure how much of performance this gains? Is it
really worth the effort? In any case, the file needs a GPL
license header.

we can feel that it's more faster than before. OK I added GPL license

Thank you,
Kyungmin Park

#5 lore raw

PATCH 1/3 Initial OneNAND support

Quoted 4 lines · In message <[email protected]> you…
Quoted 2 lines

resubmet; see also http://www.denx.de/wiki/UBoot/CodingStyle

Thank you, I use the 'indent' programe to fix indentation

You may want to use "Lindent -pcs" instead, see
http://www.denx.de/wiki/UBoot/CodingStyle
as mentioned above.

Quoted 4 lines
Quoted 1 line

Also, please restrict your line length no around 70 characters or so.

Since its code based on kernel and consistent with kernel. it has almost same syntax.

So what?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

For better performance I added 32-bytes aligned memcpy32. Pleae check it.

Did you measure how much of performance this gains? Is it
really worth the effort? In any case, the file needs a GPL
license header.

we can feel that it's more faster than before. OK I added GPL license

How much? 5%? 20%? 50%?

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Hello! I'm from outer space,  and I've made myself look like a signa-
ture.  While  you  are reading this, I'm having sex with your eyes. I
know it feels good to you, because you're smiling. I'm very horny, so
send me to someone else when you've had enough. Thanks!
                              Sincerely, A Stranger in a Strange Land
#6 lore raw

PATCH 1/3 Initial OneNAND support

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Also, please restrict your line length no around 70

characters or so.

Quoted 3 lines

Since its code based on kernel and consistent with kernel. it has almost same syntax.

So what?

To maintain easily. as mentioned it's the first version of OneNAND driver in kernel. it's code is almost same in kernel 2.6.15.
After release I changed a lots of code. I will update it for OneNAND on U- Boot.

Quoted 1 line

Indentation not by TABs, trailing white space.

I changed it using 's/^ /^ /g', 's/ $/$/g'.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

For better performance I added 32-bytes aligned memcpy32. Pleae check it.

Did you measure how much of performance this gains? Is it really worth the effort? In any case, the file needs a

Quoted 7 lines

GPL license

Quoted 3 lines
Quoted 1 line

header.

we can feel that it's more faster than before. OK I added

GPL license

How much? 5%? 20%? 50%?

Architecture optimized copy is fast about 3 times in OMAP 16xx series (ARM 9 core) in U-Boot

Here's test results
memory copy (Unit: nsec) 96 MHz 192 MHz
unsigned long * 189,440 ~ 192,000 158,720 ~
160,000
architecture optimized copy 56,320 ~ 58,880 53,760 ~ 55,
040

where increment time is 2560 nsec in 96 MHz and 1280 nsec in 192 MHz

Thank you,
Kyungmin Park

#7 lore raw

PATCH 1/3 Initial OneNAND support

Quoted 4 lines · In message <[email protected]> you…
Quoted 2 lines

Indentation not by TABs, trailing white space.

I changed it using 's/^ /^ /g', 's/ $/$/g'.

Which is definitely not good enough.

Quoted 2 lines

Architecture optimized copy is fast about 3 times in OMAP 16xx series (ARM 9 core) in U-Boot

OK. Will the code work for non-ARM architectures?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Substitute "damn" every time you're inclined to write "very"; your
editor will delete it and the writing will be just as it should be.
                - Mark Twain
#8 lore raw

PATCH 1/3 Initial OneNAND support

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Indentation not by TABs, trailing white space.

I changed it using 's/^ /^ /g', 's/ $/$/g'.

Quoted 8 lines

Which is definitely not good enough.

Quoted 1 line

Architecture optimized copy is fast about 3 times in OMAP

16xx series

Quoted 2 lines

(ARM
9 core) in U-Boot

OK. Will the code work for non-ARM architectures?

Maybe not. I'm not famiar with other architectures.
Now most boards which use OneNAND are ARM Arch. so I only consider it. Sorry. We have to consider other architetures.

We can only use it in ARM by adding __ARM__ definition in onenand_base.c, otherwise use its own memcpy

+#ifdef __ARM__
extern void memcpy32(void *, void *, size_t);

static void *memcpy(void *dest, const void *src, size_t count)

{
        if (count < 32) {
                unsigned short *_s = (unsigned short *) (src);
                unsigned short *_d = (unsigned short *) (dest);
                count >>= 1;
                while (count--)
                        *_d++ = *_s++;
                return _d;
        }

        memcpy32(dest, src, count);

        return (void *) count;
}

+#endif

Thank you,
Kyungmin Park

#9 lore raw

PATCH 1/3 Initial OneNAND support

In reply to Kyungmin Park
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

For better performance I added 32-bytes aligned memcpy32. Pleae check it.

Did you measure how much of performance this gains? Is it really worth the effort? In any case, the file needs a

Quoted 7 lines

GPL license

Quoted 3 lines
Quoted 1 line

header.

we can feel that it's more faster than before. OK I added

GPL license

How much? 5%? 20%? 50%?

Architecture optimized copy is fast about 3 times in OMAP 16xx series (ARM 9 core) in U-Boot

Quoted 9 lines

Here's test results
memory copy (Unit: nsec) 96 MHz 192 MHz
unsigned long * 189,440 ~ 192,000 158,720 ~
160,000
architecture optimized copy 56,320 ~ 58,880 53,760 ~ 55,
040

where increment time is 2560 nsec in 96 MHz and 1280 nsec in 192 MHz

On the issue of architecture specific memcpy()s. There appears to be an issue with the ppc optimized memcpy() in that it assumes alignment of both source and destination buffers. Our solution was to disable architecture specific memcpy() routines. We did however need the performance of a long word copy so we made our own memcpy() routine that we use during elf load, this isn't very elegant however.

It would be useful to have a generic C version of memcpy/memset/etc() for 8, 16 and 32 (maybe 64), bit architectures. Maybe a macro with a SIZE parameter would be suitable for generating the functions. The implementation would likely be very similar to your memcpy32() and it would be quite a bit easier to add support for unaligned pointers to a C version of memcpy() vs. modifying the asm code for each architecture.

Chris