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