Merge with git+ssh://sr@pollux.denx.org/home/wd/git/u-boot/from_stefan
authorStefan Roese <sr@denx.de>
Fri, 10 Aug 2007 18:38:35 +0000 (20:38 +0200)
committerStefan Roese <sr@denx.de>
Fri, 10 Aug 2007 18:38:35 +0000 (20:38 +0200)
drivers/nand/nand_util.c
include/div64.h [moved from include/asm-avr32/div64.h with 100% similarity]
lib_avr32/Makefile
lib_generic/Makefile
lib_generic/div64.c [moved from lib_avr32/div64.c with 97% similarity]

index 88c1df6..aee8727 100644 (file)
@@ -37,6 +37,7 @@
 #include <command.h>
 #include <watchdog.h>
 #include <malloc.h>
+#include <div64.h>
 
 #include <nand.h>
 #include <jffs2/jffs2.h>
@@ -208,10 +209,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
                }
 
                if (!opts->quiet) {
-                       int percent = (int)
-                               ((unsigned long long)
+                        unsigned long long n =(unsigned long long)
                                 (erase.addr+meminfo->erasesize-opts->offset)
-                                * 100 / erase_length);
+                                * 100;
+                       int percent = (int)do_div(n, erase_length);
 
                        /* output progress message only at whole percent
                         * steps to reduce the number of messages printed
@@ -475,10 +476,9 @@ int nand_write_opts(nand_info_t *meminfo, const nand_write_options_t *opts)
                imglen -= readlen;
 
                if (!opts->quiet) {
-                       int percent = (int)
-                               ((unsigned long long)
-                                (opts->length-imglen) * 100
-                                / opts->length);
+                        unsigned long long n = (unsigned long long)
+                                (opts->length-imglen) * 100;
+                       int percent = (int)do_div(n, opts->length);
                        /* output progress message only at whole percent
                         * steps to reduce the number of messages printed
                         * on (slow) serial consoles
@@ -651,10 +651,9 @@ int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts)
                }
 
                if (!opts->quiet) {
-                       int percent = (int)
-                               ((unsigned long long)
-                                (opts->length-imglen) * 100
-                                / opts->length);
+                        unsigned long long n = (unsigned long long)
+                                (opts->length-imglen) * 100;
+                       int percent = (int)do_div(n ,opts->length);
                        /* output progress message only at whole percent
                         * steps to reduce the number of messages printed
                         * on (slow) serial consoles
similarity index 100%
rename from include/asm-avr32/div64.h
rename to include/div64.h
index cf20836..bb2938f 100644 (file)
@@ -29,7 +29,7 @@ LIB   = $(obj)lib$(ARCH).a
 
 SOBJS  = memset.o
 
-COBJS  = board.o interrupts.o avr32_linux.o div64.o
+COBJS  = board.o interrupts.o avr32_linux.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
index b2091c5..bf37752 100644 (file)
@@ -27,7 +27,7 @@ LIB   = $(obj)libgeneric.a
 
 COBJS  = bzlib.o bzlib_crctable.o bzlib_decompress.o \
          bzlib_randtable.o bzlib_huffman.o \
-         crc32.o ctype.o display_options.o ldiv.o sha1.o \
+         crc32.o ctype.o display_options.o div64.o ldiv.o sha1.o \
          string.o vsprintf.o zlib.o
 
 SRCS   := $(COBJS:.o=.c)
similarity index 97%
rename from lib_avr32/div64.c
rename to lib_generic/div64.c
index 99726e3..d9951b5 100644 (file)
@@ -18,8 +18,6 @@
 
 #include <linux/types.h>
 
-#include <asm/div64.h>
-
 uint32_t __div64_32(uint64_t *n, uint32_t base)
 {
        uint64_t rem = *n;