reboot.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * arch/blackfin/kernel/reboot.c - handle shutdown/reboot
  3. *
  4. * Copyright 2004-2007 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/interrupt.h>
  9. #include <asm/bfin-global.h>
  10. #include <asm/reboot.h>
  11. #include <asm/system.h>
  12. #if defined(BF537_FAMILY) || defined(BF533_FAMILY) || defined(BF527_FAMILY)
  13. #define SYSCR_VAL 0x0
  14. #elif defined(BF561_FAMILY)
  15. #define SYSCR_VAL 0x20
  16. #elif defined(BF548_FAMILY)
  17. #define SYSCR_VAL 0x10
  18. #endif
  19. /* A system soft reset makes external memory unusable
  20. * so force this function into L1.
  21. */
  22. __attribute__((l1_text))
  23. void bfin_reset(void)
  24. {
  25. /* force BMODE and disable Core B (as needed) */
  26. bfin_write_SYSCR(SYSCR_VAL);
  27. /* we use asm ssync here because it's save and we save some L1 */
  28. asm("ssync;");
  29. while (1) {
  30. /* initiate system soft reset with magic 0x7 */
  31. bfin_write_SWRST(0x7);
  32. asm("ssync;");
  33. /* clear system soft reset */
  34. bfin_write_SWRST(0);
  35. asm("ssync;");
  36. /* issue core reset */
  37. asm("raise 1");
  38. }
  39. }
  40. __attribute__((weak))
  41. void native_machine_restart(char *cmd)
  42. {
  43. }
  44. void machine_restart(char *cmd)
  45. {
  46. native_machine_restart(cmd);
  47. local_irq_disable();
  48. bfin_reset();
  49. }
  50. __attribute__((weak))
  51. void native_machine_halt(void)
  52. {
  53. idle_with_irq_disabled();
  54. }
  55. void machine_halt(void)
  56. {
  57. native_machine_halt();
  58. }
  59. __attribute__((weak))
  60. void native_machine_power_off(void)
  61. {
  62. idle_with_irq_disabled();
  63. }
  64. void machine_power_off(void)
  65. {
  66. native_machine_power_off();
  67. }