From 41875e388401ad97c33252d5fa39d52e0b70ee9b Mon Sep 17 00:00:00 2001 From: Sujit Reddy Thumma Date: Tue, 4 Dec 2012 17:06:19 +0530 Subject: mmc: sdio: Fix SDIO 3.0 UHS-I initialization sequence According to UHS-I initialization sequence for SDIO 3.0 cards, the host must set bit[24] (S18R) of OCR register during OCR handshake to know whether the SDIO card is capable of doing 1.8V I/O. Signed-off-by: Sujit Reddy Thumma Signed-off-by: Subhash Jadavani Reviewed-by: Johan Rudholm Reviewed-by: Ulf Hansson Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 61a10c17aabd..c89a1bb87fa5 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -434,6 +434,14 @@ static inline int mmc_boot_partition_access(struct mmc_host *host) return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); } +static inline int mmc_host_uhs(struct mmc_host *host) +{ + return host->caps & + (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | + MMC_CAP_UHS_DDR50); +} + #ifdef CONFIG_MMC_CLKGATE void mmc_host_clk_hold(struct mmc_host *host); void mmc_host_clk_release(struct mmc_host *host); -- cgit From 2220eedfd7aea69008173a224975e10284fbe854 Mon Sep 17 00:00:00 2001 From: Konstantin Dorfman Date: Mon, 14 Jan 2013 14:28:17 -0500 Subject: mmc: fix async request mechanism for sequential read scenarios When current request is running on the bus and if next request fetched by mmcqd is NULL, mmc context (mmcqd thread) gets blocked until the current request completes. This means that if new request comes in while the mmcqd thread is blocked, this new request can not be prepared in parallel to current ongoing request. This may result in delaying the new request execution and increase it's latency. This change allows to wake up the MMC thread on new request arrival. Now once the MMC thread is woken up, a new request can be fetched and prepared in parallel to the current running request which means this new request can be started immediately after the current running request completes. With this change read throughput is improved by 16%. Signed-off-by: Konstantin Dorfman Reviewed-by: Seungwon Jeon Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index c89a1bb87fa5..523d570f58ad 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -170,6 +170,22 @@ struct mmc_slot { void *handler_priv; }; +/** + * mmc_context_info - synchronization details for mmc context + * @is_done_rcv wake up reason was done request + * @is_new_req wake up reason was new request + * @is_waiting_last_req mmc context waiting for single running request + * @wait wait queue + * @lock lock to protect data fields + */ +struct mmc_context_info { + bool is_done_rcv; + bool is_new_req; + bool is_waiting_last_req; + wait_queue_head_t wait; + spinlock_t lock; +}; + struct regulator; struct mmc_supply { @@ -331,6 +347,7 @@ struct mmc_host { struct dentry *debugfs_root; struct mmc_async_req *areq; /* active async req */ + struct mmc_context_info context_info; /* async synchronization info */ #ifdef CONFIG_FAIL_MMC_REQUEST struct fault_attr fail_mmc_request; -- cgit From d887874e0ead6a0b86b6046b872730c81c121352 Mon Sep 17 00:00:00 2001 From: Johan Rudholm Date: Mon, 28 Jan 2013 15:08:26 +0100 Subject: mmc: core: Add card_busy to host_ops This host_ops member is used to test if the card is signaling busy by pulling dat[0:3] low. Signed-off-by: Johan Rudholm Acked-by: Ulf Hansson Tested-by: Wei WANG Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 523d570f58ad..0373b0a6daac 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -131,6 +131,9 @@ struct mmc_host_ops { int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); + /* Check if the card is pulling dat[0:3] low */ + int (*card_busy)(struct mmc_host *host); + /* The tuning command opcode value is different for SD and eMMC cards */ int (*execute_tuning)(struct mmc_host *host, u32 opcode); void (*enable_preset_value)(struct mmc_host *host, bool enable); -- cgit From 52983382c74f59a3953e622d7661a24e1bc4388a Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Thu, 31 Jan 2013 11:31:37 +0800 Subject: mmc: sdhci: enhance preset value function 4d55c5a1 ("mmc: sdhci: enable preset value after uhs initialization") added preset value support and enabled it by default during sd card init. Below are the enhancements introduced by this patch: 1. In current code, preset value is enabled after setting clock finished, which means the clock is manually set by driver firstly and then suddenly switched to preset value at this point. So the first setting is useless and unnecessary. What's more, the first clock setting may differ from the preset one. The better way is enable preset value just after switch to UHS mode so the preset value can take effect immediately. So move preset value enable from mmc_sd_init_card to sdhci_set_ios which will be called during set timing. 2. In current code, preset value is disabled at the beginning of mmc_attach_sd. It's too late since low freq (400khz) should be set in mmc_power_up. So move preset value disable to sdhci_set_ios which will be called during power up. 3. host->clock and ios->drv_type should also be updated according to the preset value if it's enabled. Current code missed this. 4. This patch also introduce a quirk to disable preset value in case preset value doesn't work. This patch has been verified on sdhci-pxav3 platform with both preset enabled and disabled. Signed-off-by: Kevin Liu Reviewed-by: Ulf Hansson Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 0373b0a6daac..6c235e03de29 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -136,7 +136,6 @@ struct mmc_host_ops { /* The tuning command opcode value is different for SD and eMMC cards */ int (*execute_tuning)(struct mmc_host *host, u32 opcode); - void (*enable_preset_value)(struct mmc_host *host, bool enable); int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); void (*hw_reset)(struct mmc_host *host); void (*card_event)(struct mmc_host *host); -- cgit From abd9ac144947d9a604beb763339e2f77ce8bec79 Mon Sep 17 00:00:00 2001 From: Seungwon Jeon Date: Wed, 6 Feb 2013 17:01:43 +0900 Subject: mmc: add packed command feature of eMMC4.5 This patch adds packed command feature of eMMC4.5. The maximum number for packing read (or write) is offered and exception event relevant to packed command which is used for error handling is enabled. If host wants to use this feature, MMC_CAP2_PACKED_CMD should be set. Signed-off-by: Seungwon Jeon Reviewed-by: Maya Erez Reviewed-by: Subhash Jadavani Reviewed-by: Namjae Jeon Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 6c235e03de29..a0466c03f5e1 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -276,6 +276,10 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ +#define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */ +#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */ +#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ + MMC_CAP2_PACKED_WR) mmc_pm_flag_t pm_caps; /* supported pm features */ -- cgit From ce39f9d17c14e56ea6772aa84393e6e0cc8499c4 Mon Sep 17 00:00:00 2001 From: Seungwon Jeon Date: Wed, 6 Feb 2013 17:02:46 +0900 Subject: mmc: support packed write command for eMMC4.5 devices This patch supports packed write command of eMMC4.5 devices. Several writes can be grouped in packed command and all data of the individual commands can be sent in a single transfer on the bus. Large amounts of data in one transfer rather than several data of small size are effective for eMMC write internally. As a result, packed command help write throughput be improved. The following tables show the results of packed write. Type A: test none | packed iozone 25.8 | 31 tiotest 27.6 | 31.2 lmdd 31.2 | 35.4 Type B: test none | packed iozone 44.1 | 51.1 tiotest 47.9 | 52.5 lmdd 51.6 | 59.2 Type C: test none | packed iozone 19.5 | 32 tiotest 19.9 | 34.5 lmdd 22.8 | 40.7 Signed-off-by: Seungwon Jeon Reviewed-by: Maya Erez Reviewed-by: Namjae Jeon Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index a0466c03f5e1..fd5fd5a6026f 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -465,6 +465,11 @@ static inline int mmc_host_uhs(struct mmc_host *host) MMC_CAP_UHS_DDR50); } +static inline int mmc_host_packed_wr(struct mmc_host *host) +{ + return host->caps2 & MMC_CAP2_PACKED_WR; +} + #ifdef CONFIG_MMC_CLKGATE void mmc_host_clk_hold(struct mmc_host *host); void mmc_host_clk_release(struct mmc_host *host); -- cgit From 6c56e7a0fff166904ce2715f7ab1746460c1f11b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Sat, 16 Feb 2013 16:21:16 +0100 Subject: mmc: provide a standard MMC device-tree binding parser centrally MMC defines a number of standard DT bindings. Having each driver parse them individually adds code redundancy and is error prone. Provide a standard function to unify the parsing. After all drivers are converted to using it instead of their own parsers, this function can be integrated into mmc_alloc_host(). Signed-off-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index fd5fd5a6026f..bf93c9a6d729 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -368,6 +368,7 @@ extern struct mmc_host *mmc_alloc_host(int extra, struct device *); extern int mmc_add_host(struct mmc_host *); extern void mmc_remove_host(struct mmc_host *); extern void mmc_free_host(struct mmc_host *); +void mmc_of_parse(struct mmc_host *host); static inline void *mmc_priv(struct mmc_host *host) { -- cgit From 8c9beb117bf31cdb757bc80992281004be8a177b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 15 Feb 2013 16:13:53 +0100 Subject: mmc: (cosmetic) remove "extern" from function declarations The "extern" keyword isn't required in function declarations, remove it. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'include/linux/mmc/host.h') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index bf93c9a6d729..d6f20cc6415e 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -364,10 +364,10 @@ struct mmc_host { unsigned long private[0] ____cacheline_aligned; }; -extern struct mmc_host *mmc_alloc_host(int extra, struct device *); -extern int mmc_add_host(struct mmc_host *); -extern void mmc_remove_host(struct mmc_host *); -extern void mmc_free_host(struct mmc_host *); +struct mmc_host *mmc_alloc_host(int extra, struct device *); +int mmc_add_host(struct mmc_host *); +void mmc_remove_host(struct mmc_host *); +void mmc_free_host(struct mmc_host *); void mmc_of_parse(struct mmc_host *host); static inline void *mmc_priv(struct mmc_host *host) @@ -381,16 +381,16 @@ static inline void *mmc_priv(struct mmc_host *host) #define mmc_classdev(x) (&(x)->class_dev) #define mmc_hostname(x) (dev_name(&(x)->class_dev)) -extern int mmc_suspend_host(struct mmc_host *); -extern int mmc_resume_host(struct mmc_host *); +int mmc_suspend_host(struct mmc_host *); +int mmc_resume_host(struct mmc_host *); -extern int mmc_power_save_host(struct mmc_host *host); -extern int mmc_power_restore_host(struct mmc_host *host); +int mmc_power_save_host(struct mmc_host *host); +int mmc_power_restore_host(struct mmc_host *host); -extern void mmc_detect_change(struct mmc_host *, unsigned long delay); -extern void mmc_request_done(struct mmc_host *, struct mmc_request *); +void mmc_detect_change(struct mmc_host *, unsigned long delay); +void mmc_request_done(struct mmc_host *, struct mmc_request *); -extern int mmc_cache_ctrl(struct mmc_host *, u8); +int mmc_cache_ctrl(struct mmc_host *, u8); static inline void mmc_signal_sdio_irq(struct mmc_host *host) { -- cgit