head.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Common Blackfin startup code
  3. *
  4. * Copyright 2004-2008 Analog Devices Inc.
  5. *
  6. * Enter bugs at http://blackfin.uclinux.org/
  7. *
  8. * Licensed under the GPL-2 or later.
  9. */
  10. #include <linux/linkage.h>
  11. #include <linux/init.h>
  12. #include <asm/blackfin.h>
  13. #include <asm/thread_info.h>
  14. #include <asm/trace.h>
  15. /* A little BF561 glue ... */
  16. #ifndef WDOG_CTL
  17. # define WDOG_CTL WDOGA_CTL
  18. #endif
  19. __INIT
  20. ENTRY(_real_start)
  21. /* Enable nested interrupts */
  22. [--sp] = reti;
  23. /* watchdog off for now */
  24. p0.l = lo(WDOG_CTL);
  25. p0.h = hi(WDOG_CTL);
  26. r0 = 0xAD6(z);
  27. w[p0] = r0;
  28. ssync;
  29. /* Zero out the bss region
  30. * Note: this will fail if bss is 0 bytes ...
  31. */
  32. r0 = 0 (z);
  33. r1.l = ___bss_start;
  34. r1.h = ___bss_start;
  35. r2.l = ___bss_stop;
  36. r2.h = ___bss_stop;
  37. r2 = r2 - r1;
  38. r2 >>= 2;
  39. p1 = r1;
  40. p2 = r2;
  41. lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
  42. .L_clear_bss:
  43. [p1++] = r0;
  44. /* In case there is a NULL pointer reference,
  45. * zero out region before stext
  46. */
  47. p1 = r0;
  48. r2.l = __stext;
  49. r2.h = __stext;
  50. r2 >>= 2;
  51. p2 = r2;
  52. lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
  53. .L_clear_zero:
  54. [p1++] = r0;
  55. /* Pass the u-boot arguments to the global value command line */
  56. R0 = R7;
  57. call _cmdline_init;
  58. /* Load the current thread pointer and stack */
  59. sp.l = _init_thread_union;
  60. sp.h = _init_thread_union;
  61. p1 = THREAD_SIZE (z);
  62. sp = sp + p1;
  63. usp = sp;
  64. fp = sp;
  65. jump.l _start_kernel;
  66. ENDPROC(_real_start)
  67. __FINIT