All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
@ 2009-08-29  4:00 Kyungmin Park
  2009-09-18 19:26 ` Scott Wood
  0 siblings, 1 reply; 8+ messages in thread
From: Kyungmin Park @ 2009-08-29  4:00 UTC (permalink / raw)
  To: u-boot

Some CPU has internal OneNAND controller and use it for access OneNAND

To support these CPU, we provide the onenand_board_init
Also we can override the onenand_read_page.

Some minor fixed:
- Remove unnecessary header file
- Fix wrong access at read interrupt
- The recent OneNAND has 4KiB pagesize

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index 63995ce..22baebb 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -24,7 +24,6 @@
  */
 
 #include <common.h>
-#include <version.h>
 
 #include "onenand_ipl.h"
 
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 412572a..2257063 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -29,7 +29,14 @@
 #define THIS_ONENAND(a)         (CONFIG_SYS_ONENAND_BASE + (a))
 
 #define READ_INTERRUPT()                                                \
-	onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
+				onenand_readw(ONENAND_REG_INTERRUPT)
 
+enum {
+	ONENAND_USE_DEFAULT,
+	ONENAND_USE_GENERIC,
+};
+
+extern int (*onenand_read_page)(ulong block, ulong page,
+				u_char *buf, int pagesize);
 extern int onenand_read_block(unsigned char *buf);
 #endif
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index d1a842d..7fc0c62 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005-2008 Samsung Electronis
+ * (C) Copyright 2005-2009 Samsung Electronics
  * Kyungmin Park <kyungmin.park@samsung.com>
  *
  * See file CREDITS for list of people who contributed to this
@@ -37,8 +37,11 @@
 extern void *memcpy32(void *dest, void *src, int size);
 #endif
 
+int (*onenand_read_page)(ulong block, ulong page,
+				u_char *buf, int pagesize);
+
 /* read a page with ECC */
-static inline int onenand_read_page(ulong block, ulong page,
+static int generic_onenand_read_page(ulong block, ulong page,
 				u_char * buf, int pagesize)
 {
 	unsigned long *base;
@@ -89,9 +92,29 @@ static inline int onenand_read_page(ulong block, ulong page,
 	return 0;
 }
 
-#define ONENAND_START_PAGE		1
+#ifndef CONFIG_ONENAND_START_PAGE
+#define CONFIG_ONENAND_START_PAGE	1
+#endif
 #define ONENAND_PAGES_PER_BLOCK		64
 
+#ifndef CONFIG_ONENAND_BOARD_INIT
+static int onenand_generic_init(int *page_is_4KiB, int *page)
+{
+	int dev_id, density;
+
+	if (onenand_readw(ONENAND_REG_TECHNOLOGY))
+		*page_is_4KiB = 1;
+	dev_id = onenand_readw(ONENAND_REG_DEVICE_ID);
+	density = dev_id >> ONENAND_DEVICE_DENSITY_SHIFT;
+	density &= ONENAND_DEVICE_DENSITY_MASK;
+	if (density >= ONENAND_DEVICE_DENSITY_4Gb &&
+	    !(dev_id & ONENAND_DEVICE_IS_DDP))
+		*page_is_4KiB = 1;
+
+	return ONENAND_USE_DEFAULT;
+}
+#endif
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *                      of OneNAND, skipping bad blocks
@@ -99,24 +122,31 @@ static inline int onenand_read_page(ulong block, ulong page,
  */
 int onenand_read_block(unsigned char *buf)
 {
-	int block;
-	int page = ONENAND_START_PAGE, offset = 0;
-	int pagesize = 0, erase_shift = 0;
-	int erasesize = 0, nblocks = 0;
+	int block, nblocks;
+	int page = CONFIG_ONENAND_START_PAGE, offset = 0;
+	int pagesize, erasesize, erase_shift;
+	int page_is_4KiB = 0, ret;
+
+	pagesize = 2048; /* OneNAND has 2KiB pagesize */
+	erase_shift = 17;
+	onenand_read_page = generic_onenand_read_page;
+
+#ifdef CONFIG_ONENAND_BOARD_INIT
+	onenand_board_init(&page_is_4KiB, &page);
+#else
+	onenand_generic_init(&page_is_4KiB, &page);
+#endif
 
-	if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
-		pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
+	if (page_is_4KiB) {
+		pagesize = 4096; /* OneNAND has 4KiB pagesize */
 		erase_shift = 18;
-	} else {
-		pagesize = 2048;
-		erase_shift = 17;
 	}
 
-	erasesize = ONENAND_PAGES_PER_BLOCK * pagesize;
+	erasesize = (1 << erase_shift);
 	nblocks = (CONFIG_SYS_MONITOR_LEN + erasesize - 1) >> erase_shift;
 
 	/* NOTE: you must read page from page 1 of block 0 */
-	/* read the block page by page*/
+	/* read the block page by page */
 	for (block = 0; block < nblocks; block++) {
 		for (; page < ONENAND_PAGES_PER_BLOCK; page++) {
 			if (onenand_read_page(block, page, buf + offset,

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
  2009-08-29  4:00 [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support Kyungmin Park
@ 2009-09-18 19:26 ` Scott Wood
  2009-09-19  1:32   ` Kyungmin Park
  0 siblings, 1 reply; 8+ messages in thread
From: Scott Wood @ 2009-09-18 19:26 UTC (permalink / raw)
  To: u-boot

On Sat, Aug 29, 2009 at 01:00:59PM +0900, Kyungmin Park wrote:
>  #define READ_INTERRUPT()                                                \
> -	onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
> +				onenand_readw(ONENAND_REG_INTERRUPT)

You could get rid of the newline now...

> +enum {
> +	ONENAND_USE_DEFAULT,
> +	ONENAND_USE_GENERIC,
> +};

What is this?  Add a comment, and possibly more specific names.

> +extern int (*onenand_read_page)(ulong block, ulong page,
> +				u_char *buf, int pagesize);

Maybe use a weak function instead?  Or an #ifdef
CONFIG_SYS_ONENAND_BOARD_READ_PAGE that will keep the code for the
generic version from being in the image (it'd be nice if we could
optimize out replaced weak functions).  It seems especially odd that you
use one method for init and another for read page.

>  /* read a page with ECC */
> -static inline int onenand_read_page(ulong block, ulong page,
> +static int generic_onenand_read_page(ulong block, ulong page,
>  				u_char * buf, int pagesize)

Is the "generic" code really generic, or is it just one specific
controller?

> +#ifdef CONFIG_ONENAND_BOARD_INIT

This should probably be CONFIG_SYS_ONENAND_BOARD_INIT -- it's not
tweakable by the end user.

How is this different from the existing CONFIG_USE_ONENAND_BOARD_INIT?

> +	onenand_board_init(&page_is_4KiB, &page);
> +#else
> +	onenand_generic_init(&page_is_4KiB, &page);
> +#endif
>  
> -	if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
> -		pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
> +	if (page_is_4KiB) {
> +		pagesize = 4096; /* OneNAND has 4KiB pagesize */
>  		erase_shift = 18;
> -	} else {
> -		pagesize = 2048;
> -		erase_shift = 17;
>  	}

I don't understand why you move the pagesize/erase_shift init before
onenand_board_init, suggesting that the init code change it if it needs
changing -- but then leave the page_is_4KiB stuff in the generic code.

This should probably just be filled in by the init code without anything
here.

-Scott

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
  2009-09-18 19:26 ` Scott Wood
