All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Some small cleanup for quirks
@ 2017-02-08  1:15 Shawn Lin
  2017-02-08  1:15 ` [PATCH v2 1/5] mmc: core: change quirks.c to be a header file Shawn Lin
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Shawn Lin @ 2017-02-08  1:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin


I just see the we put them everywhere, so the legacy code
should be improved a bit for maintainability, especially for
the sdio quirks case. Just split them into small patches to be
better reviewed but I don't mind to squash them up.:)


Changes in v2:
- add __maybe_unused to make it cleanly compiled standalone
  suggested by Ulf
- add inline for mmc_fixup_device
- move INAND quirks together

Shawn Lin (5):
  mmc: core: change quirks.c to be a header file
  mmc: core: move some sdio IDs out of quirks file
  mmc: core: improve the quirks for sdio devices
  mmc: core: move all quirks together into quirks.h
  mmc: core: add mmc prefix for blk_fixups

 drivers/mmc/core/Makefile    |   2 +-
 drivers/mmc/core/block.c     |  83 +----------------------
 drivers/mmc/core/card.h      |   2 -
 drivers/mmc/core/mmc.c       |  12 +---
 drivers/mmc/core/quirks.c    |  85 ------------------------
 drivers/mmc/core/quirks.h    | 152 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/core/sdio.c      |   3 +-
 include/linux/mmc/sdio_ids.h |   7 ++
 8 files changed, 165 insertions(+), 181 deletions(-)
 delete mode 100644 drivers/mmc/core/quirks.c
 create mode 100644 drivers/mmc/core/quirks.h

-- 
1.9.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/5] mmc: core: change quirks.c to be a header file
  2017-02-08  1:15 [PATCH v2 0/5] Some small cleanup for quirks Shawn Lin
@ 2017-02-08  1:15 ` Shawn Lin
  2017-02-08 11:15   ` Ulf Hansson
  2017-02-08  1:15 ` [PATCH v2 2/5] mmc: core: move some sdio IDs out of quirks file Shawn Lin
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2017-02-08  1:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin

Rename quirks.c to quirks.h, and include it for
individual C files which need it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---

Changes in v2:
- add __maybe_unused to make it cleanly compiled standalone
  suggested by Ulf
- add inline for mmc_fixup_device

 drivers/mmc/core/Makefile               | 2 +-
 drivers/mmc/core/block.c                | 1 +
 drivers/mmc/core/card.h                 | 2 --
 drivers/mmc/core/mmc.c                  | 1 +
 drivers/mmc/core/{quirks.c => quirks.h} | 4 ++--
 drivers/mmc/core/sdio.c                 | 1 +
 6 files changed, 6 insertions(+), 5 deletions(-)
 rename drivers/mmc/core/{quirks.c => quirks.h} (95%)

diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile
index 0f81464..7e3ed1a 100644
--- a/drivers/mmc/core/Makefile
+++ b/drivers/mmc/core/Makefile
@@ -7,7 +7,7 @@ mmc_core-y			:= core.o bus.o host.o \
 				   mmc.o mmc_ops.o sd.o sd_ops.o \
 				   sdio.o sdio_ops.o sdio_bus.o \
 				   sdio_cis.o sdio_io.o sdio_irq.o \
-				   quirks.o slot-gpio.o
+				   slot-gpio.o
 mmc_core-$(CONFIG_OF)		+= pwrseq.o
 obj-$(CONFIG_PWRSEQ_SIMPLE)	+= pwrseq_simple.o
 obj-$(CONFIG_PWRSEQ_SD8787)	+= pwrseq_sd8787.o
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 985477c..ce5e2a2 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -52,6 +52,7 @@
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
+#include "quirks.h"
 #include "sd_ops.h"
 
 MODULE_ALIAS("mmc:block");
diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 95e8fc5..f06cd91 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -218,6 +218,4 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
 	return c->quirks & MMC_QUIRK_BROKEN_HPI;
 }
 
-void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table);
-
 #endif
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index f1a451e..d0e6b6f 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -25,6 +25,7 @@
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
+#include "quirks.h"
 #include "sd_ops.h"
 
 #define DEFAULT_CMD6_TIMEOUT_MS	500
diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
similarity index 95%
rename from drivers/mmc/core/quirks.c
rename to drivers/mmc/core/quirks.h
index bf25a9c..f3bbfcb7 100644
--- a/drivers/mmc/core/quirks.c
+++ b/drivers/mmc/core/quirks.h
@@ -53,7 +53,8 @@
 	END_FIXUP
 };
 
-void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
+static inline void __maybe_unused
+mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
 {
 	const struct mmc_fixup *f;
 	u64 rev = cid_rev_card(card);
@@ -82,4 +83,3 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
 		}
 	}
 }
-EXPORT_SYMBOL(mmc_fixup_device);
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index a64a870..f092a55 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -23,6 +23,7 @@
 #include "card.h"
 #include "host.h"
 #include "bus.h"
+#include "quirks.h"
 #include "sd.h"
 #include "sdio_bus.h"
 #include "mmc_ops.h"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/5] mmc: core: move some sdio IDs out of quirks file
  2017-02-08  1:15 [PATCH v2 0/5] Some small cleanup for quirks Shawn Lin
  2017-02-08  1:15 ` [PATCH v2 1/5] mmc: core: change quirks.c to be a header file Shawn Lin
@ 2017-02-08  1:15 ` Shawn Lin
  2017-02-08  1:15 ` [PATCH v2 3/5] mmc: core: improve the quirks for sdio devices Shawn Lin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-02-08  1:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin

Consolidate all the sdio devices' IDs into sdio_ids.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

Changes in v2: None

 drivers/mmc/core/quirks.h    | 20 --------------------
 include/linux/mmc/sdio_ids.h |  7 +++++++
 2 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index f3bbfcb7..253a9d5 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -17,26 +17,6 @@
 
 #include "card.h"
 
-#ifndef SDIO_VENDOR_ID_TI
-#define SDIO_VENDOR_ID_TI		0x0097
-#endif
-
-#ifndef SDIO_DEVICE_ID_TI_WL1271
-#define SDIO_DEVICE_ID_TI_WL1271	0x4076
-#endif
-
-#ifndef SDIO_VENDOR_ID_STE
-#define SDIO_VENDOR_ID_STE		0x0020
-#endif
-
-#ifndef SDIO_DEVICE_ID_STE_CW1200
-#define SDIO_DEVICE_ID_STE_CW1200	0x2280
-#endif
-
-#ifndef SDIO_DEVICE_ID_MARVELL_8797_F0
-#define SDIO_DEVICE_ID_MARVELL_8797_F0	0x9128
-#endif
-
 static const struct mmc_fixup mmc_fixup_methods[] = {
 	SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
 		   add_quirk, MMC_QUIRK_NONSTD_FUNC_IF),
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 71b113e..b733eb4 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -52,6 +52,7 @@
 #define SDIO_DEVICE_ID_MARVELL_LIBERTAS		0x9103
 #define SDIO_DEVICE_ID_MARVELL_8688WLAN		0x9104
 #define SDIO_DEVICE_ID_MARVELL_8688BT		0x9105
+#define SDIO_DEVICE_ID_MARVELL_8797_F0		0x9128
 
 #define SDIO_VENDOR_ID_SIANO			0x039a
 #define SDIO_DEVICE_ID_SIANO_NOVA_B0		0x0201
@@ -61,4 +62,10 @@
 #define SDIO_DEVICE_ID_SIANO_NOVA_A0		0x1100
 #define SDIO_DEVICE_ID_SIANO_STELLAR 		0x5347
 
+#define SDIO_VENDOR_ID_TI			0x0097
+#define SDIO_DEVICE_ID_TI_WL1271		0x4076
+
+#define SDIO_VENDOR_ID_STE			0x0020
+#define SDIO_DEVICE_ID_STE_CW1200		0x2280
+
 #endif /* LINUX_MMC_SDIO_IDS_H */
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/5] mmc: core: improve the quirks for sdio devices
  2017-02-08  1:15 [PATCH v2 0/5] Some small cleanup for quirks Shawn Lin
  2017-02-08  1:15 ` [PATCH v2 1/5] mmc: core: change quirks.c to be a header file Shawn Lin
  2017-02-08  1:15 ` [PATCH v2 2/5] mmc: core: move some sdio IDs out of quirks file Shawn Lin
@ 2017-02-08  1:15 ` Shawn Lin
  2017-02-08  1:15 ` [PATCH v2 4/5] mmc: core: move all quirks together into quirks.h Shawn Lin
  2017-02-08  1:22 ` [PATCH v2 5/5] mmc: core: add mmc prefix for blk_fixups Shawn Lin
  4 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-02-08  1:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin

