Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * MMC definitions for OMAP2
0004  *
0005  * Copyright (C) 2006 Nokia Corporation
0006  */
0007 
0008 #define OMAP_MMC_MAX_SLOTS  2
0009 
0010 struct mmc_card;
0011 
0012 struct omap_mmc_platform_data {
0013     /* back-link to device */
0014     struct device *dev;
0015 
0016     /* number of slots per controller */
0017     unsigned nr_slots:2;
0018 
0019     /* set if your board has components or wiring that limits the
0020      * maximum frequency on the MMC bus */
0021     unsigned int max_freq;
0022 
0023     /* switch the bus to a new slot */
0024     int (*switch_slot)(struct device *dev, int slot);
0025     /* initialize board-specific MMC functionality, can be NULL if
0026      * not supported */
0027     int (*init)(struct device *dev);
0028     void (*cleanup)(struct device *dev);
0029     void (*shutdown)(struct device *dev);
0030 
0031     /* Return context loss count due to PM states changing */
0032     int (*get_context_loss_count)(struct device *dev);
0033 
0034     /* Integrating attributes from the omap_hwmod layer */
0035     u8 controller_flags;
0036 
0037     /* Register offset deviation */
0038     u16 reg_offset;
0039 
0040     struct omap_mmc_slot_data {
0041 
0042         /*
0043          * 4/8 wires and any additional host capabilities
0044          * need to OR'd all capabilities (ref. linux/mmc/host.h)
0045          */
0046         u8  wires;  /* Used for the MMC driver on omap1 and 2420 */
0047         u32 caps;   /* Used for the MMC driver on 2430 and later */
0048         u32 pm_caps;    /* PM capabilities of the mmc */
0049 
0050         /*
0051          * nomux means "standard" muxing is wrong on this board, and
0052          * that board-specific code handled it before common init logic.
0053          */
0054         unsigned nomux:1;
0055 
0056         /* switch pin can be for card detect (default) or card cover */
0057         unsigned cover:1;
0058 
0059         /* use the internal clock */
0060         unsigned internal_clock:1;
0061 
0062         /* nonremovable e.g. eMMC */
0063         unsigned nonremovable:1;
0064 
0065         /* Try to sleep or power off when possible */
0066         unsigned power_saving:1;
0067 
0068         /* If using power_saving and the MMC power is not to go off */
0069         unsigned no_off:1;
0070 
0071         /* eMMC does not handle power off when not in sleep state */
0072         unsigned no_regulator_off_init:1;
0073 
0074         /* Regulator off remapped to sleep */
0075         unsigned vcc_aux_disable_is_sleep:1;
0076 
0077         /* we can put the features above into this variable */
0078 #define MMC_OMAP7XX     (1 << 3)
0079 #define MMC_OMAP15XX        (1 << 4)
0080 #define MMC_OMAP16XX        (1 << 5)
0081         unsigned features;
0082 
0083         int switch_pin;         /* gpio (card detect) */
0084         int gpio_wp;            /* gpio (write protect) */
0085 
0086         int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
0087         int (*set_power)(struct device *dev, int slot,
0088                  int power_on, int vdd);
0089         int (*get_ro)(struct device *dev, int slot);
0090         void (*remux)(struct device *dev, int slot, int power_on);
0091         /* Call back before enabling / disabling regulators */
0092         void (*before_set_reg)(struct device *dev, int slot,
0093                        int power_on, int vdd);
0094         /* Call back after enabling / disabling regulators */
0095         void (*after_set_reg)(struct device *dev, int slot,
0096                       int power_on, int vdd);
0097         /* if we have special card, init it using this callback */
0098         void (*init_card)(struct mmc_card *card);
0099 
0100         /* return MMC cover switch state, can be NULL if not supported.
0101          *
0102          * possible return values:
0103          *   0 - closed
0104          *   1 - open
0105          */
0106         int (*get_cover_state)(struct device *dev, int slot);
0107 
0108         const char *name;
0109         u32 ocr_mask;
0110 
0111         /* Card detection */
0112         int (*card_detect)(struct device *dev, int slot);
0113 
0114         unsigned int ban_openended:1;
0115 
0116     } slots[OMAP_MMC_MAX_SLOTS];
0117 };
0118 
0119 extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
0120                     int is_closed);