From patchwork Sun Oct 4 12:04:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 7323531 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 07E369F1D5 for ; Sun, 4 Oct 2015 11:55:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A3A320456 for ; Sun, 4 Oct 2015 11:55:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 090B2203FB for ; Sun, 4 Oct 2015 11:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751412AbbJDLzr (ORCPT ); Sun, 4 Oct 2015 07:55:47 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34545 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbbJDLzq (ORCPT ); Sun, 4 Oct 2015 07:55:46 -0400 Received: by padhy16 with SMTP id hy16so8548396pad.1 for ; Sun, 04 Oct 2015 04:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=0dnS+lBbG/TthNlguC4NcrRV4QTDX0TsIjcFKfbpqTw=; b=kZG0CM0nrx16DWmclCEg0j5dmpPwsQQSm4tmWdlJ5sA8+1KZfhsOF+omTSjepy0iTo R5HttAu6aYa6mOuocsJGr13MB8Cpoj12SDkXOYnFM5E9qeTfSU1W1LRq6nWw/CAWXTos S9eWiA7Ya0TzNO9XXXV33qR82aqOCt93Nv3nT02wjLAibuecRlxIkgH0jOn7aWdWiUxm zmjMFKZy905d+c1B+6dFuI6oJ5djaUFj23AmQYtP35YFOQ99T0PQ5gZmC5WXUztRcO7X C/t4Gvv8HIZrj2DUC0R3VvmFmCICPNab/wgZ1Ht+lFVgkCoQJyvDqzYL0hQdLK0yGvbY UxPQ== X-Received: by 10.69.11.196 with SMTP id ek4mr32952390pbd.148.1443959746302; Sun, 04 Oct 2015 04:55:46 -0700 (PDT) Received: from ip-172-31-29-47.ap-northeast-1.compute.internal (ec2-54-65-106-64.ap-northeast-1.compute.amazonaws.com. [54.65.106.64]) by smtp.gmail.com with ESMTPSA id gd2sm21803392pbb.41.2015.10.04.04.55.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Oct 2015 04:55:44 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org Cc: workgroup.linux@csr.com, Weijun Yang , Barry Song Subject: [PATCH v3 1/3] mmc: core: enable CMD19 tuning for DDR50 mode Date: Sun, 4 Oct 2015 12:04:11 +0000 Message-Id: <1443960253-4082-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Weijun Yang As SD Specifications Part1 Physical Layer Specification Version 3.01 says, CMD19 tuning is available for unlocked cards in transfer state of 1.8V signaling mode. The small difference between v3.00 and 3.01 spec means that CMD19 tuning is also available for DDR50 mode. Signed-off-by: Weijun Yang Signed-off-by: Barry Song --- drivers/mmc/core/sd.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 4e7366a..eaf8cb3 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -628,9 +628,24 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card) * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. */ if (!mmc_host_is_spi(card->host) && - (card->sd_bus_speed == UHS_SDR50_BUS_SPEED || - card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) + (card->sd_bus_speed == UHS_SDR50_BUS_SPEED || + card->sd_bus_speed == UHS_DDR50_BUS_SPEED || + card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) { err = mmc_execute_tuning(card); + + /* + * As SD Specifications Part1 Physical Layer Specification Version + * 3.01 says, CMD19 tuning is available for unlocked cards in transfer + * state of 1.8V signaling mode. The small difference between v3.00 + * and 3.01 spec means that CMD19 tuning is also available for DDR50 + * mode. + */ + if (err && (card->sd_bus_speed == UHS_DDR50_BUS_SPEED)) { + pr_warn("%s: ddr50 tuning failed\n", mmc_hostname(card->host)); + err = 0; + } + } + out: kfree(status);