Received: by 10.192.165.148 with SMTP id m20csp2522409imm; Sun, 22 Apr 2018 08:47:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+L/UTpBKNvRtilIhDAenfNadaq50R7eU+mpbKZOmCFNna6G8m0EVTNL1RcmXzyeBAMU4fa X-Received: by 2002:a17:902:be15:: with SMTP id r21-v6mr17156480pls.237.1524412042346; Sun, 22 Apr 2018 08:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412042; cv=none; d=google.com; s=arc-20160816; b=hqXosEEuOxcS0BL0RIQY4pil+h3mZ9D/rYj7Nby7K9ia0BScXvnZ7YSLkkEfiA0WkY WnZmmOAuwuQIuCO5sljmNad7xepceYw0DKlMk2ULtKy7guNPAxfZHiC2CI10h58+8vgu zamAXbaNRiv4uT4djcXORX1JwOA5S6PLZxJ8QbiDJpsyXPBlXqGyOyWnJ2H8CRrbz8H2 uwGpWmUg411ZYqSBVtD8aTd2Ng50xnBfa8Q3fB68bJ1ZEaNT3LTeP8sP+trLE3YDqUmB 3Ppq1wYjrvPks5K0JFpIt2Pqu0by5KZctEpjwrZXalD2Wd562wHwMBwTjmsl15zqUWqh 7B9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1x1blfnDkg3u3q91wGVgF0E085xnGj3KLoSCVcPZnZM=; b=EjgKmzYJsfnYxz1rfehZcsBBcIz8lIMBFqv6HCValvdc3nggx3/R141m1mBpU3Q3rL 2VpmNUJlIBTJErqC9zEYo1G7a8NN0p8o6H06EO22tZkQrfQs132dbIwORmV4ktiMk5qg /asx/XmNrTzPajIGEG1KnYVV8b0010BRuK1k3iKDgOtEgS7jEUr8bq7BIfjCiBvFakq3 XgsFy6v01hJ65Er7YH0orhC769Uv+TkXVMdSZHhHZ67oSNTmcTpk2GJX0kXFN9nBtW5K 6R5c9abC4IxEF0aC64Hy0PF2wsH6RYAJUUjwwDEHsZ5rGh4ux8i2xI9enmW/h7GviWE0 IvNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7-v6si10053930pls.93.2018.04.22.08.47.08; Sun, 22 Apr 2018 08:47:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754884AbeDVOCh (ORCPT + 99 others); Sun, 22 Apr 2018 10:02:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48624 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754267AbeDVOCd (ORCPT ); Sun, 22 Apr 2018 10:02:33 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 28C2BC9B; Sun, 22 Apr 2018 14:02:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Kurtz , Shyam Sundar S K , Adrian Hunter , Ulf Hansson Subject: [PATCH 4.16 182/196] mmc: sdhci-pci: Only do AMD tuning for HS200 Date: Sun, 22 Apr 2018 15:53:22 +0200 Message-Id: <20180422135113.670412371@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Kurtz commit 300ad8992913025b4294d4fc37b6bfff4a8b7ad1 upstream. Commit c31165d7400b ("mmc: sdhci-pci: Add support for HS200 tuning mode on AMD, eMMC-4.5.1") added a HS200 tuning method for use with AMD SDHCI controllers. As described in the commit subject, this tuning is specific for HS200. However, as implemented, this method is used for all host timings, because platform_execute_tuning, if it exists, is called unconditionally by sdhci_execute_tuning(). This breaks tuning when using the AMD controller with, for example, a DDR50 SD card. Instead, we can implement an amd execute_tuning wrapper callback, and then conditionally do the HS200 specific tuning for HS200, and otherwise call back to the standard sdhci_execute_tuning(). Signed-off-by: Daniel Kurtz Acked-by: Shyam Sundar S K Acked-by: Adrian Hunter Fixes: c31165d7400b ("mmc: sdhci-pci: Add support for HS200 tuning mode on AMD, eMMC-4.5.1") Cc: stable@vger.kernel.org # v4.11+ Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-pci-core.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -1318,7 +1318,7 @@ static void amd_enable_manual_tuning(str pci_write_config_dword(pdev, AMD_SD_MISC_CONTROL, val); } -static int amd_execute_tuning(struct sdhci_host *host, u32 opcode) +static int amd_execute_tuning_hs200(struct sdhci_host *host, u32 opcode) { struct sdhci_pci_slot *slot = sdhci_priv(host); struct pci_dev *pdev = slot->chip->pdev; @@ -1357,6 +1357,27 @@ static int amd_execute_tuning(struct sdh return 0; } +static int amd_execute_tuning(struct mmc_host *mmc, u32 opcode) +{ + struct sdhci_host *host = mmc_priv(mmc); + + /* AMD requires custom HS200 tuning */ + if (host->timing == MMC_TIMING_MMC_HS200) + return amd_execute_tuning_hs200(host, opcode); + + /* Otherwise perform standard SDHCI tuning */ + return sdhci_execute_tuning(mmc, opcode); +} + +static int amd_probe_slot(struct sdhci_pci_slot *slot) +{ + struct mmc_host_ops *ops = &slot->host->mmc_host_ops; + + ops->execute_tuning = amd_execute_tuning; + + return 0; +} + static int amd_probe(struct sdhci_pci_chip *chip) { struct pci_dev *smbus_dev; @@ -1391,12 +1412,12 @@ static const struct sdhci_ops amd_sdhci_ .set_bus_width = sdhci_set_bus_width, .reset = sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, - .platform_execute_tuning = amd_execute_tuning, }; static const struct sdhci_pci_fixes sdhci_amd = { .probe = amd_probe, .ops = &amd_sdhci_pci_ops, + .probe_slot = amd_probe_slot, }; static const struct pci_device_id pci_ids[] = {