common.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * arch/arm/mach-iop32x/common.c
  3. *
  4. * Common routines shared across all IOP3xx implementations
  5. *
  6. * Author: Deepak Saxena <dsaxena@mvista.com>
  7. *
  8. * Copyright 2003 (c) MontaVista, Software, Inc.
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #include <linux/delay.h>
  15. #include <asm/hardware.h>
  16. #include <asm/hardware/iop3xx.h>
  17. #ifdef CONFIG_ARCH_EP80219
  18. #include <linux/kernel.h>
  19. /*
  20. * Default power-off for EP80219
  21. */
  22. static inline void ep80219_send_to_pic(__u8 c) {
  23. }
  24. void ep80219_power_off(void)
  25. {
  26. /*
  27. * This function will send a SHUTDOWN_COMPLETE message to the PIC controller
  28. * over I2C. We are not using the i2c subsystem since we are going to power
  29. * off and it may be removed
  30. */
  31. /* Send the Address byte w/ the start condition */
  32. *IOP3XX_IDBR1 = 0x60;
  33. *IOP3XX_ICR1 = 0xE9;
  34. mdelay(1);
  35. /* Send the START_MSG byte w/ no start or stop condition */
  36. *IOP3XX_IDBR1 = 0x0F;
  37. *IOP3XX_ICR1 = 0xE8;
  38. mdelay(1);
  39. /* Send the SHUTDOWN_COMPLETE Message ID byte w/ no start or stop condition */
  40. *IOP3XX_IDBR1 = 0x03;
  41. *IOP3XX_ICR1 = 0xE8;
  42. mdelay(1);
  43. /* Send an ignored byte w/ stop condition */
  44. *IOP3XX_IDBR1 = 0x00;
  45. *IOP3XX_ICR1 = 0xEA;
  46. while (1) ;
  47. }
  48. #include <linux/init.h>
  49. #include <linux/pm.h>
  50. static int __init ep80219_init(void)
  51. {
  52. pm_power_off = ep80219_power_off;
  53. return 0;
  54. }
  55. arch_initcall(ep80219_init);
  56. #endif