p73.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2012-2020 NXP Semiconductors
  4. * *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. ******************************************************************************/
  20. #ifndef _P73_H_
  21. #define _P73_H_
  22. #define P61_MAGIC 0xEB
  23. #define P61_SET_PWR _IOW(P61_MAGIC, 0x01, long)
  24. #define P61_SET_DBG _IOW(P61_MAGIC, 0x02, long)
  25. #define P61_SET_POLL _IOW(P61_MAGIC, 0x03, long)
  26. /*
  27. * SPI Request NFCC to enable p61 power, only in param
  28. * Only for SPI
  29. * level 1 = Enable power
  30. * level 0 = Disable power
  31. */
  32. #define P61_SET_SPM_PWR _IOW(P61_MAGIC, 0x04, long)
  33. /* SPI or DWP can call this ioctl to get the current
  34. * power state of P61
  35. *
  36. */
  37. #define P61_GET_SPM_STATUS _IOR(P61_MAGIC, 0x05, long)
  38. /* throughput measurement is deprecated */
  39. /* #define P61_SET_THROUGHPUT _IOW(P61_MAGIC, 0x06, long) */
  40. #define P61_GET_ESE_ACCESS _IOW(P61_MAGIC, 0x07, long)
  41. #define P61_SET_POWER_SCHEME _IOW(P61_MAGIC, 0x08, long)
  42. #define P61_SET_DWNLD_STATUS _IOW(P61_MAGIC, 0x09, long)
  43. #define P61_INHIBIT_PWR_CNTRL _IOW(P61_MAGIC, 0x0A, long)
  44. /* SPI can call this IOCTL to perform the eSE COLD_RESET
  45. * via NFC driver.
  46. */
  47. #define ESE_PERFORM_COLD_RESET _IOW(P61_MAGIC, 0x0C, long)
  48. #define PERFORM_RESET_PROTECTION _IOW(P61_MAGIC, 0x0D, long)
  49. #define ESE_SET_TRUSTED_ACCESS _IOW(P61_MAGIC, 0x0B, long)
  50. #define P61_RW_SPI_DATA _IOWR(P61_MAGIC, 0x0F, unsigned long)
  51. #ifdef CONFIG_COMPAT
  52. #define P61_SET_PWR_COMPAT _IOW(P61_MAGIC, 0x01, unsigned int)
  53. #define P61_SET_DBG_COMPAT _IOW(P61_MAGIC, 0x02, unsigned int)
  54. #define P61_SET_POLL_COMPAT _IOW(P61_MAGIC, 0x03, unsigned int)
  55. #define P61_SET_SPM_PWR_COMPAT _IOW(P61_MAGIC, 0x04, unsigned int)
  56. #define P61_GET_SPM_STATUS_COMPAT _IOR(P61_MAGIC, 0x05, unsigned int)
  57. /* throughput measurement is deprecated */
  58. /* #define P61_SET_THROUGHPUT_COMPAT _IOW(P61_MAGIC, 0x06, unsigned int) */
  59. #define P61_GET_ESE_ACCESS_COMPAT _IOW(P61_MAGIC, 0x07, unsigned int)
  60. #define P61_SET_POWER_SCHEME_COMPAT _IOW(P61_MAGIC, 0x08, unsigned int)
  61. #define P61_SET_DWNLD_STATUS_COMPAT _IOW(P61_MAGIC, 0x09, unsigned int)
  62. #define P61_INHIBIT_PWR_CNTRL_COMPAT _IOW(P61_MAGIC, 0x0A, unsigned int)
  63. #define P61_RW_SPI_DATA_COMPAT _IOWR(P61_MAGIC, 0x0F, unsigned int)
  64. #define ESE_PERFORM_COLD_RESET_COMPAT _IOW(P61_MAGIC, 0x0C, unsigned int)
  65. #define PERFORM_RESET_PROTECTION_COMPAT _IOW(P61_MAGIC, 0x0D, unsigned int)
  66. #endif
  67. typedef enum ese_spi_transition_state {
  68. ESE_SPI_IDLE = 0x00,
  69. ESE_SPI_BUSY
  70. } ese_spi_transition_state_t;
  71. struct p61_spi_platform_data {
  72. int irq_gpio;
  73. int rst_gpio;
  74. int trusted_ese_gpio;
  75. bool gpio_coldreset;
  76. #if IS_ENABLED(CONFIG_SAMSUNG_NFC)
  77. int ap_vendor;
  78. #endif
  79. };
  80. struct p61_ioctl_transfer {
  81. unsigned char *rx_buffer;
  82. unsigned char *tx_buffer;
  83. unsigned int len;
  84. };
  85. #ifdef CONFIG_COMPAT
  86. struct p61_ioctl_transfer32 {
  87. u32 rx_buffer;
  88. u32 tx_buffer;
  89. u32 len;
  90. };
  91. #endif
  92. #if IS_ENABLED(CONFIG_SAMSUNG_NFC)
  93. void store_nfc_i2c_device(struct device *nfc_i2c_dev);
  94. void p61_print_status(const char *func_name);
  95. #endif
  96. #endif