]> git.karo-electronics.de Git - karo-tx-linux.git/commit
MIPS: __delay CPU_DADDI_WORKAROUNDS bug fix
authorMaciej W. Rozycki <macro@linux-mips.org>
Mon, 31 Mar 2014 23:57:28 +0000 (00:57 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 12 May 2014 22:29:36 +0000 (00:29 +0200)
commit2db4bc3418c43f1e810b304c48f8ddff2535075b
tree70aecfaca9e45a7b2685ef3fb65f0cdf3f595e3a
parent824122a319d827d42aeb4646a3bf639937fdb2ce
MIPS: __delay CPU_DADDI_WORKAROUNDS bug fix

With CPU_DADDI_WORKAROUNDS enabled __delay assembles with a macro in a
branch delay slot:

{standard input}: Assembler messages:
{standard input}:18: Warning: Macro instruction expanded into multiple
instructions in a branch delay slot

and broken code results:

0000000000000000 <__delay>:
   0: 1480ffff  bnez a0,0 <__delay>
   4: 24010001  li at,1
   8: 0081202f  dsubu a0,a0,at
   c: 03e00008  jr ra
  10: 00000000  nop
  14: 00000000  nop

Consequently the function loops indefinitely, showing up prominently as a
hang in the delay loop calibration at bootstrap.

This change corrects the problem by forcing the immediate 1 into a
register while keeping code produced identical where CPU_DADDI_WORKAROUNDS
is disabled.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6669/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/lib/delay.c