Rename mmc_fixup_methods to sdio_fixup_methods to better
reflect that it's for sdio devices. So we could also pass
on it from sdio card's probe sequence just like what we do
for eMMC and block there.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

Changes in v2: None

 drivers/mmc/core/quirks.h | 6 +-----
 drivers/mmc/core/sdio.c   | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 253a9d5..7cd873eb 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -17,7 +17,7 @@
 
 #include "card.h"
 
-static const struct mmc_fixup mmc_fixup_methods[] = {
+static const struct mmc_fixup sdio_fixup_methods[] = {
 	SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
 		   add_quirk, MMC_QUIRK_NONSTD_FUNC_IF),
 
@@ -39,10 +39,6 @@
 	const struct mmc_fixup *f;
 	u64 rev = cid_rev_card(card);
 
-	/* Non-core specific workarounds. */
-	if (!table)
-		table = mmc_fixup_methods;
-
 	for (f = table; f->vendor_fixup; f++) {
 		if ((f->manfid == CID_MANFID_ANY ||
 		     f->manfid == card->cid.manfid) &&
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index f092a55..fae732c 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -739,7 +739,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 		card = oldcard;
 	}
 	card->ocr = ocr_card;
-	mmc_fixup_device(card, NULL);
+	mmc_fixup_device(card, sdio_fixup_methods);
 
 	if (card->type == MMC_TYPE_SD_COMBO) {
 		err = mmc_sd_setup_card(host, card, oldcard != NULL);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/5] mmc: core: move all quirks together into quirks.h
  2017-02-08  1:15 [PATCH v2 0/5] Some small cleanup for quirks Shawn Lin
                   ` (2 preceding siblings ...)
  2017-02-08  1:15 ` [PATCH v2 3/5] mmc: core: improve the quirks for sdio devices Shawn Lin
@ 2017-02-08  1:15 ` Shawn Lin
  2017-02-08  1:22 ` [PATCH v2 5/5] mmc: core: add mmc prefix for blk_fixups Shawn Lin
  4 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-02-08  1:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin

It's not appreciated to place quirks everywhere, let's
put them together just like what we do for USB, PCI etc.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---

Changes in v2:
- move INAND quirks together

 drivers/mmc/core/block.c  | 80 -----------------------------------------
 drivers/mmc/core/mmc.c    | 11 ------
 drivers/mmc/core/quirks.h | 91 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index ce5e2a2..c5116f4 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -61,12 +61,6 @@
 #endif
 #define MODULE_PARAM_PREFIX "mmcblk."
 
-#define INAND_CMD38_ARG_EXT_CSD  113
-#define INAND_CMD38_ARG_ERASE    0x00
-#define INAND_CMD38_ARG_TRIM     0x01
-#define INAND_CMD38_ARG_SECERASE 0x80
-#define INAND_CMD38_ARG_SECTRIM1 0x81
-#define INAND_CMD38_ARG_SECTRIM2 0x88
 #define MMC_BLK_TIMEOUT_MS  (10 * 60 * 1000)        /* 10 minute timeout */
 #define MMC_SANITIZE_REQ_TIMEOUT 240000
 #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
@@ -2108,80 +2102,6 @@ static int mmc_add_disk(struct mmc_blk_data *md)
 	return ret;
 }
 
-static const struct mmc_fixup blk_fixups[] =
-{
-	MMC_FIXUP("SEM02G", CID_MANFID_SANDISK, 0x100, add_quirk,
-		  MMC_QUIRK_INAND_CMD38),
-	MMC_FIXUP("SEM04G", CID_MANFID_SANDISK, 0x100, add_quirk,
-		  MMC_QUIRK_INAND_CMD38),
-	MMC_FIXUP("SEM08G", CID_MANFID_SANDISK, 0x100, add_quirk,
-		  MMC_QUIRK_INAND_CMD38),
-	MMC_FIXUP("SEM16G", CID_MANFID_SANDISK, 0x100, add_quirk,
-		  MMC_QUIRK_INAND_CMD38),
-	MMC_FIXUP("SEM32G", CID_MANFID_SANDISK, 0x100, add_quirk,
-		  MMC_QUIRK_INAND_CMD38),
-
-	/*
-	 * Some MMC cards experience performance degradation with CMD23
-	 * instead of CMD12-bounded multiblock transfers. For now we'll
-	 * black list what's bad...
-	 * - Certain Toshiba cards.
-	 *
-	 * N.B. This doesn't affect SD cards.
-	 */
-	MMC_FIXUP("SDMB-32", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_BLK_NO_CMD23),
-	MMC_FIXUP("SDM032", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_BLK_NO_CMD23),
-	MMC_FIXUP("MMC08G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_BLK_NO_CMD23),
-	MMC_FIXUP("MMC16G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_BLK_NO_CMD23),
-	MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_BLK_NO_CMD23),
-
-	/*
-	 * Some MMC cards need longer data read timeout than indicated in CSD.
-	 */
-	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
-		  MMC_QUIRK_LONG_READ_TIME),
-	MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_LONG_READ_TIME),
-
-	/*
-	 * On these Samsung MoviNAND parts, performing secure erase or
-	 * secure trim can result in unrecoverable corruption due to a
-	 * firmware bug.
-	 */
-	MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-	MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
-
-	/*
-	 *  On Some Kingston eMMCs, performing trim can result in
-	 *  unrecoverable data conrruption occasionally due to a firmware bug.
-	 */
-	MMC_FIXUP("V10008", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_TRIM_BROKEN),
-	MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
-		  MMC_QUIRK_TRIM_BROKEN),
-
-	END_FIXUP
-};
-
 static int mmc_blk_probe(struct mmc_card *card)
 {
 	struct mmc_blk_data *md, *part_md;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index d0e6b6f..721bb01 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -49,17 +49,6 @@
 	35,	40,	45,	50,	55,	60,	70,	80,
 };
 