@ 2009-09-19  1:32   ` Kyungmin Park
  2009-09-21 16:15     ` Scott Wood
  0 siblings, 1 reply; 8+ messages in thread
From: Kyungmin Park @ 2009-09-19  1:32 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 19, 2009 at 4:26 AM, Scott Wood <scottwood@freescale.com> wrote:
> On Sat, Aug 29, 2009 at 01:00:59PM +0900, Kyungmin Park wrote:
>> ?#define READ_INTERRUPT() ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> - ? ? onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? onenand_readw(ONENAND_REG_INTERRUPT)
>
> You could get rid of the newline now...

It exceeds the 80 columns.

>
>> +enum {
>> + ? ? ONENAND_USE_DEFAULT,
>> + ? ? ONENAND_USE_GENERIC,
>> +};
>
> What is this? ?Add a comment, and possibly more specific names.

I see redefine the specific names and comments.

>
>> +extern int (*onenand_read_page)(ulong block, ulong page,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char *buf, int pagesize);
>
> Maybe use a weak function instead? ?Or an #ifdef
> CONFIG_SYS_ONENAND_BOARD_READ_PAGE that will keep the code for the
> generic version from being in the image (it'd be nice if we could
> optimize out replaced weak functions). ?It seems especially odd that you
> use one method for init and another for read page.

