Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp95990pxa; Tue, 4 Aug 2020 00:06:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1m3cW3Apjfm18XE+oIZBAlDro8d8Lo3UzDiQuQY5YfufEVn/BFSfSS0z5CmpdimX9Spse X-Received: by 2002:a17:906:1c0e:: with SMTP id k14mr19671232ejg.479.1596524791716; Tue, 04 Aug 2020 00:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596524791; cv=none; d=google.com; s=arc-20160816; b=B+qd+CLPC2gGW0i4Of1718VOCiV44QHezgI6OuLCqIRZMtx+8rBcoDwykhGNoM3mQ2 BNL0tWw/gYGKDVauTdhmT0eOE77ATi6jSJvVQJd98tz7zXIfA/+RjouvZ52oviaUR7fw G3jmutOB62WhAWZfiuPg5dPNroCxnybCMPQK75RZ+1L4GzYotlbETQKLXtRPAdMcJjCz NIzWr4t6vuvRZ/ojN+GpZoFHTUYlBUHyfW6U2S1wdGqXiGM+5uNnJ4I3Kgnq1XfXIB/r HZ+sV6xLL/nmlPIv+9nx9lkjp7/jpK+XIYuIcN/BFhUQJTnk6Ibwu7qOBs3c5rynHRpT Uf8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=ii2Fmdr9tYi+kgsMkwrWJMDVtueIqPA2h5lRRpteFCk=; b=cLYJ6xi67ccNN/8TC+IHhyOICz23JaP9Nl8gp8X0BS/IfibCr6e+TDbCJxi6O1QTW4 igYOC8v88c1bB8jeSmmwQY4gOt9Ee6SpuaiIUaRmWer1HPCQfkX+5lCqtnat7Et3/59u kld1cw9M4t7QB872MGo8fjI0tWhkNr/7jtt9M4Z7VJgieMTUuVtw6y/GYt5JwoAVV3Ys 0FVNidRPVQTvCh5ixWOJojoaq/duJOU8cfVYld5BCsRJAdejv7ikSpVYtPKfXyNmhg8s ELpQgbbw+nf7NObUSTrpPDaE/8mDtnuJyaxsNsC+2Dqpzi/B+Q8olgQCuhwoBx8IZLlv T8+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a18si7322758ejr.616.2020.08.04.00.06.08; Tue, 04 Aug 2020 00:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726643AbgHDHDp convert rfc822-to-8bit (ORCPT + 99 others); Tue, 4 Aug 2020 03:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725300AbgHDHDp (ORCPT ); Tue, 4 Aug 2020 03:03:45 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46C67C06174A for ; Tue, 4 Aug 2020 00:03:45 -0700 (PDT) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2qz4-0003zv-69; Tue, 04 Aug 2020 09:03:38 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1k2qz1-0004be-32; Tue, 04 Aug 2020 09:03:35 +0200 Message-ID: <3413ca889fcef11c6dafe1d6b135e1887d84a6e4.camel@pengutronix.de> Subject: Re: [v2,5/6] reset-controller: ti: Introduce force-update method From: Philipp Zabel To: Crystal Guo , robh+dt@kernel.org, matthias.bgg@gmail.com Cc: srv_heupstream@mediatek.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, seiya.wang@mediatek.com, stanley.chu@mediatek.com, yingjoe.chen@mediatek.com, fan.chen@mediatek.com, yong.liang@mediatek.com, Suman Anna , "Andrew F. Davis" Date: Tue, 04 Aug 2020 09:03:35 +0200 In-Reply-To: <20200803061511.29555-6-crystal.guo@mediatek.com> References: <20200803061511.29555-1-crystal.guo@mediatek.com> <20200803061511.29555-6-crystal.guo@mediatek.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Crystal, On Mon, 2020-08-03 at 14:15 +0800, Crystal Guo wrote: > Introduce force-update method for assert and deassert interface, > which force the write operation in case the read already happens > to return the correct value. > > Signed-off-by: Crystal Guo Added Suman and Andrew for confirmation: I think writing unconditionally can't break any existing user. Just changing to regmap_write_bits() instead of adding the update-force property as in v1 should be fine. regards Philipp > --- > drivers/reset/reset-ti-syscon.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c > index 1c74bcb9a6c3..f4baf78afd14 100644 > --- a/drivers/reset/reset-ti-syscon.c > +++ b/drivers/reset/reset-ti-syscon.c > @@ -57,6 +57,7 @@ struct ti_syscon_reset_data { > struct ti_syscon_reset_control *controls; > unsigned int nr_controls; > bool assert_deassert_together; > + bool update_force; > }; > > #define to_ti_syscon_reset_data(rcdev) \ > @@ -90,7 +91,10 @@ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, > mask = BIT(control->assert_bit); > value = (control->flags & ASSERT_SET) ? mask : 0x0; > > - return regmap_update_bits(data->regmap, control->assert_offset, mask, value); > + if (data->update_force) > + return regmap_write_bits(data->regmap, control->assert_offset, mask, value); > + else > + return regmap_update_bits(data->regmap, control->assert_offset, mask, value); > } > > /** > @@ -121,7 +125,10 @@ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, > mask = BIT(control->deassert_bit); > value = (control->flags & DEASSERT_SET) ? mask : 0x0; > > - return regmap_update_bits(data->regmap, control->deassert_offset, mask, value); > + if (data->update_force) > + return regmap_write_bits(data->regmap, control->deassert_offset, mask, value); > + else > + return regmap_update_bits(data->regmap, control->deassert_offset, mask, value); > } > > /** > @@ -223,6 +230,10 @@ static int ti_syscon_reset_probe(struct platform_device *pdev) > data->assert_deassert_together = true; > else > data->assert_deassert_together = false; > + if (of_property_read_bool(np, "update-force")) > + data->update_force = true; > + else > + data->update_force = false; > > data->rcdev.ops = &ti_syscon_reset_ops; > data->rcdev.owner = THIS_MODULE; > -- > 2.18.0