[Blackfin] arch: Add proper SW System Reset delay sequence
authorMichael Hennerich <michael.hennerich@analog.com>
Tue, 22 Jan 2008 10:38:02 +0000 (18:38 +0800)
committerBryan Wu <bryan.wu@analog.com>
Tue, 22 Jan 2008 10:38:02 +0000 (18:38 +0800)
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
arch/blackfin/kernel/reboot.c

index 06501a594ddadc3ff1485db06088041ea5e11bdf..483f93dfc1b590a7ea6cdc582a40eadd3d17982e 100644 (file)
 #define SYSCR_VAL      0x10
 #endif
 
+/*
+ * Delay min 5 SCLK cycles using worst case CCLK/SCLK ratio (15)
+ */
+#define SWRST_DELAY    (5 * 15)
+
 /* A system soft reset makes external memory unusable
  * so force this function into L1.
  */
@@ -34,11 +39,15 @@ void bfin_reset(void)
        while (1) {
                /* initiate system soft reset with magic 0x7 */
                bfin_write_SWRST(0x7);
-               bfin_read_SWRST();
-               asm("ssync;");
+
+               /* Wait for System reset to actually reset, needs to be 5 SCLKs, */
+               /* Assume CCLK / SCLK ratio is worst case (15), and use 5*15     */
+
+               asm("LSETUP(.Lfoo,.Lfoo) LC0 = %0\n .Lfoo: NOP;\n"
+                : : "a" (SWRST_DELAY) : "LC0", "LT0", "LB0");
+
                /* clear system soft reset */
                bfin_write_SWRST(0);
-               bfin_read_SWRST();
                asm("ssync;");
                /* issue core reset */
                asm("raise 1");