From patchwork Mon Feb 5 12:50:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 126847 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1942078ljc; Mon, 5 Feb 2018 04:51:43 -0800 (PST) X-Google-Smtp-Source: AH8x225Oa9pl4iNRECW93SMjrw8qckLP5SLMvQeR8xkgnBr0Qt+I5gE9d1nDPhGNrH3CdC8z2mD1 X-Received: by 2002:a17:902:183:: with SMTP id b3-v6mr15798581plb.383.1517835103030; Mon, 05 Feb 2018 04:51:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517835103; cv=none; d=google.com; s=arc-20160816; b=j9+tO+RdeO4EukdDVtmICB3mfUvE1zHn5KCTrRf5PjLaNjQ0FIZ9LE/2vhGsyu911Y rAMDPmsuxwB8PiBm0u5aHW0OIwVphKNb1zg94aAWinI1ON1AdCEyDPjSaFtFd+KpXsMz imBlYOemt1aSlKuyqOryucJpQuXqo0LGMLg8hokik+DNXtKV/kzitaCyqwVE2I0LoGn6 EjU0sA3ghnQTdB8fC/dsl63DSuh6v7aiutksJkYRy4ID+B/xmR4mCx25OvU4yuymFlM8 943SPYSp3rShhaiisruYb4nWJw3KW4/ddnySl7N20bRAGo0ZT9xCRDqWGkwRahAkVA/O MkMA== 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:dkim-signature :arc-authentication-results; bh=ph1QdB/cHge0ys2ZENoo7qLHVmUh0jQHgRZu8nN/B9A=; b=tapb5gCNELWe8Quhh8HTP7Z9LsR4UAdWxE7Asl8QPsgyziPeuCHg602SJqKSpVuert T4HBN1Du3nTnijnpvDJe5530MsXpisorp721Z+jxMX33d+0oZW1NEX3S66AdQFYzb2um GSko81YUzdwSyVmUBHICa0YYxrUWPVT6iWKUBkdtobNkba+radGycbIG/D7gop23Sa7R Z1aDPSFtCRJ1UL4eKdDT3yzzJtLsME09pbpQSeUNVJ7noxB45N2ysVdwePjKtUt8lASK EYz9I1PY0XAKiGuyBizKIttyS8aPEslskI4Ydphf/0/pB+840IhgfW2MtTfWCyMZ5/qB 2h0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UIx2CP9d; 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 q23si727871pff.403.2018.02.05.04.51.42; Mon, 05 Feb 2018 04:51:43 -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=UIx2CP9d; 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 S1753065AbeBEMvk (ORCPT + 28 others); Mon, 5 Feb 2018 07:51:40 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:29226 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752743AbeBEMvX (ORCPT ); Mon, 5 Feb 2018 07:51:23 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w15Coi79010632; Mon, 5 Feb 2018 06:50:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1517835044; bh=sv6ZJ0aAyBVVuwihGHXPb74P5wbRtTu7unstvm7D5+M=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UIx2CP9dLGnBBZYYqTQIoTSbLFv9dOhU+zZ3TYhf+uPnMhbd14JVALcfbs20sCrFY +i1s2BfObtS6eUQvqf/+vD/ShHlY3KHcBX5FCyX/1N8azPhwjhkHsGiIDzJrg2n7Sa 7RvAsqXkkeAcAu1ydPaKCUu2w/MoYREMj+58JHyI= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CoibP006621; Mon, 5 Feb 2018 06:50:44 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 5 Feb 2018 06:50:44 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 5 Feb 2018 06:50:44 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CoaGW023963; Mon, 5 Feb 2018 06:50:41 -0600 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Adrian Hunter CC: Rob Herring , Mark Rutland , Russell King , Kishon Vijay Abraham I , , , , , Subject: [PATCH v2 01/16] mmc: sdhci-omap: Update 'power_mode' outside sdhci_omap_init_74_clocks Date: Mon, 5 Feb 2018 18:20:14 +0530 Message-ID: <20180205125029.21570-2-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180205125029.21570-1-kishon@ti.com> References: <20180205125029.21570-1-kishon@ti.com> MIME-Version: 1.0 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 Updating 'power_mode' in sdhci_omap_init_74_clocks results in 'power_mode' never updated to MMC_POWER_OFF during card removal. This results in initialization sequence not sent to the card during re-insertion. Fix it here by adding sdhci_omap_set_power_mode to update power_mode. This function can also be used later to perform operations that are specific to a power mode (e.g, disable tuning during power off). Signed-off-by: Kishon Vijay Abraham I Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-omap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 628bfe9a3d17..96985786cadf 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -244,6 +244,12 @@ static int sdhci_omap_start_signal_voltage_switch(struct mmc_host *mmc, return 0; } +static void sdhci_omap_set_power_mode(struct sdhci_omap_host *omap_host, + u8 power_mode) +{ + omap_host->power_mode = power_mode; +} + static void sdhci_omap_set_bus_mode(struct sdhci_omap_host *omap_host, unsigned int mode) { @@ -273,6 +279,7 @@ static void sdhci_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) sdhci_omap_set_bus_mode(omap_host, ios->bus_mode); sdhci_set_ios(mmc, ios); + sdhci_omap_set_power_mode(omap_host, ios->power_mode); } static u16 sdhci_omap_calc_divisor(struct sdhci_pltfm_host *host, @@ -401,8 +408,6 @@ static void sdhci_omap_init_74_clocks(struct sdhci_host *host, u8 power_mode) sdhci_omap_writel(omap_host, SDHCI_OMAP_STAT, INT_CC_EN); enable_irq(host->irq); - - omap_host->power_mode = power_mode; } static struct sdhci_ops sdhci_omap_ops = { @@ -504,6 +509,7 @@ static int sdhci_omap_probe(struct platform_device *pdev) omap_host->host = host; omap_host->base = host->ioaddr; omap_host->dev = dev; + omap_host->power_mode = MMC_POWER_UNDEFINED; host->ioaddr += offset; mmc = host->mmc; From patchwork Mon Feb 5 12:50:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 126860 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1944868ljc; Mon, 5 Feb 2018 04:55:29 -0800 (PST) X-Google-Smtp-Source: AH8x225xdbPqGvsn8E2EvjqnhLvAMgiAt+DswVv38ccWxlS8F1U2A12FZz2por2Ot2FXNhkl0Bh6 X-Received: by 2002:a17:902:b406:: with SMTP id x6-v6mr34725406plr.150.1517835329563; Mon, 05 Feb 2018 04:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517835329; cv=none; d=google.com; s=arc-20160816; b=g1QbmESx8Ccx3SXo5pHnkCmGIWeIkmG7F5vigNXat+OfGOLyeFxBmLI5SPjgE8kzup kGHTG9FTeF+dPbHAHVOCYOzXWp2Cy4nUH7/PVy8uElxKNKqpTeKT/CN/B3InHhrVjjwW C+7fBr+Rg+brEg6GpIHMtIcTqZ1y2fs84RfKsZXMVi/9QE0dEuUxqfXWFvSVnAo1mjgr MQU5VxKjqD8XeHQ/SDaxm6335fNAOe+aJucgULY1Nocp2XV16apZfXn/P7hAiCK0EeDZ KOZSxSZl5+DlKtZK49QrZrC5s/WjxhVpl/wnAdtt/5ITnavymhZOmjIwPjUSScs/NNwU 9OiA== 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:dkim-signature :arc-authentication-results; bh=2qa5MpTGHMbbwLsmycrIH/lv4Q2TDfdMUUjlcDxyv/E=; b=mXa4wy264YToSlKX97st+vhA+UeqTw4G4nZ1t+25ty85MmWsjLpr2z0xAOCAcSRa1t rQjvFnTd3VLm2eKvv9ffewXnYLg/lK2MoqH7YT+n0JgtE1aVATrNoYmto0fiyfmJvdp0 j2uvywNzO683+6SzUHyikR0nbSc4o7iPVVeCEfGT0ONbZ6KenMfgE6ydMbqknKeBZol/ HRY5HlNxkPk/S59FpylF5dDnLE5AU72NlGYf2JDCWP5YRaQ2HB0gbKEI0kHoDsxi8xi5 DBKmkzBPARE4qJUWDaaCMvDVGe6lxHEJApsBeR/w+sppSmVOf1S9GpH+8TKqXnBwM8T6 GmIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=h2pCgUZw; 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 a80si6833656pfa.6.2018.02.05.04.55.29; Mon, 05 Feb 2018 04:55:29 -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=h2pCgUZw; 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 S1753314AbeBEMz0 (ORCPT + 28 others); Mon, 5 Feb 2018 07:55:26 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:29249 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753015AbeBEMvf (ORCPT ); Mon, 5 Feb 2018 07:51:35 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w15Cp6T6010676; Mon, 5 Feb 2018 06:51:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1517835066; bh=NDjo/cfB2UpDXEwpkDPLp+FNxEOsgl601Pt2M/VFwNI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=h2pCgUZw9LoLsMrduQ6bjKdv7dy4cAqtYcNaqS7mq8AgxAoKCHHZhdlY3UD7LZeea L6vU+5yN6lZp80s9wMpAQ0wHlyjmDoc+fnif/vvDUcI2HYt2+yJOGQfM8PgplHO5Ai kqLIyVDnJ9/wngPxeymiK8zdjqLFXwV3rOPEJGLY= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15Cp6un020099; Mon, 5 Feb 2018 06:51:06 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 5 Feb 2018 06:51:05 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 5 Feb 2018 06:51:05 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CoaGc023963; Mon, 5 Feb 2018 06:51:02 -0600 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Adrian Hunter CC: Rob Herring , Mark Rutland , Russell King , Kishon Vijay Abraham I , , , , , Subject: [PATCH v2 07/16] mmc: sdhci_omap: Fix sdhci-omap quirks Date: Mon, 5 Feb 2018 18:20:20 +0530 Message-ID: <20180205125029.21570-8-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180205125029.21570-1-kishon@ti.com> References: <20180205125029.21570-1-kishon@ti.com> MIME-Version: 1.0 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 Add SDHCI_QUIRK2_PRESET_VALUE_BROKEN quirk as setting preset values loads incorrect CLKD values (for UHS modes). Remove SDHCI_QUIRK2_NO_1_8_V quirk as sdhci-omap now supports UHS modes. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/sdhci-omap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 8b6170cd689b..d5a9e688dc1b 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -710,8 +710,8 @@ static const struct sdhci_pltfm_data sdhci_omap_pdata = { SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, - .quirks2 = SDHCI_QUIRK2_NO_1_8_V | - SDHCI_QUIRK2_ACMD23_BROKEN | + .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN | + SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_RSP_136_HAS_CRC, .ops = &sdhci_omap_ops, }; From patchwork Mon Feb 5 12:50:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 126859 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1944802ljc; Mon, 5 Feb 2018 04:55:23 -0800 (PST) X-Google-Smtp-Source: AH8x225gjcwyQFOpHNn08/4xlcYaGx4DoI7BL/cwetHzxxp4HZAGq0y2lInwQGYHUmN9c5wyaYrR X-Received: by 10.98.147.154 with SMTP id r26mr48476871pfk.207.1517835323530; Mon, 05 Feb 2018 04:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517835323; cv=none; d=google.com; s=arc-20160816; b=rvRBfRhwVBAwIgHppnbeyX3r2IfRTBfS0dKv1XN2xuIIqt6cmsdDA0trm3VDfzQu7i Dm1K/7Lk3bYWZX1i1MnmUzM971e0459L7JZeT69FB5OwVTHBvYAWhD19kqXQWU8CIVmH Mwp3b1N3P+iPoGr5LReTXqAXTSWV8zN0s13euCRURTsJPmLKWZ7f/t6bartYRevZ+ghv 9VyR2jV4w6E7StccOkgNdJLeKrbV56AMVhVIjG/XvSAIpqQvrO7JTDP5cYuP8YRsc4C9 qhYGYfvEUHSQKBhw3wLiiQL1j4fSvMMpKIYmhd36mYQyCCjMdytL7QHUtV79coNZSqXz 9elg== 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:dkim-signature :arc-authentication-results; bh=weUU6NEXXT5DQU+Q6aQT+3H1YVrMDP3UCuXAKMrXXq4=; b=DpOSR2CLdoSS8gzQxYjsFMOejn7M7owidorABGBUSPvGkpF9QxlB1EBJZOE0guX6TX B6Pk1qYuLzCut7aHk1m/k8U6d1Gc8O+TRtXmQg4BTUDQL7yEH0Byp0klfPJ8bWiFFrBD 7fhsfWtCn/4ENGOjlLuQUt9DyhTh5pfw/9UbCCeW70lighO5X+zOAOvm873KOuLe1zZI JFCA82QWnxQ3/1jP/9862QDDR4I/Zb2DtxhYaqM+pMkFwmuH1N/DKfBSqTd8XspUPE4i uthSOUaAdNYkS0NdZi2OGaW6vnUP7jSMFKZs759lQacmGupZyovJFggrTuSVbrUob+Qw DTEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=K+J6vvRg; 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 a80si6833656pfa.6.2018.02.05.04.55.23; Mon, 05 Feb 2018 04:55:23 -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=K+J6vvRg; 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 S1753298AbeBEMzV (ORCPT + 28 others); Mon, 5 Feb 2018 07:55:21 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:29250 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753019AbeBEMvg (ORCPT ); Mon, 5 Feb 2018 07:51:36 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w15CpKst010711; Mon, 5 Feb 2018 06:51:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1517835080; bh=i4kqLZLgCErWl/Ox9o1blp+m9db1p6YI6j3whPTha7I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=K+J6vvRgIS01QY3at48QUfH8osm+oGl3LB4RKHYCf9TukmoBYUfuthv7qAmkPGxjc vzDGu5c6z4sxAjGX8S9qfpBfFcU0PIcb2RISJR8bVcUFN1pYcRrrt67C0+jxI5NrAu rDOOIfye02tHQmlnm3P8FBcKz+wJH3bQgstMk084= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CpK5l020474; Mon, 5 Feb 2018 06:51:20 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 5 Feb 2018 06:51:20 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 5 Feb 2018 06:51:20 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CoaGg023963; Mon, 5 Feb 2018 06:51:17 -0600 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Adrian Hunter CC: Rob Herring , Mark Rutland , Russell King , Kishon Vijay Abraham I , , , , , Subject: [PATCH v2 11/16] mmc: sdhci: Program a relatively accurate SW timeout value Date: Mon, 5 Feb 2018 18:20:24 +0530 Message-ID: <20180205125029.21570-12-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180205125029.21570-1-kishon@ti.com> References: <20180205125029.21570-1-kishon@ti.com> MIME-Version: 1.0 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 sdhci has a 10 second timeout to catch devices that stop responding. Instead of programming 10 second arbitrary value, calculate the total time it would take for the entire transfer to happen and program the timeout value accordingly. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/sdhci.c | 46 +++++++++++++++++++++++++++++++++++++++------- drivers/mmc/host/sdhci.h | 10 ++++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) -- 2.11.0 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 0489572d1892..d52f9e7eabe2 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -673,6 +673,37 @@ static void sdhci_adma_table_post(struct sdhci_host *host, } } +static void sdhci_calc_sw_timeout(struct sdhci_host *host, + struct mmc_command *cmd, + unsigned int target_timeout) +{ + struct mmc_data *data = cmd->data; + struct mmc_host *mmc = host->mmc; + unsigned long long transfer_time; + struct mmc_ios *ios = &mmc->ios; + unsigned char bus_width = ios->bus_width; + unsigned int blksz; + unsigned int freq; + + if (data) { + blksz = data->blksz; + freq = host->mmc->actual_clock ? host->mmc->actual_clock : + host->clock; + transfer_time = (unsigned long long)(blksz * NSEC_PER_SEC * + (8 / bus_width)) / freq; + /* multiply by '2' to account for any unknowns */ + transfer_time = transfer_time * 2; + /* calculate timeout for the entire data */ + host->data_timeout = (data->blocks * ((target_timeout * + NSEC_PER_USEC) + + transfer_time)); + } else { + host->data_timeout = target_timeout * NSEC_PER_USEC; + } + + host->data_timeout += MMC_CMD_TRANSFER_TIME; +} + static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) { u8 count; @@ -742,6 +773,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) host->hw_timeout_disabled = true; } } + sdhci_calc_sw_timeout(host, cmd, target_timeout); return count; } @@ -1130,13 +1162,6 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) mdelay(1); } - timeout = jiffies; - if (!cmd->data && cmd->busy_timeout > 9000) - timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; - else - timeout += 10 * HZ; - sdhci_mod_timer(host, cmd, timeout); - host->cmd = cmd; if (sdhci_data_line_cmd(cmd)) { WARN_ON(host->data_cmd); @@ -1176,6 +1201,13 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200) flags |= SDHCI_CMD_DATA; + timeout = jiffies; + if (sdhci_data_line_cmd(cmd)) + timeout += nsecs_to_jiffies(host->data_timeout); + else + timeout += 10 * HZ; + sdhci_mod_timer(host, cmd, timeout); + sdhci_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); } EXPORT_SYMBOL_GPL(sdhci_send_command); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 3a967a56fcc3..b73577d77856 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -332,6 +332,14 @@ struct sdhci_adma2_64_desc { /* Allow for a a command request and a data request at the same time */ #define SDHCI_MAX_MRQS 2 +/* + * 48bit command and 136 bit response in 400KHz clock should take 0.46ms. + * However since the start time of the command, the time between + * command and response, and the time between response and start of data is + * not known, set the command transfer time to 2ms. + */ +#define MMC_CMD_TRANSFER_TIME (2 * NSEC_PER_MSEC) /* max 2 ms */ + enum sdhci_cookie { COOKIE_UNMAPPED, COOKIE_PRE_MAPPED, /* mapped by sdhci_pre_req() */ @@ -554,6 +562,8 @@ struct sdhci_host { /* Host SDMA buffer boundary. */ u32 sdma_boundary; + unsigned long long data_timeout; + unsigned long private[0] ____cacheline_aligned; }; From patchwork Mon Feb 5 12:50:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 126858 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1944367ljc; Mon, 5 Feb 2018 04:54:50 -0800 (PST) X-Google-Smtp-Source: AH8x226BFScWWEv0Qc8CLnrLxCyj09XmKDFqZ/RCqioajqkoCzsvUrTeeOzep7x5VC0l9urLetgX X-Received: by 10.101.83.3 with SMTP id m3mr4568352pgq.396.1517835290395; Mon, 05 Feb 2018 04:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517835290; cv=none; d=google.com; s=arc-20160816; b=lZzBGzjIMNjPAp7OnsbJ8hnXir+a8uqfkNsyOmwq5A/VukhsDTVqAtrwDJE4LMpv9y xwKGpnxArWzMkqpxTWK5AL9XmvfcYCDFTXl2aeN0be2QXwLsnxvpLQvou2Nm+jMVHa2o 933J4fhP4BrFo8rVp6A7ilr6PGMkVq90+rFgSbWm5lQ72aPsmjclGKr7El8Hi1jEYJlT nD43VZ8Z8W80k0ZEvC9soBYhvk7uEcqCl79lsMAl9KO68iaqmCKC8S6Jr9hRvcPazkNf VZ4I4lcl1641ryaubQ7tnTBbqNPqmlPQRTasNWzU0GDPe1QZb0UocW7pW4lapkw8DdXr GCBQ== 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:arc-authentication-results; bh=KVhMaY6SG0Uew8mZIK9ntHuDxq1sjfhmM/n0VRmElJA=; b=0wFv7UKlVkhN5p5wP0AxZM2P6I7A1wCz7VOJfQg7Jyy5UeU6rZBKvKgWmcrjhfYU7Q xe5cAI3axVglVoDFTxfl3agYqN5t6yxNfrw834y+121O3kBKmr06gpWUDoJrPWgcQ540 gr9FB2jT8/8CIZBU8QkhPpi9BrUZwQoH4Uly6CLITmuTVCiS5D8sCRU7MeL//jjDRSTF OLo70citHwBrdEGftPQq+hqiCoX4HmLOyD+wZa0CvBzImKucVKNKWrxNOwxXjlVzHhvg F8lRFcahNT6mRVFv6dYe37qjw8osd3N+NmmWf9S4HgK3usqzbz9ISNnV8N9KYYgYmZf8 CYtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RXVtjkBu; 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 15-v6si4965935pla.23.2018.02.05.04.54.50; Mon, 05 Feb 2018 04:54:50 -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=RXVtjkBu; 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 S1753229AbeBEMys (ORCPT + 28 others); Mon, 5 Feb 2018 07:54:48 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:29267 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752891AbeBEMvt (ORCPT ); Mon, 5 Feb 2018 07:51:49 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w15CpOql010715; Mon, 5 Feb 2018 06:51:24 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1517835084; bh=rGHgbOdfFQiOyJZ7o6bv4I+8yk+un6WuJGmoVI1dnog=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RXVtjkBuBw6J4sJVH5hDU60EH/T5GxKuKBERyo7m36SXtkSz6ZZBiv0Cz5W6SaaFU eEIL+4JyPRi/SskjMnFwnSxbJe+CGkYua7t1xlUTkk59vw8N9ZJiwUs3eaHahtlikB ct1Er5v+5/MeQxm7sWzVtOVHLXgVLaWgtGV5ePFM= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CpOxu007722; Mon, 5 Feb 2018 06:51:24 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 5 Feb 2018 06:51:24 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 5 Feb 2018 06:51:24 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w15CoaGh023963; Mon, 5 Feb 2018 06:51:21 -0600 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Adrian Hunter CC: Rob Herring , Mark Rutland , Russell King , Kishon Vijay Abraham I , , , , , Subject: [PATCH v2 12/16] mmc: sdhci-omap: Workaround for Errata i834 Date: Mon, 5 Feb 2018 18:20:25 +0530 Message-ID: <20180205125029.21570-13-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180205125029.21570-1-kishon@ti.com> References: <20180205125029.21570-1-kishon@ti.com> MIME-Version: 1.0 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 Errata i834 in AM572x Sitara Processors Silicon Revision 2.0, 1.1 (SPRZ429K July 2014–Revised March 2017 [1]) mentions the maximum obtainable timeout through MMC host controller is 700ms. And for commands taking longer than 700ms, hardware timeout should be disabled and software timeout should be used. The workaround for Errata i834 can be achieved by adding SDHCI_QUIRK2_DISABLE_HW_TIMEOUT quirk in sdhci-omap. [1] -> http://www.ti.com/lit/er/sprz429k/sprz429k.pdf Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/sdhci-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index c2570db3f7a2..db487b77fbcc 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -714,7 +714,8 @@ static const struct sdhci_pltfm_data sdhci_omap_pdata = { SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN | SDHCI_QUIRK2_PRESET_VALUE_BROKEN | - SDHCI_QUIRK2_RSP_136_HAS_CRC, + SDHCI_QUIRK2_RSP_136_HAS_CRC | + SDHCI_QUIRK2_DISABLE_HW_TIMEOUT, .ops = &sdhci_omap_ops, };