-static const struct mmc_fixup mmc_ext_csd_fixups[] = {
-	/*
-	 * Certain Hynix eMMC 4.41 cards might get broken when HPI feature
-	 * is used so disable the HPI feature for such buggy cards.
-	 */
-	MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX,
-			      0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5),
-
-	END_FIXUP
-};
-
 #define UNSTUFF_BITS(resp,start,size)					\
 	({								\
 		const int __size = size;				\
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 7cd873eb..6db19ad 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -17,6 +17,97 @@
 
 #include "card.h"
 
+static const struct mmc_fixup blk_fixups[] = {
+#define INAND_CMD38_ARG_EXT_CSD  113
+#define INAND_CMD38_ARG_ERASE    0x00
+#define INAND_CMD38_ARG_TRIM     0x01
+#define INAND_CMD38_ARG_SECERASE 0x80
+#define INAND_CMD38_ARG_SECTRIM1 0x81
+#define INAND_CMD38_ARG_SECTRIM2 0x88
+	/* CMD38 argument is passed through EXT_CSD[113] */
+	MMC_FIXUP("SEM02G", CID_MANFID_SANDISK, 0x100, add_quirk,
+		  MMC_QUIRK_INAND_CMD38),
+	MMC_FIXUP("SEM04G", CID_MANFID_SANDISK, 0x100, add_quirk,
+		  MMC_QUIRK_INAND_CMD38),
+	MMC_FIXUP("SEM08G", CID_MANFID_SANDISK, 0x100, add_quirk,
+		  MMC_QUIRK_INAND_CMD38),
+	MMC_FIXUP("SEM16G", CID_MANFID_SANDISK, 0x100, add_quirk,
+		  MMC_QUIRK_INAND_CMD38),
+	MMC_FIXUP("SEM32G", CID_MANFID_SANDISK, 0x100, add_quirk,
+		  MMC_QUIRK_INAND_CMD38),
+
+	/*
+	 * Some MMC cards experience performance degradation with CMD23
+	 * instead of CMD12-bounded multiblock transfers. For now we'll
+	 * black list what's bad...
+	 * - Certain Toshiba cards.
+	 *
+	 * N.B. This doesn't affect SD cards.
+	 */
+	MMC_FIXUP("SDMB-32", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_BLK_NO_CMD23),
+	MMC_FIXUP("SDM032", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_BLK_NO_CMD23),
+	MMC_FIXUP("MMC08G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_BLK_NO_CMD23),
+	MMC_FIXUP("MMC16G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_BLK_NO_CMD23),
+	MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_BLK_NO_CMD23),
+
+	/*
+	 * Some MMC cards need longer data read timeout than indicated in CSD.
+	 */
+	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
+		  MMC_QUIRK_LONG_READ_TIME),
+	MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_LONG_READ_TIME),
+
+	/*
+	 * On these Samsung MoviNAND parts, performing secure erase or
+	 * secure trim can result in unrecoverable corruption due to a
+	 * firmware bug.
+	 */
+	MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+
+	/*
+	 *  On Some Kingston eMMCs, performing trim can result in
+	 *  unrecoverable data conrruption occasionally due to a firmware bug.
+	 */
+	MMC_FIXUP("V10008", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_TRIM_BROKEN),
+	MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_TRIM_BROKEN),
+
+	END_FIXUP
+};
+
+static const struct mmc_fixup mmc_ext_csd_fixups[] = {
+	/*
+	 * Certain Hynix eMMC 4.41 cards might get broken when HPI feature
+	 * is used so disable the HPI feature for such buggy cards.
+	 */
+	MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX,
+			      0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5),
+
+	END_FIXUP
+};
+
 static const struct mmc_fixup sdio_fixup_methods[] = {
 	SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
 		   add_quirk, MMC_QUIRK_NONSTD_FUNC_IF),
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 5/5] mmc: core: add mmc prefix for blk_fixups
  2017-02-08  1:15 [PATCH v2 0/5] Some small cleanup for quirks Shawn Lin
                   ` (3 preceding siblings ...)
  2017-02-08  1:15 ` [PATCH v2 4/5] mmc: core: move all quirks together into quirks.h Shawn Lin
