summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/delta/nand.c8
-rw-r--r--board/zylonite/nand.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/board/delta/nand.c b/board/delta/nand.c
index e87d502..85a6ba2 100644
--- a/board/delta/nand.c
+++ b/board/delta/nand.c
@@ -193,7 +193,7 @@ static unsigned long get_delta(unsigned long start)
static void wait_us(unsigned long us)
{
unsigned long start = OSCR;
- us *= OSCR_CLK_FREQ;
+ us = DIV_ROUND_UP(us * OSCR_CLK_FREQ, 1000);
while (get_delta(start) < us) {
/* do nothing */
@@ -214,9 +214,11 @@ static unsigned long dfc_wait_event(unsigned long event)
if(!event)
return 0xff000000;
else if(event & (NDSR_CS0_CMDD | NDSR_CS0_BBD))
- timeout = CONFIG_SYS_NAND_PROG_ERASE_TO * OSCR_CLK_FREQ;
+ timeout = DIV_ROUND_UP(CONFIG_SYS_NAND_PROG_ERASE_TO
+ * OSCR_CLK_FREQ, 1000);
else
- timeout = CONFIG_SYS_NAND_OTHER_TO * OSCR_CLK_FREQ;
+ timeout = DIV_ROUND_UP(CONFIG_SYS_NAND_OTHER_TO
+ * OSCR_CLK_FREQ, 1000);
while(1) {
ndsr = NDSR;
diff --git a/board/zylonite/nand.c b/board/zylonite/nand.c
index bec54cb..7cad1ac 100644
--- a/board/zylonite/nand.c
+++ b/board/zylonite/nand.c
@@ -198,7 +198,7 @@ static unsigned long get_delta(unsigned long start)
static void wait_us(unsigned long us)
{
unsigned long start = OSCR;
- us *= OSCR_CLK_FREQ;
+ us = DIV_ROUND_UP(us * OSCR_CLK_FREQ, 1000);
while (get_delta(start) < us) {
/* do nothing */
@@ -219,9 +219,11 @@ static unsigned long dfc_wait_event(unsigned long event)
if(!event)
return 0xff000000;
else if(event & (NDSR_CS0_CMDD | NDSR_CS0_BBD))
- timeout = CONFIG_SYS_NAND_PROG_ERASE_TO * OSCR_CLK_FREQ;
+ timeout = DIV_ROUND_UP(CONFIG_SYS_NAND_PROG_ERASE_TO
+ * OSCR_CLK_FREQ, 1000);
else
- timeout = CONFIG_SYS_NAND_OTHER_TO * OSCR_CLK_FREQ;
+ timeout = DIV_ROUND_UP(CONFIG_SYS_NAND_OTHER_TO
+ * OSCR_CLK_FREQ, 1000);
while(1) {
ndsr = NDSR;