usb: renesas_usbhs: fixup comment-out
[linux-2.6/next.git] / drivers / mmc / core / quirks.c
blob3a596217029e1e94fbd9797f2d324fa5dde03472
1 /*
2 * This file contains work-arounds for many known SD/MMC
3 * and SDIO hardware bugs.
5 * Copyright (c) 2011 Andrei Warkentin <andreiw@motorola.com>
6 * Copyright (c) 2011 Pierre Tardy <tardyp@gmail.com>
7 * Inspired from pci fixup code:
8 * Copyright (c) 1999 Martin Mares <mj@ucw.cz>
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/mmc/card.h>
16 #ifndef SDIO_VENDOR_ID_TI
17 #define SDIO_VENDOR_ID_TI 0x0097
18 #endif
20 #ifndef SDIO_DEVICE_ID_TI_WL1271
21 #define SDIO_DEVICE_ID_TI_WL1271 0x4076
22 #endif
25 * This hook just adds a quirk for all sdio devices
27 static void add_quirk_for_sdio_devices(struct mmc_card *card, int data)
29 if (mmc_card_sdio(card))
30 card->quirks |= data;
33 static const struct mmc_fixup mmc_fixup_methods[] = {
34 /* by default sdio devices are considered CLK_GATING broken */
35 /* good cards will be whitelisted as they are tested */
36 SDIO_FIXUP(SDIO_ANY_ID, SDIO_ANY_ID,
37 add_quirk_for_sdio_devices,
38 MMC_QUIRK_BROKEN_CLK_GATING),
40 SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
41 remove_quirk, MMC_QUIRK_BROKEN_CLK_GATING),
43 SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
44 add_quirk, MMC_QUIRK_NONSTD_FUNC_IF),
46 SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
47 add_quirk, MMC_QUIRK_DISABLE_CD),
49 END_FIXUP
52 void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
54 const struct mmc_fixup *f;
55 u64 rev = cid_rev_card(card);
57 /* Non-core specific workarounds. */
58 if (!table)
59 table = mmc_fixup_methods;
61 for (f = table; f->vendor_fixup; f++) {
62 if ((f->manfid == CID_MANFID_ANY ||
63 f->manfid == card->cid.manfid) &&
64 (f->oemid == CID_OEMID_ANY ||
65 f->oemid == card->cid.oemid) &&
66 (f->name == CID_NAME_ANY ||
67 !strncmp(f->name, card->cid.prod_name,
68 sizeof(card->cid.prod_name))) &&
69 (f->cis_vendor == card->cis.vendor ||
70 f->cis_vendor == (u16) SDIO_ANY_ID) &&
71 (f->cis_device == card->cis.device ||
72 f->cis_device == (u16) SDIO_ANY_ID) &&
73 rev >= f->rev_start && rev <= f->rev_end) {
74 dev_dbg(&card->dev, "calling %pF\n", f->vendor_fixup);
75 f->vendor_fixup(card, f->data);
79 EXPORT_SYMBOL(mmc_fixup_device);