From patchwork Tue Sep 15 07:13:17 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: 7180741 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 7056E9F326 for ; Tue, 15 Sep 2015 07:13:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6376020762 for ; Tue, 15 Sep 2015 07:13:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 594EE2075F for ; Tue, 15 Sep 2015 07:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955AbbIOHNj (ORCPT ); Tue, 15 Sep 2015 03:13:39 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:36159 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbbIOHNi (ORCPT ); Tue, 15 Sep 2015 03:13:38 -0400 Received: by lbcao8 with SMTP id ao8so79472868lbc.3 for ; Tue, 15 Sep 2015 00:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ee3+eG8+ZkFWf5373QmHugTlDSwZ8ZbU17ENuA9RLug=; b=mO2K0DANm3kABnF4/+uLQ4S0tMVwFukND5NtNM0QG79Bm1ugN1ZQL94VBhKmJbtVkd 6ZTI/rfN7pEiqzeG0kgRVValBpdM2OMjWStt0pkhrruKPIFq0/HlWdw94g1uWXApiUQQ 66FTwPN6xgrVU+jEoKGeppDrmGHzHO7oZvALuwE15U5f8kbDmJ1qbrA6LSnqfH5pzGKd pr5daIcZpOWSYYDiKFQrFhRYHsx7d9rbhaXwRXS5EFE8QAeaAwmR93z0alX8f9uV6j9o 5KgFSmeP5NdpuJRR1hKqGAnUQmkv+lL2gxmNaIn0HXF+gsm6b1eOe71K105+SuTJgKJa aprQ== X-Received: by 10.152.6.196 with SMTP id d4mr8011111laa.121.1442301217517; Tue, 15 Sep 2015 00:13:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.137.196 with HTTP; Tue, 15 Sep 2015 00:13:17 -0700 (PDT) In-Reply-To: References: <1439282492-6274-1-git-send-email-21cnbao@gmail.com> From: Barry Song <21cnbao@gmail.com> Date: Tue, 15 Sep 2015 15:13:17 +0800 Message-ID: Subject: Re: [PATCH 1/2] mmc: core: enable CMD19 tuning for DDR50 mode To: Ulf Hansson Cc: linux-mmc , "linux-arm-kernel@lists.infradead.org" , DL-SHA-WorkGroupLinux , Weijun Yang , Barry Song 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 2015-08-25 20:05 GMT+08:00 Ulf Hansson : > On 20 August 2015 at 02:16, Barry Song <21cnbao@gmail.com> wrote: >> 2015-08-18 1:11 GMT+08:00 Ulf Hansson : >>> On 11 August 2015 at 10:41, Barry Song <21cnbao@gmail.com> wrote: >>>> 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. >>> >>> So what happens with cards following the 3.0 spec version, those >>> doesn't need to support the tuning CMD right? Perhaps that needs to be >>> addressed in this patch well!? >> >> from HW registers of the card, we cann't know whether the HW needs >> tuning. it is said 3.0.x need tuning, but 3.0 doesn't need. @weijun, >> pls fix me if i am wrong. >> if so, it seems we need a static flag somewhere to indicate whether >> the tuning is needed. we can't detect to find the tuning requirement. > > Another way is to always try doing the tuning for DDR50, but in case > of errors just ignore them and print a debug/info message!? Uffe, do you mean something like below: case MMC_TIMING_UHS_SDR50: > > Kind regards > Uffe -barry --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 4e7366a..d4df9f0 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -629,8 +629,23 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card) */ 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_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_err("%s: ddr50 tuning failed\n", mmc_hostname(card->host)); + kfree(status); + return 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;