18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * MMC definitions for OMAP2 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2006 Nokia Corporation 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#define OMAP_MMC_MAX_SLOTS 2 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cistruct mmc_card; 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cistruct omap_mmc_platform_data { 138c2ecf20Sopenharmony_ci /* back-link to device */ 148c2ecf20Sopenharmony_ci struct device *dev; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci /* number of slots per controller */ 178c2ecf20Sopenharmony_ci unsigned nr_slots:2; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci /* set if your board has components or wiring that limits the 208c2ecf20Sopenharmony_ci * maximum frequency on the MMC bus */ 218c2ecf20Sopenharmony_ci unsigned int max_freq; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci /* switch the bus to a new slot */ 248c2ecf20Sopenharmony_ci int (*switch_slot)(struct device *dev, int slot); 258c2ecf20Sopenharmony_ci /* initialize board-specific MMC functionality, can be NULL if 268c2ecf20Sopenharmony_ci * not supported */ 278c2ecf20Sopenharmony_ci int (*init)(struct device *dev); 288c2ecf20Sopenharmony_ci void (*cleanup)(struct device *dev); 298c2ecf20Sopenharmony_ci void (*shutdown)(struct device *dev); 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci /* Return context loss count due to PM states changing */ 328c2ecf20Sopenharmony_ci int (*get_context_loss_count)(struct device *dev); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci /* Integrating attributes from the omap_hwmod layer */ 358c2ecf20Sopenharmony_ci u8 controller_flags; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci /* Register offset deviation */ 388c2ecf20Sopenharmony_ci u16 reg_offset; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci struct omap_mmc_slot_data { 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci /* 438c2ecf20Sopenharmony_ci * 4/8 wires and any additional host capabilities 448c2ecf20Sopenharmony_ci * need to OR'd all capabilities (ref. linux/mmc/host.h) 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci u8 wires; /* Used for the MMC driver on omap1 and 2420 */ 478c2ecf20Sopenharmony_ci u32 caps; /* Used for the MMC driver on 2430 and later */ 488c2ecf20Sopenharmony_ci u32 pm_caps; /* PM capabilities of the mmc */ 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci /* 518c2ecf20Sopenharmony_ci * nomux means "standard" muxing is wrong on this board, and 528c2ecf20Sopenharmony_ci * that board-specific code handled it before common init logic. 538c2ecf20Sopenharmony_ci */ 548c2ecf20Sopenharmony_ci unsigned nomux:1; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci /* switch pin can be for card detect (default) or card cover */ 578c2ecf20Sopenharmony_ci unsigned cover:1; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci /* use the internal clock */ 608c2ecf20Sopenharmony_ci unsigned internal_clock:1; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci /* nonremovable e.g. eMMC */ 638c2ecf20Sopenharmony_ci unsigned nonremovable:1; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci /* Try to sleep or power off when possible */ 668c2ecf20Sopenharmony_ci unsigned power_saving:1; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci /* If using power_saving and the MMC power is not to go off */ 698c2ecf20Sopenharmony_ci unsigned no_off:1; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci /* eMMC does not handle power off when not in sleep state */ 728c2ecf20Sopenharmony_ci unsigned no_regulator_off_init:1; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci /* Regulator off remapped to sleep */ 758c2ecf20Sopenharmony_ci unsigned vcc_aux_disable_is_sleep:1; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci /* we can put the features above into this variable */ 788c2ecf20Sopenharmony_ci#define MMC_OMAP7XX (1 << 3) 798c2ecf20Sopenharmony_ci#define MMC_OMAP15XX (1 << 4) 808c2ecf20Sopenharmony_ci#define MMC_OMAP16XX (1 << 5) 818c2ecf20Sopenharmony_ci unsigned features; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci int switch_pin; /* gpio (card detect) */ 848c2ecf20Sopenharmony_ci int gpio_wp; /* gpio (write protect) */ 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci int (*set_bus_mode)(struct device *dev, int slot, int bus_mode); 878c2ecf20Sopenharmony_ci int (*set_power)(struct device *dev, int slot, 888c2ecf20Sopenharmony_ci int power_on, int vdd); 898c2ecf20Sopenharmony_ci int (*get_ro)(struct device *dev, int slot); 908c2ecf20Sopenharmony_ci void (*remux)(struct device *dev, int slot, int power_on); 918c2ecf20Sopenharmony_ci /* Call back before enabling / disabling regulators */ 928c2ecf20Sopenharmony_ci void (*before_set_reg)(struct device *dev, int slot, 938c2ecf20Sopenharmony_ci int power_on, int vdd); 948c2ecf20Sopenharmony_ci /* Call back after enabling / disabling regulators */ 958c2ecf20Sopenharmony_ci void (*after_set_reg)(struct device *dev, int slot, 968c2ecf20Sopenharmony_ci int power_on, int vdd); 978c2ecf20Sopenharmony_ci /* if we have special card, init it using this callback */ 988c2ecf20Sopenharmony_ci void (*init_card)(struct mmc_card *card); 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci /* return MMC cover switch state, can be NULL if not supported. 1018c2ecf20Sopenharmony_ci * 1028c2ecf20Sopenharmony_ci * possible return values: 1038c2ecf20Sopenharmony_ci * 0 - closed 1048c2ecf20Sopenharmony_ci * 1 - open 1058c2ecf20Sopenharmony_ci */ 1068c2ecf20Sopenharmony_ci int (*get_cover_state)(struct device *dev, int slot); 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci const char *name; 1098c2ecf20Sopenharmony_ci u32 ocr_mask; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci /* Card detection IRQs */ 1128c2ecf20Sopenharmony_ci int card_detect_irq; 1138c2ecf20Sopenharmony_ci int (*card_detect)(struct device *dev, int slot); 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci unsigned int ban_openended:1; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci } slots[OMAP_MMC_MAX_SLOTS]; 1188c2ecf20Sopenharmony_ci}; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ciextern void omap_mmc_notify_cover_event(struct device *dev, int slot, 1218c2ecf20Sopenharmony_ci int is_closed); 122