| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copied from <file:arch/powerpc/kernel/misc_32.S> |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 10 | 11 | * kexec bits: |
|---|
| 11 | 12 | * Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com> |
|---|
| 12 | 13 | * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is free software; you can redistribute it and/or |
|---|
| 15 | | - * modify it under the terms of the GNU General Public License |
|---|
| 16 | | - * as published by the Free Software Foundation; either version |
|---|
| 17 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 18 | | - * |
|---|
| 19 | 14 | */ |
|---|
| 20 | 15 | #include "ppc_asm.h" |
|---|
| 21 | 16 | |
|---|
| .. | .. |
|---|
| 23 | 18 | |
|---|
| 24 | 19 | .text |
|---|
| 25 | 20 | |
|---|
| 26 | | -/* udelay (on non-601 processors) needs to know the period of the |
|---|
| 21 | +/* udelay needs to know the period of the |
|---|
| 27 | 22 | * timebase in nanoseconds. This used to be hardcoded to be 60ns |
|---|
| 28 | 23 | * (period of 66MHz/4). Now a variable is used that is initialized to |
|---|
| 29 | 24 | * 60 for backward compatibility, but it can be overridden as necessary |
|---|
| .. | .. |
|---|
| 42 | 37 | */ |
|---|
| 43 | 38 | .globl udelay |
|---|
| 44 | 39 | udelay: |
|---|
| 45 | | - mfspr r4,SPRN_PVR |
|---|
| 46 | | - srwi r4,r4,16 |
|---|
| 47 | | - cmpwi 0,r4,1 /* 601 ? */ |
|---|
| 48 | | - bne .Ludelay_not_601 |
|---|
| 49 | | -00: li r0,86 /* Instructions / microsecond? */ |
|---|
| 50 | | - mtctr r0 |
|---|
| 51 | | -10: addi r0,r0,0 /* NOP */ |
|---|
| 52 | | - bdnz 10b |
|---|
| 53 | | - subic. r3,r3,1 |
|---|
| 54 | | - bne 00b |
|---|
| 55 | | - blr |
|---|
| 56 | | - |
|---|
| 57 | | -.Ludelay_not_601: |
|---|
| 58 | 40 | mulli r4,r3,1000 /* nanoseconds */ |
|---|
| 59 | 41 | /* Change r4 to be the number of ticks using: |
|---|
| 60 | 42 | * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns |
|---|