blob: 929469291406fa0a41511c118ab49bae3270b07e [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
Tony Lindgren68f39e72012-10-15 12:09:43 -070013struct mmc_card;
14
Russell Kinga09e64f2008-08-05 16:14:15 +010015struct omap_mmc_platform_data {
David Brownell01971f62009-03-23 18:23:47 -070016 /* back-link to device */
17 struct device *dev;
Russell Kinga09e64f2008-08-05 16:14:15 +010018
Tony Lindgrend8874662008-12-10 17:37:16 -080019 /* number of slots per controller */
Russell Kinga09e64f2008-08-05 16:14:15 +010020 unsigned nr_slots:2;
21
22 /* set if your board has components or wiring that limits the
23 * maximum frequency on the MMC bus */
24 unsigned int max_freq;
25
26 /* switch the bus to a new slot */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080027 int (*switch_slot)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +010028 /* initialize board-specific MMC functionality, can be NULL if
29 * not supported */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080030 int (*init)(struct device *dev);
31 void (*cleanup)(struct device *dev);
32 void (*shutdown)(struct device *dev);
Russell Kinga09e64f2008-08-05 16:14:15 +010033
Denis Karpov1887bde2009-09-22 16:44:40 -070034 /* Return context loss count due to PM states changing */
35 int (*get_context_loss_count)(struct device *dev);
36
Kishore Kadiyala6ab89462011-03-01 13:12:56 -080037 /* Integrating attributes from the omap_hwmod layer */
38 u8 controller_flags;
39
kishore kadiyala91a0b082010-10-01 16:35:28 -070040 /* Register offset deviation */
41 u16 reg_offset;
42
Russell Kinga09e64f2008-08-05 16:14:15 +010043 struct omap_mmc_slot_data {
Tony Lindgrend8874662008-12-10 17:37:16 -080044
Tony Lindgren63509e32010-10-04 16:58:01 -070045 /*
46 * 4/8 wires and any additional host capabilities
47 * need to OR'd all capabilities (ref. linux/mmc/host.h)
48 */
49 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
50 u32 caps; /* Used for the MMC driver on 2430 and later */
Eliad Peller6fdc75d2011-11-22 16:02:18 +020051 u32 pm_caps; /* PM capabilities of the mmc */
Tony Lindgren90c62bf2008-12-10 17:37:17 -080052
Tony Lindgrend8874662008-12-10 17:37:16 -080053 /*
54 * nomux means "standard" muxing is wrong on this board, and
55 * that board-specific code handled it before common init logic.
56 */
57 unsigned nomux:1;
58
59 /* switch pin can be for card detect (default) or card cover */
60 unsigned cover:1;
61
Tony Lindgrend8874662008-12-10 17:37:16 -080062 /* use the internal clock */
63 unsigned internal_clock:1;
Tony Lindgren90c62bf2008-12-10 17:37:17 -080064
Adrian Hunter23d99bb2009-09-22 16:44:48 -070065 /* nonremovable e.g. eMMC */
66 unsigned nonremovable:1;
67
Denis Karpovdd498ef2009-09-22 16:44:49 -070068 /* Try to sleep or power off when possible */
69 unsigned power_saving:1;
70
Adrian Hunter1df58db2010-02-15 10:03:34 -080071 /* If using power_saving and the MMC power is not to go off */
72 unsigned no_off:1;
73
Balaji T Kb1c1df72011-05-30 19:55:34 +053074 /* eMMC does not handle power off when not in sleep state */
75 unsigned no_regulator_off_init:1;
76
Adrian Huntere0eb2422010-02-15 10:03:34 -080077 /* Regulator off remapped to sleep */
78 unsigned vcc_aux_disable_is_sleep:1;
79
stanley.miao03e7e172010-05-13 12:39:31 +000080 /* we can put the features above into this variable */
Linus Torvalds82873612012-12-12 11:45:16 -080081#define MMC_OMAP7XX (1 << 3)
82#define MMC_OMAP15XX (1 << 4)
83#define MMC_OMAP16XX (1 << 5)
stanley.miao03e7e172010-05-13 12:39:31 +000084 unsigned features;
85
Tony Lindgren90c62bf2008-12-10 17:37:17 -080086 int switch_pin; /* gpio (card detect) */
87 int gpio_wp; /* gpio (write protect) */
Tony Lindgrend8874662008-12-10 17:37:16 -080088
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080089 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
90 int (*set_power)(struct device *dev, int slot,
91 int power_on, int vdd);
92 int (*get_ro)(struct device *dev, int slot);
Adrian Hunterce6f0012010-02-15 10:03:34 -080093 void (*remux)(struct device *dev, int slot, int power_on);
Adrian Hunterdb0fefc2010-02-15 10:03:34 -080094 /* Call back before enabling / disabling regulators */
95 void (*before_set_reg)(struct device *dev, int slot,
96 int power_on, int vdd);
97 /* Call back after enabling / disabling regulators */
98 void (*after_set_reg)(struct device *dev, int slot,
99 int power_on, int vdd);
Grazvydas Ignotas48168582010-08-10 18:01:52 -0700100 /* if we have special card, init it using this callback */
101 void (*init_card)(struct mmc_card *card);
Russell Kinga09e64f2008-08-05 16:14:15 +0100102
103 /* return MMC cover switch state, can be NULL if not supported.
104 *
105 * possible return values:
Tony Lindgrend8874662008-12-10 17:37:16 -0800106 * 0 - closed
107 * 1 - open
Russell Kinga09e64f2008-08-05 16:14:15 +0100108 */
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800109 int (*get_cover_state)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +0100110
111 const char *name;
112 u32 ocr_mask;
113
114 /* Card detection IRQs */
115 int card_detect_irq;
Adrian Hunterdb0fefc2010-02-15 10:03:34 -0800116 int (*card_detect)(struct device *dev, int slot);
Russell Kinga09e64f2008-08-05 16:14:15 +0100117
118 unsigned int ban_openended:1;
119
120 } slots[OMAP_MMC_MAX_SLOTS];
121};