[U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support

Kyungmin Park
2009-10-07T01:24:48Z

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 */