pm-mb93093.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * FR-V MB93093 Power Management Routines
  3. *
  4. * Copyright (c) 2004 Red Hat, Inc.
  5. *
  6. * Written by: msalter@redhat.com
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License.
  10. *
  11. */
  12. #include <linux/init.h>
  13. #include <linux/pm.h>
  14. #include <linux/sched.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/sysctl.h>
  17. #include <linux/errno.h>
  18. #include <linux/delay.h>
  19. #include <asm/uaccess.h>
  20. #include <asm/mb86943a.h>
  21. #include "local.h"
  22. static unsigned long imask;
  23. /*
  24. * Setup interrupt masks, etc to enable wakeup by power switch
  25. */
  26. static void mb93093_power_switch_setup(void)
  27. {
  28. /* mask all but FPGA interrupt sources. */
  29. imask = *(volatile unsigned long *)0xfeff9820;
  30. *(volatile unsigned long *)0xfeff9820 = ~(1 << (IRQ_XIRQ2_LEVEL + 16)) & 0xfffe0000;
  31. }
  32. /*
  33. * Cleanup interrupt masks, etc after wakeup by power switch
  34. */
  35. static void mb93093_power_switch_cleanup(void)
  36. {
  37. *(volatile unsigned long *)0xfeff9820 = imask;
  38. }
  39. /*
  40. * Return non-zero if wakeup irq was caused by power switch
  41. */
  42. static int mb93093_power_switch_check(void)
  43. {
  44. return 1;
  45. }
  46. /*
  47. * Initialize power interface
  48. */
  49. static int __init mb93093_pm_init(void)
  50. {
  51. __power_switch_wake_setup = mb93093_power_switch_setup;
  52. __power_switch_wake_check = mb93093_power_switch_check;
  53. __power_switch_wake_cleanup = mb93093_power_switch_cleanup;
  54. return 0;
  55. }
  56. __initcall(mb93093_pm_init);