modem.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Copyright (C) 2010 Google, Inc.
  3. * Copyright (C) 2010 Samsung Electronics.
  4. *
  5. * This software is licensed under the terms of the GNU General Public
  6. * License version 2, as published by the Free Software Foundation, and
  7. * may be copied, distributed, and modified under those terms.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #ifndef __MODEM_IF_H__
  16. #define __MODEM_IF_H__
  17. enum modem_t {
  18. IMC_XMM6260,
  19. IMC_XMM6262,
  20. VIA_CBP71,
  21. VIA_CBP72,
  22. SEC_CMC221,
  23. QC_MDM6600,
  24. QC_ESC6270,
  25. QC_MSM8x55,
  26. QC_MSM7x27,
  27. SPRD_SC6500,
  28. DUMMY,
  29. MAX_MODEM_TYPE
  30. };
  31. enum dev_format {
  32. IPC_FMT,
  33. IPC_RAW,
  34. IPC_RFS,
  35. IPC_CMD,
  36. IPC_BOOT,
  37. IPC_BOOT_2,
  38. IPC_MULTI_RAW,
  39. IPC_RAMDUMP,
  40. MAX_DEV_FORMAT,
  41. };
  42. enum modem_io {
  43. IODEV_MISC,
  44. IODEV_NET,
  45. IODEV_DUMMY,
  46. };
  47. enum modem_link {
  48. LINKDEV_UNDEFINED,
  49. LINKDEV_MIPI,
  50. LINKDEV_DPRAM,
  51. LINKDEV_SPI,
  52. LINKDEV_USB,
  53. LINKDEV_HSIC,
  54. LINKDEV_C2C,
  55. LINKDEV_MAX,
  56. };
  57. #define LINKTYPE(modem_link) (1u << (modem_link))
  58. enum modem_network {
  59. UMTS_NETWORK,
  60. CDMA_NETWORK,
  61. LTE_NETWORK,
  62. TDSCDMA_NETWORK,
  63. };
  64. enum sipc_ver {
  65. NO_SIPC_VER = 0,
  66. SIPC_VER_40 = 40,
  67. SIPC_VER_41 = 41,
  68. SIPC_VER_42 = 42,
  69. SIPC_VER_50 = 50,
  70. MAX_SIPC_VER,
  71. };
  72. enum sipc_dev_type {
  73. IPC_FMT_DEV = 0,
  74. IPC_RAW_DEV,
  75. IPC_RFS_DEV,
  76. MAX_IPC_DEV,
  77. };
  78. /**
  79. * struct modem_io_t - declaration for io_device
  80. * @name: device name
  81. * @id: contain format & channel information
  82. * (id & 11100000b)>>5 = format (eg, 0=FMT, 1=RAW, 2=RFS)
  83. * (id & 00011111b) = channel (valid only if format is RAW)
  84. * @format: device format
  85. * @io_type: type of this io_device
  86. * @links: list of link_devices to use this io_device
  87. * for example, if you want to use DPRAM and USB in an io_device.
  88. * .links = LINKTYPE(LINKDEV_DPRAM) | LINKTYPE(LINKDEV_USB)
  89. * @tx_link: when you use 2+ link_devices, set the link for TX.
  90. * If define multiple link_devices in @links,
  91. * you can receive data from them. But, cannot send data to all.
  92. * TX is only one link_device.
  93. *
  94. * This structure is used in board-*-modem.c
  95. */
  96. struct modem_io_t {
  97. char *name;
  98. int id;
  99. enum dev_format format;
  100. enum modem_io io_type;
  101. enum modem_link links;
  102. enum modem_link tx_link;
  103. };
  104. /* platform data */
  105. struct modem_data {
  106. char *name;
  107. unsigned gpio_cp_on;
  108. unsigned gpio_cp_off;
  109. unsigned gpio_reset_req_n;
  110. unsigned gpio_pda_active;
  111. unsigned gpio_phone_active;
  112. unsigned gpio_cp_dump_int;
  113. unsigned gpio_ap_dump_int;
  114. unsigned gpio_sim_detect;
  115. #ifdef CONFIG_GSM_MODEM_SPRD6500
  116. unsigned gpio_ap_cp_int1;
  117. unsigned gpio_ap_cp_int2;
  118. unsigned gpio_uart_sel;
  119. unsigned gpio_ipc_mrdy;
  120. unsigned gpio_ipc_srdy;
  121. unsigned gpio_ipc_sub_mrdy;
  122. unsigned gpio_ipc_sub_srdy;
  123. #endif
  124. #ifdef CONFIG_SEC_DUAL_MODEM_MODE
  125. unsigned gpio_sim_sel;
  126. #endif
  127. /* Switch with 2 links in a modem */
  128. unsigned gpio_dynamic_switching;
  129. /* modem component */
  130. enum modem_network modem_net;
  131. enum modem_t modem_type;
  132. enum modem_link link_types;
  133. char *link_name;
  134. /* SIPC version */
  135. enum sipc_ver ipc_version;
  136. /* Information of IO devices */
  137. unsigned num_iodevs;
  138. struct modem_io_t *iodevs;
  139. /* Handover with 2+ link devices */
  140. bool use_handover;
  141. };
  142. #define LOG_TAG "mif: "
  143. #define mif_err(fmt, ...) \
  144. pr_err(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__)
  145. #define mif_debug(fmt, ...) \
  146. pr_debug(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__)
  147. #define mif_info(fmt, ...) \
  148. pr_info(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__)
  149. #define mif_trace(fmt, ...) \
  150. printk(KERN_DEBUG "mif: %s: %d: called(%pF): " fmt, \
  151. __func__, __LINE__, __builtin_return_address(0), ##__VA_ARGS__)
  152. #endif