mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Hans Christian Lonstad <hcl@datarespons.com>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [RFT PATCH master 2/3] soc: imx: imx8m-featctrl: check if all bits are set
Date: Mon, 17 Oct 2022 15:49:28 +0200	[thread overview]
Message-ID: <20221017134929.622022-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20221017134929.622022-1-a.fatoum@pengutronix.de>

The bits are not documented in the reference manual, so the bit masks
were taken from NXP code written for U-Boot. There, checking is done
for whether any bit is set. For 8MP however, all-bits-set is checked.

Testing on i.MX8MM shows that all bits are set though, so switch to
that for uniformity.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/soc/imx/imx8m-featctrl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/imx/imx8m-featctrl.c b/drivers/soc/imx/imx8m-featctrl.c
index 480c80e6c1d9..1798d0fc2863 100644
--- a/drivers/soc/imx/imx8m-featctrl.c
+++ b/drivers/soc/imx/imx8m-featctrl.c
@@ -28,6 +28,11 @@ static int imx8m_feat_check(struct feature_controller *feat, int idx)
 	return test_bit(idx, priv->features) ? FEATCTRL_OKAY : FEATCTRL_GATED;
 }
 
+static inline bool is_fused(u32 val, u32 bitmask)
+{
+	return bitmask && (val & bitmask) == bitmask;
+}
+
 int imx8m_feat_ctrl_init(struct device_d *dev, u32 tester4,
 			 const struct imx8m_featctrl_data *data)
 {
@@ -44,9 +49,9 @@ int imx8m_feat_ctrl_init(struct device_d *dev, u32 tester4,
 
 	bitmap_fill(features, IMX8M_FEAT_END);
 
-	if (tester4 & data->vpu_bitmask)
+	if (is_fused(tester4, data->vpu_bitmask))
 		clear_bit(IMX8M_FEAT_VPU, features);
-	if (tester4 & data->gpu_bitmask)
+	if (is_fused(tester4, data->gpu_bitmask))
 		clear_bit(IMX8M_FEAT_GPU, features);
 
 	switch (tester4 & 3) {
-- 
2.30.2




  parent reply	other threads:[~2022-10-17 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 13:49 [RFT PATCH master 0/3] soc: imx8m-featctrl: fixes and first 8MP support Ahmad Fatoum
2022-10-17 13:49 ` [RFT PATCH master 1/3] dt-bindings: features: imx8m: fix typo in constant Ahmad Fatoum
2022-10-17 13:49 ` Ahmad Fatoum [this message]
2022-10-17 13:49 ` [RFT PATCH master 3/3] ARM: i.MX8MP: add feature controller support for Plus Ahmad Fatoum
2022-10-17 19:46 ` [RFT PATCH master 0/3] soc: imx8m-featctrl: fixes and first 8MP support Hans Christian Lønstad
2022-10-18  8:57 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221017134929.622022-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=hcl@datarespons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox