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