[RFT PATCH master 2/3] soc: imx: imx8m-featctrl: check if all bits are set
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Oct 17 06:49:28 PDT 2022
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 at 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
More information about the barebox
mailing list