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

Kyungmin Park kmpark at infradead.org
Tue Jul 21 02:55:44 CEST 2009


S5PC100 has own OneNAND controller and has different interface.
OneNAND IPL use it to S5PC100 board.

Signed-off-by: Kyungmin Park <kyungmin.park at 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


More information about the U-Boot mailing list