i8042-io.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #elif defined(CONFIG_PPC)
  26. extern int of_i8042_kbd_irq;
  27. extern int of_i8042_aux_irq;
  28. # define I8042_KBD_IRQ of_i8042_kbd_irq
  29. # define I8042_AUX_IRQ of_i8042_aux_irq
  30. #else
  31. # define I8042_KBD_IRQ 1
  32. # define I8042_AUX_IRQ 12
  33. #endif
  34. /*
  35. * Register numbers.
  36. */
  37. #define I8042_COMMAND_REG 0x64
  38. #define I8042_STATUS_REG 0x64
  39. #define I8042_DATA_REG 0x60
  40. static inline int i8042_read_data(void)
  41. {
  42. return inb(I8042_DATA_REG);
  43. }
  44. static inline int i8042_read_status(void)
  45. {
  46. return inb(I8042_STATUS_REG);
  47. }
  48. static inline void i8042_write_data(int val)
  49. {
  50. outb(val, I8042_DATA_REG);
  51. }
  52. static inline void i8042_write_command(int val)
  53. {
  54. outb(val, I8042_COMMAND_REG);
  55. }
  56. static inline int i8042_platform_init(void)
  57. {
  58. /*
  59. * On some platforms touching the i8042 data register region can do really
  60. * bad things. Because of this the region is always reserved on such boxes.
  61. */
  62. #if defined(CONFIG_PPC)
  63. if (check_legacy_ioport(I8042_DATA_REG))
  64. return -ENODEV;
  65. #endif
  66. #if !defined(__sh__) && !defined(__alpha__)
  67. if (!request_region(I8042_DATA_REG, 16, "i8042"))
  68. return -EBUSY;
  69. #endif
  70. i8042_reset = I8042_RESET_ALWAYS;
  71. return 0;
  72. }
  73. static inline void i8042_platform_exit(void)
  74. {
  75. #if !defined(__sh__) && !defined(__alpha__)
  76. release_region(I8042_DATA_REG, 16);
  77. #endif
  78. }
  79. #endif /* _I8042_IO_H */