From patchwork Mon Sep 28 03:23:37 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: 7274991 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A203CBEEA4 for ; Mon, 28 Sep 2015 03:15:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35AB5206C0 for ; Mon, 28 Sep 2015 03:15:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EB19206B7 for ; Mon, 28 Sep 2015 03:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755629AbbI1DPY (ORCPT ); Sun, 27 Sep 2015 23:15:24 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33434 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755562AbbI1DPX (ORCPT ); Sun, 27 Sep 2015 23:15:23 -0400 Received: by pacex6 with SMTP id ex6so160483768pac.0 for ; Sun, 27 Sep 2015 20:15:23 -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=86J1hUczv17xF3nlVIgyt9HMKsCBuwNV4kwteKp0qVs=; b=t1aFiUQqVafpGkOi6B2NEEFdiQ46doLAlXFK2DlI0D1fWtfQTMZf+h5tsnkjPjSzG1 6DDP0A54SkLCMjisszZRrFAZ3GpYW5OztKTd4LAoV1eWRr+c0p4QAci7mpP0wW4mupzv 7+YEZud3bwPMl70XNE4XODyfeWFzmsYVCSeURwnZU58oYd2OASSFVIm7LkTRR6pBRzYJ Ct+7n9O9vmdFYsmxPsJymQReXUGlItp1MnPKa1dEcgzLxKDpazEIA2YHcFhSJwXs0kc7 BQTK/OEfDQnU4yoJ/NlHhgP6ZJvoFfl+eYU6QQPSckzFaxJKqpHeZfPdj7XaJM7O1ICs 4C9A== X-Received: by 10.68.191.200 with SMTP id ha8mr23688184pbc.72.1443410123301; Sun, 27 Sep 2015 20:15:23 -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 ej3sm16127153pbd.13.2015.09.27.20.15.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Sep 2015 20:15:22 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, workgroup.linux@csr.com, Weijun Yang , Barry Song Subject: [PATCH v2 1/2] mmc: core: enable CMD19 tuning for DDR50 mode Date: Mon, 28 Sep 2015 03:23:37 +0000 Message-Id: <1443410618-14763-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 +++++++++++++++++-- drivers/mmc/host/sdhci.c | 1 + 2 files changed, 18 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); diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 64b7fdb..382810d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1915,6 +1915,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) break; case MMC_TIMING_UHS_SDR104: + case MMC_TIMING_UHS_DDR50: break; case MMC_TIMING_UHS_SDR50: