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.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 52DC5C43381 for ; Mon, 25 Mar 2019 22:31:04 +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 215A6206DF for ; Mon, 25 Mar 2019 22:31:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VLq9/ZxO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FibEusRL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 215A6206DF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.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=WkMr4ZaZ7+ErVUVHgZiDC34OU1hvWL2xc278hd//y8c=; b=VLq9/ZxOVZhyKM Fk6qJVlQgOoshEPRqW7kZiSi+yHQnW5/f6O4WGvswd/Ax50gW9+zG5+O/MUbqhWVU1VoujVi3F0+5 //9Z6/czKPdoNaMQp2lRSYb6UqFnqXAPnkdc6ubo/X0vM6sMrgqCXw7MJwid5QUfm0+CKArV7Y83Z OxGBEbw+Bo44foi6R832mpUEtLX76LjRRwyBOxtvSYKumwgEd9K6WQWLI8pvnme3CnTWSWbbVW5wh 3PTiJ0Thipi0uSp3A4wsppWGjPknv/FLkHAiyJ2+9flXbEmfUwCzcEqUpvsXZEjg5IduZZaSxUWGN JjuoEUx/E7jGcGxP+Z2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8Y7P-0004Dg-9c; Mon, 25 Mar 2019 22:30:59 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8Y7N-0004Cu-8q for linux-arm-kernel@bombadil.infradead.org; Mon, 25 Mar 2019 22:30:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ggfin3UywUcHW+muQtbafPUT/3SV1HcHYg5cYGnm/aY=; b=FibEusRLclFFMRRQmxJb5rkIIB cz5OVzAd6C4jznkhMPdXRrc+Wg0qjSsq9+nla2lJeR+gQOa0SJhofvEWWGEUBppa+dQmEjG1w19lT J7+8WtXdt1e1O/O9QBonvIiKDMakIxDUxiA3P7PRN75EFzPH2LNiPf0HRjBSpbG4g4I4NxQKdUDlQ IJozXvAJ0+hA1VUaOET+JJ7TUpqWwolDMKsfv4LXNRSzGktIDBSX9Pc4svd3GCdTOV2d3rj/HGn0i aj7fkRcscd4II50mZLRHeunwbr1vJ4G0/kCe2wAD87U3idezUUhvJFAD3nWKL+ktD3t3cvF1apdAD I2EXvBJA==; Received: from muru.com ([72.249.23.125]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8Xcd-0000G1-Ek for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2019 21:59:12 +0000 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id A8C9980CC; Mon, 25 Mar 2019 21:59:23 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Subject: [PATCH 06/14] bus: ti-sysc: Enable all clocks directly during init to read revision Date: Mon, 25 Mar 2019 14:58:41 -0700 Message-Id: <20190325215849.13182-7-tony@atomide.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190325215849.13182-1-tony@atomide.com> References: <20190325215849.13182-1-tony@atomide.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190325_175911_575496_9F22F060 X-CRM114-Status: GOOD ( 16.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Tero Kristo , Dave Gerlach , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Peter Ujfalusi , Faiz Abbas , Keerthy , linux-arm-kernel@lists.infradead.org, Roger Quadros 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 The first thing we want to do is just read the module revision register to be able to configure the module specific quirks and configure the module registers. As the interconnect target module may not yet be properly configured and may need a reset first, we don't want to use pm_runtime_get() at this point. To read the revision register, let's just enable the all the clocks for the interconnect target module during init even if the optional clocks are not needed. That way we can read the revision register to configure the quirks needed for PM runtime. Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 50 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -1042,39 +1042,45 @@ static int sysc_reset(struct sysc *ddata) 100, MAX_MODULE_SOFTRESET_WAIT); } -/* At this point the module is configured enough to read the revision */ +/* + * At this point the module is configured enough to read the revision but + * module may not be completely configured yet to use PM runtime. Enable + * all clocks directly during init to configure the quirks needed for PM + * runtime based on the revision register. + */ static int sysc_init_module(struct sysc *ddata) { - int error; + int error = 0; + bool manage_clocks = true; if (ddata->cfg.quirks & - (SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT)) { - ddata->revision = sysc_read_revision(ddata); - goto rev_quirks; - } + (SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT)) + manage_clocks = false; - error = pm_runtime_get_sync(ddata->dev); - if (error < 0) { - pm_runtime_put_noidle(ddata->dev); + if (manage_clocks) { + error = sysc_enable_opt_clocks(ddata); + if (error) + return error; - return 0; + error = sysc_enable_main_clocks(ddata); + if (error) + goto err_opt_clocks; } + ddata->revision = sysc_read_revision(ddata); + sysc_init_revision_quirks(ddata); + error = sysc_reset(ddata); - if (error) { + if (error) dev_err(ddata->dev, "Reset failed with %d\n", error); - pm_runtime_put_sync(ddata->dev); - return error; - } - - ddata->revision = sysc_read_revision(ddata); - pm_runtime_put_sync(ddata->dev); - -rev_quirks: - sysc_init_revision_quirks(ddata); + if (manage_clocks) + sysc_disable_main_clocks(ddata); +err_opt_clocks: + if (manage_clocks) + sysc_disable_opt_clocks(ddata); - return 0; + return error; } static int sysc_init_sysc_mask(struct sysc *ddata) @@ -1812,11 +1818,11 @@ static int sysc_probe(struct platform_device *pdev) if (error) return error; - pm_runtime_enable(ddata->dev); error = sysc_init_module(ddata); if (error) goto unprepare; + pm_runtime_enable(ddata->dev); error = pm_runtime_get_sync(ddata->dev); if (error < 0) { pm_runtime_put_noidle(ddata->dev); -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel