Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21354976ybl; Mon, 6 Jan 2020 03:02:26 -0800 (PST) X-Google-Smtp-Source: APXvYqy73VB2nMZp398efvL4FnpAEc97R2cgnIPXYGQ8ACsXCVo7zXrmhxW/O9Es47Diy8+87sCB X-Received: by 2002:a9d:4b05:: with SMTP id q5mr98313443otf.174.1578308546758; Mon, 06 Jan 2020 03:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578308546; cv=none; d=google.com; s=arc-20160816; b=KlzBslWXCCtXZ8sv1YlXcJjBngvk5KE3d5H6eWt3H/4i6IUF3ByXApCuc50pcpy+R/ uZef7bC/+kZZddYWBOuWv0ER0kOOhuJ+71EnB2OpwaP3fwxpFZ20XbAJpIhSMSf4REkD QweUrh8gWJrY0wjPEdA9X1FplJNcLYZTHmQrGXniW+t4xO6Ar2fm9TyrunHFvNdGvmXd urtd//PKMYaak5FfA0bgZdrRMfEovv+MNHTkyaravAj3GSmpFpn59OwjFeu//moU96cF ddcquNnRvW5sNTTcUcS0sIslK+fRqL78UMz9bkdvtitzpoxnpKKrBFW6j19+BKQz7F+E xcdA== 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=+gf7Kaf1a2PdFTy6/5gyUqimfxpn7cpZE1fdbz4Rpnw=; b=H0ImH9iuPFaEA/X1sI26Q2JSQMnRJddb5zwnX76L0im35Id4lWO0bGWtT9FEqYqmAc rb4derZnAqXmqOuEKJ3KGq1Ych1jdzStileXFrI/UKxPiV8mVOwKrttBqPaUWh3NS2xj DGCwqj+FG3Guit9+paN69klp6FiTSzV1CnedyUj1drGTbOA4EQ5yylRde8qon9SVhqPx UB6PSB4BqKuX5UAQR+2ew9aGFhuR5wIvw7Toz+sFqO7b3/ZgMy6QEPnnp1QRHY0P51DD jDgO/FxCvAqGVQX7JoZ1DIpagCw1TE0H2mnSqXI02ZoI1YLBuR1NfneKWQWVYf9gvhMn 5c+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gJcVTfqp; 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 d21si23530805oic.168.2020.01.06.03.02.14; Mon, 06 Jan 2020 03:02:26 -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=gJcVTfqp; 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 S1726536AbgAFLB3 (ORCPT + 99 others); Mon, 6 Jan 2020 06:01:29 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50538 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbgAFLB3 (ORCPT ); Mon, 6 Jan 2020 06:01:29 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 006B1Jpt123417; Mon, 6 Jan 2020 05:01:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1578308479; bh=+gf7Kaf1a2PdFTy6/5gyUqimfxpn7cpZE1fdbz4Rpnw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gJcVTfqpOteO0SBzJ5lwELgmDuQXzzc26q8R10SIfWkTYMeSA8ynAsGrbttDQ0UKF yB/0e3H73EexnY8Te2mrIKXK0p0FXE8RYYW60vGTpG3PS20BRK9C8tBpwvtzkrJN1H gt8lIozzP6siwfY252sOn2gw9TBBPLasnkiCLUwE= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 006B1J6p098858; Mon, 6 Jan 2020 05:01:19 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 6 Jan 2020 05:01:18 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 6 Jan 2020 05:01:18 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 006B00K0007044; Mon, 6 Jan 2020 05:01:11 -0600 From: Faiz Abbas To: , , , CC: , , , , , , Subject: [PATCH v4 09/11] mmc: sdhci-omap: Add ti,needs-special-reset property Date: Mon, 6 Jan 2020 16:31:31 +0530 Message-ID: <20200106110133.13791-10-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20200106110133.13791-1-faiz_abbas@ti.com> References: <20200106110133.13791-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 Some omap controllers need software to monitor a 0->1->0 for software reset. Add a ti,needs-special-reset property to indicate this and use the special_reset member to indicate when a controller needs this. Signed-off-by: Faiz Abbas --- drivers/mmc/host/sdhci-omap.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 1f05c8e98d62..34df30edd450 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -107,6 +107,7 @@ struct sdhci_omap_host { struct pinctrl *pinctrl; struct pinctrl_state **pinctrl_state; bool is_tuning; + bool special_reset; }; static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host); @@ -779,15 +780,35 @@ static void sdhci_omap_set_uhs_signaling(struct sdhci_host *host, sdhci_omap_start_clock(omap_host); } +#define MMC_TIMEOUT_US 20000 /* 20000 micro Sec */ static 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); + unsigned long limit = MMC_TIMEOUT_US; + unsigned long i = 0; /* Don't reset data lines during tuning operation */ if (omap_host->is_tuning) mask &= ~SDHCI_RESET_DATA; + if (omap_host->special_reset) { + sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET); + while ((!(sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask)) && + (i++ < limit)) + udelay(1); + i = 0; + while ((sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) && + (i++ < limit)) + udelay(1); + + if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) + dev_err(mmc_dev(host->mmc), + "Timeout waiting on controller reset in %s\n", + __func__); + return; + } + sdhci_reset(host, mask); } @@ -1107,6 +1128,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) if (!mmc_can_gpio_ro(mmc)) mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; + if (of_find_property(dev->of_node, "ti,needs-special-reset", NULL)) + omap_host->special_reset = true; + pltfm_host->clk = devm_clk_get(dev, "fck"); if (IS_ERR(pltfm_host->clk)) { ret = PTR_ERR(pltfm_host->clk); -- 2.19.2