1*68f39e74STony Lindgren /* 2*68f39e74STony Lindgren * MMC definitions for OMAP2 3*68f39e74STony Lindgren * 4*68f39e74STony Lindgren * Copyright (C) 2006 Nokia Corporation 5*68f39e74STony Lindgren * 6*68f39e74STony Lindgren * This program is free software; you can redistribute it and/or modify 7*68f39e74STony Lindgren * it under the terms of the GNU General Public License version 2 as 8*68f39e74STony Lindgren * published by the Free Software Foundation. 9*68f39e74STony Lindgren */ 10*68f39e74STony Lindgren 11*68f39e74STony Lindgren #define OMAP_MMC_MAX_SLOTS 2 12*68f39e74STony Lindgren 13*68f39e74STony Lindgren /* 14*68f39e74STony Lindgren * struct omap_mmc_dev_attr.flags possibilities 15*68f39e74STony Lindgren * 16*68f39e74STony Lindgren * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can 17*68f39e74STony Lindgren * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag 18*68f39e74STony Lindgren * should be set if this is the case. See for example Section 22.5.3 19*68f39e74STony Lindgren * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia 20*68f39e74STony Lindgren * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R). 21*68f39e74STony Lindgren * 22*68f39e74STony Lindgren * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers 23*68f39e74STony Lindgren * don't work correctly on some MMC controller instances on some 24*68f39e74STony Lindgren * OMAP3 SoCs; this flag should be set if this is the case. See 25*68f39e74STony Lindgren * for example Advisory 2.1.1.128 "MMC: Multiple Block Read 26*68f39e74STony Lindgren * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_ 27*68f39e74STony Lindgren * Revision F (October 2010) (SPRZ278F). 28*68f39e74STony Lindgren */ 29*68f39e74STony Lindgren #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) 30*68f39e74STony Lindgren #define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1) 31*68f39e74STony Lindgren 32*68f39e74STony Lindgren struct mmc_card; 33*68f39e74STony Lindgren 34*68f39e74STony Lindgren struct omap_mmc_dev_attr { 35*68f39e74STony Lindgren u8 flags; 36*68f39e74STony Lindgren }; 37*68f39e74STony Lindgren 38*68f39e74STony Lindgren struct omap_mmc_platform_data { 39*68f39e74STony Lindgren /* back-link to device */ 40*68f39e74STony Lindgren struct device *dev; 41*68f39e74STony Lindgren 42*68f39e74STony Lindgren /* number of slots per controller */ 43*68f39e74STony Lindgren unsigned nr_slots:2; 44*68f39e74STony Lindgren 45*68f39e74STony Lindgren /* set if your board has components or wiring that limits the 46*68f39e74STony Lindgren * maximum frequency on the MMC bus */ 47*68f39e74STony Lindgren unsigned int max_freq; 48*68f39e74STony Lindgren 49*68f39e74STony Lindgren /* switch the bus to a new slot */ 50*68f39e74STony Lindgren int (*switch_slot)(struct device *dev, int slot); 51*68f39e74STony Lindgren /* initialize board-specific MMC functionality, can be NULL if 52*68f39e74STony Lindgren * not supported */ 53*68f39e74STony Lindgren int (*init)(struct device *dev); 54*68f39e74STony Lindgren void (*cleanup)(struct device *dev); 55*68f39e74STony Lindgren void (*shutdown)(struct device *dev); 56*68f39e74STony Lindgren 57*68f39e74STony Lindgren /* To handle board related suspend/resume functionality for MMC */ 58*68f39e74STony Lindgren int (*suspend)(struct device *dev, int slot); 59*68f39e74STony Lindgren int (*resume)(struct device *dev, int slot); 60*68f39e74STony Lindgren 61*68f39e74STony Lindgren /* Return context loss count due to PM states changing */ 62*68f39e74STony Lindgren int (*get_context_loss_count)(struct device *dev); 63*68f39e74STony Lindgren 64*68f39e74STony Lindgren /* Integrating attributes from the omap_hwmod layer */ 65*68f39e74STony Lindgren u8 controller_flags; 66*68f39e74STony Lindgren 67*68f39e74STony Lindgren /* Register offset deviation */ 68*68f39e74STony Lindgren u16 reg_offset; 69*68f39e74STony Lindgren 70*68f39e74STony Lindgren struct omap_mmc_slot_data { 71*68f39e74STony Lindgren 72*68f39e74STony Lindgren /* 73*68f39e74STony Lindgren * 4/8 wires and any additional host capabilities 74*68f39e74STony Lindgren * need to OR'd all capabilities (ref. linux/mmc/host.h) 75*68f39e74STony Lindgren */ 76*68f39e74STony Lindgren u8 wires; /* Used for the MMC driver on omap1 and 2420 */ 77*68f39e74STony Lindgren u32 caps; /* Used for the MMC driver on 2430 and later */ 78*68f39e74STony Lindgren u32 pm_caps; /* PM capabilities of the mmc */ 79*68f39e74STony Lindgren 80*68f39e74STony Lindgren /* 81*68f39e74STony Lindgren * nomux means "standard" muxing is wrong on this board, and 82*68f39e74STony Lindgren * that board-specific code handled it before common init logic. 83*68f39e74STony Lindgren */ 84*68f39e74STony Lindgren unsigned nomux:1; 85*68f39e74STony Lindgren 86*68f39e74STony Lindgren /* switch pin can be for card detect (default) or card cover */ 87*68f39e74STony Lindgren unsigned cover:1; 88*68f39e74STony Lindgren 89*68f39e74STony Lindgren /* use the internal clock */ 90*68f39e74STony Lindgren unsigned internal_clock:1; 91*68f39e74STony Lindgren 92*68f39e74STony Lindgren /* nonremovable e.g. eMMC */ 93*68f39e74STony Lindgren unsigned nonremovable:1; 94*68f39e74STony Lindgren 95*68f39e74STony Lindgren /* Try to sleep or power off when possible */ 96*68f39e74STony Lindgren unsigned power_saving:1; 97*68f39e74STony Lindgren 98*68f39e74STony Lindgren /* If using power_saving and the MMC power is not to go off */ 99*68f39e74STony Lindgren unsigned no_off:1; 100*68f39e74STony Lindgren 101*68f39e74STony Lindgren /* eMMC does not handle power off when not in sleep state */ 102*68f39e74STony Lindgren unsigned no_regulator_off_init:1; 103*68f39e74STony Lindgren 104*68f39e74STony Lindgren /* Regulator off remapped to sleep */ 105*68f39e74STony Lindgren unsigned vcc_aux_disable_is_sleep:1; 106*68f39e74STony Lindgren 107*68f39e74STony Lindgren /* we can put the features above into this variable */ 108*68f39e74STony Lindgren #define HSMMC_HAS_PBIAS (1 << 0) 109*68f39e74STony Lindgren #define HSMMC_HAS_UPDATED_RESET (1 << 1) 1108287361aSLinus Torvalds #define HSMMC_HAS_HSPE_SUPPORT (1 << 2) 1118287361aSLinus Torvalds #define MMC_OMAP7XX (1 << 3) 1128287361aSLinus Torvalds #define MMC_OMAP15XX (1 << 4) 1138287361aSLinus Torvalds #define MMC_OMAP16XX (1 << 5) 114*68f39e74STony Lindgren unsigned features; 115*68f39e74STony Lindgren 116*68f39e74STony Lindgren int switch_pin; /* gpio (card detect) */ 117*68f39e74STony Lindgren int gpio_wp; /* gpio (write protect) */ 118*68f39e74STony Lindgren 119*68f39e74STony Lindgren int (*set_bus_mode)(struct device *dev, int slot, int bus_mode); 120*68f39e74STony Lindgren int (*set_power)(struct device *dev, int slot, 121*68f39e74STony Lindgren int power_on, int vdd); 122*68f39e74STony Lindgren int (*get_ro)(struct device *dev, int slot); 123*68f39e74STony Lindgren void (*remux)(struct device *dev, int slot, int power_on); 124*68f39e74STony Lindgren /* Call back before enabling / disabling regulators */ 125*68f39e74STony Lindgren void (*before_set_reg)(struct device *dev, int slot, 126*68f39e74STony Lindgren int power_on, int vdd); 127*68f39e74STony Lindgren /* Call back after enabling / disabling regulators */ 128*68f39e74STony Lindgren void (*after_set_reg)(struct device *dev, int slot, 129*68f39e74STony Lindgren int power_on, int vdd); 130*68f39e74STony Lindgren /* if we have special card, init it using this callback */ 131*68f39e74STony Lindgren void (*init_card)(struct mmc_card *card); 132*68f39e74STony Lindgren 133*68f39e74STony Lindgren /* return MMC cover switch state, can be NULL if not supported. 134*68f39e74STony Lindgren * 135*68f39e74STony Lindgren * possible return values: 136*68f39e74STony Lindgren * 0 - closed 137*68f39e74STony Lindgren * 1 - open 138*68f39e74STony Lindgren */ 139*68f39e74STony Lindgren int (*get_cover_state)(struct device *dev, int slot); 140*68f39e74STony Lindgren 141*68f39e74STony Lindgren const char *name; 142*68f39e74STony Lindgren u32 ocr_mask; 143*68f39e74STony Lindgren 144*68f39e74STony Lindgren /* Card detection IRQs */ 145*68f39e74STony Lindgren int card_detect_irq; 146*68f39e74STony Lindgren int (*card_detect)(struct device *dev, int slot); 147*68f39e74STony Lindgren 148*68f39e74STony Lindgren unsigned int ban_openended:1; 149*68f39e74STony Lindgren 150*68f39e74STony Lindgren } slots[OMAP_MMC_MAX_SLOTS]; 151*68f39e74STony Lindgren }; 152