From patchwork Wed Jan 13 08:36:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 8023451 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 238169F6FA for ; Wed, 13 Jan 2016 08:37:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E27E20430 for ; Wed, 13 Jan 2016 08:37:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69B932042B for ; Wed, 13 Jan 2016 08:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755339AbcAMIhz (ORCPT ); Wed, 13 Jan 2016 03:37:55 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:34376 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753718AbcAMIhy (ORCPT ); Wed, 13 Jan 2016 03:37:54 -0500 Received: by mail-wm0-f50.google.com with SMTP id u188so287559383wmu.1; Wed, 13 Jan 2016 00:37:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=lhPslsip1yFDx6E92JnM9YiC4a7dv8Zv2ZLieezPl90=; b=FF+LUgM9IrF+iduI4TmiCoQaXwYFT5E0fxKD6qzUJt+E7KkjH8uUkN50BKZQxmIgC0 WdsSKvYRYqhO9YASstxwUwnPmWZUC/97uR43AaSdPUVZuyFXjM/GVVxupVG/BprrmcxQ gkkPw4Mn+rFB3NWFRKnrbuVqLBnggKI/abF4/zBKLOxCSh3YiOYeMPAlVsqu8UjT3kdx Jh3UI9iCFtAOIAVY70YGMiOCrnFNNasQOtdu8bPSQQjnOozKugnvhyWWUjiERAcW2qH6 O9TVsSNni4pwJPtpWVhRGlCbQSgnLEjq4MH6zvBQYVnl7iE0dnfAA1e0Qf1agv2Z8Rbh 1Z9A== X-Received: by 10.194.71.77 with SMTP id s13mr36744664wju.175.1452674272935; Wed, 13 Jan 2016 00:37:52 -0800 (PST) Received: from localhost.localdomain ([212.91.95.170]) by smtp.gmail.com with ESMTPSA id cs4sm323549wjc.10.2016.01.13.00.37.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jan 2016 00:37:51 -0800 (PST) From: Carlo Caione To: ulf.hansson@linaro.org, weijuny@qti.qualcomm.com, 21cnbao@gmail.com, linux-mmc@vger.kernel.org, jh80.chung@samsung.com, baohuas@qti.qualcomm.com Cc: Carlo Caione , stable@vger.kernel.org Subject: [PATCH] mmc: core: Enable tuning according to the actual timing Date: Wed, 13 Jan 2016 09:36:55 +0100 Message-Id: <1452674215-21560-1-git-send-email-carlo@caione.org> X-Mailer: git-send-email 2.5.0 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_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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: Carlo Caione While in sdhci_execute_tuning() the choice whether or not to enable the tuning is done on the actual timing, in the mmc_sdio_init_uhs_card() the check is done on the capability of the card. This difference is causing some issues with some SDIO cards in DDR50 mode where the CDM19 is wrongly issued. With this patch we modify the check in both mmc_(sd|sdio)_init_uhs_card() functions to take the proper decision only according to the actual timing specification. Cc: stable@vger.kernel.org Signed-off-by: Carlo Caione --- drivers/mmc/core/sd.c | 8 ++++---- drivers/mmc/core/sdio.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 141eaa9..967535d 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -626,9 +626,9 @@ 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_DDR50_BUS_SPEED || - card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) { + (card->host->ios.timing == MMC_TIMING_UHS_SDR50 || + card->host->ios.timing == MMC_TIMING_UHS_DDR50 || + card->host->ios.timing == MMC_TIMING_UHS_SDR104)) { err = mmc_execute_tuning(card); /* @@ -638,7 +638,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card) * 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) { + if (err && card->host->ios.timing == MMC_TIMING_UHS_DDR50) { pr_warn("%s: ddr50 tuning failed\n", mmc_hostname(card->host)); err = 0; diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 16d838e..0444773 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -535,8 +535,8 @@ static int mmc_sdio_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->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) || - (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104))) + ((card->host->ios.timing == MMC_TIMING_UHS_SDR50) || + (card->host->ios.timing == MMC_TIMING_UHS_SDR104))) err = mmc_execute_tuning(card); out: return err;