xref: /openbmc/linux/drivers/mmc/host/sdhci-pci.h (revision b34e08d5)
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_MRFL_MMC	0x1190
15 #define PCI_DEVICE_ID_INTEL_CLV_SDIO0	0x08f9
16 #define PCI_DEVICE_ID_INTEL_CLV_SDIO1	0x08fa
17 #define PCI_DEVICE_ID_INTEL_CLV_SDIO2	0x08fb
18 #define PCI_DEVICE_ID_INTEL_CLV_EMMC0	0x08e5
19 #define PCI_DEVICE_ID_INTEL_CLV_EMMC1	0x08e6
20 
21 /*
22  * PCI registers
23  */
24 
25 #define PCI_SDHCI_IFPIO			0x00
26 #define PCI_SDHCI_IFDMA			0x01
27 #define PCI_SDHCI_IFVENDOR		0x02
28 
29 #define PCI_SLOT_INFO			0x40	/* 8 bits */
30 #define  PCI_SLOT_INFO_SLOTS(x)		((x >> 4) & 7)
31 #define  PCI_SLOT_INFO_FIRST_BAR_MASK	0x07
32 
33 #define MAX_SLOTS			8
34 
35 struct sdhci_pci_chip;
36 struct sdhci_pci_slot;
37 
38 struct sdhci_pci_fixes {
39 	unsigned int		quirks;
40 	unsigned int		quirks2;
41 	bool			allow_runtime_pm;
42 	bool			own_cd_for_runtime_pm;
43 
44 	int			(*probe) (struct sdhci_pci_chip *);
45 
46 	int			(*probe_slot) (struct sdhci_pci_slot *);
47 	void			(*remove_slot) (struct sdhci_pci_slot *, int);
48 
49 	int			(*suspend) (struct sdhci_pci_chip *);
50 	int			(*resume) (struct sdhci_pci_chip *);
51 };
52 
53 struct sdhci_pci_slot {
54 	struct sdhci_pci_chip	*chip;
55 	struct sdhci_host	*host;
56 	struct sdhci_pci_data	*data;
57 
58 	int			pci_bar;
59 	int			rst_n_gpio;
60 	int			cd_gpio;
61 	int			cd_irq;
62 
63 	void (*hw_reset)(struct sdhci_host *host);
64 };
65 
66 struct sdhci_pci_chip {
67 	struct pci_dev		*pdev;
68 
69 	unsigned int		quirks;
70 	unsigned int		quirks2;
71 	bool			allow_runtime_pm;
72 	const struct sdhci_pci_fixes *fixes;
73 
74 	int			num_slots;	/* Slots on controller */
75 	struct sdhci_pci_slot	*slots[MAX_SLOTS]; /* Pointers to host slots */
76 };
77 
78 #endif /* __SDHCI_PCI_H */
79