public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv
@ 2013-12-05 19:48 Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 2/5] ARM:zynq: Correct __udelay " Tom Rini
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Tom Rini @ 2013-12-05 19:48 UTC (permalink / raw)
  To: u-boot

Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/arm/cpu/armv7/rmobile/timer.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/rmobile/timer.c b/arch/arm/cpu/armv7/rmobile/timer.c
index 72e0c12..67a5a7a 100644
--- a/arch/arm/cpu/armv7/rmobile/timer.c
+++ b/arch/arm/cpu/armv7/rmobile/timer.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 #include <asm/io.h>
 #include <asm/arch-armv7/globaltimer.h>
 #include <asm/arch/rmobile.h>
@@ -38,13 +39,12 @@ static u64 get_time_us(void)
 	u64 timer = get_cpu_global_timer();
 
 	timer = ((timer << 2) + (CLK2MHZ(CONFIG_SYS_CPU_CLK) >> 1));
-	timer /= (u64)CLK2MHZ(CONFIG_SYS_CPU_CLK);
-	return timer;
+	return lldiv(timer, CLK2MHZ(CONFIG_SYS_CPU_CLK));
 }
 
 static ulong get_time_ms(void)
 {
-	return (ulong)(get_time_us() / 1000);
+	return lldiv(get_time_us(), 1000);
 }
 
 int timer_init(void)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 2/5] ARM:zynq: Correct __udelay to use lldiv
  2013-12-05 19:48 [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Tom Rini
@ 2013-12-05 19:48 ` Tom Rini
  2013-12-16 14:16   ` [U-Boot] [U-Boot,2/5] " Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick " Tom Rini
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2013-12-05 19:48 UTC (permalink / raw)
  To: u-boot

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/arm/cpu/armv7/zynq/timer.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
index 636322a..2be253c 100644
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ b/arch/arm/cpu/armv7/zynq/timer.c
@@ -107,8 +107,7 @@ void __udelay(unsigned long usec)
 	if (usec == 0)
 		return;
 
-	countticks = (u32) (((unsigned long long) TIMER_TICK_HZ * usec) /
-								1000000);
+	countticks = lldiv(TIMER_TICK_HZ * usec, 1000000);
 
 	/* decrementing timer */
 	timeend = readl(&timer_base->counter) - countticks;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick to use lldiv
  2013-12-05 19:48 [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 2/5] ARM:zynq: Correct __udelay " Tom Rini
@ 2013-12-05 19:48 ` Tom Rini
  2013-12-06  1:15   ` Marek Vasut
  2013-12-16 14:16   ` [U-Boot] [U-Boot, " Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 4/5] JFFS2: Correct jffs2_1pass_build_lists " Tom Rini
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Tom Rini @ 2013-12-05 19:48 UTC (permalink / raw)
  To: u-boot

Cc: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/arm/cpu/pxa/timer.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
index 78d9f32..c4717de 100644
--- a/arch/arm/cpu/pxa/timer.c
+++ b/arch/arm/cpu/pxa/timer.c
@@ -28,12 +28,12 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static unsigned long long tick_to_time(unsigned long long tick)
 {
-	return tick * CONFIG_SYS_HZ / TIMER_FREQ_HZ;
+	return lldiv(tick * CONFIG_SYS_HZ, TIMER_FREQ_HZ);
 }
 
 static unsigned long long us_to_tick(unsigned long long us)
 {
-	return (us * TIMER_FREQ_HZ) / 1000000;
+	return lldiv(us * TIMER_FREQ_HZ, 1000000);
 }
 
 int timer_init(void)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 4/5] JFFS2: Correct jffs2_1pass_build_lists to use lldiv
  2013-12-05 19:48 [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 2/5] ARM:zynq: Correct __udelay " Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick " Tom Rini
@ 2013-12-05 19:48 ` Tom Rini
  2013-12-16 14:16   ` [U-Boot] [U-Boot, " Tom Rini
  2013-12-05 19:48 ` [U-Boot] [PATCH 5/5] yaffs2: Use lldiv for 64bit division Tom Rini
  2013-12-06  0:31 ` [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Nobuhiro Iwamatsu
  4 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2013-12-05 19:48 UTC (permalink / raw)
  To: u-boot

Since part_info size became 64bit we need to use lldiv here.

Signed-off-by: Tom Rini <trini@ti.com>
---
 fs/jffs2/jffs2_1pass.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index c856983..3fb5db3 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -114,6 +114,7 @@
 #include <common.h>
 #include <config.h>
 #include <malloc.h>
+#include <div64.h>
 #include <linux/stat.h>
 #include <linux/time.h>
 #include <watchdog.h>
@@ -1438,7 +1439,7 @@ jffs2_1pass_build_lists(struct part_info * part)
 {
 	struct b_lists *pL;
 	struct jffs2_unknown_node *node;
-	u32 nr_sectors = part->size/part->sector_size;
+	u32 nr_sectors;
 	u32 i;
 	u32 counter4 = 0;
 	u32 counterF = 0;
@@ -1447,6 +1448,7 @@ jffs2_1pass_build_lists(struct part_info * part)
 	u32 buf_size = DEFAULT_EMPTY_SCAN_SIZE;
 	char *buf;
 
+	nr_sectors = lldiv(part->size, part->sector_size);
 	/* turn off the lcd.  Refreshing the lcd adds 50% overhead to the */
 	/* jffs2 list building enterprise nope.  in newer versions the overhead is */
 	/* only about 5 %.  not enough to inconvenience people for. */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 5/5] yaffs2: Use lldiv for 64bit division
  2013-12-05 19:48 [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Tom Rini
                   ` (2 preceding siblings ...)
  2013-12-05 19:48 ` [U-Boot] [PATCH 4/5] JFFS2: Correct jffs2_1pass_build_lists " Tom Rini
@ 2013-12-05 19:48 ` Tom Rini
  2013-12-16 14:16   ` [U-Boot] [U-Boot,5/5] " Tom Rini
  2013-12-06  0:31 ` [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Nobuhiro Iwamatsu
  4 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2013-12-05 19:48 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Tom Rini <trini@ti.com>
---
 fs/yaffs2/yaffs_uboot_glue.c |    3 ++-
 fs/yaffs2/yaffsfs.c          |    5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c
index e113e40..50000a1 100644
--- a/fs/yaffs2/yaffs_uboot_glue.c
+++ b/fs/yaffs2/yaffs_uboot_glue.c
@@ -20,6 +20,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 
 #include <config.h>
 #include "nand.h"
@@ -184,7 +185,7 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
 	}
 
 	if (end_block == 0)
-		end_block = mtd->size / mtd->erasesize - 1;
+		end_block = lldiv(mtd->size, mtd->erasesize - 1);
 
 	if (end_block < start_block) {
 		printf("Bad start/end\n");
diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c
index ac4a010..334598e 100644
--- a/fs/yaffs2/yaffsfs.c
+++ b/fs/yaffs2/yaffsfs.c
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <div64.h>
 #include "yaffsfs.h"
 #include "yaffs_guts.h"
 #include "yaffscfg.h"
@@ -1603,8 +1604,8 @@ static int yaffsfs_DoStat(struct yaffs_obj *obj, struct yaffs_stat *buf)
 		buf->st_rdev = obj->yst_rdev;
 		buf->st_size = yaffs_get_obj_length(obj);
 		buf->st_blksize = obj->my_dev->data_bytes_per_chunk;
-		buf->st_blocks = (buf->st_size + buf->st_blksize - 1) /
-		    buf->st_blksize;
+		buf->st_blocks = lldiv(buf->st_size + buf->st_blksize - 1,
+		    buf->st_blksize);
 #if CONFIG_YAFFS_WINCE
 		buf->yst_wince_atime[0] = obj->win_atime[0];
 		buf->yst_wince_atime[1] = obj->win_atime[1];
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv
  2013-12-05 19:48 [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Tom Rini
                   ` (3 preceding siblings ...)
  2013-12-05 19:48 ` [U-Boot] [PATCH 5/5] yaffs2: Use lldiv for 64bit division Tom Rini
@ 2013-12-06  0:31 ` Nobuhiro Iwamatsu
  4 siblings, 0 replies; 11+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-12-06  0:31 UTC (permalink / raw)
  To: u-boot

Hi, Tom.

Thanks for your patch.
But I already sent a same patch as yours.
  http://patchwork.ozlabs.org/patch/294819/

Best regards,
  Nobuhiro

2013/12/6 Tom Rini <trini@ti.com>:
> Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> Signed-off-by: Tom Rini <trini@ti.com>
> ---
>  arch/arm/cpu/armv7/rmobile/timer.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/rmobile/timer.c b/arch/arm/cpu/armv7/rmobile/timer.c
> index 72e0c12..67a5a7a 100644
> --- a/arch/arm/cpu/armv7/rmobile/timer.c
> +++ b/arch/arm/cpu/armv7/rmobile/timer.c
> @@ -6,6 +6,7 @@
>   */
>
>  #include <common.h>
> +#include <div64.h>
>  #include <asm/io.h>
>  #include <asm/arch-armv7/globaltimer.h>
>  #include <asm/arch/rmobile.h>
> @@ -38,13 +39,12 @@ static u64 get_time_us(void)
>         u64 timer = get_cpu_global_timer();
>
>         timer = ((timer << 2) + (CLK2MHZ(CONFIG_SYS_CPU_CLK) >> 1));
> -       timer /= (u64)CLK2MHZ(CONFIG_SYS_CPU_CLK);
> -       return timer;
> +       return lldiv(timer, CLK2MHZ(CONFIG_SYS_CPU_CLK));
>  }
>
>  static ulong get_time_ms(void)
>  {
> -       return (ulong)(get_time_us() / 1000);
> +       return lldiv(get_time_us(), 1000);
>  }
>
>  int timer_init(void)
> --
> 1.7.9.5
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



-- 
Nobuhiro Iwamatsu

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick to use lldiv
  2013-12-05 19:48 ` [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick " Tom Rini
@ 2013-12-06  1:15   ` Marek Vasut
  2013-12-16 14:16   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 11+ messages in thread
From: Marek Vasut @ 2013-12-06  1:15 UTC (permalink / raw)
  To: u-boot

On Thursday, December 05, 2013 at 08:48:37 PM, Tom Rini wrote:
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Signed-off-by: Tom Rini <trini@ti.com>

Acked-by: Marek Vasut <marex@denx.de>

btw. how come you still CC this old address ? ;-)

> ---
>  arch/arm/cpu/pxa/timer.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
> index 78d9f32..c4717de 100644
> --- a/arch/arm/cpu/pxa/timer.c
> +++ b/arch/arm/cpu/pxa/timer.c
> @@ -28,12 +28,12 @@ DECLARE_GLOBAL_DATA_PTR;
> 
>  static unsigned long long tick_to_time(unsigned long long tick)
>  {
> -	return tick * CONFIG_SYS_HZ / TIMER_FREQ_HZ;
> +	return lldiv(tick * CONFIG_SYS_HZ, TIMER_FREQ_HZ);
>  }
> 
>  static unsigned long long us_to_tick(unsigned long long us)
>  {
> -	return (us * TIMER_FREQ_HZ) / 1000000;
> +	return lldiv(us * TIMER_FREQ_HZ, 1000000);
>  }
> 
>  int timer_init(void)

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-Boot,2/5] ARM:zynq: Correct __udelay to use lldiv
  2013-12-05 19:48 ` [U-Boot] [PATCH 2/5] ARM:zynq: Correct __udelay " Tom Rini
@ 2013-12-16 14:16   ` Tom Rini
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2013-12-16 14:16 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 05, 2013 at 02:48:36PM -0500, Tom Rini wrote:

> Cc: Michal Simek <monstr@monstr.eu>
> Signed-off-by: Tom Rini <trini@ti.com>
> 
> ---
> arch/arm/cpu/armv7/zynq/timer.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131216/e240dcae/attachment.pgp>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-Boot, 3/5] ARM:PXA: Correct tick_to_time / us_to_tick to use lldiv
  2013-12-05 19:48 ` [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick " Tom Rini
  2013-12-06  1:15   ` Marek Vasut
@ 2013-12-16 14:16   ` Tom Rini
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Rini @ 2013-12-16 14:16 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 05, 2013 at 02:48:37PM -0500, Tom Rini wrote:

> Cc: Marek Vasut <marek.vasut@gmail.com>
> Signed-off-by: Tom Rini <trini@ti.com>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131216/c54ddfdd/attachment.pgp>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-Boot, 4/5] JFFS2: Correct jffs2_1pass_build_lists to use lldiv
  2013-12-05 19:48 ` [U-Boot] [PATCH 4/5] JFFS2: Correct jffs2_1pass_build_lists " Tom Rini
@ 2013-12-16 14:16   ` Tom Rini
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2013-12-16 14:16 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 05, 2013 at 02:48:38PM -0500, Tom Rini wrote:

> Since part_info size became 64bit we need to use lldiv here.
> 
> Signed-off-by: Tom Rini <trini@ti.com>
> 
> ---
> fs/jffs2/jffs2_1pass.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131216/6f7ef4f5/attachment.pgp>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-Boot,5/5] yaffs2: Use lldiv for 64bit division
  2013-12-05 19:48 ` [U-Boot] [PATCH 5/5] yaffs2: Use lldiv for 64bit division Tom Rini
@ 2013-12-16 14:16   ` Tom Rini
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2013-12-16 14:16 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 05, 2013 at 02:48:39PM -0500, Tom Rini wrote:

> Signed-off-by: Tom Rini <trini@ti.com>
> 
> ---
> fs/yaffs2/yaffs_uboot_glue.c |    3 ++-
>  fs/yaffs2/yaffsfs.c          |    5 +++--
>  2 files changed, 5 insertions(+), 3 deletions(-)

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131216/61621518/attachment.pgp>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-12-16 14:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-05 19:48 [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Tom Rini
2013-12-05 19:48 ` [U-Boot] [PATCH 2/5] ARM:zynq: Correct __udelay " Tom Rini
2013-12-16 14:16   ` [U-Boot] [U-Boot,2/5] " Tom Rini
2013-12-05 19:48 ` [U-Boot] [PATCH 3/5] ARM:PXA: Correct tick_to_time / us_to_tick " Tom Rini
2013-12-06  1:15   ` Marek Vasut
2013-12-16 14:16   ` [U-Boot] [U-Boot, " Tom Rini
2013-12-05 19:48 ` [U-Boot] [PATCH 4/5] JFFS2: Correct jffs2_1pass_build_lists " Tom Rini
2013-12-16 14:16   ` [U-Boot] [U-Boot, " Tom Rini
2013-12-05 19:48 ` [U-Boot] [PATCH 5/5] yaffs2: Use lldiv for 64bit division Tom Rini
2013-12-16 14:16   ` [U-Boot] [U-Boot,5/5] " Tom Rini
2013-12-06  0:31 ` [U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv Nobuhiro Iwamatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox