blob: 929469291406fa0a41511c118ab49bae3270b07e [file] [log] [blame]
Kyle Swenson8d8f6542021-03-15 11:02:55 -06001/*
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_MMC_MAX_SLOTS 2
12
13struct mmc_card;
14
15struct omap_mmc_platform_data {
16 /* back-link to device */
17 struct device *dev;
18
19 /* number of slots per controller */
20 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 */
27 int (*switch_slot)(struct device *dev, int slot);
28 /* initialize board-specific MMC functionality, can be NULL if
29 * not supported */
30 int (*init)(struct device *dev);
31 void (*cleanup)(struct device *dev);
32 void (*shutdown)(struct device *dev);
33
34 /* Return context loss count due to PM states changing */
35 int (*get_context_loss_count)(struct device *dev);
36
37 /* Integrating attributes from the omap_hwmod layer */
38 u8 controller_flags;
39
40 /* Register offset deviation */
41 u16 reg_offset;
42
43 struct omap_mmc_slot_data {
44
45 /*
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 */
51 u32 pm_caps; /* PM capabilities of the mmc */
52
53 /*
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
62 /* use the internal clock */
63 unsigned internal_clock:1;
64
65 /* nonremovable e.g. eMMC */
66 unsigned nonremovable:1;
67
68 /* Try to sleep or power off when possible */
69 unsigned power_saving:1;
70
71 /* If using power_saving and the MMC power is not to go off */
72 unsigned no_off:1;
73
74 /* eMMC does not handle power off when not in sleep state */
75 unsigned no_regulator_off_init:1;
76
77 /* Regulator off remapped to sleep */
78 unsigned vcc_aux_disable_is_sleep:1;
79
80 /* we can put the features above into this variable */
81#define MMC_OMAP7XX (1 << 3)
82#define MMC_OMAP15XX (1 << 4)
83#define MMC_OMAP16XX (1 << 5)
84 unsigned features;
85
86 int switch_pin; /* gpio (card detect) */
87 int gpio_wp; /* gpio (write protect) */
88
89 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);
93 void (*remux)(struct device *dev, int slot, int power_on);
94 /* 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);
100 /* if we have special card, init it using this callback */
101 void (*init_card)(struct mmc_card *card);
102
103 /* return MMC cover switch state, can be NULL if not supported.
104 *
105 * possible return values:
106 * 0 - closed
107 * 1 - open
108 */
109 int (*get_cover_state)(struct device *dev, int slot);
110
111 const char *name;
112 u32 ocr_mask;
113
114 /* Card detection IRQs */
115 int card_detect_irq;
116 int (*card_detect)(struct device *dev, int slot);
117
118 unsigned int ban_openended:1;
119
120 } slots[OMAP_MMC_MAX_SLOTS];
121};