summaryrefslogtreecommitdiff
path: root/board/delta
diff options
context:
space:
mode:
authorMarkus Klotzbücher <Markus Klotzbümk@pollux.denx.de>2006-03-02 14:02:36 +0100
committerMarkus Klotzbücher <mk@pollux.denx.de>2006-03-02 14:02:36 +0100
commite2053f9c7a00ccce4ded50634e8b52138f6e88bc (patch)
tree332b806d81e8819b9c4efdba5834abdece23c6d1 /board/delta
parentbb1ff049fbac1a4edf8f0655071383e3837d337e (diff)
downloadu-boot-imx-e2053f9c7a00ccce4ded50634e8b52138f6e88bc.zip
u-boot-imx-e2053f9c7a00ccce4ded50634e8b52138f6e88bc.tar.gz
u-boot-imx-e2053f9c7a00ccce4ded50634e8b52138f6e88bc.tar.bz2
Moved the waiting loop for "Read Data Request" RDDREQ into the
delta_cmdfunc function, because this bit is only set once after a command is sent and this allows read functions to be called multiple times.
Diffstat (limited to 'board/delta')
-rw-r--r--board/delta/nand.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/board/delta/nand.c b/board/delta/nand.c
index 50d2ec2..da6430d 100644
--- a/board/delta/nand.c
+++ b/board/delta/nand.c
@@ -55,13 +55,6 @@ static void delta_read_buf(struct mtd_info *mtd, u_char* const buf, int len)
{
int i, j;
- while(1) {
- if(NDSR & NDSR_RDDREQ) {
- NDSR |= NDSR_RDDREQ;
- break;
- }
- }
-
/* we have to be carefull not to overflow the buffer if len is
* not a multiple of 4 */
unsigned long num_words = len & 0xfffffffc;
@@ -90,19 +83,25 @@ static void delta_read_buf(struct mtd_info *mtd, u_char* const buf, int len)
static unsigned long read_buf = 0;
static unsigned char bytes_read = 0;
+/* wait for read request */
+static void delta_wait_event(unsigned long event)
+{
+ if(!event)
+ return;
+
+ while(1) {
+ if(NDSR & event) {
+ NDSR |= event;
+ break;
+ }
+ }
+}
static u_char delta_read_byte(struct mtd_info *mtd)
{
/* struct nand_chip *this = mtd->priv; */
unsigned char byte;
if(bytes_read == 0) {
- /* wait for read request */
- while(1) {
- if(NDSR & NDSR_RDDREQ) {
- NDSR |= NDSR_RDDREQ;
- break;
- }
- }
read_buf = NDDB;
printk("delta_read_byte: 0x%x.\n", read_buf);
}
@@ -119,7 +118,7 @@ static void delta_cmdfunc(struct mtd_info *mtd, unsigned command,
int column, int page_addr)
{
/* register struct nand_chip *this = mtd->priv; */
- unsigned long ndcb0=0, ndcb1=0, ndcb2=0;
+ unsigned long ndcb0=0, ndcb1=0, ndcb2=0, event=0;
/* clear the ugly byte read buffer */
bytes_read = 0;
@@ -153,10 +152,12 @@ static void delta_cmdfunc(struct mtd_info *mtd, unsigned command,
((page_addr<<8) & 0xff00) |
((page_addr<<8) & 0xff0000) |
((page_addr<<8) & 0xff000000)); /* make this 0x01000000 ? */
+ event = NDSR_RDDREQ;
break;
case NAND_CMD_READID:
printk("delta_cmdfunc: NAND_CMD_READID.\n");
ndcb0 = (NAND_CMD_READID | (3 << 21) | (1 << 16)); /* addr cycles*/
+ event = NDSR_RDDREQ;
break;
case NAND_CMD_PAGEPROG:
break;
@@ -190,6 +191,9 @@ static void delta_cmdfunc(struct mtd_info *mtd, unsigned command,
NDCB0 = ndcb0;
NDCB0 = ndcb1;
NDCB0 = ndcb2;
+
+ /* wait for event */
+ delta_wait_event(event);
}
static void delta_dfc_gpio_init()