Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / include / linux / platform_data / mmc-omap.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * MMC definitions for OMAP2
4  *
5  * Copyright (C) 2006 Nokia Corporation
6  */
7
8 #define OMAP_MMC_MAX_SLOTS      2
9
10 struct mmc_card;
11
12 struct omap_mmc_platform_data {
13         /* back-link to device */
14         struct device *dev;
15
16         /* number of slots per controller */
17         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 */
24         int (*switch_slot)(struct device *dev, int slot);
25         /* initialize board-specific MMC functionality, can be NULL if
26          * not supported */
27         int (*init)(struct device *dev);
28         void (*cleanup)(struct device *dev);
29         void (*shutdown)(struct device *dev);
30
31         /* Return context loss count due to PM states changing */
32         int (*get_context_loss_count)(struct device *dev);
33
34         /* Integrating attributes from the omap_hwmod layer */
35         u8 controller_flags;
36
37         /* Register offset deviation */
38         u16 reg_offset;
39
40         struct omap_mmc_slot_data {
41
42                 /*
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 */
48                 u32 pm_caps;    /* PM capabilities of the mmc */
49
50                 /*
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
59                 /* use the internal clock */
60                 unsigned internal_clock:1;
61
62                 /* nonremovable e.g. eMMC */
63                 unsigned nonremovable:1;
64
65                 /* Try to sleep or power off when possible */
66                 unsigned power_saving:1;
67
68                 /* If using power_saving and the MMC power is not to go off */
69                 unsigned no_off:1;
70
71                 /* eMMC does not handle power off when not in sleep state */
72                 unsigned no_regulator_off_init:1;
73
74                 /* Regulator off remapped to sleep */
75                 unsigned vcc_aux_disable_is_sleep:1;
76
77                 /* we can put the features above into this variable */
78 #define MMC_OMAP7XX             (1 << 3)
79 #define MMC_OMAP15XX            (1 << 4)
80 #define MMC_OMAP16XX            (1 << 5)
81                 unsigned features;
82
83                 int switch_pin;                 /* gpio (card detect) */
84                 int gpio_wp;                    /* gpio (write protect) */
85
86                 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);
90                 void (*remux)(struct device *dev, int slot, int power_on);
91                 /* 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);
97                 /* if we have special card, init it using this callback */
98                 void (*init_card)(struct mmc_card *card);
99
100                 /* return MMC cover switch state, can be NULL if not supported.
101                  *
102                  * possible return values:
103                  *   0 - closed
104                  *   1 - open
105                  */
106                 int (*get_cover_state)(struct device *dev, int slot);
107
108                 const char *name;
109                 u32 ocr_mask;
110
111                 /* Card detection IRQs */
112                 int card_detect_irq;
113                 int (*card_detect)(struct device *dev, int slot);
114
115                 unsigned int ban_openended:1;
116
117         } slots[OMAP_MMC_MAX_SLOTS];
118 };