From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AECCBC41514 for ; Wed, 7 Aug 2019 07:50:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8743122BED for ; Wed, 7 Aug 2019 07:50:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sPq7AYTT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="qJrtuztt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8743122BED Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SFGQLTDS0kHadoeR2HJHi0zmv4gAc9Hez904NrAv3uk=; b=sPq7AYTT7D2G6J 1CAP4N51bSl2Vq4a1LXwVzzTzziu+7HZGdjyiTiHvJ8Htg63DMHCxmOAOC1Z8VfvyLBGCR3M3fAts 6tvD/NFNxN4QDS9Np4//oZZ5G+YMHQ640hhcuGyCkjLIskdh0YnfEvyJS0DlGKDFVYYfUrCuxaik9 bKT6eWS0TKd5SSPQIwpZUDcQwtvShP/RSR2HEZb8e+rY3ETzqVVoUEzAagK5qadBKaapAs+vrQW4f wVPRU99Bvyicl9hpYTFtA4T+Jzby1ASNBY0z5vMydKHi+8WoGzLM/R00ZRsRwKRNQXEbY8COUSrJ1 JhBQZZmQ9IBUt8TnGT8Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hvGhh-0003oW-RL; Wed, 07 Aug 2019 07:49:49 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hvGhR-0003am-KU for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2019 07:49:35 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x777nUpq026495; Wed, 7 Aug 2019 02:49:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565164170; bh=38KuTU80Xa1yf7f4cPI/hHILKIMORwhhd0n/rtt8q8Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qJrtuztt9XsCmiZZHPPsnuPtHHCIsE0Oeyi1RzMafXYwi8gjMfQBey3JkOuJTQhVi y535iifnDhW1XM7NPFUI64FJvUdZ3mWibl+OwGatpfZZvMoVIfl3/HQm2FnrQQcxx3 HiR7I7Aea7ndO8hxtcP4HOE/2LLcsW/Z/Q1ItGpY= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x777nUC2051435 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 7 Aug 2019 02:49:30 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 7 Aug 2019 02:49:30 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 7 Aug 2019 02:49:30 -0500 Received: from gomoku.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x777nNHf118711; Wed, 7 Aug 2019 02:49:28 -0500 From: Tero Kristo To: , , , Subject: [PATCH 3/8] soc: ti: omap-prm: poll for reset complete during de-assert Date: Wed, 7 Aug 2019 10:48:54 +0300 Message-ID: <1565164139-21886-4-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1565164139-21886-1-git-send-email-t-kristo@ti.com> References: <1565164139-21886-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190807_004933_751888_099B224B X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony@atomide.com, devicetree@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Poll for reset completion status during de-assertion of reset, otherwise the IP in question might be accessed before it has left reset properly. Signed-off-by: Tero Kristo --- drivers/soc/ti/omap_prm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c index 7c89eb8..d412af3 100644 --- a/drivers/soc/ti/omap_prm.c +++ b/drivers/soc/ti/omap_prm.c @@ -107,6 +107,7 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev, u32 v; int st_bit = id; bool has_rstst; + int timeout = 0; /* check the current status to avoid de-asserting the line twice */ v = readl_relaxed(reset->prm->base + reset->prm->data->rstctl); @@ -129,6 +130,22 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev, v &= ~(1 << id); writel_relaxed(v, reset->prm->base + reset->prm->data->rstctl); + if (!has_rstst) + return 0; + + /* wait for the status to be set */ + while (1) { + v = readl_relaxed(reset->prm->base + reset->prm->data->rstst); + v &= 1 << st_bit; + if (v) + break; + timeout++; + if (timeout > OMAP_RESET_MAX_WAIT) + return -EBUSY; + + udelay(1); + } + return 0; } -- 1.9.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel