i8237.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * 8237A DMA controller suspend functions.
  3. *
  4. * Written by Pierre Ossman, 2005.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or (at
  9. * your option) any later version.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/syscore_ops.h>
  13. #include <asm/dma.h>
  14. /*
  15. * This module just handles suspend/resume issues with the
  16. * 8237A DMA controller (used for ISA and LPC).
  17. * Allocation is handled in kernel/dma.c and normal usage is
  18. * in asm/dma.h.
  19. */
  20. static void i8237A_resume(void)
  21. {
  22. unsigned long flags;
  23. int i;
  24. flags = claim_dma_lock();
  25. dma_outb(0, DMA1_RESET_REG);
  26. dma_outb(0, DMA2_RESET_REG);
  27. for (i = 0; i < 8; i++) {
  28. set_dma_addr(i, 0x000000);
  29. /* DMA count is a bit weird so this is not 0 */
  30. set_dma_count(i, 1);
  31. }
  32. /* Enable cascade DMA or channel 0-3 won't work */
  33. enable_dma(4);
  34. release_dma_lock(flags);
  35. }
  36. static struct syscore_ops i8237_syscore_ops = {
  37. .resume = i8237A_resume,
  38. };
  39. static int __init i8237A_init_ops(void)
  40. {
  41. register_syscore_ops(&i8237_syscore_ops);
  42. return 0;
  43. }
  44. device_initcall(i8237A_init_ops);