Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp384596imm; Thu, 26 Jul 2018 05:28:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpddRZsuiaFyi1d/yljqTKrMEIY9KAr5SH/kVuMKUiD2F/FMexVybXnoOeUh6b8FT2JmpeL2 X-Received: by 2002:a17:902:5a3:: with SMTP id f32-v6mr1794012plf.286.1532608101082; Thu, 26 Jul 2018 05:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532608101; cv=none; d=google.com; s=arc-20160816; b=iQ2pGUTYNoVK4zx+orzm9IF5ZH0Z2/01bb/qg1mls795SlK/1isBD/5WNF445L6Log 4oCDHFdLrGGeYdqTztXCuLklp2ZQN/SU9cQMO/nFiFgkL4LqOknibkikRYeOB4ZoKQ2L fckPSpOW3O8tAFHsJMXEUmj227bxvagp9onyTFUbJMBjC9Wh6URd+iwkBheGAmNqTFTy fw1mk4ySpR9nRkW0ZNiK89vFAfT0koDJOMd+/ovIYbuJCXLpFIWytKTtbohlAvDTzkhJ 8C9C77TlSan0Aqd9bk1zKmvzXk/ijgi+rxNDSTZtB7yYCryAhSfRdiS0ITfEhCHLVXxd varQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=xINbwaJbE0ZPdBFYH83Z3e5R6VAsUKtI7XWcnxEzpDQ=; b=NVmOZ6AbuI1vcNbKHhzgYZayVulmf0bzEXQBGlnTwLU0xu/BVypDkCy4Wq8TWtdqPt GU6QVvmr+F6fWjE0Zif0oJBj4lL6mAZWk5hwjvVAPJSXvNacFHifvSxBovPDQ2cFlNOT f4YT2Us+RnfsEXZ8Q3hlb6s0QHK3dbDkgCdf2cVg3r1+3a4MWFnlnHkmUIry26PCBdnj d/jN5cDxePYWykGMyMpsc34Exmeun4xbv+SKl0aKgvxNWcxKb+X+seruscFNU2GsAPd1 HiPL2zGpZioScIJW3uFj3mTqocEom3J063GveXkazvOwc2YXao9tqlDjetOyAepKAgRm QMlg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w25-v6si1264750pga.58.2018.07.26.05.28.06; Thu, 26 Jul 2018 05:28:21 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731495AbeGZNnu (ORCPT + 99 others); Thu, 26 Jul 2018 09:43:50 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:12197 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730175AbeGZNnt (ORCPT ); Thu, 26 Jul 2018 09:43:49 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Thu, 26 Jul 2018 05:27:01 -0700 Received: from HQMAIL106.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 26 Jul 2018 05:27:12 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 26 Jul 2018 05:27:12 -0700 Received: from HQMAIL112.nvidia.com (172.18.146.18) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 26 Jul 2018 12:27:11 +0000 Received: from HQMAIL108.nvidia.com (172.18.146.13) by HQMAIL112.nvidia.com (172.18.146.18) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 26 Jul 2018 12:27:11 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2 via Frontend Transport; Thu, 26 Jul 2018 12:27:11 +0000 Received: from dhcp-10-21-25-168.Nvidia.com (Not Verified[10.21.25.201]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 26 Jul 2018 05:27:10 -0700 From: Aapo Vienamo To: Ulf Hansson , Rob Herring , Mark Rutland , Thierry Reding , Jonathan Hunter , "Adrian Hunter" , Mikko Perttunen CC: , , , , Aapo Vienamo Subject: [PATCH v2 03/10] mmc: tegra: Power on the calibration pad Date: Thu, 26 Jul 2018 15:26:49 +0300 Message-ID: <1532608016-14319-4-git-send-email-avienamo@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532608016-14319-1-git-send-email-avienamo@nvidia.com> References: <1532608016-14319-1-git-send-email-avienamo@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Automatic pad drive strength calibration is performed on a separate pad identical to the ones used for driving the actual bus. Power on the calibration pad during the calibration procedure and power it off afterwards to save power. Signed-off-by: Aapo Vienamo Reviewed-by: Mikko Perttunen --- drivers/mmc/host/sdhci-tegra.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 51eda20..363490e 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -53,6 +53,7 @@ #define SDHCI_TEGRA_SDMEM_COMP_PADCTRL 0x1e0 #define SDHCI_TEGRA_SDMEM_COMP_PADCTRL_VREF_SEL_MASK 0x0000000f #define SDHCI_TEGRA_SDMEM_COMP_PADCTRL_VREF_SEL_VAL 0x7 +#define SDHCI_TEGRA_SDMEM_COMP_PADCTRL_E_INPUT_E_PWRD BIT(31) #define SDHCI_TEGRA_AUTO_CAL_STATUS 0x1ec #define SDHCI_TEGRA_AUTO_CAL_ACTIVE BIT(31) @@ -241,11 +242,30 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask) tegra_host->ddr_signaling = false; } +static void tegra_sdhci_configure_cal_pad(struct sdhci_host *host, bool enable) +{ + u32 reg; + + /* + * Enable or disable the additional I/O pad used by the drive strength + * calibration process. + */ + reg = sdhci_readl(host, SDHCI_TEGRA_SDMEM_COMP_PADCTRL); + if (enable) + reg |= SDHCI_TEGRA_SDMEM_COMP_PADCTRL_E_INPUT_E_PWRD; + else + reg &= ~SDHCI_TEGRA_SDMEM_COMP_PADCTRL_E_INPUT_E_PWRD; + sdhci_writel(host, reg, SDHCI_TEGRA_SDMEM_COMP_PADCTRL); + udelay(1); +} + static void tegra_sdhci_pad_autocalib(struct sdhci_host *host) { u32 reg; int ret; + tegra_sdhci_configure_cal_pad(host, true); + reg = sdhci_readl(host, SDHCI_TEGRA_AUTO_CAL_CONFIG); reg |= SDHCI_AUTO_CAL_ENABLE | SDHCI_AUTO_CAL_START; sdhci_writel(host, reg, SDHCI_TEGRA_AUTO_CAL_CONFIG); @@ -255,6 +275,8 @@ static void tegra_sdhci_pad_autocalib(struct sdhci_host *host) reg, !(reg & SDHCI_TEGRA_AUTO_CAL_ACTIVE), 1, 10000); + tegra_sdhci_configure_cal_pad(host, false); + if (ret) dev_err(mmc_dev(host->mmc), "Pad autocal timed out\n"); } -- 2.7.4