From 207b1150c00d0471c11669cd3f249d81909b3ac8 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Fri, 7 Oct 2016 05:38:35 +0100 Subject: ARM: 8619/1: udelay: document the various constants Explain where the value for UDELAY_MULT and UDELAY_SHIFT come from. Also fix/clarify some comments pertaining to their usage in the assembly code. Signed-off-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/lib/delay-loop.S | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'arch/arm/lib') diff --git a/arch/arm/lib/delay-loop.S b/arch/arm/lib/delay-loop.S index 792c59d885bc..c766694e929c 100644 --- a/arch/arm/lib/delay-loop.S +++ b/arch/arm/lib/delay-loop.S @@ -17,24 +17,23 @@ .LC1: .word UDELAY_MULT /* + * loops = r0 * HZ * loops_per_jiffy / 1000000 + * * r0 <= 2000 * HZ <= 1000 */ ENTRY(__loop_udelay) ldr r2, .LC1 - mul r0, r2, r0 -ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0x7fffff06 + mul r0, r2, r0 @ r0 = delay_us * UDELAY_MULT +ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0xfffffaf0 ldr r2, .LC0 ldr r2, [r2] - umull r1, r0, r2, r0 - adds r1, r1, #0xffffffff - adcs r0, r0, r0 + umull r1, r0, r2, r0 @ r0-r1 = r0 * loops_per_jiffy + adds r1, r1, #0xffffffff @ rounding up ... + adcs r0, r0, r0 @ and right shift by 31 reteq lr -/* - * loops = r0 * HZ * loops_per_jiffy / 1000000 - */ .align 3 @ Delay routine -- cgit v1.2.3