From patchwork Thu May 26 01:56:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9136391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8705B6075C for ; Thu, 26 May 2016 01:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ABEF27BE4 for ; Thu, 26 May 2016 01:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FA7A27E72; Thu, 26 May 2016 01:56:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, URIBL_BLACK autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 917FF280BA for ; Thu, 26 May 2016 01:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753055AbcEZB4c (ORCPT ); Wed, 25 May 2016 21:56:32 -0400 Received: from lucky1.263xmail.com ([211.157.147.135]:55323 "EHLO vmpostfix.263.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753022AbcEZB4a (ORCPT ); Wed, 25 May 2016 21:56:30 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.129]) by vmpostfix.263.net (Postfix) with SMTP id 0E2CF9F0; Thu, 26 May 2016 09:56:26 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 24850160FA; Thu, 26 May 2016 09:56:23 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: ulf.hansson@linaro.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 10839B0NHXY; Thu, 26 May 2016 09:56:24 +0800 (CST) From: Shawn Lin To: Ulf Hansson Cc: Adrian Hunter , Jaehoon Chung , Michal Simek , soren.brinkmann@xilinx.com, Rob Herring , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Doug Anderson , Brian Norris , Heiko Stuebner , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Shawn Lin Subject: [PATCH v6 2/5] mmc: core: add mmc-hs400-enhanced-strobe support Date: Thu, 26 May 2016 09:56:12 +0800 Message-Id: <1464227772-31255-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1464227707-30616-1-git-send-email-shawn.lin@rock-chips.com> References: <1464227707-30616-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduce mmc-hs400-enhanced-strobe for platforms which want to enable enhanced strobe function from DT if the mmc host controller claims to support enhanced strobe. Signed-off-by: Shawn Lin Reviewed-by: Douglas Anderson Tested-by: Jaehoon Chung --- Changes in v6: - add Doug's review-tag and Jaehoon's test-tag Changes in v5: - avoid to call hs400_enhanced+_strobe in mmc_set_initial_state if no setting MMC_CAP2_HS400_ES. - add Adrian's ack for patch[5/5] Changes in v4: - check avail_type with EXT_CSD_CARD_TYPE_HS400 instead of card_type - check if host support 8-bit when selecting hs400es - some minor fix suggested by Douglas and add his review tag Changes in v3: - remove helper function and shorten cap2 to MMC_CAP2_HS400_ES - rename callback to hs400_enhanced_strobe and make it return void - add enhanced_strobe in mmc_ios and pass it to hs400_enhanced_strobe - disable host's enhanced strobe in mmc_set_initial_state - remove bus checking after switching hs400es - add new function for hs400es timing selection - fix wrong judgement of mmc_card_hs400es Changes in v2: - switch to HS400ES from Highspeed mode directly drivers/mmc/core/host.c | 2 ++ include/linux/mmc/host.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index e0a3ee1..45773e4 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -289,6 +289,8 @@ int mmc_of_parse(struct mmc_host *host) host->caps2 |= MMC_CAP2_HS400_1_8V | MMC_CAP2_HS200_1_8V_SDR; if (of_property_read_bool(np, "mmc-hs400-1_2v")) host->caps2 |= MMC_CAP2_HS400_1_2V | MMC_CAP2_HS200_1_2V_SDR; + if (of_property_read_bool(np, "mmc-hs400-enhanced-strobe")) + host->caps2 |= MMC_CAP2_HS400_ES; host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr); if (host->dsr_req && (host->dsr & ~0xffff)) { diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 85800b4..2a06fb0 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -302,6 +302,7 @@ struct mmc_host { #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */ +#define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */ mmc_pm_flag_t pm_caps; /* supported pm features */