I tried to use weak function but it produces more than expected. as
you know it got size limitation.
When use the weak function. the apollon board will be broken.
and I don't want to use #ifdef. since Now we support two different
CPUs, s5pc100, s5pc110. these accesses different way. s5pc100 use own
OneNAND controller. but s5pc110 use generic OneNAND method.
That's reason to define the function pointer.

>
>> ?/* read a page with ECC */
>> -static inline int onenand_read_page(ulong block, ulong page,
>> +static int generic_onenand_read_page(ulong block, ulong page,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char * buf, int pagesize)
>
> Is the "generic" code really generic, or is it just one specific
> controller?

The 'generic' means the original OneNAND access method. Use NOR
interface and use OneNAND registers.
Most and Most generic method.

Only Samsung SoCs, s3c64xx series, and s5pc100 uses their own OneNAND
controller.

>
>> +#ifdef CONFIG_ONENAND_BOARD_INIT
>
> This should probably be CONFIG_SYS_ONENAND_BOARD_INIT -- it's not
> tweakable by the end user.
>
> How is this different from the existing CONFIG_USE_ONENAND_BOARD_INIT?

Okay l try to consider how to use same configurations.

>
>> + ? ? onenand_board_init(&page_is_4KiB, &page);
>> +#else
>> + ? ? onenand_generic_init(&page_is_4KiB, &page);
>> +#endif
>>
>> - ? ? if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
>> - ? ? ? ? ? ? pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
>> + ? ? if (page_is_4KiB) {
>> + ? ? ? ? ? ? pagesize = 4096; /* OneNAND has 4KiB pagesize */
>> ? ? ? ? ? ? ? erase_shift = 18;
>> - ? ? } else {
>> - ? ? ? ? ? ? pagesize = 2048;
>> - ? ? ? ? ? ? erase_shift = 17;
>> ? ? ? }
>
> I don't understand why you move the pagesize/erase_shift init before
> onenand_board_init, suggesting that the init code change it if it needs
> changing -- but then leave the page_is_4KiB stuff in the generic code.
>
> This should probably just be filled in by the init code without anything
> here.

No different. basically I assume OneNAND has 2KiB pagesize and
In special case, MLC, and 4KiB pagesize OneNAND set the 4KiB pagesize.

If you want to leave as before. no problem.

Please consider the code size and don't want to break exsiting board support.
That's reason I can't use weak function and use #ifdef at onenand_board_init.

Thank you,
Kyungmin Park

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
  2009-09-19  1:32   ` Kyungmin Park
@ 2009-09-21 16:15     ` Scott Wood
  2009-09-21 23:52       ` Kyungmin Park
  0 siblings, 1 reply; 8+ messages in thread
From: Scott Wood @ 2009-09-21 16:15 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 19, 2009 at 10:32:30AM +0900, Kyungmin Park wrote:
> On Sat, Sep 19, 2009 at 4:26 AM, Scott Wood <scottwood@freescale.com> wrote:
> > On Sat, Aug 29, 2009 at 01:00:59PM +0900, Kyungmin Park wrote:
> >> ?#define READ_INTERRUPT() ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> >> - ? ? onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? onenand_readw(ONENAND_REG_INTERRUPT)
> >
> > You could get rid of the newline now...
> 
> It exceeds the 80 columns.

No it doesn't, anymore.  You'll note that the start of onenand_readw() in to
the right of the end of READ_INTERRUPT, so you're not saving any horizontal
space with the newline.

> >> +enum {
> >> + ? ? ONENAND_USE_DEFAULT,
> >> + ? ? ONENAND_USE_GENERIC,
> >> +};
> >
> > What is this? ?Add a comment, and possibly more specific names.
> 
> I see redefine the specific names and comments.
> 
> >
> >> +extern int (*onenand_read_page)(ulong block, ulong page,
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char *buf, int pagesize);
> >
> > Maybe use a weak function instead? ?Or an #ifdef
> > CONFIG_SYS_ONENAND_BOARD_READ_PAGE that will keep the code for the
> > generic version from being in the image (it'd be nice if we could
> > optimize out replaced weak functions). ?It seems especially odd that you
> > use one method for init and another for read page.
> 
> I tried to use weak function but it produces more than expected.

More than compiling both functions and choosing with a function pointer?

> as you know it got size limitation. When use the weak function. the
> apollon board will be broken. 

Broken how?  Size?

> and I don't want to use #ifdef. since Now we support two different CPUs,
> s5pc100, s5pc110. these accesses different way. s5pc100 use own OneNAND
> controller. but s5pc110 use generic OneNAND method. That's reason to
> define the function pointer.

Function pointers make sense if you want to override on a per-device basis
(i.e. multiple controller types in the same system) or dynamically
(different hardware handled by the same binary).  Are you trying to generate
one image that works on both s5pc100 and s5pc110?  That sounds pretty
luxurious for a space-constrained NAND bootstrap. :-)

> >> ?/* read a page with ECC */
> >> -static inline int onenand_read_page(ulong block, ulong page,
> >> +static int generic_onenand_read_page(ulong block, ulong page,
> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char * buf, int pagesize)
> >
> > Is the "generic" code really generic, or is it just one specific
> > controller?
> 
> The 'generic' means the original OneNAND access method. Use NOR
> interface and use OneNAND registers.
> Most and Most generic method.

OK, good; it was never clear to me just which hardware the existing onenand
code has been targeting; I had gotten the impression that it was for one of
the chips with a custom controller.

Better, though, would be to still have good separation between that
implementation and the infrastructure that is truly generic even when you
have a special controller.  This is something I don't like about the current
NAND code.

> >> + ? ? onenand_board_init(&page_is_4KiB, &page);
> >> +#else
> >> + ? ? onenand_generic_init(&page_is_4KiB, &page);
> >> +#endif
> >>
> >> - ? ? if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
> >> - ? ? ? ? ? ? pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
> >> + ? ? if (page_is_4KiB) {
> >> + ? ? ? ? ? ? pagesize = 4096; /* OneNAND has 4KiB pagesize */
> >> ? ? ? ? ? ? ? erase_shift = 18;
> >> - ? ? } else {
> >> - ? ? ? ? ? ? pagesize = 2048;
> >> - ? ? ? ? ? ? erase_shift = 17;
> >> ? ? ? }
> >
> > I don't understand why you move the pagesize/erase_shift init before
> > onenand_board_init, suggesting that the init code change it if it needs
> > changing -- but then leave the page_is_4KiB stuff in the generic code.
> >
> > This should probably just be filled in by the init code without anything
> > here.
> 
> No different. basically I assume OneNAND has 2KiB pagesize and
> In special case, MLC, and 4KiB pagesize OneNAND set the 4KiB pagesize.
> 
> If you want to leave as before. no problem.
> 
> Please consider the code size

It seems to me that just having the replaceable init function fill in the
page size would be smaller than having non-replaceable code that passes a
pointer in and then decides on the basis what was written there.

> and don't want to break exsiting board support.

I don't see how this additional bit of refactoring would put other boards at
higher risk of breaking that what you're already doing.  For any board that
doesn't override onenand_board_init (and since that's a new capability,
there should not be any that do yet), you're just moving something from one
part of generic code to another.

-Scott

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
  2009-09-21 16:15     ` Scott Wood
@ 2009-09-21 23:52       ` Kyungmin Park
  0 siblings, 0 replies; 8+ messages in thread
From: Kyungmin Park @ 2009-09-21 23:52 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 22, 2009 at 1:15 AM, Scott Wood <scottwood@freescale.com> wrote:
> On Sat, Sep 19, 2009 at 10:32:30AM +0900, Kyungmin Park wrote:
>> On Sat, Sep 19, 2009 at 4:26 AM, Scott Wood <scottwood@freescale.com> wrote:
>> > On Sat, Aug 29, 2009 at 01:00:59PM +0900, Kyungmin Park wrote:
>> >> ?#define READ_INTERRUPT() ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> >> - ? ? onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
>> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? onenand_readw(ONENAND_REG_INTERRUPT)
>> >
>> > You could get rid of the newline now...
>>
>> It exceeds the 80 columns.
>
> No it doesn't, anymore. ?You'll note that the start of onenand_readw() in to
> the right of the end of READ_INTERRUPT, so you're not saving any horizontal
> space with the newline.

Right, change it.

>
>> >> +enum {
>> >> + ? ? ONENAND_USE_DEFAULT,
>> >> + ? ? ONENAND_USE_GENERIC,
>> >> +};
>> >
>> > What is this? ?Add a comment, and possibly more specific names.
>>
>> I see redefine the specific names and comments.

At this time no need to it. remove it.

>>
>> >
>> >> +extern int (*onenand_read_page)(ulong block, ulong page,
>> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char *buf, int pagesize);
>> >
>> > Maybe use a weak function instead? ?Or an #ifdef
>> > CONFIG_SYS_ONENAND_BOARD_READ_PAGE that will keep the code for the
>> > generic version from being in the image (it'd be nice if we could
>> > optimize out replaced weak functions). ?It seems especially odd that you
>> > use one method for init and another for read page.
>>
>> I tried to use weak function but it produces more than expected.
>
> More than compiling both functions and choosing with a function pointer?

Weak function itself. when using the weak function. it create more
than function pointer.

>
>> as you know it got size limitation. When use the weak function. the
>> apollon board will be broken.
>
> Broken how? ?Size?

Yes, I'm under pressure of size limitation.

>
>> and I don't want to use #ifdef. since Now we support two different CPUs,
>> s5pc100, s5pc110. these accesses different way. s5pc100 use own OneNAND
>> controller. but s5pc110 use generic OneNAND method. That's reason to
>> define the function pointer.
>
> Function pointers make sense if you want to override on a per-device basis
> (i.e. multiple controller types in the same system) or dynamically
> (different hardware handled by the same binary). ?Are you trying to generate
> one image that works on both s5pc100 and s5pc110? ?That sounds pretty
> luxurious for a space-constrained NAND bootstrap. :-)

Now I used the two different CPUs. s5pc100 and s5pc110. also these
cpus have different interface. Own controller and generic,
respectively. Of course Now it supports both at one image.
That's reason to introduce the onenand_board_init at onenand IPL.
Right. it's some luxurious but need to maintain several boards. It requires it.

>
>> >> ?/* read a page with ECC */
>> >> -static inline int onenand_read_page(ulong block, ulong page,
>> >> +static int generic_onenand_read_page(ulong block, ulong page,
>> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char * buf, int pagesize)
>> >
>> > Is the "generic" code really generic, or is it just one specific
>> > controller?
>>
>> The 'generic' means the original OneNAND access method. Use NOR
>> interface and use OneNAND registers.
>> Most and Most generic method.
>
> OK, good; it was never clear to me just which hardware the existing onenand
> code has been targeting; I had gotten the impression that it was for one of
> the chips with a custom controller.
>
> Better, though, would be to still have good separation between that
> implementation and the infrastructure that is truly generic even when you
> have a special controller. ?This is something I don't like about the current
> NAND code.
>
>> >> + ? ? onenand_board_init(&page_is_4KiB, &page);
>> >> +#else
>> >> + ? ? onenand_generic_init(&page_is_4KiB, &page);
>> >> +#endif
>> >>
>> >> - ? ? if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
>> >> - ? ? ? ? ? ? pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
>> >> + ? ? if (page_is_4KiB) {
>> >> + ? ? ? ? ? ? pagesize = 4096; /* OneNAND has 4KiB pagesize */
>> >> ? ? ? ? ? ? ? erase_shift = 18;
>> >> - ? ? } else {
>> >> - ? ? ? ? ? ? pagesize = 2048;
>> >> - ? ? ? ? ? ? erase_shift = 17;
>> >> ? ? ? }
>> >
>> > I don't understand why you move the pagesize/erase_shift init before
>> > onenand_board_init, suggesting that the init code change it if it needs
>> > changing -- but then leave the page_is_4KiB stuff in the generic code.
>> >
>> > This should probably just be filled in by the init code without anything
>> > here.
>>
>> No different. basically I assume OneNAND has 2KiB pagesize and
>> In special case, MLC, and 4KiB pagesize OneNAND set the 4KiB pagesize.
>>
>> If you want to leave as before. no problem.
>>
>> Please consider the code size
>
> It seems to me that just having the replaceable init function fill in the
> page size would be smaller than having non-replaceable code that passes a
> pointer in and then decides on the basis what was written there.
>
>> and don't want to break exsiting board support.
>
> I don't see how this additional bit of refactoring would put other boards at
> higher risk of breaking that what you're already doing. ?For any board that
> doesn't override onenand_board_init (and since that's a new capability,
> there should not be any that do yet), you're just moving something from one
> part of generic code to another.

At this time I just refactoring the code and then I will add board
specific patch later.

Thank you,
Kyungmin Park

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
  2009-10-07  3:12 ` Kyungmin Park
@ 2009-10-19 19:51   ` Scott Wood
  0 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2009-10-19 19:51 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 07, 2009 at 12:12:16PM +0900, Kyungmin Park wrote:
> Sorry, there's typo.
> 
> Here's fixed patch.

Please resend the amended patch, complete with changelog, without trailing
quoted material, so that I can just apply one e-mail.

-Scott

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
  2009-10-07  1:24 Kyungmin Park
@ 2009-10-07  3:12 ` Kyungmin Park
  2009-10-19 19:51   ` Scott Wood
  0 siblings, 1 reply; 8+ messages in thread
From: Kyungmin Park @ 2009-10-07  3:12 UTC (permalink / raw)
  To: u-boot

Sorry, there's typo.

Here's fixed patch.

diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 8d0df81..47b60b3 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -110,6 +110,14 @@ static void onenand_generic_init(int
*page_is_4KiB, int *page)
                *page_is_4KiB = 1;
 }

+static int __onenand_board_init(int *page_is_4KiB, int *page)
+{
+       return 0;
+}
+
+int onenand_board_init(int *page_is_4KiB, int *page)
+       __attribute__((weak, alias("__onenand_board_init")));
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *                      of OneNAND, skipping bad blocks
@@ -120,11 +128,13 @@ int onenand_read_block(unsigned char *buf)
        int block, nblocks;
        int page = CONFIG_ONENAND_START_PAGE, offset = 0;
        int pagesize, erasesize, erase_shift;
-       int page_is_4KiB = 0;
+       int page_is_4KiB = 0, ret;

        onenand_read_page = generic_onenand_read_page;

-       onenand_generic_init(&page_is_4KiB, &page);
+       ret = onenand_board_init(&page_is_4KiB, &page);
+       if (!ret)
+               onenand_generic_init(&page_is_4KiB, &page);

        if (page_is_4KiB) {
                pagesize = 4096; /* OneNAND has 4KiB pagesize */


On Wed, Oct 7, 2009 at 10:24 AM, Kyungmin Park <kmpark@infradead.org> wrote:
> Some Samsung SoCs, s3c64xx, s5pc100 has own OneNAND controller
> and different OneNAND access method.
> To support this, each board has own init and set onenand_read_page for it.
>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
> index 8d0df81..47b60b3 100644
> --- a/onenand_ipl/onenand_read.c
> +++ b/onenand_ipl/onenand_read.c
> @@ -110,6 +110,14 @@ static void onenand_generic_init(int *page_is_4KiB, int *page)
> ? ? ? ? ? ? ? ?*page_is_4KiB = 1;
> ?}
>
> +static int __onenand_board_init(int *page_is_4KiB, int *page)
> +{
> + ? ? ? return 0;
> +}
> +
> +int onenand_board_init(int *page_is_4KiB, int *page)
> + ? ? ? __attribute__((weak, alias("__onenand_board_init")));
> +
> ?/**
> ?* onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
> ?* ? ? ? ? ? ? ? ? ? ? ?of OneNAND, skipping bad blocks
> @@ -120,11 +128,13 @@ int onenand_read_block(unsigned char *buf)
> ? ? ? ?int block, nblocks;
> ? ? ? ?int page = CONFIG_ONENAND_START_PAGE, offset = 0;
> ? ? ? ?int pagesize, erasesize, erase_shift;
> - ? ? ? int page_is_4KiB = 0;
> + ? ? ? int page_is_4KiB = 0, ret;
>
> ? ? ? ?onenand_read_page = generic_onenand_read_page;
>
> - ? ? ? onenand_generic_init(&page_is_4KiB, &page);
> + ? ? ? ret = onenand_board_init(&page_is_4KiB, &page);
> + ? ? ? if (ret)
> + ? ? ? ? ? ? ? onenand_generic_init(&page_is_4KiB, &page);
>
> ? ? ? ?if (page_is_4KiB) {
> ? ? ? ? ? ? ? ?pagesize = 4096; /* OneNAND has 4KiB pagesize */
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support
@ 2009-10-07  1:24 Kyungmin Park
  2009-10-07  3:12 ` Kyungmin Park
  0 siblings, 1 reply; 8+ messages in thread
From: Kyungmin Park @ 2009-10-07  1:24 UTC (permalink / raw)
  To: u-boot

Some Samsung SoCs, s3c64xx, s5pc100 has own OneNAND controller
and different OneNAND access method.
To support this, each board has own init and set onenand_read_page for it.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 8d0df81..47b60b3 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -110,6 +110,14 @@ static void onenand_generic_init(int *page_is_4KiB, int *page)
 		*page_is_4KiB = 1;
 }
 
