1*d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
268f39e74STony Lindgren /*
368f39e74STony Lindgren  * MMC definitions for OMAP2
468f39e74STony Lindgren  *
568f39e74STony Lindgren  * Copyright (C) 2006 Nokia Corporation
668f39e74STony Lindgren  */
768f39e74STony Lindgren 
868f39e74STony Lindgren #define OMAP_MMC_MAX_SLOTS	2
968f39e74STony Lindgren 
1068f39e74STony Lindgren struct mmc_card;
1168f39e74STony Lindgren 
1268f39e74STony Lindgren struct omap_mmc_platform_data {
1368f39e74STony Lindgren 	/* back-link to device */
1468f39e74STony Lindgren 	struct device *dev;
1568f39e74STony Lindgren 
1668f39e74STony Lindgren 	/* number of slots per controller */
1768f39e74STony Lindgren 	unsigned nr_slots:2;
1868f39e74STony Lindgren 
1968f39e74STony Lindgren 	/* set if your board has components or wiring that limits the
2068f39e74STony Lindgren 	 * maximum frequency on the MMC bus */
2168f39e74STony Lindgren 	unsigned int max_freq;
2268f39e74STony Lindgren 
2368f39e74STony Lindgren 	/* switch the bus to a new slot */
2468f39e74STony Lindgren 	int (*switch_slot)(struct device *dev, int slot);
2568f39e74STony Lindgren 	/* initialize board-specific MMC functionality, can be NULL if
2668f39e74STony Lindgren 	 * not supported */
2768f39e74STony Lindgren 	int (*init)(struct device *dev);
2868f39e74STony Lindgren 	void (*cleanup)(struct device *dev);
2968f39e74STony Lindgren 	void (*shutdown)(struct device *dev);
3068f39e74STony Lindgren 
3168f39e74STony Lindgren 	/* Return context loss count due to PM states changing */
3268f39e74STony Lindgren 	int (*get_context_loss_count)(struct device *dev);
3368f39e74STony Lindgren 
3468f39e74STony Lindgren 	/* Integrating attributes from the omap_hwmod layer */
3568f39e74STony Lindgren 	u8 controller_flags;
3668f39e74STony Lindgren 
3768f39e74STony Lindgren 	/* Register offset deviation */
3868f39e74STony Lindgren 	u16 reg_offset;
3968f39e74STony Lindgren 
4068f39e74STony Lindgren 	struct omap_mmc_slot_data {
4168f39e74STony Lindgren 
4268f39e74STony Lindgren 		/*
4368f39e74STony Lindgren 		 * 4/8 wires and any additional host capabilities
4468f39e74STony Lindgren 		 * need to OR'd all capabilities (ref. linux/mmc/host.h)
4568f39e74STony Lindgren 		 */
4668f39e74STony Lindgren 		u8  wires;	/* Used for the MMC driver on omap1 and 2420 */
4768f39e74STony Lindgren 		u32 caps;	/* Used for the MMC driver on 2430 and later */
4868f39e74STony Lindgren 		u32 pm_caps;	/* PM capabilities of the mmc */
4968f39e74STony Lindgren 
5068f39e74STony Lindgren 		/*
5168f39e74STony Lindgren 		 * nomux means "standard" muxing is wrong on this board, and
5268f39e74STony Lindgren 		 * that board-specific code handled it before common init logic.
5368f39e74STony Lindgren 		 */
5468f39e74STony Lindgren 		unsigned nomux:1;
5568f39e74STony Lindgren 
5668f39e74STony Lindgren 		/* switch pin can be for card detect (default) or card cover */
5768f39e74STony Lindgren 		unsigned cover:1;
5868f39e74STony Lindgren 
5968f39e74STony Lindgren 		/* use the internal clock */
6068f39e74STony Lindgren 		unsigned internal_clock:1;
6168f39e74STony Lindgren 
6268f39e74STony Lindgren 		/* nonremovable e.g. eMMC */
6368f39e74STony Lindgren 		unsigned nonremovable:1;
6468f39e74STony Lindgren 
6568f39e74STony Lindgren 		/* Try to sleep or power off when possible */
6668f39e74STony Lindgren 		unsigned power_saving:1;
6768f39e74STony Lindgren 
6868f39e74STony Lindgren 		/* If using power_saving and the MMC power is not to go off */
6968f39e74STony Lindgren 		unsigned no_off:1;
7068f39e74STony Lindgren 
7168f39e74STony Lindgren 		/* eMMC does not handle power off when not in sleep state */
7268f39e74STony Lindgren 		unsigned no_regulator_off_init:1;
7368f39e74STony Lindgren 
7468f39e74STony Lindgren 		/* Regulator off remapped to sleep */
7568f39e74STony Lindgren 		unsigned vcc_aux_disable_is_sleep:1;
7668f39e74STony Lindgren 
7768f39e74STony Lindgren 		/* we can put the features above into this variable */
788287361aSLinus Torvalds #define MMC_OMAP7XX		(1 << 3)
798287361aSLinus Torvalds #define MMC_OMAP15XX		(1 << 4)
808287361aSLinus Torvalds #define MMC_OMAP16XX		(1 << 5)
8168f39e74STony Lindgren 		unsigned features;
8268f39e74STony Lindgren 
8368f39e74STony Lindgren 		int switch_pin;			/* gpio (card detect) */
8468f39e74STony Lindgren 		int gpio_wp;			/* gpio (write protect) */
8568f39e74STony Lindgren 
8668f39e74STony Lindgren 		int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
8768f39e74STony Lindgren 		int (*set_power)(struct device *dev, int slot,
8868f39e74STony Lindgren 				 int power_on, int vdd);
8968f39e74STony Lindgren 		int (*get_ro)(struct device *dev, int slot);
9068f39e74STony Lindgren 		void (*remux)(struct device *dev, int slot, int power_on);
9168f39e74STony Lindgren 		/* Call back before enabling / disabling regulators */
9268f39e74STony Lindgren 		void (*before_set_reg)(struct device *dev, int slot,
9368f39e74STony Lindgren 				       int power_on, int vdd);
9468f39e74STony Lindgren 		/* Call back after enabling / disabling regulators */
9568f39e74STony Lindgren 		void (*after_set_reg)(struct device *dev, int slot,
9668f39e74STony Lindgren 				      int power_on, int vdd);
9768f39e74STony Lindgren 		/* if we have special card, init it using this callback */
9868f39e74STony Lindgren 		void (*init_card)(struct mmc_card *card);
9968f39e74STony Lindgren 
10068f39e74STony Lindgren 		/* return MMC cover switch state, can be NULL if not supported.
10168f39e74STony Lindgren 		 *
10268f39e74STony Lindgren 		 * possible return values:
10368f39e74STony Lindgren 		 *   0 - closed
10468f39e74STony Lindgren 		 *   1 - open
10568f39e74STony Lindgren 		 */
10668f39e74STony Lindgren 		int (*get_cover_state)(struct device *dev, int slot);
10768f39e74STony Lindgren 
10868f39e74STony Lindgren 		const char *name;
10968f39e74STony Lindgren 		u32 ocr_mask;
11068f39e74STony Lindgren 
11168f39e74STony Lindgren 		/* Card detection IRQs */
11268f39e74STony Lindgren 		int card_detect_irq;
11368f39e74STony Lindgren 		int (*card_detect)(struct device *dev, int slot);
11468f39e74STony Lindgren 
11568f39e74STony Lindgren 		unsigned int ban_openended:1;
11668f39e74STony Lindgren 
11768f39e74STony Lindgren 	} slots[OMAP_MMC_MAX_SLOTS];
11868f39e74STony Lindgren };
119