Skip to content

Commit fcd0532

Browse files
claudiubezneasre
authored andcommitted
power: reset: at91-reset: make at91sam9g45_restart() generic
Make at91sam9g45_restart() generic. Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 68a84a3 commit fcd0532

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

drivers/power/reset/at91-reset.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,32 +105,23 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
105105
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
106106

107107
asm volatile(
108-
/*
109-
* Test wether we have a second RAM controller to care
110-
* about.
111-
*
112-
* First, test that we can dereference the virtual address.
113-
*/
114-
"cmp %1, #0\n\t"
115-
"beq 1f\n\t"
116-
117-
/* Then, test that the RAM controller is enabled */
118-
"ldr r4, [%1]\n\t"
119-
"cmp r4, #0\n\t"
120-
121108
/* Align to cache lines */
122109
".balign 32\n\t"
123110

124111
/* Disable SDRAM0 accesses */
125-
"1: str %3, [%0, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
112+
" tst %0, #0\n\t"
113+
" beq 1f\n\t"
114+
" str %3, [%0, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
126115
/* Power down SDRAM0 */
127116
" str %4, [%0, %6]\n\t"
128117
/* Disable SDRAM1 accesses */
118+
"1: tst %1, #0\n\t"
119+
" beq 2f\n\t"
129120
" strne %3, [%1, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
130121
/* Power down SDRAM1 */
131122
" strne %4, [%1, %6]\n\t"
132123
/* Reset CPU */
133-
" str %5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
124+
"2: str %5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
134125

135126
" b .\n\t"
136127
:

0 commit comments

Comments
 (0)