i8042-io.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef _I8042_IO_H
  2. #define _I8042_IO_H
  3. /*
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License version 2 as published by
  6. * the Free Software Foundation.
  7. */
  8. /*
  9. * Names.
  10. */
  11. #define I8042_KBD_PHYS_DESC "isa0060/serio0"
  12. #define I8042_AUX_PHYS_DESC "isa0060/serio1"
  13. #define I8042_MUX_PHYS_DESC "isa0060/serio%d"
  14. /*
  15. * IRQs.
  16. */
  17. #ifdef __alpha__
  18. # define I8042_KBD_IRQ 1
  19. # define I8042_AUX_IRQ (RTC_PORT(0) == 0x170 ? 9 : 12) /* Jensen is special */
  20. #elif defined(__arm__)
  21. /* defined in include/asm-arm/arch-xxx/irqs.h */
  22. #include <asm/irq.h>
  23. #elif defined(CONFIG_SH_CAYMAN)
  24. #include <asm/irq.h>
  25. #else
  26. # define I8042_KBD_IRQ 1
  27. # define I8042_AUX_IRQ 12
  28. #endif
  29. /*
  30. * Register numbers.
  31. */
  32. #define I8042_COMMAND_REG 0x64
  33. #define I8042_STATUS_REG 0x64
  34. #define I8042_DATA_REG 0x60
  35. static inline int i8042_read_data(void)
  36. {
  37. return inb(I8042_DATA_REG);
  38. }
  39. static inline int i8042_read_status(void)
  40. {
  41. return inb(I8042_STATUS_REG);
  42. }
  43. static inline void i8042_write_data(int val)
  44. {
  45. outb(val, I8042_DATA_REG);
  46. }
  47. static inline void i8042_write_command(int val)
  48. {
  49. outb(val, I8042_COMMAND_REG);
  50. }
  51. static inline int i8042_platform_init(void)
  52. {
  53. /*
  54. * On some platforms touching the i8042 data register region can do really
  55. * bad things. Because of this the region is always reserved on such boxes.
  56. */
  57. #if defined(CONFIG_PPC)
  58. if (check_legacy_ioport(I8042_DATA_REG))
  59. return -ENODEV;
  60. #endif
  61. #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__)
  62. if (!request_region(I8042_DATA_REG, 16, "i8042"))
  63. return -EBUSY;
  64. #endif
  65. i8042_reset = 1;
  66. return 0;
  67. }
  68. static inline void i8042_platform_exit(void)
  69. {
  70. #if !defined(__sh__) && !defined(__alpha__)
  71. release_region(I8042_DATA_REG, 16);
  72. #endif
  73. }
  74. #endif /* _I8042_IO_H */