From: Kyungmin Park <kmpark@infradead.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [ONENAND] Reduce OneNAND IPL code size
Date: Thu, 23 Oct 2008 09:54:52 +0900 [thread overview]
Message-ID: <20081023005452.GA13453@july> (raw)
To give more code at lowlevel_init at each boards
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/cpu/arm1136/start.S b/cpu/arm1136/start.S
index e622338..132cc4a 100644
--- a/cpu/arm1136/start.S
+++ b/cpu/arm1136/start.S
@@ -33,23 +33,7 @@
.globl _start
_start: b reset
#ifdef CONFIG_ONENAND_IPL
- ldr pc, _hang
- ldr pc, _hang
- ldr pc, _hang
- ldr pc, _hang
- ldr pc, _hang
- ldr pc, _hang
- ldr pc, _hang
-
-_hang:
- .word do_hang
- .word 0x12345678
- .word 0x12345678
- .word 0x12345678
- .word 0x12345678
- .word 0x12345678
- .word 0x12345678
- .word 0x12345678 /* now 16*4=64 */
+ . = _start + 64 /* now 16*4=64 */
#else
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
@@ -362,12 +346,7 @@ cpu_init_crit:
/*
* exception handlers
*/
-#ifdef CONFIG_ONENAND_IPL
- .align 5
-do_hang:
- ldr sp, _TEXT_BASE /* use 32 words about stack */
- bl hang /* hang and never return */
-#else /* !CONFIG_ONENAND IPL */
+#ifndef CONFIG_ONENAND_IPL
.align 5
undefined_instruction:
get_bad_stack
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index aff62d2..2440d8b 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -39,6 +39,7 @@ int print_info(void)
typedef int (init_fnc_t)(void);
+#ifdef CONFIG_USE_ONENAND_INIT
init_fnc_t *init_sequence[] = {
board_init, /* basic board dependent setup */
#ifdef CONFIG_SYS_PRINTF
@@ -47,24 +48,23 @@ init_fnc_t *init_sequence[] = {
#endif
NULL,
};
+#endif
void start_oneboot(void)
{
- init_fnc_t **init_fnc_ptr;
uchar *buf;
+#ifdef CONFIG_USE_ONENAND_INIT
+ init_fnc_t **init_fnc_ptr;
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0)
hang();
}
+#endif
buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
- if (!onenand_read_block0(buf))
- buf += ONENAND_BLOCK_SIZE;
-
- if (buf == (uchar *)CONFIG_SYS_LOAD_ADDR)
- hang();
+ onenand_read_block0(buf);
/* go run U-Boot and never return */
printf("Starting OS Bootloader...\n");
@@ -73,9 +73,11 @@ void start_oneboot(void)
/* should never come here */
}
+#ifdef CONFIG_USE_ONENAND_INIT
void hang(void)
{
/* if board_hang() returns, hange here */
printf("X-Loader hangs\n");
for (;;);
}
+#endif
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 3387998..438e58c 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -23,7 +23,7 @@
#include <linux/mtd/onenand_regs.h>
-#define ONENAND_BLOCK_SIZE 2048
+#define ONENAND_BLOCK_SIZE 0x20000
#ifndef CONFIG_SYS_PRINTF
#define printf(format, args...)
@@ -39,5 +39,5 @@
#define ONENAND_PAGE_SIZE 2048
-extern int onenand_read_block0(unsigned char *buf);
+extern void onenand_read_block0(unsigned char *buf);
#endif
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 6d04943..38703fb 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-2008 Samsung Electronics
* Kyungmin Park <kyungmin.park@samsung.com>
*
* See file CREDITS for list of people who contributed to this
@@ -87,14 +87,16 @@ static inline int onenand_read_page(ulong block, ulong page,
#define ONENAND_START_PAGE 1
#define ONENAND_PAGES_PER_BLOCK 64
+#ifndef CONFIG_ONENAND_END_BLOCK
+#define CONFIG_ONENAND_END_BLOCK 1
+#endif
/**
* onenand_read_block - Read a block data to buf
- * @return 0 on success
*/
-int onenand_read_block0(unsigned char *buf)
+void onenand_read_block0(unsigned char *buf)
{
- int page, offset = 0;
+ int block, page, offset = 0;
int pagesize = ONENAND_PAGE_SIZE;
/* MLC OneNAND has 4KiB page size */
@@ -103,12 +105,12 @@ int onenand_read_block0(unsigned char *buf)
/* NOTE: you must read page from page 1 of block 0 */
/* read the block page by page*/
- for (page = ONENAND_START_PAGE;
- page < ONENAND_PAGES_PER_BLOCK; page++) {
-
- onenand_read_page(0, page, buf + offset, pagesize);
- offset += pagesize;
+ page = ONENAND_START_PAGE;
+ for (block = 0; block < CONFIG_ONENAND_END_BLOCK; block++) {
+ for (; page < ONENAND_PAGES_PER_BLOCK; page++) {
+ onenand_read_page(block, page, buf + offset, pagesize);
+ offset += pagesize;
+ }
+ page = 0;
}
-
- return 0;
}
next reply other threads:[~2008-10-23 0:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-23 0:54 Kyungmin Park [this message]
2008-10-23 8:09 ` [U-Boot] [PATCH] [ONENAND] Reduce OneNAND IPL code size Wolfgang Denk
2008-10-23 8:39 ` Kyungmin Park
2008-10-23 9:13 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081023005452.GA13453@july \
--to=kmpark@infradead.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.