Lines Matching +full:mmc +full:- +full:card

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Private header for the mmc subsystem
13 #include <linux/mmc/card.h>
15 #define mmc_card_name(c) ((c)->cid.prod_name)
16 #define mmc_card_id(c) (dev_name(&(c)->dev))
19 /* Card states */
21 #define MMC_STATE_READONLY (1<<1) /* card is read-only */
22 #define MMC_STATE_BLOCKADDR (1<<2) /* card uses block-addressing */
23 #define MMC_CARD_SDXC (1<<3) /* card is SDXC */
24 #define MMC_CARD_REMOVED (1<<4) /* card has been removed */
25 #define MMC_STATE_SUSPENDED (1<<5) /* card is suspended */
27 #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
28 #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
29 #define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
30 #define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
31 #define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
32 #define mmc_card_suspended(c) ((c)->state & MMC_STATE_SUSPENDED)
34 #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
35 #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
36 #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
37 #define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
38 #define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
39 #define mmc_card_set_suspended(c) ((c)->state |= MMC_STATE_SUSPENDED)
40 #define mmc_card_clr_suspended(c) ((c)->state &= ~MMC_STATE_SUSPENDED)
43 * The world is not perfect and supplies us with broken mmc/sdio devices.
44 * For at least some of these bugs we need a work-around.
47 /* CID-specific fields. */
60 /* SDIO-specific fields. You can use SDIO_ANY_ID here of course */
63 /* for MMC cards */
69 void (*vendor_fixup)(struct mmc_card *card, int data);
73 #define CID_MANFID_ANY (-1u)
74 #define CID_OEMID_ANY ((unsigned short) -1)
75 #define CID_YEAR_ANY ((unsigned short) -1)
76 #define CID_MONTH_ANY ((unsigned char) -1)
79 #define EXT_CSD_REV_ANY (-1u)
122 MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data, \
127 MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data, \
133 0, -1ull, \
143 .rev_end = -1ull, \
158 #define cid_rev_card(card) \ argument
159 cid_rev(card->cid.hwrev, \
160 card->cid.fwrev, \
161 card->cid.year, \
162 card->cid.month)
167 static inline void __maybe_unused add_quirk(struct mmc_card *card, int data) in add_quirk() argument
169 card->quirks |= data; in add_quirk()
172 static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data) in remove_quirk() argument
174 card->quirks &= ~data; in remove_quirk()
177 static inline void __maybe_unused add_limit_rate_quirk(struct mmc_card *card, in add_limit_rate_quirk() argument
180 card->quirk_max_rate = data; in add_limit_rate_quirk()
183 static inline void __maybe_unused wl1251_quirk(struct mmc_card *card, in wl1251_quirk() argument
187 * We have TI wl1251 attached to this mmc. Pass this in wl1251_quirk()
192 dev_info(card->host->parent, "found wl1251\n"); in wl1251_quirk()
193 card->quirks |= MMC_QUIRK_NONSTD_SDIO; in wl1251_quirk()
194 card->cccr.wide_bus = 1; in wl1251_quirk()
195 card->cis.vendor = 0x104c; in wl1251_quirk()
196 card->cis.device = 0x9066; in wl1251_quirk()
197 card->cis.blksize = 512; in wl1251_quirk()
198 card->cis.max_dtr = 24000000; in wl1251_quirk()
202 * Quirk add/remove for MMC products.
204 static inline void __maybe_unused add_quirk_mmc(struct mmc_card *card, int data) in add_quirk_mmc() argument
206 if (mmc_card_mmc(card)) in add_quirk_mmc()
207 card->quirks |= data; in add_quirk_mmc()
210 static inline void __maybe_unused remove_quirk_mmc(struct mmc_card *card, in remove_quirk_mmc() argument
213 if (mmc_card_mmc(card)) in remove_quirk_mmc()
214 card->quirks &= ~data; in remove_quirk_mmc()
220 static inline void __maybe_unused add_quirk_sd(struct mmc_card *card, int data) in add_quirk_sd() argument
222 if (mmc_card_sd(card)) in add_quirk_sd()
223 card->quirks |= data; in add_quirk_sd()
226 static inline void __maybe_unused remove_quirk_sd(struct mmc_card *card, in remove_quirk_sd() argument
229 if (mmc_card_sd(card)) in remove_quirk_sd()
230 card->quirks &= ~data; in remove_quirk_sd()
235 return c->quirks & MMC_QUIRK_LENIENT_FN0; in mmc_card_lenient_fn0()
240 return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; in mmc_blksz_for_byte_mode()
245 return c->quirks & MMC_QUIRK_DISABLE_CD; in mmc_card_disable_cd()
250 return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF; in mmc_card_nonstd_func_interface()
255 return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; in mmc_card_broken_byte_mode_512()
260 return c->quirks & MMC_QUIRK_LONG_READ_TIME; in mmc_card_long_read_time()
265 return c->quirks & MMC_QUIRK_BROKEN_IRQ_POLLING; in mmc_card_broken_irq_polling()
270 return c->quirks & MMC_QUIRK_BROKEN_HPI; in mmc_card_broken_hpi()
275 return c->quirks & MMC_QUIRK_BROKEN_SD_DISCARD; in mmc_card_broken_sd_discard()
280 return c->quirks & MMC_QUIRK_BROKEN_SD_CACHE; in mmc_card_broken_sd_cache()
285 return c->quirks & MMC_QUIRK_BROKEN_CACHE_FLUSH; in mmc_card_broken_cache_flush()