Skip to contentSkip to conversation

mmc: card: Add eMMC4.5 write packed commands unit-tests

PATCH Superseded Maya Erez 1 participant 1 message Jul 15, 2012

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Maya Erez

author
#0 lore raw

PATCH v4 3/3 mmc: card: Add eMMC4.5 write packed commands unit-tests

Expose the following packed commands tests:
- Test the write packed commands list preparation
- Simulate a returned error code
- Send an invalid packed command to the card

---
 drivers/mmc/card/Kconfig          |   11 +
 drivers/mmc/card/Makefile         |    1 +
 drivers/mmc/card/block.c          |   82 ++-
 drivers/mmc/card/mmc_block_test.c | 1522 +++++++++++++++++++++++++++++++++++++
 drivers/mmc/card/queue.h          |   15 +
 5 files changed, 1619 insertions(+), 12 deletions(-)
 create mode 100644 drivers/mmc/card/mmc_block_test.c
drivers/mmc/card/Kconfig +11 -0
index 3b1f783..bbe8cac 100644
@@ -67,3 +67,14 @@ config MMC_TEST
 
 	  This driver is only of interest to those developing or
 	  testing a host driver. Most people should say N here.
+
+config MMC_BLOCK_TEST
+	tristate "MMC block test"
+	depends on MMC_BLOCK && IOSCHED_TEST
+	default m
+	help
+	  MMC block test can be used with test iosched to test the MMC block
+	  device.
+	  Currently used to test eMMC 4.5 features (packed commands, sanitize,
+	  BKOPs).
+
drivers/mmc/card/Makefile +1 -0
index c73b406..d55107f 100644
@@ -8,3 +8,4 @@ obj-$(CONFIG_MMC_TEST)		+= mmc_test.o
 
 obj-$(CONFIG_SDIO_UART)		+= sdio_uart.o
 
+obj-$(CONFIG_MMC_BLOCK_TEST)		+= mmc_block_test.o
drivers/mmc/card/block.c +70 -12

100 lines not on this page · raw message

drivers/mmc/card/mmc_block_test.c new file +1522 -0

1,522 lines not on this page · raw message

drivers/mmc/card/queue.h +15 -0
index 5e04938..4214f69 100644
@@ -12,6 +12,17 @@ struct mmc_blk_request {
 	struct mmc_data		data;
 };
 
+enum mmc_blk_status {
+	MMC_BLK_SUCCESS = 0,
+	MMC_BLK_PARTIAL,
+	MMC_BLK_CMD_ERR,
+	MMC_BLK_RETRY,
+	MMC_BLK_ABORT,
+	MMC_BLK_DATA_ERR,
+	MMC_BLK_ECC_ERR,
+	MMC_BLK_NOMEDIUM,
+};
+
 enum mmc_packed_cmd {
 	MMC_PACKED_NONE = 0,
 	MMC_PACKED_WRITE,
@@ -45,6 +56,8 @@ struct mmc_queue {
 	struct mmc_queue_req	mqrq[2];
 	struct mmc_queue_req	*mqrq_cur;
 	struct mmc_queue_req	*mqrq_prev;
+	int (*err_check_fn) (struct mmc_card *, struct mmc_async_req *);
+	void (*packed_test_fn) (struct request_queue *, struct mmc_queue_req *);
 };
 
 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
@@ -58,4 +71,6 @@ extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
 
+extern void print_mmc_packing_stats(struct mmc_card *card);
+
 #endif
Signature · 4 lines
1.7.3.3
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.