Skip to contentSkip to conversation

exynos: Correct use of 64-bit division

PATCH New Simon Glass 2 participants 4 messages Apr 13, 2013 – Apr 17, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 exynos: Correct use of 64-bit division

The current code is causing errors like this on my toolchains:

/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.22/ ld.bfd.real: failed to merge target specific data of file /usr/lib/gcc/ armv7a-cros-linux-gnueabi/4.7.x-google/libgcc.a(_divdi3.o)

Use do_div() to avoid this.

---
 arch/arm/cpu/armv7/s5p-common/timer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/s5p-common/timer.c +6 -1
index 6a0fa58..4adfaae 100644
@@ -24,6 +24,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 #include <asm/io.h>
 #include <asm/arch/pwm.h>
 #include <asm/arch/clk.h>
@@ -76,6 +77,8 @@ int timer_init(void)
  */
 unsigned long get_timer(unsigned long base)
 {
+	unsigned long long time_ms;
+
 	ulong now = timer_get_us_down();
 
 	/*
@@ -87,7 +90,9 @@ unsigned long get_timer(unsigned long base)
 	gd->arch.lastinc = now;
 
 	/* Divide by 1000 to convert from us to ms */
-	return gd->arch.timer_reset_value / 1000 - base;
+	time_ms = gd->arch.timer_reset_value;
+	do_div(time_ms, 1000);
+	return time_ms - base;
 }
 
 unsigned long timer_get_us(void)
Signature · 1 line
1.8.1.3
#1 lore raw

PATCH 2/2 exynos: fdt: Add TMU node for snow

Snow is missing a TMU node, and with TMU support this is not allowed, so it fails to boot. Add it.

---
 board/samsung/dts/exynos5250-snow.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
board/samsung/dts/exynos5250-snow.dts +14 -0
index 8b303bf..24658c1 100644
@@ -55,4 +55,18 @@
 			compatible = "maxim,max77686_pmic";
 		};
 	};
+
+	tmu at 10060000 {
+		samsung,min-temp	= <25>;
+		samsung,max-temp	= <125>;
+		samsung,start-warning	= <95>;
+		samsung,start-tripping	= <105>;
+		samsung,hw-tripping	= <110>;
+		samsung,efuse-min-value	= <40>;
+		samsung,efuse-value	= <55>;
+		samsung,efuse-max-value	= <100>;
+		samsung,slope		= <274761730>;
+		samsung,dc-value	= <25>;
+	};
+
 };
Signature · 1 line
1.8.1.3
#2 lore raw

PATCH 2/2 exynos: fdt: Add TMU node for snow

Quoted 22 lines · Simon Glass

Snow is missing a TMU node, and with TMU support this is not allowed, so it fails to boot. Add it.

---
 board/samsung/dts/exynos5250-snow.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
board/samsung/dts/exynos5250-snow.dts +5 -0
index 8b303bf..24658c1 100644
@@ -55,4 +55,18 @@
 			compatible = "maxim,max77686_pmic";
 		};
 	};
+
+	tmu at 10060000 {
+		samsung,min-temp	= <25>;
+		samsung,max-temp	= <125>;
+		samsung,start-warning	= <95>;

board/samsung/dts/exynos5250-snow.dts line 72

Quoted 10 lines
board/samsung/dts/exynos5250-snow.dts +9 -0
+		samsung,start-tripping	= <105>;
+		samsung,hw-tripping	= <110>;
+		samsung,efuse-min-value	= <40>;
+		samsung,efuse-value	= <55>;
+		samsung,efuse-max-value	= <100>;
+		samsung,slope		= <274761730>;
+		samsung,dc-value	= <25>;
+	};
+
 };

applied to u-boot-samsung

Thanks,
Minkyu Kang.

#3 lore raw

PATCH 1/2 exynos: Correct use of 64-bit division

In reply to Simon Glass
Quoted 36 lines · Simon Glass

The current code is causing errors like this on my toolchains:

/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.22/ ld.bfd.real: failed to merge target specific data of file /usr/lib/gcc/ armv7a-cros-linux-gnueabi/4.7.x-google/libgcc.a(_divdi3.o)

Use do_div() to avoid this.

---
 arch/arm/cpu/armv7/s5p-common/timer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/s5p-common/timer.c +3 -0
index 6a0fa58..4adfaae 100644
@@ -24,6 +24,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 #include <asm/io.h>
 #include <asm/arch/pwm.h>
 #include <asm/arch/clk.h>
@@ -76,6 +77,8 @@ int timer_init(void)
  */
 unsigned long get_timer(unsigned long base)
 {
+	unsigned long long time_ms;
+
 	ulong now = timer_get_us_down();
 
 	/*

arch/arm/cpu/armv7/s5p-common/timer.c unsigned long get_timer(unsigned long base) · line 98

Quoted 10 lines
arch/arm/cpu/armv7/s5p-common/timer.c +3 -1
@@ -87,7 +90,9 @@ unsigned long get_timer(unsigned long base)
 	gd->arch.lastinc = now;
 
 	/* Divide by 1000 to convert from us to ms */
-	return gd->arch.timer_reset_value / 1000 - base;
+	time_ms = gd->arch.timer_reset_value;
+	do_div(time_ms, 1000);
+	return time_ms - base;
 }
 
 unsigned long timer_get_us(void)

applied to u-boot-samsung

Thanks,
Minkyu Kang.