+static int __onenand_board_init(int *page_is_4KiB, int *page)
+{
+	return 0;
+}
+
+int onenand_board_init(int *page_is_4KiB, int *page)
+	__attribute__((weak, alias("__onenand_board_init")));
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *                      of OneNAND, skipping bad blocks
@@ -120,11 +128,13 @@ int onenand_read_block(unsigned char *buf)
 	int block, nblocks;
 	int page = CONFIG_ONENAND_START_PAGE, offset = 0;
 	int pagesize, erasesize, erase_shift;
-	int page_is_4KiB = 0;
+	int page_is_4KiB = 0, ret;
 
 	onenand_read_page = generic_onenand_read_page;
 
-	onenand_generic_init(&page_is_4KiB, &page);
+	ret = onenand_board_init(&page_is_4KiB, &page);
+	if (ret)
+		onenand_generic_init(&page_is_4KiB, &page);
 
 	if (page_is_4KiB) {
 		pagesize = 4096; /* OneNAND has 4KiB pagesize */

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-10-19 19:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-29  4:00 [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support Kyungmin Park
2009-09-18 19:26 ` Scott Wood
2009-09-19  1:32   ` Kyungmin Park
2009-09-21 16:15     ` Scott Wood
2009-09-21 23:52       ` Kyungmin Park
2009-10-07  1:24 Kyungmin Park
2009-10-07  3:12 ` Kyungmin Park
2009-10-19 19:51   ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.