Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 8306/1: loop_udelay: remove bogomips value limitation

Now that we don't support ARMv3 anymore, the loop based delay code can
convert microsecs into number of loops using a 64-bit multiplication
and more precision.

This allows us to lift the hard limit of 3355 on the bogomips value as
loops_per_jiffy may now safely span the full 32-bit range.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Nicolas Pitre and committed by
Russell King
215e362d 2374b063

+12 -14
+3 -3
arch/arm/include/asm/delay.h
··· 10 10 #include <asm/param.h> /* HZ */ 11 11 12 12 #define MAX_UDELAY_MS 2 13 - #define UDELAY_MULT ((UL(2199023) * HZ) >> 11) 14 - #define UDELAY_SHIFT 30 13 + #define UDELAY_MULT UL(2047 * HZ + 483648 * HZ / 1000000) 14 + #define UDELAY_SHIFT 31 15 15 16 16 #ifndef __ASSEMBLY__ 17 17 ··· 34 34 * it, it means that you're calling udelay() with an out of range value. 35 35 * 36 36 * With currently imposed limits, this means that we support a max delay 37 - * of 2000us. Further limits: HZ<=1000 and bogomips<=3355 37 + * of 2000us. Further limits: HZ<=1000 38 38 */ 39 39 extern void __bad_udelay(void); 40 40
+4 -1
arch/arm/lib/Makefile
··· 29 29 lib-y += io-readsw-armv4.o io-writesw-armv4.o 30 30 endif 31 31 32 - lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o 32 + ifeq ($(CONFIG_ARCH_RPC),y) 33 + lib-y += ecard.o io-acorn.o floppydma.o 34 + AFLAGS_delay-loop.o += -march=armv4 35 + endif 33 36 34 37 $(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S 35 38 $(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S
+5 -10
arch/arm/lib/delay-loop.S
··· 10 10 #include <linux/linkage.h> 11 11 #include <asm/assembler.h> 12 12 #include <asm/delay.h> 13 + 13 14 .text 14 15 15 16 .LC0: .word loops_per_jiffy ··· 18 17 19 18 /* 20 19 * r0 <= 2000 21 - * lpj <= 0x01ffffff (max. 3355 bogomips) 22 20 * HZ <= 1000 23 21 */ 24 22 ··· 25 25 ldr r2, .LC1 26 26 mul r0, r2, r0 27 27 ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0x7fffff06 28 - mov r1, #-1 29 28 ldr r2, .LC0 30 - ldr r2, [r2] @ max = 0x01ffffff 31 - add r0, r0, r1, lsr #32-14 32 - mov r0, r0, lsr #14 @ max = 0x0001ffff 33 - add r2, r2, r1, lsr #32-10 34 - mov r2, r2, lsr #10 @ max = 0x00007fff 35 - mul r0, r2, r0 @ max = 2^32-1 36 - add r0, r0, r1, lsr #32-6 37 - movs r0, r0, lsr #6 29 + ldr r2, [r2] 30 + umull r1, r0, r2, r0 31 + adds r1, r1, #0xffffffff 32 + adcs r0, r0, r0 38 33 reteq lr 39 34 40 35 /*