blob: 778ae8eb1f3e859d6aea678c15f2f4b24713ec03 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
David Brownell15a05802007-08-08 09:12:54 -07002#ifndef __LINUX_SPI_MMC_SPI_H
3#define __LINUX_SPI_MMC_SPI_H
4
Anton Vorontsov9c43df52008-12-30 18:15:28 +03005#include <linux/spi/spi.h>
Anton Vorontsov63e14622008-06-01 11:49:32 +02006#include <linux/interrupt.h>
7
Paul Gortmaker313162d2012-01-30 11:46:54 -05008struct device;
David Brownell15a05802007-08-08 09:12:54 -07009struct mmc_host;
10
11/* Put this in platform_data of a device being used to manage an MMC/SD
12 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
13 *
14 * REVISIT This is not a spi-specific notion. Any card slot should be
15 * able to handle it. If the MMC core doesn't adopt this kind of notion,
16 * switch the "struct device *" parameters over to "struct spi_device *".
17 */
18struct mmc_spi_platform_data {
19 /* driver activation and (optional) card detect irq hookup */
20 int (*init)(struct device *,
21 irqreturn_t (*)(int, void *),
22 void *);
23 void (*exit)(struct device *, void *);
24
Anton Vorontsov619ef4b2008-06-17 18:17:21 +040025 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
26 unsigned long caps;
Laurent Pinchartbf287a92013-08-08 12:38:32 +020027 unsigned long caps2;
Anton Vorontsov619ef4b2008-06-17 18:17:21 +040028
David Brownell15a05802007-08-08 09:12:54 -070029 /* how long to debounce card detect, in msecs */
30 u16 detect_delay;
31
32 /* power management */
33 u16 powerup_msecs; /* delay of up to 250 msec */
34 u32 ocr_mask; /* available voltages */
35 void (*setpower)(struct device *, unsigned int maskval);
36};
37
Anton Vorontsov9c43df52008-12-30 18:15:28 +030038#ifdef CONFIG_OF
39extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
40extern void mmc_spi_put_pdata(struct spi_device *spi);
41#else
42static inline struct mmc_spi_platform_data *
43mmc_spi_get_pdata(struct spi_device *spi)
44{
45 return spi->dev.platform_data;
46}
47static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
48#endif /* CONFIG_OF */
49
David Brownell15a05802007-08-08 09:12:54 -070050#endif /* __LINUX_SPI_MMC_SPI_H */