blob: 35d494f7d62f4fef7238301482db8e7ded85620f [file] [log] [blame]
Andreas Fenkart551434382014-11-08 15:33:09 +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
11#define OMAP_HSMMC_MAX_SLOTS 1
12
13/*
14 * struct omap_hsmmc_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)
31#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
32
33struct omap_hsmmc_dev_attr {
34 u8 flags;
35};
36
37struct mmc_card;
38
39struct omap_hsmmc_platform_data {
40 /* back-link to device */
41 struct device *dev;
42
43 /* number of slots per controller */
44 unsigned nr_slots:2;
45
46 /* set if your board has components or wiring that limits the
47 * maximum frequency on the MMC bus */
48 unsigned int max_freq;
49
Andreas Fenkart551434382014-11-08 15:33:09 +010050 /* To handle board related suspend/resume functionality for MMC */
51 int (*suspend)(struct device *dev, int slot);
52 int (*resume)(struct device *dev, int slot);
53
Andreas Fenkart551434382014-11-08 15:33:09 +010054 /* Integrating attributes from the omap_hwmod layer */
55 u8 controller_flags;
56
57 /* Register offset deviation */
58 u16 reg_offset;
59
60 struct omap_hsmmc_slot_data {
61 /*
62 * 4/8 wires and any additional host capabilities
63 * need to OR'd all capabilities (ref. linux/mmc/host.h)
64 */
Andreas Fenkart551434382014-11-08 15:33:09 +010065 u32 caps; /* Used for the MMC driver on 2430 and later */
66 u32 pm_caps; /* PM capabilities of the mmc */
67
Andreas Fenkart551434382014-11-08 15:33:09 +010068 /* switch pin can be for card detect (default) or card cover */
69 unsigned cover:1;
70
71 /* use the internal clock */
72 unsigned internal_clock:1;
73
74 /* nonremovable e.g. eMMC */
75 unsigned nonremovable:1;
76
Andreas Fenkart551434382014-11-08 15:33:09 +010077 /* eMMC does not handle power off when not in sleep state */
78 unsigned no_regulator_off_init:1;
79
Andreas Fenkart551434382014-11-08 15:33:09 +010080 /* we can put the features above into this variable */
81#define HSMMC_HAS_PBIAS (1 << 0)
82#define HSMMC_HAS_UPDATED_RESET (1 << 1)
83#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
84 unsigned features;
85
86 int switch_pin; /* gpio (card detect) */
87 int gpio_wp; /* gpio (write protect) */
88
Andreas Fenkart551434382014-11-08 15:33:09 +010089 int (*set_power)(struct device *dev, int slot,
90 int power_on, int vdd);
91 int (*get_ro)(struct device *dev, int slot);
92 void (*remux)(struct device *dev, int slot, int power_on);
93 /* Call back before enabling / disabling regulators */
94 void (*before_set_reg)(struct device *dev, int slot,
95 int power_on, int vdd);
96 /* Call back after enabling / disabling regulators */
97 void (*after_set_reg)(struct device *dev, int slot,
98 int power_on, int vdd);
99 /* if we have special card, init it using this callback */
100 void (*init_card)(struct mmc_card *card);
101
102 /* return MMC cover switch state, can be NULL if not supported.
103 *
104 * possible return values:
105 * 0 - closed
106 * 1 - open
107 */
108 int (*get_cover_state)(struct device *dev, int slot);
109
110 const char *name;
111 u32 ocr_mask;
112
113 /* Card detection IRQs */
114 int card_detect_irq;
115
116 int (*card_detect)(struct device *dev, int slot);
Andreas Fenkart551434382014-11-08 15:33:09 +0100117 } slots[OMAP_HSMMC_MAX_SLOTS];
118};