From patchwork Mon Jan 4 21:15:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 7951261 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 86BC39F1C0 for ; Mon, 4 Jan 2016 21:16:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF2BF201ED for ; Mon, 4 Jan 2016 21:16:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B1DA202FF for ; Mon, 4 Jan 2016 21:16:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbcADVQT (ORCPT ); Mon, 4 Jan 2016 16:16:19 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34424 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751523AbcADVQQ (ORCPT ); Mon, 4 Jan 2016 16:16:16 -0500 Received: by mail-wm0-f44.google.com with SMTP id u188so913909wmu.1 for ; Mon, 04 Jan 2016 13:16:16 -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=PUqX2h8BM1WMZq9p3cNQomzQjb6iQKX7oR8JkOVnoP0=; b=qb1GklVVu/knuYI84rOoh+KlpdhJnipYmxgNxNTbkWw1n1D94tYHt6YlLjPSsBX2cs 04QTqKApzVXH4QoNNyERxew9tU4FF7H+rTjulVrjlMdsQRTLL/OwmhKU7pn0E3a4BxiZ BmxaKHtKsD3oeWyFzl5s0+IklEDv9I8PqYDeCaTiodLbFL7qW6aUGGX4yruQxJEEYs5t /JKXIxKamPW7rreOabC8B7qAXEoRGsVsdEH4+hlnRINLTtuGzTyz1vz+5obXuaq93hX3 pXKItV4EM55/83cR7gRTRN+7taTSS066LEfZkpkSUuDjbC2wL6quqczRL3TS2SQGKVv9 a4OQ== X-Received: by 10.28.215.209 with SMTP id o200mr420254wmg.31.1451942175576; Mon, 04 Jan 2016 13:16:15 -0800 (PST) Received: from localhost.localdomain (2-238-57-164.ip242.fastwebnet.it. [2.238.57.164]) by smtp.gmail.com with ESMTPSA id s129sm387144wmf.18.2016.01.04.13.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Jan 2016 13:16:14 -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 Subject: [PATCH RESEND] mmc: core: Enable tuning according to the actual timing Date: Mon, 4 Jan 2016 22:15:58 +0100 Message-Id: <1451942158-32409-1-git-send-email-carlo@caione.org> 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_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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: 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. Signed-off-by: Carlo Caione --- Hi Ulf, as it turns out the panic I was seeing wasn't related to this patch. I had a discussion with Hante Meuleman and apparently they fixed the problem I was seeing with the patch "brcmfmac: Fix double free on exception at module load." to be included in 4.5, so I'm submitting again this patch for your consideration. Cheers, --- 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;