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