lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200803061511.29555-6-crystal.guo@mediatek.com>
Date:   Mon, 3 Aug 2020 14:15:10 +0800
From:   Crystal Guo <crystal.guo@...iatek.com>
To:     <p.zabel@...gutronix.de>, <robh+dt@...nel.org>,
        <matthias.bgg@...il.com>
CC:     <srv_heupstream@...iatek.com>,
        <linux-mediatek@...ts.infradead.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <seiya.wang@...iatek.com>,
        <stanley.chu@...iatek.com>, <yingjoe.chen@...iatek.com>,
        <fan.chen@...iatek.com>, <yong.liang@...iatek.com>,
        Crystal Guo <crystal.guo@...iatek.com>
Subject: [v2,5/6] reset-controller: ti: Introduce force-update method

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 <crystal.guo@...iatek.com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