Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1882111imu; Wed, 21 Nov 2018 03:31:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJ0qfd9w/zgL2Xipd6700SsVv1PKV9gV13rLkHLDcQlrdgOljCRtpZ9L4xI5GDT/EodyRK X-Received: by 2002:a63:f658:: with SMTP id u24mr5646034pgj.267.1542799867784; Wed, 21 Nov 2018 03:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542799867; cv=none; d=google.com; s=arc-20160816; b=KOx41z/P2/YRIuLCU5lA4QiZXA6msGRFawMVOVudTyfeeT25/Wr2Xu0RSTutwcZ+XL lHmdajmvdmLcNQCZWhnIc96CqAu9BxcHoj7EPD9L9kXx9jLcry7WX3O5vlV43hSFBtXs hMzZ8GmkF5ACKYYR8x3ExTVYYw88siNvF5GWseNx30VF3c/87k9S1Mz2n+I+earA2CpT 4OBIWAUzXdvrwI93jZ0GFrckCnmwSJtgrN/FIcKg/Ny1Abr11GNpCQmS4OVyRqK5pjVY +QSNab3JOzf2DUhaZZBOOenhxoQmfetw403R0809PG9oPikDKwB4eL71v85D143f/dLz //kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TVuGQAJLBCGDQEo4wUpfbiKWsVPiXETwGfkNgAMd4j8=; b=KfSTIjdTsYTI1y5sY8bchLDcey7MHuEeHoNX3GsjQTCpiB45C/5xNiFhv00jVAUIqR 6HTqOIJaiz42tbjHwnz8RR1fVrC4woM6WlLSh8V9Z+4kOC9Hv9SkDUk/f7k1sIUFv+s5 DoGD9OqR8/NRM8wL28W5gMnW/MWY/6NuXC/cpCHcuml6LGWKYsk3TLP3ms41x4raV9rR 6IIEL6ZycoypyWsA/QFi28oLp9PbRkHAJlhfoMIFyWl2cQ72i2Slg0JWS1rFYHxmC8ra jMY5ZKTFyigHxR1xFqX2mN1welkhopbe0ssjxojaYeLVrhma9aP8aQYjSIeWJImUePnW pC1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ienI2NNA; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be8-v6si46177486plb.143.2018.11.21.03.30.52; Wed, 21 Nov 2018 03:31:07 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ienI2NNA; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729778AbeKUVFQ (ORCPT + 99 others); Wed, 21 Nov 2018 16:05:16 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:54816 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbeKUVFP (ORCPT ); Wed, 21 Nov 2018 16:05:15 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id wALAVLpX053801; Wed, 21 Nov 2018 04:31:21 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1542796281; bh=TVuGQAJLBCGDQEo4wUpfbiKWsVPiXETwGfkNgAMd4j8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ienI2NNAk46w+o+NI1MWvGEpEfxv26r8zmrVmcIAifdABYB5VVW80ODhM3QTMeVXA 9eR/KIoGfCkIck/qGTqfHVqoAkfaCin8AhTsnYVi3WJ3bofiKdqXaiVO4iq0NIjxGP UkT+qkjhZDk7lVJdbFOl8+mb3mBQDg9pfp1nU0c0= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wALAVLXG110062 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 21 Nov 2018 04:31:21 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 21 Nov 2018 04:31:20 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 21 Nov 2018 04:31:20 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wALAVECe025951; Wed, 21 Nov 2018 04:31:19 -0600 From: Faiz Abbas To: , CC: , , , Subject: [PATCH v2 2/3] mmc: sdhci-omap: Add platform specific reset callback Date: Wed, 21 Nov 2018 16:03:56 +0530 Message-ID: <20181121103357.3448-3-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121103357.3448-1-faiz_abbas@ti.com> References: <20181121103357.3448-1-faiz_abbas@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TRM (SPRUIC2C - January 2017 - Revised May 2018 [1]) forbids assertion of data reset while tuning is happening. Implement a platform specific callback that takes care of this condition. [1] http://www.ti.com/lit/pdf/spruic2 Section 25.5.1.2.4 Acked-by: Kishon Vijay Abraham I Signed-off-by: Faiz Abbas --- drivers/mmc/host/sdhci-omap.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index d264391616f9..4fad47926743 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -115,6 +115,7 @@ struct sdhci_omap_host { struct pinctrl *pinctrl; struct pinctrl_state **pinctrl_state; + bool is_tuning; }; static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host); @@ -322,6 +323,8 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) dcrc_was_enabled = true; } + omap_host->is_tuning = true; + while (phase_delay <= MAX_PHASE_DELAY) { sdhci_omap_set_dll(omap_host, phase_delay); @@ -359,9 +362,12 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) phase_delay = max_window + 4 * (max_len >> 1); sdhci_omap_set_dll(omap_host, phase_delay); + omap_host->is_tuning = false; + goto ret; tuning_error: + omap_host->is_tuning = false; dev_err(dev, "Tuning failed\n"); sdhci_omap_disable_tuning(omap_host); @@ -687,6 +693,18 @@ static void sdhci_omap_set_uhs_signaling(struct sdhci_host *host, sdhci_omap_start_clock(omap_host); } +void sdhci_omap_reset(struct sdhci_host *host, u8 mask) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); + + /* Don't reset data lines during tuning operation */ + if (omap_host->is_tuning) + mask &= ~SDHCI_RESET_DATA; + + sdhci_reset(host, mask); +} + static struct sdhci_ops sdhci_omap_ops = { .set_clock = sdhci_omap_set_clock, .set_power = sdhci_omap_set_power, @@ -695,7 +713,7 @@ static struct sdhci_ops sdhci_omap_ops = { .get_min_clock = sdhci_omap_get_min_clock, .set_bus_width = sdhci_omap_set_bus_width, .platform_send_init_74_clocks = sdhci_omap_init_74_clocks, - .reset = sdhci_reset, + .reset = sdhci_omap_reset, .set_uhs_signaling = sdhci_omap_set_uhs_signaling, }; -- 2.19.1