1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 268f39e74STony Lindgren /* 368f39e74STony Lindgren * MMC definitions for OMAP2 468f39e74STony Lindgren * 568f39e74STony Lindgren * Copyright (C) 2006 Nokia Corporation 668f39e74STony Lindgren */ 768f39e74STony Lindgren 868f39e74STony Lindgren #define OMAP_MMC_MAX_SLOTS 2 968f39e74STony Lindgren 1068f39e74STony Lindgren struct mmc_card; 1168f39e74STony Lindgren 1268f39e74STony Lindgren struct omap_mmc_platform_data { 1368f39e74STony Lindgren /* back-link to device */ 1468f39e74STony Lindgren struct device *dev; 1568f39e74STony Lindgren 1668f39e74STony Lindgren /* number of slots per controller */ 1768f39e74STony Lindgren unsigned nr_slots:2; 1868f39e74STony Lindgren 1968f39e74STony Lindgren /* set if your board has components or wiring that limits the 2068f39e74STony Lindgren * maximum frequency on the MMC bus */ 2168f39e74STony Lindgren unsigned int max_freq; 2268f39e74STony Lindgren 2368f39e74STony Lindgren /* initialize board-specific MMC functionality, can be NULL if 2468f39e74STony Lindgren * not supported */ 2568f39e74STony Lindgren int (*init)(struct device *dev); 2668f39e74STony Lindgren void (*cleanup)(struct device *dev); 2768f39e74STony Lindgren void (*shutdown)(struct device *dev); 2868f39e74STony Lindgren 2968f39e74STony Lindgren /* Return context loss count due to PM states changing */ 3068f39e74STony Lindgren int (*get_context_loss_count)(struct device *dev); 3168f39e74STony Lindgren 3268f39e74STony Lindgren /* Integrating attributes from the omap_hwmod layer */ 3368f39e74STony Lindgren u8 controller_flags; 3468f39e74STony Lindgren 3568f39e74STony Lindgren /* Register offset deviation */ 3668f39e74STony Lindgren u16 reg_offset; 3768f39e74STony Lindgren 3868f39e74STony Lindgren struct omap_mmc_slot_data { 3968f39e74STony Lindgren 4068f39e74STony Lindgren /* 4168f39e74STony Lindgren * 4/8 wires and any additional host capabilities 4268f39e74STony Lindgren * need to OR'd all capabilities (ref. linux/mmc/host.h) 4368f39e74STony Lindgren */ 4468f39e74STony Lindgren u8 wires; /* Used for the MMC driver on omap1 and 2420 */ 4568f39e74STony Lindgren u32 caps; /* Used for the MMC driver on 2430 and later */ 4668f39e74STony Lindgren u32 pm_caps; /* PM capabilities of the mmc */ 4768f39e74STony Lindgren 4868f39e74STony Lindgren /* 4968f39e74STony Lindgren * nomux means "standard" muxing is wrong on this board, and 5068f39e74STony Lindgren * that board-specific code handled it before common init logic. 5168f39e74STony Lindgren */ 5268f39e74STony Lindgren unsigned nomux:1; 5368f39e74STony Lindgren 5468f39e74STony Lindgren /* switch pin can be for card detect (default) or card cover */ 5568f39e74STony Lindgren unsigned cover:1; 5668f39e74STony Lindgren 5768f39e74STony Lindgren /* use the internal clock */ 5868f39e74STony Lindgren unsigned internal_clock:1; 5968f39e74STony Lindgren 6068f39e74STony Lindgren /* nonremovable e.g. eMMC */ 6168f39e74STony Lindgren unsigned nonremovable:1; 6268f39e74STony Lindgren 6368f39e74STony Lindgren /* Try to sleep or power off when possible */ 6468f39e74STony Lindgren unsigned power_saving:1; 6568f39e74STony Lindgren 6668f39e74STony Lindgren /* If using power_saving and the MMC power is not to go off */ 6768f39e74STony Lindgren unsigned no_off:1; 6868f39e74STony Lindgren 6968f39e74STony Lindgren /* eMMC does not handle power off when not in sleep state */ 7068f39e74STony Lindgren unsigned no_regulator_off_init:1; 7168f39e74STony Lindgren 7268f39e74STony Lindgren /* Regulator off remapped to sleep */ 7368f39e74STony Lindgren unsigned vcc_aux_disable_is_sleep:1; 7468f39e74STony Lindgren 7568f39e74STony Lindgren /* we can put the features above into this variable */ 768287361aSLinus Torvalds #define MMC_OMAP7XX (1 << 3) 778287361aSLinus Torvalds #define MMC_OMAP15XX (1 << 4) 788287361aSLinus Torvalds #define MMC_OMAP16XX (1 << 5) 7968f39e74STony Lindgren unsigned features; 8068f39e74STony Lindgren 8168f39e74STony Lindgren int switch_pin; /* gpio (card detect) */ 8268f39e74STony Lindgren int gpio_wp; /* gpio (write protect) */ 8368f39e74STony Lindgren 8468f39e74STony Lindgren int (*set_bus_mode)(struct device *dev, int slot, int bus_mode); 8568f39e74STony Lindgren int (*set_power)(struct device *dev, int slot, 8668f39e74STony Lindgren int power_on, int vdd); 8768f39e74STony Lindgren int (*get_ro)(struct device *dev, int slot); 8868f39e74STony Lindgren void (*remux)(struct device *dev, int slot, int power_on); 8968f39e74STony Lindgren /* Call back before enabling / disabling regulators */ 9068f39e74STony Lindgren void (*before_set_reg)(struct device *dev, int slot, 9168f39e74STony Lindgren int power_on, int vdd); 9268f39e74STony Lindgren /* Call back after enabling / disabling regulators */ 9368f39e74STony Lindgren void (*after_set_reg)(struct device *dev, int slot, 9468f39e74STony Lindgren int power_on, int vdd); 9568f39e74STony Lindgren /* if we have special card, init it using this callback */ 9668f39e74STony Lindgren void (*init_card)(struct mmc_card *card); 9768f39e74STony Lindgren 9868f39e74STony Lindgren /* return MMC cover switch state, can be NULL if not supported. 9968f39e74STony Lindgren * 10068f39e74STony Lindgren * possible return values: 10168f39e74STony Lindgren * 0 - closed 10268f39e74STony Lindgren * 1 - open 10368f39e74STony Lindgren */ 10468f39e74STony Lindgren int (*get_cover_state)(struct device *dev, int slot); 10568f39e74STony Lindgren 10668f39e74STony Lindgren const char *name; 10768f39e74STony Lindgren u32 ocr_mask; 10868f39e74STony Lindgren 109*67a73230SH. Nikolaus Schaller /* Card detection */ 11068f39e74STony Lindgren int (*card_detect)(struct device *dev, int slot); 11168f39e74STony Lindgren 11268f39e74STony Lindgren unsigned int ban_openended:1; 11368f39e74STony Lindgren 11468f39e74STony Lindgren } slots[OMAP_MMC_MAX_SLOTS]; 11568f39e74STony Lindgren }; 1162f961265SLee Jones 1172f961265SLee Jones extern void omap_mmc_notify_cover_event(struct device *dev, int slot, 1182f961265SLee Jones int is_closed); 119