Skip to contentSkip to conversation

iio:frequency:adf4377: Fix duplicated soft reset mask

PATCH Superseded SeungJu Cheon 5 participants 8 messages Dec 30, 2025 – Jan 23

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio:frequency:adf4377: Fix duplicated soft reset mask

The regmap_read_poll_timeout() uses ADF4377_0000_SOFT_RESET_R_MSK twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

Fix by using both masks as done in regmap_update_bits() above.

---
 drivers/iio/frequency/adf4377.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4377.c +1 -1
index 08833b7035e4..48aa4b015a14 100644
@@ -501,7 +501,7 @@ static int adf4377_soft_reset(struct adf4377_state *st)
 		return ret;
 
 	return regmap_read_poll_timeout(st->regmap, 0x0, read_val,
-					!(read_val & (ADF4377_0000_SOFT_RESET_R_MSK |
+					!(read_val & (ADF4377_0000_SOFT_RESET_MSK |
 					ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 * 100);
 }
 
Signature · 1 line
2.52.0
#1 lore raw
Quoted 5 lines · SeungJu Cheon

The regmap_read_poll_timeout() uses ADF4377_0000_SOFT_RESET_R_MSK twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

Fix by using both masks as done in regmap_update_bits() above.

Shouldn't we have a Fixes tag here?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

PATCH v2 1/1 iio:frequency:adf4377: Fix duplicated soft reset mask

In reply to SeungJu Cheon

The regmap_read_poll_timeout() uses ADF4377_0000_SOFT_RESET_R_MSK twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

Fix by using both masks as done in regmap_update_bits() above.

Fixes eda549e2e524 ("iio:frequency:adf4377: add support for ADF4377")
---
 drivers/iio/frequency/adf4377.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4377.c +1 -1
index 08833b7035e4..48aa4b015a14 100644
@@ -501,7 +501,7 @@ static int adf4377_soft_reset(struct adf4377_state *st)
 		return ret;
 
 	return regmap_read_poll_timeout(st->regmap, 0x0, read_val,
-					!(read_val & (ADF4377_0000_SOFT_RESET_R_MSK |
+					!(read_val & (ADF4377_0000_SOFT_RESET_MSK |
 					ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 * 100);
 }
 
Signature · 1 line
2.52.0
#3 lore raw
Quoted 4 lines · SeungJu Cheon

The regmap_read_poll_timeout() uses ADF4377_0000_SOFT_RESET_R_MSK twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

an incomplete

Quoted 1 line

Fix by using both masks as done in regmap_update_bits() above.

...

May I ask how you tested this? Logically from the code it sounds correct, but I haven't read the datasheet yet, so I can't tell if this is the expected value to read or not.

drivers/iio/frequency/adf4377.c static int adf4377_soft_reset(struct adf4377_state *st) · line 505

Quoted 4 lines
        return regmap_read_poll_timeout(st->regmap, 0x0, read_val,
drivers/iio/frequency/adf4377.c +1 -1
-                                       !(read_val & (ADF4377_0000_SOFT_RESET_R_MSK |
+                                       !(read_val & (ADF4377_0000_SOFT_RESET_MSK |
                                        ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 * 100);

Okay, I opened the datasheet, and the below is what I read there. The code first sets the SOFT_RESET_R and SOFT_RESET bits to "1", and waits for them to be cleared. But the Table 43 does not mention that SOFT_RESET_R is auto cleaned, and actually I don't see with a brief look what the "repeat of" term means.

And for normal operation they needs to be 0ed as per:
"SOFT_RESET, SOFT_RESET_R, RST_SYS, and ADC_ST_CNV are the only
remaining RW bit fields not mentioned yet, and must also be set to their POR state (see Table 34)."

With that said, I would wait for AD people to clarify the programming workflow here.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw
Quoted 29 lines · On Wed, 31 Dec 2025 13:19:46 +0200 Andy Shevchenko <[email protected]>…
Quoted 4 lines · SeungJu Cheon

The regmap_read_poll_timeout() uses ADF4377_0000_SOFT_RESET_R_MSK twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

an incomplete

Quoted 1 line

Fix by using both masks as done in regmap_update_bits() above.

...

May I ask how you tested this? Logically from the code it sounds correct, but I haven't read the datasheet yet, so I can't tell if this is the expected value to read or not.

drivers/iio/frequency/adf4377.c static int adf4377_soft_reset(struct adf4377_state *st) · line 505

Quoted 4 lines
        return regmap_read_poll_timeout(st->regmap, 0x0, read_val,
drivers/iio/frequency/adf4377.c +1 -1
-                                       !(read_val & (ADF4377_0000_SOFT_RESET_R_MSK |
+                                       !(read_val & (ADF4377_0000_SOFT_RESET_MSK |
                                        ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 * 100);  

Okay, I opened the datasheet, and the below is what I read there. The code first sets the SOFT_RESET_R and SOFT_RESET bits to "1", and waits for them to be cleared. But the Table 43 does not mention that SOFT_RESET_R is auto cleaned, and actually I don't see with a brief look what the "repeat of" term means.

Quoted 8 lines

And for normal operation they needs to be 0ed as per:
"SOFT_RESET, SOFT_RESET_R, RST_SYS, and ADC_ST_CNV are the only
remaining RW bit fields not mentioned yet, and must also be set to their POR state (see Table 34)."

With that said, I would wait for AD people to clarify the programming workflow here.

Small kernel development process thing as well. Please don't send a v2 in reply to a v1. It can become very confusing if we end up with a larger number of versions. Much better to just post a new thread for each version, and include
a link back to the lore archive of the previous version in your cover letter.

Also from a practical point of view, it ends up pages up in people's inboxes and so is is less likely to get reviewed!

Thanks

Jonathan

maintainer
#5 lore raw
Quoted 46 lines · On Sun, 11 Jan 2026 12:09:25 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 29 lines · On Wed, 31 Dec 2025 13:19:46 +0200 Andy Shevchenko <[email protected]>…
Quoted 4 lines · SeungJu Cheon

The regmap_read_poll_timeout() uses ADF4377_0000_SOFT_RESET_R_MSK twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

an incomplete

Quoted 1 line

Fix by using both masks as done in regmap_update_bits() above.

...

May I ask how you tested this? Logically from the code it sounds correct, but I haven't read the datasheet yet, so I can't tell if this is the expected value to read or not.

drivers/iio/frequency/adf4377.c static int adf4377_soft_reset(struct adf4377_state *st) · line 505

Quoted 4 lines
        return regmap_read_poll_timeout(st->regmap, 0x0, read_val,
drivers/iio/frequency/adf4377.c +1 -1
-                                       !(read_val & (ADF4377_0000_SOFT_RESET_R_MSK |
+                                       !(read_val & (ADF4377_0000_SOFT_RESET_MSK |
                                        ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 * 100);    

Okay, I opened the datasheet, and the below is what I read there. The code first sets the SOFT_RESET_R and SOFT_RESET bits to "1", and waits for them to be cleared. But the Table 43 does not mention that SOFT_RESET_R is auto cleaned, and actually I don't see with a brief look what the "repeat of" term means.

Quoted 8 lines

And for normal operation they needs to be 0ed as per:
"SOFT_RESET, SOFT_RESET_R, RST_SYS, and ADC_ST_CNV are the only
remaining RW bit fields not mentioned yet, and must also be set to their POR state (see Table 34)."

With that said, I would wait for AD people to clarify the programming workflow here.

Small kernel development process thing as well. Please don't send a v2 in reply to a v1. It can become very confusing if we end up with a larger number of versions. Much better to just post a new thread for each version, and include
a link back to the lore archive of the previous version in your cover letter.

Quoted 7 lines

Also from a practical point of view, it ends up pages up in people's inboxes and so is is less likely to get reviewed!

Thanks

Jonathan

ADI folk. This is waiting for one of you to take a look at the questions Andy raised.

Thanks!

Jonathan

maintainer
#6 lore raw
Quoted 69 lines

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: Friday, January 23, 2026 11:44 AM
To: Andy Shevchenko <[email protected]>; Hennerich, Michael <[email protected]>; Sa, Nuno <[email protected]>
Cc: SeungJu Cheon <[email protected]>; Miclaus, Antoniu <[email protected]>; [email protected]; [email protected]; David Lechner <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2] iio:frequency:adf4377: Fix duplicated soft reset mask

[External]

Quoted 4 lines · On Sun, 11 Jan 2026 12:09:25 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Wed, 31 Dec 2025 13:19:46 +0200 Andy Shevchenko <[email protected]>…

On Tue, Dec 30, 2025 at 3:21 PM SeungJu Cheon

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines

The regmap_read_poll_timeout() uses

ADF4377_0000_SOFT_RESET_R_MSK

Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

twice instead of checking both SOFT_RESET_MSK (bit 0) and SOFT_RESET_R_MSK (bit 7). This causes incomplete reset status check.

an incomplete

Quoted 1 line

Fix by using both masks as done in regmap_update_bits() above.

...

Quoted 7 lines
Quoted 7 lines

May I ask how you tested this? Logically from the code it sounds correct, but I haven't read the datasheet yet, so I can't tell if this is the expected value to read or not.

Quoted 2 lines
        return regmap_read_poll_timeout(st->regmap, 0x0, read_val,

- !(read_val & (ADF4377_0000_SOFT_RESET_R_MSK

|

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+ !(read_val & (ADF4377_0000_SOFT_RESET_MSK |

                                        ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 *

100);

Quoted 12 lines
Quoted 12 lines

Okay, I opened the datasheet, and the below is what I read there. The code first sets the SOFT_RESET_R and SOFT_RESET bits to "1", and waits for them to be cleared. But the Table 43 does not mention that SOFT_RESET_R is auto cleaned, and actually I don't see with a brief look what the "repeat of" term means.

And for normal operation they needs to be 0ed as per:
"SOFT_RESET, SOFT_RESET_R, RST_SYS, and ADC_ST_CNV are the only
remaining RW bit fields not mentioned yet, and must also be set to their POR state (see Table 34)."

Quoted 5 lines
Quoted 3 lines

With that said, I would wait for AD people to clarify the programming workflow here.

Small kernel development process thing as well. Please don't send a v2 in

reply to a v1.

Quoted 5 lines

It can become very confusing if we end up with a larger number of versions. Much better to just post a new thread for each version, and include a link back to the lore archive of the previous version in your cover letter.

Also from a practical point of view, it ends up pages up in people's inboxes

and

Quoted 8 lines
Quoted 6 lines

so is is less likely to get reviewed!

Thanks

Jonathan

ADI folk. This is waiting for one of you to take a look at the questions Andy raised.

Yep, it's a straightforward copy-paste typo - SOFT_RESET_R_MSK is OR'd with itself, so we're only
checking BIT(7). Since we set both bits before polling, we should be waiting for both to clear.

Regards,
Antoniu

Quoted 3 lines

Thanks!

Jonathan

#7 lore raw
Quoted 8 lines · Antoniu
Quoted 8 lines

From: Jonathan Cameron <[email protected]>
Sent: Friday, January 23, 2026 11:44 AM

Quoted 3 lines · On Sun, 11 Jan 2026 12:09:25 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Wed, 31 Dec 2025 13:19:46 +0200 Andy Shevchenko <[email protected]>…

On Tue, Dec 30, 2025 at 3:21 PM SeungJu Cheon

<[email protected]> wrote:

...

Quoted 34 lines
Quoted 34 lines
Quoted 7 lines
Quoted 7 lines

May I ask how you tested this? Logically from the code it sounds correct, but I haven't read the datasheet yet, so I can't tell if this is the expected value to read or not.

Quoted 2 lines
        return regmap_read_poll_timeout(st->regmap, 0x0, read_val,

- !(read_val & (ADF4377_0000_SOFT_RESET_R_MSK

|

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+ !(read_val & (ADF4377_0000_SOFT_RESET_MSK |

                                        ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 *

100);

Quoted 12 lines
Quoted 12 lines

Okay, I opened the datasheet, and the below is what I read there. The code first sets the SOFT_RESET_R and SOFT_RESET bits to "1", and waits for them to be cleared. But the Table 43 does not mention that SOFT_RESET_R is auto cleaned, and actually I don't see with a brief look what the "repeat of" term means.

And for normal operation they needs to be 0ed as per:
"SOFT_RESET, SOFT_RESET_R, RST_SYS, and ADC_ST_CNV are the only
remaining RW bit fields not mentioned yet, and must also be set to their POR state (see Table 34)."

Quoted 4 lines
Quoted 2 lines

With that said, I would wait for AD people to clarify the programming workflow here.

Small kernel development process thing as well. Please don't send a v2 in

reply to a v1.

Quoted 5 lines

It can become very confusing if we end up with a larger number of versions. Much better to just post a new thread for each version, and include a link back to the lore archive of the previous version in your cover letter.

Also from a practical point of view, it ends up pages up in people's inboxes

and

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

so is is less likely to get reviewed!

ADI folk. This is waiting for one of you to take a look at the questions Andy raised.

Yep, it's a straightforward copy-paste typo - SOFT_RESET_R_MSK is OR'd with itself, so we're only checking BIT(7). Since we set both bits before polling, we should be waiting for both to clear.

Can you clarify more on this, please? Datasheet is unclear about the second bit to be self-cleared.

And are you going to fix documentation (Datasheet)?

Signature · 2 lines
With Best Regards,
Andy Shevchenko