sdhci-pci.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __SDHCI_PCI_H
  3. #define __SDHCI_PCI_H
  4. /*
  5. * PCI device IDs, sub IDs
  6. */
  7. #define PCI_DEVICE_ID_O2_SDS0 0x8420
  8. #define PCI_DEVICE_ID_O2_SDS1 0x8421
  9. #define PCI_DEVICE_ID_O2_FUJIN2 0x8520
  10. #define PCI_DEVICE_ID_O2_SEABIRD0 0x8620
  11. #define PCI_DEVICE_ID_O2_SEABIRD1 0x8621
  12. #define PCI_DEVICE_ID_O2_GG8_9860 0x9860
  13. #define PCI_DEVICE_ID_O2_GG8_9861 0x9861
  14. #define PCI_DEVICE_ID_O2_GG8_9862 0x9862
  15. #define PCI_DEVICE_ID_O2_GG8_9863 0x9863
  16. #define PCI_DEVICE_ID_INTEL_PCH_SDIO0 0x8809
  17. #define PCI_DEVICE_ID_INTEL_PCH_SDIO1 0x880a
  18. #define PCI_DEVICE_ID_INTEL_BYT_EMMC 0x0f14
  19. #define PCI_DEVICE_ID_INTEL_BYT_SDIO 0x0f15
  20. #define PCI_DEVICE_ID_INTEL_BYT_SD 0x0f16
  21. #define PCI_DEVICE_ID_INTEL_BYT_EMMC2 0x0f50
  22. #define PCI_DEVICE_ID_INTEL_BSW_EMMC 0x2294
  23. #define PCI_DEVICE_ID_INTEL_BSW_SDIO 0x2295
  24. #define PCI_DEVICE_ID_INTEL_BSW_SD 0x2296
  25. #define PCI_DEVICE_ID_INTEL_MRFLD_MMC 0x1190
  26. #define PCI_DEVICE_ID_INTEL_CLV_SDIO0 0x08f9
  27. #define PCI_DEVICE_ID_INTEL_CLV_SDIO1 0x08fa
  28. #define PCI_DEVICE_ID_INTEL_CLV_SDIO2 0x08fb
  29. #define PCI_DEVICE_ID_INTEL_CLV_EMMC0 0x08e5
  30. #define PCI_DEVICE_ID_INTEL_CLV_EMMC1 0x08e6
  31. #define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7
  32. #define PCI_DEVICE_ID_INTEL_SPT_EMMC 0x9d2b
  33. #define PCI_DEVICE_ID_INTEL_SPT_SDIO 0x9d2c
  34. #define PCI_DEVICE_ID_INTEL_SPT_SD 0x9d2d
  35. #define PCI_DEVICE_ID_INTEL_DNV_EMMC 0x19db
  36. #define PCI_DEVICE_ID_INTEL_CDF_EMMC 0x18db
  37. #define PCI_DEVICE_ID_INTEL_BXT_SD 0x0aca
  38. #define PCI_DEVICE_ID_INTEL_BXT_EMMC 0x0acc
  39. #define PCI_DEVICE_ID_INTEL_BXT_SDIO 0x0ad0
  40. #define PCI_DEVICE_ID_INTEL_BXTM_SD 0x1aca
  41. #define PCI_DEVICE_ID_INTEL_BXTM_EMMC 0x1acc
  42. #define PCI_DEVICE_ID_INTEL_BXTM_SDIO 0x1ad0
  43. #define PCI_DEVICE_ID_INTEL_APL_SD 0x5aca
  44. #define PCI_DEVICE_ID_INTEL_APL_EMMC 0x5acc
  45. #define PCI_DEVICE_ID_INTEL_APL_SDIO 0x5ad0
  46. #define PCI_DEVICE_ID_INTEL_GLK_SD 0x31ca
  47. #define PCI_DEVICE_ID_INTEL_GLK_EMMC 0x31cc
  48. #define PCI_DEVICE_ID_INTEL_GLK_SDIO 0x31d0
  49. #define PCI_DEVICE_ID_INTEL_CNP_EMMC 0x9dc4
  50. #define PCI_DEVICE_ID_INTEL_CNP_SD 0x9df5
  51. #define PCI_DEVICE_ID_INTEL_CNPH_SD 0xa375
  52. #define PCI_DEVICE_ID_INTEL_ICP_EMMC 0x34c4
  53. #define PCI_DEVICE_ID_INTEL_ICP_SD 0x34f8
  54. #define PCI_DEVICE_ID_INTEL_EHL_EMMC 0x4b47
  55. #define PCI_DEVICE_ID_INTEL_EHL_SD 0x4b48
  56. #define PCI_DEVICE_ID_INTEL_CML_EMMC 0x02c4
  57. #define PCI_DEVICE_ID_INTEL_CML_SD 0x02f5
  58. #define PCI_DEVICE_ID_INTEL_CMLH_SD 0x06f5
  59. #define PCI_DEVICE_ID_INTEL_JSL_EMMC 0x4dc4
  60. #define PCI_DEVICE_ID_INTEL_JSL_SD 0x4df8
  61. #define PCI_DEVICE_ID_INTEL_LKF_EMMC 0x98c4
  62. #define PCI_DEVICE_ID_INTEL_LKF_SD 0x98f8
  63. #define PCI_DEVICE_ID_INTEL_ADL_EMMC 0x54c4
  64. #define PCI_DEVICE_ID_SYSKONNECT_8000 0x8000
  65. #define PCI_DEVICE_ID_VIA_95D0 0x95d0
  66. #define PCI_DEVICE_ID_REALTEK_5250 0x5250
  67. #define PCI_SUBDEVICE_ID_NI_7884 0x7884
  68. #define PCI_SUBDEVICE_ID_NI_78E3 0x78e3
  69. #define PCI_VENDOR_ID_ARASAN 0x16e6
  70. #define PCI_DEVICE_ID_ARASAN_PHY_EMMC 0x0670
  71. #define PCI_DEVICE_ID_SYNOPSYS_DWC_MSHC 0xc202
  72. #define PCI_DEVICE_ID_GLI_9755 0x9755
  73. #define PCI_DEVICE_ID_GLI_9750 0x9750
  74. #define PCI_DEVICE_ID_GLI_9763E 0xe763
  75. #define PCI_DEVICE_ID_GLI_9767 0x9767
  76. /*
  77. * PCI device class and mask
  78. */
  79. #define SYSTEM_SDHCI (PCI_CLASS_SYSTEM_SDHCI << 8)
  80. #define PCI_CLASS_MASK 0xFFFF00
  81. /*
  82. * Macros for PCI device-description
  83. */
  84. #define _PCI_VEND(vend) PCI_VENDOR_ID_##vend
  85. #define _PCI_DEV(vend, dev) PCI_DEVICE_ID_##vend##_##dev
  86. #define _PCI_SUBDEV(subvend, subdev) PCI_SUBDEVICE_ID_##subvend##_##subdev
  87. #define SDHCI_PCI_DEVICE(vend, dev, cfg) { \
  88. .vendor = _PCI_VEND(vend), .device = _PCI_DEV(vend, dev), \
  89. .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
  90. .driver_data = (kernel_ulong_t)&(sdhci_##cfg) \
  91. }
  92. #define SDHCI_PCI_SUBDEVICE(vend, dev, subvend, subdev, cfg) { \
  93. .vendor = _PCI_VEND(vend), .device = _PCI_DEV(vend, dev), \
  94. .subvendor = _PCI_VEND(subvend), \
  95. .subdevice = _PCI_SUBDEV(subvend, subdev), \
  96. .driver_data = (kernel_ulong_t)&(sdhci_##cfg) \
  97. }
  98. #define SDHCI_PCI_DEVICE_CLASS(vend, cl, cl_msk, cfg) { \
  99. .vendor = _PCI_VEND(vend), .device = PCI_ANY_ID, \
  100. .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
  101. .class = (cl), .class_mask = (cl_msk), \
  102. .driver_data = (kernel_ulong_t)&(sdhci_##cfg) \
  103. }
  104. /*
  105. * PCI registers
  106. */
  107. #define PCI_SDHCI_IFPIO 0x00
  108. #define PCI_SDHCI_IFDMA 0x01
  109. #define PCI_SDHCI_IFVENDOR 0x02
  110. #define PCI_SLOT_INFO 0x40 /* 8 bits */
  111. #define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7)
  112. #define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07
  113. #define MAX_SLOTS 8
  114. struct sdhci_pci_chip;
  115. struct sdhci_pci_slot;
  116. struct sdhci_pci_fixes {
  117. unsigned int quirks;
  118. unsigned int quirks2;
  119. bool allow_runtime_pm;
  120. bool own_cd_for_runtime_pm;
  121. int (*probe) (struct sdhci_pci_chip *);
  122. int (*probe_slot) (struct sdhci_pci_slot *);
  123. int (*add_host) (struct sdhci_pci_slot *);
  124. void (*remove_slot) (struct sdhci_pci_slot *, int);
  125. #ifdef CONFIG_PM_SLEEP
  126. int (*suspend) (struct sdhci_pci_chip *);
  127. int (*resume) (struct sdhci_pci_chip *);
  128. #endif
  129. #ifdef CONFIG_PM
  130. int (*runtime_suspend) (struct sdhci_pci_chip *);
  131. int (*runtime_resume) (struct sdhci_pci_chip *);
  132. #endif
  133. const struct sdhci_ops *ops;
  134. const struct dmi_system_id *cd_gpio_override;
  135. size_t priv_size;
  136. };
  137. struct sdhci_pci_slot {
  138. struct sdhci_pci_chip *chip;
  139. struct sdhci_host *host;
  140. int cd_idx;
  141. bool cd_override_level;
  142. void (*hw_reset)(struct sdhci_host *host);
  143. unsigned long private[] ____cacheline_aligned;
  144. };
  145. struct sdhci_pci_chip {
  146. struct pci_dev *pdev;
  147. unsigned int quirks;
  148. unsigned int quirks2;
  149. bool allow_runtime_pm;
  150. bool pm_retune;
  151. bool rpm_retune;
  152. const struct sdhci_pci_fixes *fixes;
  153. int num_slots; /* Slots on controller */
  154. struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
  155. };
  156. static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
  157. {
  158. return (void *)slot->private;
  159. }
  160. #ifdef CONFIG_PM_SLEEP
  161. int sdhci_pci_resume_host(struct sdhci_pci_chip *chip);
  162. #endif
  163. int sdhci_pci_enable_dma(struct sdhci_host *host);
  164. extern const struct sdhci_pci_fixes sdhci_arasan;
  165. extern const struct sdhci_pci_fixes sdhci_snps;
  166. extern const struct sdhci_pci_fixes sdhci_o2;
  167. extern const struct sdhci_pci_fixes sdhci_gl9750;
  168. extern const struct sdhci_pci_fixes sdhci_gl9755;
  169. extern const struct sdhci_pci_fixes sdhci_gl9763e;
  170. extern const struct sdhci_pci_fixes sdhci_gl9767;
  171. #endif /* __SDHCI_PCI_H */