i8042-unicore32io.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 PS2_COMMAND
  29. #define I8042_STATUS_REG PS2_STATUS
  30. #define I8042_DATA_REG PS2_DATA
  31. #define I8042_REGION_START (resource_size_t)(PS2_DATA)
  32. #define I8042_REGION_SIZE (resource_size_t)(16)
  33. static inline int i8042_read_data(void)
  34. {
  35. return readb(I8042_DATA_REG);
  36. }
  37. static inline int i8042_read_status(void)
  38. {
  39. return readb(I8042_STATUS_REG);
  40. }
  41. static inline void i8042_write_data(int val)
  42. {
  43. writeb(val, I8042_DATA_REG);
  44. }
  45. static inline void i8042_write_command(int val)
  46. {
  47. writeb(val, I8042_COMMAND_REG);
  48. }
  49. static inline int i8042_platform_init(void)
  50. {
  51. if (!request_mem_region(I8042_REGION_START, I8042_REGION_SIZE, "i8042"))
  52. return -EBUSY;
  53. i8042_reset = I8042_RESET_ALWAYS;
  54. return 0;
  55. }
  56. static inline void i8042_platform_exit(void)
  57. {
  58. release_mem_region(I8042_REGION_START, I8042_REGION_SIZE);
  59. }
  60. #endif /* _I8042_UNICORE32_H */