1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PLATFORM_DATA_SDHCI_S3C_H
3 #define __PLATFORM_DATA_SDHCI_S3C_H
4 
5 struct platform_device;
6 
7 enum cd_types {
8 	S3C_SDHCI_CD_INTERNAL,	/* use mmc internal CD line */
9 	S3C_SDHCI_CD_EXTERNAL,	/* use external callback */
10 	S3C_SDHCI_CD_GPIO,	/* use external gpio pin for CD line */
11 	S3C_SDHCI_CD_NONE,	/* no CD line, use polling to detect card */
12 	S3C_SDHCI_CD_PERMANENT,	/* no CD line, card permanently wired to host */
13 };
14 
15 /**
16  * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
17  * @max_width: The maximum number of data bits supported.
18  * @host_caps: Standard MMC host capabilities bit field.
19  * @host_caps2: The second standard MMC host capabilities bit field.
20  * @cd_type: Type of Card Detection method (see cd_types enum above)
21  * @ext_cd_init: Initialize external card detect subsystem. Called on
22  *		 sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
23  *		 notify_func argument is a callback to the sdhci-s3c driver
24  *		 that triggers the card detection event. Callback arguments:
25  *		 dev is pointer to platform device of the host controller,
26  *		 state is new state of the card (0 - removed, 1 - inserted).
27  * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
28  *		 sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
29  *		 notify_func argument is the same callback as for ext_cd_init.
30  * @ext_cd_gpio: gpio pin used for external CD line, valid only if
31  *		 cd_type == S3C_SDHCI_CD_GPIO
32  * @ext_cd_gpio_invert: invert values for external CD gpio line
33  * @cfg_gpio: Configure the GPIO for a specific card bit-width
34  *
35  * Initialisation data specific to either the machine or the platform
36  * for the device driver to use or call-back when configuring gpio or
37  * card speed information.
38 */
39 struct s3c_sdhci_platdata {
40 	unsigned int	max_width;
41 	unsigned int	host_caps;
42 	unsigned int	host_caps2;
43 	unsigned int	pm_caps;
44 	enum cd_types	cd_type;
45 
46 	int		ext_cd_gpio;
47 	bool		ext_cd_gpio_invert;
48 	int	(*ext_cd_init)(void (*notify_func)(struct platform_device *,
49 						   int state));
50 	int	(*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
51 						      int state));
52 
53 	void	(*cfg_gpio)(struct platform_device *dev, int width);
54 };
55 
56 
57 #endif /* __PLATFORM_DATA_SDHCI_S3C_H */
58