blob: 9acf0e87aa9be12c3d4a7966e8c8807543474beb [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Russell Kinga09e64f2008-08-05 16:14:15 +01002/*
3 * MMC definitions for OMAP2
4 *
5 * Copyright (C) 2006 Nokia Corporation
Russell Kinga09e64f2008-08-05 16:14:15 +01006 */
7
Russell Kinga09e64f2008-08-05 16:14:15 +01008#define OMAP_MMC_MAX_SLOTS 2
9
Tony Lindgren68f39e72012-10-15 12:09:43 -070010struct mmc_card;
11
Russell Kinga09e64f2008-08-05 16:14:15 +010012struct omap_mmc_platform_data {
David Brownell01971f62009-03-23 18:23:47 -070013 /* back-link to device */
14 struct device *dev;
Russell Kinga09e64f2008-08-05 16:14:15 +010015
Tony Lindgrend8874662008-12-10 17:37:16 -080016 /* number of slots per controller */
Russell Kinga09e64f2008-08-05 16:14:15 +010017 unsigned nr_slots:2;
18
19 /* set if your board has components or wiring that limits the
20 * maximum frequency on the MMC bus */
21 unsigned int max_freq;
22
23 /* switch the bus to a new slot */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080024 int (*switch_slot)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +010025 /* initialize board-specific MMC functionality, can be NULL if
26 * not supported */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080027 int (*init)(struct device *dev);
28 void (*cleanup)(struct device *dev);
29 void (*shutdown)(struct device *dev);
Russell Kinga09e64f2008-08-05 16:14:15 +010030
Denis Karpov1887bde2009-09-22 16:44:40 -070031 /* Return context loss count due to PM states changing */
32 int (*get_context_loss_count)(struct device *dev);
33
Kishore Kadiyala6ab89462011-03-01 13:12:56 -080034 /* Integrating attributes from the omap_hwmod layer */
35 u8 controller_flags;
36
kishore kadiyala91a0b082010-10-01 16:35:28 -070037 /* Register offset deviation */
38 u16 reg_offset;
39
Russell Kinga09e64f2008-08-05 16:14:15 +010040 struct omap_mmc_slot_data {
Tony Lindgrend8874662008-12-10 17:37:16 -080041
Tony Lindgren63509e32010-10-04 16:58:01 -070042 /*
43 * 4/8 wires and any additional host capabilities
44 * need to OR'd all capabilities (ref. linux/mmc/host.h)
45 */
46 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
47 u32 caps; /* Used for the MMC driver on 2430 and later */
Eliad Peller6fdc75d2011-11-22 16:02:18 +020048 u32 pm_caps; /* PM capabilities of the mmc */
Tony Lindgren90c62bf2008-12-10 17:37:17 -080049
Tony Lindgrend8874662008-12-10 17:37:16 -080050 /*
51 * nomux means "standard" muxing is wrong on this board, and
52 * that board-specific code handled it before common init logic.
53 */
54 unsigned nomux:1;
55
56 /* switch pin can be for card detect (default) or card cover */
57 unsigned cover:1;
58
Tony Lindgrend8874662008-12-10 17:37:16 -080059 /* use the internal clock */
60 unsigned internal_clock:1;
Tony Lindgren90c62bf2008-12-10 17:37:17 -080061
Adrian Hunter23d99bb2009-09-22 16:44:48 -070062 /* nonremovable e.g. eMMC */
63 unsigned nonremovable:1;
64
Denis Karpovdd498ef2009-09-22 16:44:49 -070065 /* Try to sleep or power off when possible */
66 unsigned power_saving:1;
67
Adrian Hunter1df58db2010-02-15 10:03:34 -080068 /* If using power_saving and the MMC power is not to go off */
69 unsigned no_off:1;
70
Balaji T Kb1c1df72011-05-30 19:55:34 +053071 /* eMMC does not handle power off when not in sleep state */
72 unsigned no_regulator_off_init:1;
73
Adrian Huntere0eb2422010-02-15 10:03:34 -080074 /* Regulator off remapped to sleep */
75 unsigned vcc_aux_disable_is_sleep:1;
76
stanley.miao03e7e172010-05-13 12:39:31 +000077 /* we can put the features above into this variable */
Linus Torvalds82873612012-12-12 11:45:16 -080078#define MMC_OMAP7XX (1 << 3)
79#define MMC_OMAP15XX (1 << 4)
80#define MMC_OMAP16XX (1 << 5)
stanley.miao03e7e172010-05-13 12:39:31 +000081 unsigned features;
82
Tony Lindgren90c62bf2008-12-10 17:37:17 -080083 int switch_pin; /* gpio (card detect) */
84 int gpio_wp; /* gpio (write protect) */
Tony Lindgrend8874662008-12-10 17:37:16 -080085
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080086 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
87 int (*set_power)(struct device *dev, int slot,
88 int power_on, int vdd);
89 int (*get_ro)(struct device *dev, int slot);
Adrian Hunterce6f0012010-02-15 10:03:34 -080090 void (*remux)(struct device *dev, int slot, int power_on);
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080091 /* Call back before enabling / disabling regulators */
92 void (*before_set_reg)(struct device *dev, int slot,
93 int power_on, int vdd);
94 /* Call back after enabling / disabling regulators */
95 void (*after_set_reg)(struct device *dev, int slot,
96 int power_on, int vdd);
Grazvydas Ignotas48168582010-08-10 18:01:52 -070097 /* if we have special card, init it using this callback */
98 void (*init_card)(struct mmc_card *card);
Russell Kinga09e64f2008-08-05 16:14:15 +010099
100 /* return MMC cover switch state, can be NULL if not supported.
101 *
102 * possible return values:
Tony Lindgrend8874662008-12-10 17:37:16 -0800103 * 0 - closed
104 * 1 - open
Russell Kinga09e64f2008-08-05 16:14:15 +0100105 */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800106 int (*get_cover_state)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +0100107
108 const char *name;
109 u32 ocr_mask;
110
111 /* Card detection IRQs */
112 int card_detect_irq;
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800113 int (*card_detect)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +0100114
115 unsigned int ban_openended:1;
116
117 } slots[OMAP_MMC_MAX_SLOTS];
118};