xref: /OK3568_Linux_fs/kernel/include/linux/platform_data/mmc-s3cmci.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _ARCH_MCI_H
3*4882a593Smuzhiyun #define _ARCH_MCI_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /**
6*4882a593Smuzhiyun  * struct s3c24xx_mci_pdata - sd/mmc controller platform data
7*4882a593Smuzhiyun  * @no_wprotect: Set this to indicate there is no write-protect switch.
8*4882a593Smuzhiyun  * @no_detect: Set this if there is no detect switch.
9*4882a593Smuzhiyun  * @wprotect_invert: Invert the default sense of the write protect switch.
10*4882a593Smuzhiyun  * @use_dma: Set to allow the use of DMA.
11*4882a593Smuzhiyun  * @gpio_detect: GPIO number for the card detect line.
12*4882a593Smuzhiyun  * @gpio_wprotect: GPIO number for the write protect line.
13*4882a593Smuzhiyun  * @ocr_avail: The mask of the available power states, non-zero to use.
14*4882a593Smuzhiyun  * @set_power: Callback to control the power mode.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  * The @gpio_detect is used for card detection when @no_wprotect is unset,
17*4882a593Smuzhiyun  * and the default sense is that 0 returned from gpio_get_value() means
18*4882a593Smuzhiyun  * that a card is inserted. If @detect_invert is set, then the value from
19*4882a593Smuzhiyun  * gpio_get_value() is inverted, which makes 1 mean card inserted.
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * The driver will use @gpio_wprotect to signal whether the card is write
22*4882a593Smuzhiyun  * protected if @no_wprotect is not set. A 0 returned from gpio_get_value()
23*4882a593Smuzhiyun  * means the card is read/write, and 1 means read-only. The @wprotect_invert
24*4882a593Smuzhiyun  * will invert the value returned from gpio_get_value().
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  * Card power is set by @ocr_availa, using MCC_VDD_ constants if it is set
27*4882a593Smuzhiyun  * to a non-zero value, otherwise the default of 3.2-3.4V is used.
28*4882a593Smuzhiyun  */
29*4882a593Smuzhiyun struct s3c24xx_mci_pdata {
30*4882a593Smuzhiyun 	unsigned int	no_wprotect:1;
31*4882a593Smuzhiyun 	unsigned int	no_detect:1;
32*4882a593Smuzhiyun 	unsigned int	wprotect_invert:1;
33*4882a593Smuzhiyun 	unsigned int	use_dma:1;
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun 	unsigned long	ocr_avail;
36*4882a593Smuzhiyun 	void		(*set_power)(unsigned char power_mode,
37*4882a593Smuzhiyun 				     unsigned short vdd);
38*4882a593Smuzhiyun 	struct gpio_desc *bus[6];
39*4882a593Smuzhiyun };
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /**
42*4882a593Smuzhiyun  * s3c24xx_mci_set_platdata - set platform data for mmc/sdi device
43*4882a593Smuzhiyun  * @pdata: The platform data
44*4882a593Smuzhiyun  *
45*4882a593Smuzhiyun  * Copy the platform data supplied by @pdata so that this can be marked
46*4882a593Smuzhiyun  * __initdata.
47*4882a593Smuzhiyun  */
48*4882a593Smuzhiyun extern void s3c24xx_mci_def_set_power(unsigned char power_mode, unsigned short vdd);
49*4882a593Smuzhiyun extern void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata);
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun #endif /* _ARCH_NCI_H */
52