[U-Boot] [PATCH] OneNAND: S5PC100 OneNAND IPL support

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com --- diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h index 412572a..b43ddfb 100644 --- a/onenand_ipl/onenand_ipl.h +++ b/onenand_ipl/onenand_ipl.h @@ -31,5 +31,14 @@ #define READ_INTERRUPT() \ onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
+#ifdef CONFIG_S5PC1XX +#define AHB_ADDR 0xB0000000 +#define MEM_ADDR(fba, fpa, fsa) ((fba) << 13 | (fpa) << 7 | (fsa) << 5) +#define CMD_MAP_01(mem_addr) (AHB_ADDR | (1 << 26) | (mem_addr)) +#define CMD_MAP_11(addr) (AHB_ADDR | (3 << 26) | ((addr) << 2)) +#undef onenand_readw +#define onenand_readw(a) (readl(CMD_MAP_11((a) >> 1)) & 0xffff) +#endif + 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..7ffc9a9 100644 --- a/onenand_ipl/onenand_read.c +++ b/onenand_ipl/onenand_read.c @@ -37,6 +37,23 @@ extern void *memcpy32(void *dest, void *src, int size); #endif
+#ifdef CONFIG_S5PC1XX +static inline int onenand_read_page(ulong block, ulong page, + u_char * buf, int pagesize) +{ + unsigned int *p = (unsigned int *) buf; + int mem_addr, i; + + mem_addr = MEM_ADDR(block, page, 0); + + pagesize >>= 2; + + for (i = 0; i < pagesize; i++) + *p++ = readl(CMD_MAP_01(mem_addr)); + + return 0; +} +#else /* read a page with ECC */ static inline int onenand_read_page(ulong block, ulong page, u_char * buf, int pagesize) @@ -88,6 +105,7 @@ static inline int onenand_read_page(ulong block, ulong page,
return 0; } +#endif
#define ONENAND_START_PAGE 1 #define ONENAND_PAGES_PER_BLOCK 64

On 09:55 Tue 21 Jul , Kyungmin Park wrote:
S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
is there any better than put soc specific code in generic implementatioN
Best Regards, J.

On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 09:55 Tue 21 Jul , Kyungmin Park wrote:
S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
is there any better than put soc specific code in generic implementatioN
I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.
Thank you, Kyungmin Park

On 14:28 Fri 24 Jul , Kyungmin Park wrote:
On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 09:55 Tue 21 Jul , Kyungmin Park wrote:
S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
is there any better than put soc specific code in generic implementatioN
I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.
I known so what do you propose?
Best Regards, J.

On Tue, Jul 28, 2009 at 5:09 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 14:28 Fri 24 Jul , Kyungmin Park wrote:
On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 09:55 Tue 21 Jul , Kyungmin Park wrote:
S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
is there any better than put soc specific code in generic implementatioN
I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.
I known so what do you propose?
just commit the patch I sent. It's difficult to remove the ifdef since size limitation.
Thank you, Kyungmin Park

On 07:58 Tue 28 Jul , Kyungmin Park wrote:
On Tue, Jul 28, 2009 at 5:09 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 14:28 Fri 24 Jul , Kyungmin Park wrote:
On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 09:55 Tue 21 Jul , Kyungmin Park wrote:
S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
is there any better than put soc specific code in generic implementatioN
I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.
I known so what do you propose?
just commit the patch I sent. It's difficult to remove the ifdef since size limitation.
I understand your problem of size but is there any otherway to do ti without the onenand soc controler ?
I'll prefer we find a way to not put soc specific code in the generic code maybe we can crete a header which will be soc specific or a generic that we will include depending on the soc
Best Regards, J.

On Tue, Jul 28, 2009 at 10:42 PM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 07:58 Tue 28 Jul , Kyungmin Park wrote:
On Tue, Jul 28, 2009 at 5:09 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 14:28 Fri 24 Jul , Kyungmin Park wrote:
On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe PLAGNIOL-VILLARDplagnioj@jcrosoft.com wrote:
On 09:55 Tue 21 Jul , Kyungmin Park wrote:
S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.
Signed-off-by: Kyungmin Park kyungmin.park@samsung.com
is there any better than put soc specific code in generic implementatioN
I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.
I known so what do you propose?
just commit the patch I sent. It's difficult to remove the ifdef since size limitation.
I understand your problem of size but is there any otherway to do ti without the onenand soc controler ?
No, no way we should use soc controller.
I'll prefer we find a way to not put soc specific code in the generic code maybe we can crete a header which will be soc specific or a generic that we will include depending on the soc
something like weak alias?
The new problem is now I want to support S5PC100 & S5PC110 Samsung SoC simultaneously. But these has different interface. c100 has CMD_MAP method, c110 has similar generic but different. At runtime it detects the cpu id and determine which read function is used. At this case, s5pc100/c110 has no size limitation because of internal ROM code. At boot it loads 16KiB and 8KiB data to internal RAM respectively.
Okay I will try to make it generic and resend it after finishing the port s5pc110 works
Thank you, Kyungmin Park
Best Regards, J.

I'll prefer we find a way to not put soc specific code in the generic code maybe we can crete a header which will be soc specific or a generic that we will include depending on the soc
something like weak alias?
The new problem is now I want to support S5PC100 & S5PC110 Samsung SoC simultaneously. But these has different interface. c100 has CMD_MAP method, c110 has similar generic but different. At runtime it detects the cpu id and determine which read function is used. At this case, s5pc100/c110 has no size limitation because of internal ROM code. At boot it loads 16KiB and 8KiB data to internal RAM respectively.
Okay I will try to make it generic and resend it after finishing the port s5pc110 works
ok so this patch will be add at the same thime of the s5pc110 in the next branch
Best Regards, J.
participants (2)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Kyungmin Park