| 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 | /* initialize board-specific MMC functionality, can be NULL if |
| 24 | * not supported */ |
| 25 | int (*init)(struct device *dev); |
| 26 | void (*cleanup)(struct device *dev); |
| 27 | void (*shutdown)(struct device *dev); |
| 28 | |
| 29 | /* Return context loss count due to PM states changing */ |
| 30 | int (*get_context_loss_count)(struct device *dev); |
| 31 | |
| 32 | /* Integrating attributes from the omap_hwmod layer */ |
| 33 | u8 controller_flags; |
| 34 | |
| 35 | /* Register offset deviation */ |
| 36 | u16 reg_offset; |
| 37 | |
| 38 | struct omap_mmc_slot_data { |
| 39 | |
| 40 | /* |
| 41 | * 4/8 wires and any additional host capabilities |
| 42 | * need to OR'd all capabilities (ref. linux/mmc/host.h) |
| 43 | */ |
| 44 | u8 wires; /* Used for the MMC driver on omap1 and 2420 */ |
| 45 | u32 caps; /* Used for the MMC driver on 2430 and later */ |
| 46 | u32 pm_caps; /* PM capabilities of the mmc */ |
| 47 | |
| 48 | /* |
| 49 | * nomux means "standard" muxing is wrong on this board, and |
| 50 | * that board-specific code handled it before common init logic. |
| 51 | */ |
| 52 | unsigned nomux:1; |
| 53 | |
| 54 | /* switch pin can be for card detect (default) or card cover */ |
| 55 | unsigned cover:1; |
| 56 | |
| 57 | /* use the internal clock */ |
| 58 | unsigned internal_clock:1; |
| 59 | |
| 60 | /* nonremovable e.g. eMMC */ |
| 61 | unsigned nonremovable:1; |
| 62 | |
| 63 | /* Try to sleep or power off when possible */ |
| 64 | unsigned power_saving:1; |
| 65 | |
| 66 | /* If using power_saving and the MMC power is not to go off */ |
| 67 | unsigned no_off:1; |
| 68 | |
| 69 | /* eMMC does not handle power off when not in sleep state */ |
| 70 | unsigned no_regulator_off_init:1; |
| 71 | |
| 72 | /* Regulator off remapped to sleep */ |
| 73 | unsigned vcc_aux_disable_is_sleep:1; |
| 74 | |
| 75 | /* we can put the features above into this variable */ |
| 76 | #define MMC_OMAP7XX (1 << 3) |
| 77 | #define MMC_OMAP15XX (1 << 4) |
| 78 | #define MMC_OMAP16XX (1 << 5) |
| 79 | unsigned features; |
| 80 | |
| 81 | int switch_pin; /* gpio (card detect) */ |
| 82 | int gpio_wp; /* gpio (write protect) */ |
| 83 | |
| 84 | int (*set_bus_mode)(struct device *dev, int slot, int bus_mode); |
| 85 | int (*set_power)(struct device *dev, int slot, |
| 86 | int power_on, int vdd); |
| 87 | int (*get_ro)(struct device *dev, int slot); |
| 88 | void (*remux)(struct device *dev, int slot, int power_on); |
| 89 | /* Call back before enabling / disabling regulators */ |
| 90 | void (*before_set_reg)(struct device *dev, int slot, |
| 91 | int power_on, int vdd); |
| 92 | /* Call back after enabling / disabling regulators */ |
| 93 | void (*after_set_reg)(struct device *dev, int slot, |
| 94 | int power_on, int vdd); |
| 95 | /* if we have special card, init it using this callback */ |
| 96 | void (*init_card)(struct mmc_card *card); |
| 97 | |
| 98 | /* return MMC cover switch state, can be NULL if not supported. |
| 99 | * |
| 100 | * possible return values: |
| 101 | * 0 - closed |
| 102 | * 1 - open |
| 103 | */ |
| 104 | int (*get_cover_state)(struct device *dev, int slot); |
| 105 | |
| 106 | const char *name; |
| 107 | u32 ocr_mask; |
| 108 | |
| 109 | /* Card detection */ |
| 110 | int (*card_detect)(struct device *dev, int slot); |
| 111 | |
| 112 | unsigned int ban_openended:1; |
| 113 | |
| 114 | } slots[OMAP_MMC_MAX_SLOTS]; |
| 115 | }; |
| 116 | |
| 117 | extern void omap_mmc_notify_cover_event(struct device *dev, int slot, |
| 118 | int is_closed); |
| 119 | |