xref: /openbmc/linux/drivers/mmc/host/sdhci-pci.h (revision 52fb57e7)
1 #ifndef __SDHCI_PCI_H
2 #define __SDHCI_PCI_H
3 
4 /*
5  * PCI device IDs
6  */
7 
8 #define PCI_DEVICE_ID_INTEL_PCH_SDIO0	0x8809
9 #define PCI_DEVICE_ID_INTEL_PCH_SDIO1	0x880a
10 #define PCI_DEVICE_ID_INTEL_BYT_EMMC	0x0f14
11 #define PCI_DEVICE_ID_INTEL_BYT_SDIO	0x0f15
12 #define PCI_DEVICE_ID_INTEL_BYT_SD	0x0f16
13 #define PCI_DEVICE_ID_INTEL_BYT_EMMC2	0x0f50
14 #define PCI_DEVICE_ID_INTEL_BSW_EMMC	0x2294
15 #define PCI_DEVICE_ID_INTEL_BSW_SDIO	0x2295
16 #define PCI_DEVICE_ID_INTEL_BSW_SD	0x2296
17 #define PCI_DEVICE_ID_INTEL_MRFL_MMC	0x1190
18 #define PCI_DEVICE_ID_INTEL_CLV_SDIO0	0x08f9
19 #define PCI_DEVICE_ID_INTEL_CLV_SDIO1	0x08fa
20 #define PCI_DEVICE_ID_INTEL_CLV_SDIO2	0x08fb
21 #define PCI_DEVICE_ID_INTEL_CLV_EMMC0	0x08e5
22 #define PCI_DEVICE_ID_INTEL_CLV_EMMC1	0x08e6
23 #define PCI_DEVICE_ID_INTEL_QRK_SD	0x08A7
24 #define PCI_DEVICE_ID_INTEL_SPT_EMMC	0x9d2b
25 #define PCI_DEVICE_ID_INTEL_SPT_SDIO	0x9d2c
26 #define PCI_DEVICE_ID_INTEL_SPT_SD	0x9d2d
27 
28 /*
29  * PCI registers
30  */
31 
32 #define PCI_SDHCI_IFPIO			0x00
33 #define PCI_SDHCI_IFDMA			0x01
34 #define PCI_SDHCI_IFVENDOR		0x02
35 
36 #define PCI_SLOT_INFO			0x40	/* 8 bits */
37 #define  PCI_SLOT_INFO_SLOTS(x)		((x >> 4) & 7)
38 #define  PCI_SLOT_INFO_FIRST_BAR_MASK	0x07
39 
40 #define MAX_SLOTS			8
41 
42 struct sdhci_pci_chip;
43 struct sdhci_pci_slot;
44 
45 struct sdhci_pci_fixes {
46 	unsigned int		quirks;
47 	unsigned int		quirks2;
48 	bool			allow_runtime_pm;
49 	bool			own_cd_for_runtime_pm;
50 
51 	int			(*probe) (struct sdhci_pci_chip *);
52 
53 	int			(*probe_slot) (struct sdhci_pci_slot *);
54 	void			(*remove_slot) (struct sdhci_pci_slot *, int);
55 
56 	int			(*suspend) (struct sdhci_pci_chip *);
57 	int			(*resume) (struct sdhci_pci_chip *);
58 };
59 
60 struct sdhci_pci_slot {
61 	struct sdhci_pci_chip	*chip;
62 	struct sdhci_host	*host;
63 	struct sdhci_pci_data	*data;
64 
65 	int			pci_bar;
66 	int			rst_n_gpio;
67 	int			cd_gpio;
68 	int			cd_irq;
69 
70 	char			*cd_con_id;
71 	int			cd_idx;
72 	bool			cd_override_level;
73 
74 	void (*hw_reset)(struct sdhci_host *host);
75 };
76 
77 struct sdhci_pci_chip {
78 	struct pci_dev		*pdev;
79 
80 	unsigned int		quirks;
81 	unsigned int		quirks2;
82 	bool			allow_runtime_pm;
83 	const struct sdhci_pci_fixes *fixes;
84 
85 	int			num_slots;	/* Slots on controller */
86 	struct sdhci_pci_slot	*slots[MAX_SLOTS]; /* Pointers to host slots */
87 };
88 
89 #endif /* __SDHCI_PCI_H */
90