xtensa: extract common CPU reset code into separate function
platform_restart implementatations do the same thing to reset CPU. Don't duplicate that code, move it to a function and call it from platform_restart. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
23c2b9321b
commit
4f2056873f
|
@ -69,4 +69,10 @@ extern int platform_pcibios_fixup (void);
|
||||||
*/
|
*/
|
||||||
extern void platform_calibrate_ccount (void);
|
extern void platform_calibrate_ccount (void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flush and reset the mmu, simulate a processor reset, and
|
||||||
|
* jump to the reset vector.
|
||||||
|
*/
|
||||||
|
void cpu_reset(void) __attribute__((noreturn));
|
||||||
|
|
||||||
#endif /* _XTENSA_PLATFORM_H */
|
#endif /* _XTENSA_PLATFORM_H */
|
||||||
|
|
|
@ -549,6 +549,29 @@ static int __init topology_init(void)
|
||||||
}
|
}
|
||||||
subsys_initcall(topology_init);
|
subsys_initcall(topology_init);
|
||||||
|
|
||||||
|
void cpu_reset(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__ ("movi a2, 15\n\t"
|
||||||
|
"wsr a2, icountlevel\n\t"
|
||||||
|
"movi a2, 0\n\t"
|
||||||
|
"wsr a2, icount\n\t"
|
||||||
|
#if XCHAL_NUM_IBREAK > 0
|
||||||
|
"wsr a2, ibreakenable\n\t"
|
||||||
|
#endif
|
||||||
|
#if XCHAL_HAVE_LOOPS
|
||||||
|
"wsr a2, lcount\n\t"
|
||||||
|
#endif
|
||||||
|
"movi a2, 0x1f\n\t"
|
||||||
|
"wsr a2, ps\n\t"
|
||||||
|
"isync\n\t"
|
||||||
|
"jx %0\n\t"
|
||||||
|
:
|
||||||
|
: "a" (XCHAL_RESET_VECTOR_VADDR)
|
||||||
|
: "a2");
|
||||||
|
for (;;)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
void machine_restart(char * cmd)
|
void machine_restart(char * cmd)
|
||||||
{
|
{
|
||||||
platform_restart();
|
platform_restart();
|
||||||
|
|
|
@ -53,25 +53,7 @@ void platform_restart(void)
|
||||||
{
|
{
|
||||||
/* Flush and reset the mmu, simulate a processor reset, and
|
/* Flush and reset the mmu, simulate a processor reset, and
|
||||||
* jump to the reset vector. */
|
* jump to the reset vector. */
|
||||||
|
cpu_reset();
|
||||||
__asm__ __volatile__("movi a2, 15\n\t"
|
|
||||||
"wsr a2, icountlevel\n\t"
|
|
||||||
"movi a2, 0\n\t"
|
|
||||||
"wsr a2, icount\n\t"
|
|
||||||
#if XCHAL_NUM_IBREAK > 0
|
|
||||||
"wsr a2, ibreakenable\n\t"
|
|
||||||
#endif
|
|
||||||
#if XCHAL_HAVE_LOOPS
|
|
||||||
"wsr a2, lcount\n\t"
|
|
||||||
#endif
|
|
||||||
"movi a2, 0x1f\n\t"
|
|
||||||
"wsr a2, ps\n\t"
|
|
||||||
"isync\n\t"
|
|
||||||
"jx %0\n\t"
|
|
||||||
:
|
|
||||||
: "a" (XCHAL_RESET_VECTOR_VADDR)
|
|
||||||
: "a2");
|
|
||||||
|
|
||||||
/* control never gets here */
|
/* control never gets here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,26 +64,7 @@ void platform_restart(void)
|
||||||
{
|
{
|
||||||
/* Flush and reset the mmu, simulate a processor reset, and
|
/* Flush and reset the mmu, simulate a processor reset, and
|
||||||
* jump to the reset vector. */
|
* jump to the reset vector. */
|
||||||
|
cpu_reset();
|
||||||
__asm__ __volatile__ ("movi a2, 15\n\t"
|
|
||||||
"wsr a2, icountlevel\n\t"
|
|
||||||
"movi a2, 0\n\t"
|
|
||||||
"wsr a2, icount\n\t"
|
|
||||||
#if XCHAL_NUM_IBREAK > 0
|
|
||||||
"wsr a2, ibreakenable\n\t"
|
|
||||||
#endif
|
|
||||||
#if XCHAL_HAVE_LOOPS
|
|
||||||
"wsr a2, lcount\n\t"
|
|
||||||
#endif
|
|
||||||
"movi a2, 0x1f\n\t"
|
|
||||||
"wsr a2, ps\n\t"
|
|
||||||
"isync\n\t"
|
|
||||||
"jx %0\n\t"
|
|
||||||
:
|
|
||||||
: "a" (XCHAL_RESET_VECTOR_VADDR)
|
|
||||||
: "a2"
|
|
||||||
);
|
|
||||||
|
|
||||||
/* control never gets here */
|
/* control never gets here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,27 +54,7 @@ void platform_restart(void)
|
||||||
{
|
{
|
||||||
/* Flush and reset the mmu, simulate a processor reset, and
|
/* Flush and reset the mmu, simulate a processor reset, and
|
||||||
* jump to the reset vector. */
|
* jump to the reset vector. */
|
||||||
|
cpu_reset();
|
||||||
|
|
||||||
__asm__ __volatile__ ("movi a2, 15\n\t"
|
|
||||||
"wsr a2, icountlevel\n\t"
|
|
||||||
"movi a2, 0\n\t"
|
|
||||||
"wsr a2, icount\n\t"
|
|
||||||
#if XCHAL_NUM_IBREAK > 0
|
|
||||||
"wsr a2, ibreakenable\n\t"
|
|
||||||
#endif
|
|
||||||
#if XCHAL_HAVE_LOOPS
|
|
||||||
"wsr a2, lcount\n\t"
|
|
||||||
#endif
|
|
||||||
"movi a2, 0x1f\n\t"
|
|
||||||
"wsr a2, ps\n\t"
|
|
||||||
"isync\n\t"
|
|
||||||
"jx %0\n\t"
|
|
||||||
:
|
|
||||||
: "a" (XCHAL_RESET_VECTOR_VADDR)
|
|
||||||
: "a2"
|
|
||||||
);
|
|
||||||
|
|
||||||
/* control never gets here */
|
/* control never gets here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue