blob: 39a7abc5604c502d00356ff052183c87f8f41a39 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
Russell Kinga09e64f2008-08-05 16:14:15 +010011#define OMAP_MMC_MAX_SLOTS 2
12
Paul Walmsley9b682562011-10-06 14:50:35 -060013/*
14 * struct omap_mmc_dev_attr.flags possibilities
15 *
16 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
17 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
18 * should be set if this is the case. See for example Section 22.5.3
19 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
20 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
21 *
22 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
23 * don't work correctly on some MMC controller instances on some
24 * OMAP3 SoCs; this flag should be set if this is the case. See
25 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
26 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
27 * Revision F (October 2010) (SPRZ278F).
28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
Kishore Kadiyala6ab89462011-03-01 13:12:56 -080031
Tony Lindgren68f39e72012-10-15 12:09:43 -070032struct mmc_card;
33
Kishore Kadiyala6ab89462011-03-01 13:12:56 -080034struct omap_mmc_dev_attr {
35 u8 flags;
36};
37
Russell Kinga09e64f2008-08-05 16:14:15 +010038struct omap_mmc_platform_data {
David Brownell01971f62009-03-23 18:23:47 -070039 /* back-link to device */
40 struct device *dev;
Russell Kinga09e64f2008-08-05 16:14:15 +010041
Tony Lindgrend8874662008-12-10 17:37:16 -080042 /* number of slots per controller */
Russell Kinga09e64f2008-08-05 16:14:15 +010043 unsigned nr_slots:2;
44
45 /* set if your board has components or wiring that limits the
46 * maximum frequency on the MMC bus */
47 unsigned int max_freq;
48
49 /* switch the bus to a new slot */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080050 int (*switch_slot)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +010051 /* initialize board-specific MMC functionality, can be NULL if
52 * not supported */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080053 int (*init)(struct device *dev);
54 void (*cleanup)(struct device *dev);
55 void (*shutdown)(struct device *dev);
Russell Kinga09e64f2008-08-05 16:14:15 +010056
57 /* To handle board related suspend/resume functionality for MMC */
58 int (*suspend)(struct device *dev, int slot);
59 int (*resume)(struct device *dev, int slot);
60
Denis Karpov1887bde2009-09-22 16:44:40 -070061 /* Return context loss count due to PM states changing */
62 int (*get_context_loss_count)(struct device *dev);
63
Kishore Kadiyala6ab89462011-03-01 13:12:56 -080064 /* Integrating attributes from the omap_hwmod layer */
65 u8 controller_flags;
66
kishore kadiyala91a0b082010-10-01 16:35:28 -070067 /* Register offset deviation */
68 u16 reg_offset;
69
Russell Kinga09e64f2008-08-05 16:14:15 +010070 struct omap_mmc_slot_data {
Tony Lindgrend8874662008-12-10 17:37:16 -080071
Tony Lindgren63509e32010-10-04 16:58:01 -070072 /*
73 * 4/8 wires and any additional host capabilities
74 * need to OR'd all capabilities (ref. linux/mmc/host.h)
75 */
76 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
77 u32 caps; /* Used for the MMC driver on 2430 and later */
Eliad Peller6fdc75d2011-11-22 16:02:18 +020078 u32 pm_caps; /* PM capabilities of the mmc */
Tony Lindgren90c62bf2008-12-10 17:37:17 -080079
Tony Lindgrend8874662008-12-10 17:37:16 -080080 /*
81 * nomux means "standard" muxing is wrong on this board, and
82 * that board-specific code handled it before common init logic.
83 */
84 unsigned nomux:1;
85
86 /* switch pin can be for card detect (default) or card cover */
87 unsigned cover:1;
88
Tony Lindgrend8874662008-12-10 17:37:16 -080089 /* use the internal clock */
90 unsigned internal_clock:1;
Tony Lindgren90c62bf2008-12-10 17:37:17 -080091
Adrian Hunter23d99bb2009-09-22 16:44:48 -070092 /* nonremovable e.g. eMMC */
93 unsigned nonremovable:1;
94
Denis Karpovdd498ef2009-09-22 16:44:49 -070095 /* Try to sleep or power off when possible */
96 unsigned power_saving:1;
97
Adrian Hunter1df58db2010-02-15 10:03:34 -080098 /* If using power_saving and the MMC power is not to go off */
99 unsigned no_off:1;
100
Balaji T Kb1c1df72011-05-30 19:55:34 +0530101 /* eMMC does not handle power off when not in sleep state */
102 unsigned no_regulator_off_init:1;
103
Adrian Huntere0eb2422010-02-15 10:03:34 -0800104 /* Regulator off remapped to sleep */
105 unsigned vcc_aux_disable_is_sleep:1;
106
stanley.miao03e7e172010-05-13 12:39:31 +0000107 /* we can put the features above into this variable */
108#define HSMMC_HAS_PBIAS (1 << 0)
Madhusudhan Chikkature07ad64b2010-10-01 16:35:25 -0700109#define HSMMC_HAS_UPDATED_RESET (1 << 1)
stanley.miao03e7e172010-05-13 12:39:31 +0000110 unsigned features;
111
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800112 int switch_pin; /* gpio (card detect) */
113 int gpio_wp; /* gpio (write protect) */
Tony Lindgrend8874662008-12-10 17:37:16 -0800114
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800115 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
116 int (*set_power)(struct device *dev, int slot,
117 int power_on, int vdd);
118 int (*get_ro)(struct device *dev, int slot);
Adrian Hunterce6f0012010-02-15 10:03:34 -0800119 void (*remux)(struct device *dev, int slot, int power_on);
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800120 /* Call back before enabling / disabling regulators */
121 void (*before_set_reg)(struct device *dev, int slot,
122 int power_on, int vdd);
123 /* Call back after enabling / disabling regulators */
124 void (*after_set_reg)(struct device *dev, int slot,
125 int power_on, int vdd);
Grazvydas Ignotas48168582010-08-10 18:01:52 -0700126 /* if we have special card, init it using this callback */
127 void (*init_card)(struct mmc_card *card);
Russell Kinga09e64f2008-08-05 16:14:15 +0100128
129 /* return MMC cover switch state, can be NULL if not supported.
130 *
131 * possible return values:
Tony Lindgrend8874662008-12-10 17:37:16 -0800132 * 0 - closed
133 * 1 - open
Russell Kinga09e64f2008-08-05 16:14:15 +0100134 */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800135 int (*get_cover_state)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +0100136
137 const char *name;
138 u32 ocr_mask;
139
140 /* Card detection IRQs */
141 int card_detect_irq;
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800142 int (*card_detect)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +0100143
144 unsigned int ban_openended:1;
145
146 } slots[OMAP_MMC_MAX_SLOTS];
147};