Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4745692img; Tue, 26 Mar 2019 16:14:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO+/T1Hkt7vy6reGYCVv+UXj+LYxMPdxC2gxid9LkvNwM0ZE84KFn3it1uUrZ01/wUyvhe X-Received: by 2002:a63:360e:: with SMTP id d14mr18099447pga.188.1553642051438; Tue, 26 Mar 2019 16:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553642051; cv=none; d=google.com; s=arc-20160816; b=IyOme6KSLzHibOa3q8VqZAfWeX/HlVypSEG9iSyPL0zqaO08TXIQX0KThtK5CdNmTo N45rjvc6FUOcT+j7SZHhJUIhCT3UWBa6afE7+o2ta2au7k+5j9y2aAdZYpCy2P8cL6M/ FljdlG77saUs24n/QTq2L0qibrvjSxmKwtDcTGsW/j+/QMgL/lJiKiiaiZL2SvHcHXYB 0br9tPp7vPM0pzBYiWLUYmozaaC5hpZe/TtcMjt5XHjO76y+eQFlm+FvQVbcUqAQ7XqF TOtX/8w4VIhjHK/Z+hQOs0FXkrt8fzzS1H3N84r4GvEVwJIiBE7pbLNc29NaoGENOAae NQbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=h3A8ah+4H4jwmoCyzaNGDzFJt96o3KRwloy2tdq7GUc=; b=yztItIFm8wNBiSmOondzCdaGQidiIJCUnrmmAM1P9QlZcpAsJCwUWdAwYokVWmcHDv G9jhgeUPj5r8udEvf4zpe8c/KIxfaike8uEpyxqmDb2+PmLN41pB0hifqkkaa2W0Nx6q ZEbneApN/pv/4cu3/BKwxB5QTyl7MK2vE8msrxcowziDzfaKh0xTv70Nd0FE+k7POZ8o jzEw2Jhk2crbZnPn9GGgTDPSYwDXFOB9Lsc/tDTNjQvii2L5CP8G+kgQKSLvEWjRnHCi X9t8fErS7kBMgobaCUz3lZOS5devWqCo4UzY9pgpZ7CbA3P6P9IhpyR2o//JrHbx1P3Y 7O0A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si18542484plg.221.2019.03.26.16.13.56; Tue, 26 Mar 2019 16:14:11 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732442AbfCZXNL (ORCPT + 99 others); Tue, 26 Mar 2019 19:13:11 -0400 Received: from muru.com ([72.249.23.125]:42954 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731583AbfCZXNL (ORCPT ); Tue, 26 Mar 2019 19:13:11 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 0310B8030; Tue, 26 Mar 2019 23:13:22 +0000 (UTC) Date: Tue, 26 Mar 2019 16:13:06 -0700 From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: Dave Gerlach , Faiz Abbas , Greg Kroah-Hartman , Keerthy , Nishanth Menon , Peter Ujfalusi , Roger Quadros , Suman Anna , Tero Kristo , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 09/14] bus: ti-sysc: Move rstctrl reset to happen later Message-ID: <20190326231306.GC49658@atomide.com> References: <20190325215849.13182-1-tony@atomide.com> <20190325215849.13182-10-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190325215849.13182-10-tony@atomide.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Tony Lindgren [190325 22:00]: > We should not do the reset until the clocks are enabled. Let's only init > restctrl in sysc_init_resets() and do the reset later on in sysc_reset(). ... > static int sysc_reset(struct sysc *ddata) > { > int offset = ddata->offsets[SYSC_SYSCONFIG]; > - int val; > + int error, val; > > if (ddata->legacy_mode || offset < 0 || > ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) > - return 0; > + return sysc_rstctrl_reset_deassert(ddata, false); > + > + error = sysc_rstctrl_reset_deassert(ddata, true); > + if (error) > + return error; This change is wrong, we need to deassert rstctrl reset before we enable clocks, not after. Updated version below. Regards, Tony 8< -------------------- From tony Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Thu, 21 Mar 2019 11:00:21 -0700 Subject: [PATCH] bus: ti-sysc: Move rstctrl reset to happen later We can do the rsstctrl a bit later, but need to deassert rstctrl reset before the clocks are enabled if asserted. Let's only init restctrl in sysc_init_resets() and do the reset later on just before we enable the device clocks. Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 61 +++++++++++++++++++++++++++---------------- 1 file changed, 39 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 @@ -339,38 +339,18 @@ static void sysc_disable_opt_clocks(struct sysc *ddata) } /** - * sysc_init_resets - reset module on init + * sysc_init_resets - init rstctrl reset line if configured * @ddata: device driver data * - * A module can have both OCP softreset control and external rstctrl. - * If more complicated rstctrl resets are needed, please handle these - * directly from the child device driver and map only the module reset - * for the parent interconnect target module device. - * - * Automatic reset of the module on init can be skipped with the - * "ti,no-reset-on-init" device tree property. + * See sysc_rstctrl_reset_deassert(). */ static int sysc_init_resets(struct sysc *ddata) { - int error; - ddata->rsts = devm_reset_control_array_get_optional_exclusive(ddata->dev); if (IS_ERR(ddata->rsts)) return PTR_ERR(ddata->rsts); - if (ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) - goto deassert; - - error = reset_control_assert(ddata->rsts); - if (error) - return error; - -deassert: - error = reset_control_deassert(ddata->rsts); - if (error) - return error; - return 0; } @@ -1031,6 +1011,35 @@ static int sysc_legacy_init(struct sysc *ddata) return error; } +/** + * sysc_rstctrl_reset_deassert - deassert rstctrl reset + * @ddata: device driver data + * @reset: reset before deassert + * + * A module can have both OCP softreset control and external rstctrl. + * If more complicated rstctrl resets are needed, please handle these + * directly from the child device driver and map only the module reset + * for the parent interconnect target module device. + * + * Automatic reset of the module on init can be skipped with the + * "ti,no-reset-on-init" device tree property. + */ +static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset) +{ + int error; + + if (!ddata->rsts) + return 0; + + if (reset) { + error = reset_control_assert(ddata->rsts); + if (error) + return error; + } + + return reset_control_deassert(ddata->rsts); +} + static int sysc_reset(struct sysc *ddata) { int offset = ddata->offsets[SYSC_SYSCONFIG]; @@ -1071,6 +1080,14 @@ static int sysc_init_module(struct sysc *ddata) { int error = 0; bool manage_clocks = true; + bool reset = true; + + if (ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) + reset = false; + + error = sysc_rstctrl_reset_deassert(ddata, reset); + if (error) + return error; if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT)) -- 2.21.0