@ 2017-02-08  1:22 ` Shawn Lin
  4 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2017-02-08  1:22 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Shawn Lin

That makes all the quirks table look more consistent.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---

Changes in v2: None

 drivers/mmc/core/block.c  | 2 +-
 drivers/mmc/core/quirks.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index c5116f4..30a8974 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2113,7 +2113,7 @@ static int mmc_blk_probe(struct mmc_card *card)
 	if (!(card->csd.cmdclass & CCC_BLOCK_READ))
 		return -ENODEV;
 
-	mmc_fixup_device(card, blk_fixups);
+	mmc_fixup_device(card, mmc_blk_fixups);
 
 	md = mmc_blk_alloc(card);
 	if (IS_ERR(md))
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 6db19ad..5406456 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -17,7 +17,7 @@
 
 #include "card.h"
 
-static const struct mmc_fixup blk_fixups[] = {
+static const struct mmc_fixup mmc_blk_fixups[] = {
 #define INAND_CMD38_ARG_EXT_CSD  113
 #define INAND_CMD38_ARG_ERASE    0x00
 #define INAND_CMD38_ARG_TRIM     0x01
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/5] mmc: core: change quirks.c to be a header file
  2017-02-08  1:15 ` [PATCH v2 1/5] mmc: core: change quirks.c to be a header file Shawn Lin
@ 2017-02-08 11:15   ` Ulf Hansson
  2017-02-10  9:41     ` Shawn Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Ulf Hansson @ 2017-02-08 11:15 UTC (permalink / raw)
  To: Shawn Lin; +Cc: linux-mmc

[...]

> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
> similarity index 95%
> rename from drivers/mmc/core/quirks.c
> rename to drivers/mmc/core/quirks.h
> index bf25a9c..f3bbfcb7 100644
> --- a/drivers/mmc/core/quirks.c
> +++ b/drivers/mmc/core/quirks.h

As you are rename this to become a header file, please also clean up
the included headers from the new quirks.h.

For example, you don't need these:

#include <linux/kernel.h>
#include <linux/export.h>

Instead you need:
#include <linux/device.h>
#include <linux/string.h>


> @@ -53,7 +53,8 @@
>         END_FIXUP
>  };
>
> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
> +static inline void __maybe_unused

The "__maybe_unused" shouldn't be needed here, or is it?

> +mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>  {
>         const struct mmc_fixup *f;
>         u64 rev = cid_rev_card(card);
> @@ -82,4 +83,3 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>                 }
>         }
>  }
> -EXPORT_SYMBOL(mmc_fixup_device);

[...]

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/5] mmc: core: change quirks.c to be a header file
  2017-02-08 11:15   ` Ulf Hansson
@ 2017-02-10  9:41     ` Shawn Lin
  2017-02-14  8:54       ` Ulf Hansson
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2017-02-10  9:41 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: shawn.lin, linux-mmc

On 2017/2/8 19:15, Ulf Hansson wrote:
> [...]
>
>> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
>> similarity index 95%
>> rename from drivers/mmc/core/quirks.c
>> rename to drivers/mmc/core/quirks.h
>> index bf25a9c..f3bbfcb7 100644
>> --- a/drivers/mmc/core/quirks.c
>> +++ b/drivers/mmc/core/quirks.h
>
> As you are rename this to become a header file, please also clean up
> the included headers from the new quirks.h.
>
> For example, you don't need these:
>
> #include <linux/kernel.h>
> #include <linux/export.h>
>
> Instead you need:
> #include <linux/device.h>
> #include <linux/string.h>
>

Sure.

>
>> @@ -53,7 +53,8 @@
>>         END_FIXUP
>>  };
>>
>> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>> +static inline void __maybe_unused
>
> The "__maybe_unused" shouldn't be needed here, or is it?
>

I tried to keep a C file to include quirk.h to make sure it will
be compiled standalone cleanly. Otherwise the gcc cast a warning
with W=1 about "defined but not used"..


>> +mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>>  {
>>         const struct mmc_fixup *f;
>>         u64 rev = cid_rev_card(card);
>> @@ -82,4 +83,3 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>>                 }
>>         }
>>  }
>> -EXPORT_SYMBOL(mmc_fixup_device);
>
> [...]
>
> Kind regards
> Uffe
>
>
>


-- 
Best Regards
Shawn Lin


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/5] mmc: core: change quirks.c to be a header file
  2017-02-10  9:41     ` Shawn Lin
@ 2017-02-14  8:54       ` Ulf Hansson
  0 siblings, 0 replies; 9+ messages in thread
From: Ulf Hansson @ 2017-02-14  8:54 UTC (permalink / raw)
  To: Shawn Lin; +Cc: linux-mmc

On 10 February 2017 at 10:41, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> On 2017/2/8 19:15, Ulf Hansson wrote:
>>
>> [...]
>>
>>> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
>>> similarity index 95%
>>> rename from drivers/mmc/core/quirks.c
>>> rename to drivers/mmc/core/quirks.h
>>> index bf25a9c..f3bbfcb7 100644
>>> --- a/drivers/mmc/core/quirks.c
>>> +++ b/drivers/mmc/core/quirks.h
>>
>>
>> As you are rename this to become a header file, please also clean up
>> the included headers from the new quirks.h.
>>
>> For example, you don't need these:
>>
>> #include <linux/kernel.h>
>> #include <linux/export.h>
>>
>> Instead you need:
>> #include <linux/device.h>
>> #include <linux/string.h>
>>
>
> Sure.
>
>>
>>> @@ -53,7 +53,8 @@
>>>         END_FIXUP
>>>  };
>>>
>>> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup
>>> *table)
>>> +static inline void __maybe_unused
>>
>>
>> The "__maybe_unused" shouldn't be needed here, or is it?
>>
>
> I tried to keep a C file to include quirk.h to make sure it will
> be compiled standalone cleanly. Otherwise the gcc cast a warning
> with W=1 about "defined but not used"..

I see.

However those kind of warnings isn't relevant when compiling the
header standalone.

[...]

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-02-14  8:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08  1:15 [PATCH v2 0/5] Some small cleanup for quirks Shawn Lin
2017-02-08  1:15 ` [PATCH v2 1/5] mmc: core: change quirks.c to be a header file Shawn Lin
2017-02-08 11:15   ` Ulf Hansson
2017-02-10  9:41     ` Shawn Lin
2017-02-14  8:54       ` Ulf Hansson
2017-02-08  1:15 ` [PATCH v2 2/5] mmc: core: move some sdio IDs out of quirks file Shawn Lin
2017-02-08  1:15 ` [PATCH v2 3/5] mmc: core: improve the quirks for sdio devices Shawn Lin
2017-02-08  1:15 ` [PATCH v2 4/5] mmc: core: move all quirks together into quirks.h Shawn Lin
2017-02-08  1:22 ` [PATCH v2 5/5] mmc: core: add mmc prefix for blk_fixups Shawn Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.