i8042-unicore32io.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Code specific to PKUnity SoC and UniCore ISA
  3. *
  4. * Maintained by GUAN Xue-tao <gxt@mprc.pku.edu.cn>
  5. * Copyright (C) 2001-2011 Guan Xuetao
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _I8042_UNICORE32_H
  12. #define _I8042_UNICORE32_H
  13. #include <mach/hardware.h>
  14. /*
  15. * Names.
  16. */
  17. #define I8042_KBD_PHYS_DESC "isa0060/serio0"
  18. #define I8042_AUX_PHYS_DESC "isa0060/serio1"
  19. #define I8042_MUX_PHYS_DESC "isa0060/serio%d"
  20. /*
  21. * IRQs.
  22. */
  23. #define I8042_KBD_IRQ IRQ_PS2_KBD
  24. #define I8042_AUX_IRQ IRQ_PS2_AUX
  25. /*
  26. * Register numbers.
  27. */
  28. #define I8042_COMMAND_REG ((unsigned long)&PS2_COMMAND)
  29. #define I8042_STATUS_REG ((unsigned long)&PS2_STATUS)
  30. #define I8042_DATA_REG ((unsigned long)&PS2_DATA)
  31. static inline int i8042_read_data(void)
  32. {
  33. return inb(I8042_DATA_REG);
  34. }
  35. static inline int i8042_read_status(void)
  36. {
  37. return inb(I8042_STATUS_REG);
  38. }
  39. static inline void i8042_write_data(int val)
  40. {
  41. outb(val, I8042_DATA_REG);
  42. }
  43. static inline void i8042_write_command(int val)
  44. {
  45. outb(val, I8042_COMMAND_REG);
  46. }
  47. static inline int i8042_platform_init(void)
  48. {
  49. if (!request_region(I8042_DATA_REG, 16, "i8042"))
  50. return -EBUSY;
  51. i8042_reset = 1;
  52. return 0;
  53. }
  54. static inline void i8042_platform_exit(void)
  55. {
  56. release_region(I8042_DATA_REG, 16);
  57. }
  58. #endif /* _I8042_UNICORE32_H */