Received: by 10.223.185.116 with SMTP id b49csp5460579wrg; Wed, 7 Mar 2018 12:08:40 -0800 (PST) X-Google-Smtp-Source: AG47ELsBsQ/PJ8Gohsy+bGtOHS4nGYrWWYhksfaWXi0emdRoEApFmHtAbt1OwCwA+adYUDqITW0M X-Received: by 10.98.36.217 with SMTP id k86mr23799069pfk.137.1520453319970; Wed, 07 Mar 2018 12:08:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453319; cv=none; d=google.com; s=arc-20160816; b=Ll+vQiLdwzCY5GRkiw0eg9ZfvCm7SWow1hNydMBdDAP4kW6W+iLH8fI4/yIyWHIqLM QLooXv0jMPxxK1qfIflnQiLa+VUzWKonpKGhjH9L1GNU1naaHFJ3eATThmy6nmUEo1l0 mTlpCvgBPfNbzvlMJnjCIgqJATRO4KfoeZj07rpZwA7FF9+EioQoqDa1ut6AxeXpaygM atvwCnZi8NCa/8MHqxMGnqyiy/vp1uhsqPevSK+v1V9Dsi163MjDyvvcvx5hhm1Qmq0t nK7KFnfsPPeU0sNOFCa4LwD2aiWpHb/+Jxc5uifmmg1HxDPM4qygiUlPRkth0CnpLq7c AGLw== 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=+B69skLm/KUumc8eg/yWkxDtJBI1grQ8jAki8ny2bNI=; b=hOIoppaJTpt1iwy+X5HB33TG4LGdnkeCOqmkWX4U0P78IgR7zh+REioXNkBgUqzKj+ rR3htKDCh9kwMNPZ/w0q/OtF4H65/LJR41demIibBA1AVUlmRPOBNXSUGgx6WUSNlVF/ gVLjSPj8bfhFQ7WAFzVBVkFV2FgnNRp+eqdfT6r7D4hs/7y2LCDxg2ZZ2y8EwqZw95QY FyF/39ev+To0NaBMzzYsY09cyx2BhvPO75qRoxbnNxrjFrMr1T+9Wkr4QJ3YwiTKx01J W+8dY63RhQs8esgTyWU/wcvaynK28edJelWzHxP/ReWS+KhBnA7kvBBT0Dh3ETuJYJhi VtaA== 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 u1si11782754pgp.498.2018.03.07.12.08.24; Wed, 07 Mar 2018 12:08:39 -0800 (PST) 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 S965467AbeCGTqG (ORCPT + 99 others); Wed, 7 Mar 2018 14:46:06 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44442 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965391AbeCGTqD (ORCPT ); Wed, 7 Mar 2018 14:46:03 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 34F11FE5; Wed, 7 Mar 2018 19:46:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Ulf Hansson Subject: [PATCH 4.14 015/110] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers Date: Wed, 7 Mar 2018 11:37:58 -0800 Message-Id: <20180307191041.685553678@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter commit f8870ae6e2d6be75b1accc2db981169fdfbea7ab upstream. Tuning can leave the IP in an active state (Buffer Read Enable bit set) which prevents the entry to low power states (i.e. S0i3). Data reset will clear it. Generally tuning is followed by a data transfer which will anyway sort out the state, so it is rare that S0i3 is actually prevented. Signed-off-by: Adrian Hunter Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-pci-core.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -594,9 +594,36 @@ static void byt_read_dsm(struct sdhci_pc slot->chip->rpm_retune = intel_host->d3_retune; } -static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) +static int intel_execute_tuning(struct mmc_host *mmc, u32 opcode) +{ + int err = sdhci_execute_tuning(mmc, opcode); + struct sdhci_host *host = mmc_priv(mmc); + + if (err) + return err; + + /* + * Tuning can leave the IP in an active state (Buffer Read Enable bit + * set) which prevents the entry to low power states (i.e. S0i3). Data + * reset will clear it. + */ + sdhci_reset(host, SDHCI_RESET_DATA); + + return 0; +} + +static void byt_probe_slot(struct sdhci_pci_slot *slot) { + struct mmc_host_ops *ops = &slot->host->mmc_host_ops; + byt_read_dsm(slot); + + ops->execute_tuning = intel_execute_tuning; +} + +static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) +{ + byt_probe_slot(slot); slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR | MMC_CAP_CMD_DURING_TFR | @@ -651,7 +678,7 @@ static int ni_byt_sdio_probe_slot(struct { int err; - byt_read_dsm(slot); + byt_probe_slot(slot); err = ni_set_max_freq(slot); if (err) @@ -664,7 +691,7 @@ static int ni_byt_sdio_probe_slot(struct static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot) { - byt_read_dsm(slot); + byt_probe_slot(slot); slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE | MMC_CAP_WAIT_WHILE_BUSY; return 0; @@ -672,7 +699,7 @@ static int byt_sdio_probe_slot(struct sd static int byt_sd_probe_slot(struct sdhci_pci_slot *slot) { - byt_read_dsm(slot); + byt_probe_slot(slot); slot->host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_AGGRESSIVE_PM | MMC_CAP_CD_WAKE; slot->cd_idx = 0;