From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752735AbeDJLy3 (ORCPT ); Tue, 10 Apr 2018 07:54:29 -0400 Received: from mga07.intel.com ([134.134.136.100]:2990 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752333AbeDJLy0 (ORCPT ); Tue, 10 Apr 2018 07:54:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,431,1517904000"; d="scan'208";a="190289151" Subject: Re: [PATCH] mmc: sdhci-pci: Only do AMD tuning for HS200 To: Daniel Kurtz Cc: satyajit.sahu@amd.com, ssundark@amd.com, craigb@chromium.org, Ulf Hansson , linux-mmc@vger.kernel.org, open list References: <20180406220806.150534-1-djkurtz@chromium.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <36f6658d-87d4-6fe2-9387-02c08fb84b48@intel.com> Date: Tue, 10 Apr 2018 14:53:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180406220806.150534-1-djkurtz@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/04/18 01:07, Daniel Kurtz wrote: > 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: Adrian Hunter > --- > drivers/mmc/host/sdhci-pci-core.c | 25 +++++++++++++++++++++++-- > 1 file changed, 23 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c > index 787434e5589d..78c25ad35fd2 100644 > --- a/drivers/mmc/host/sdhci-pci-core.c > +++ b/drivers/mmc/host/sdhci-pci-core.c > @@ -1312,7 +1312,7 @@ static void amd_enable_manual_tuning(struct pci_dev *pdev) > 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; > @@ -1351,6 +1351,27 @@ static int amd_execute_tuning(struct sdhci_host *host, u32 opcode) > 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; > @@ -1385,12 +1406,12 @@ static const struct sdhci_ops amd_sdhci_pci_ops = { > .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[] = { >