iio:frequency:adf4377: Fix duplicated soft reset mask
Subsystems (3)
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
@@ -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
Quoted 5 lines · SeungJu Cheon
The
regmap_read_poll_timeout()usesADF4377_0000_SOFT_RESET_R_MSKtwice instead of checking bothSOFT_RESET_MSK(bit 0) andSOFT_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
PATCH v2 1/1 iio:frequency:adf4377: Fix duplicated soft reset mask
In reply to SeungJu CheonThe 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
@@ -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
Quoted 4 lines · SeungJu Cheon
The
regmap_read_poll_timeout()usesADF4377_0000_SOFT_RESET_R_MSKtwice instead of checking bothSOFT_RESET_MSK(bit 0) andSOFT_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
Jonathan Cameron
maintainerQuoted 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()usesADF4377_0000_SOFT_RESET_R_MSKtwice instead of checking bothSOFT_RESET_MSK(bit 0) andSOFT_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_RandSOFT_RESETbits to "1", and waits for them to be cleared. But the Table 43 does not mention thatSOFT_RESET_Ris 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, andADC_ST_CNVare 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
Jonathan Cameron
maintainerQuoted 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()usesADF4377_0000_SOFT_RESET_R_MSKtwice instead of checking bothSOFT_RESET_MSK(bit 0) andSOFT_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_RandSOFT_RESETbits to "1", and waits for them to be cleared. But the Table 43 does not mention thatSOFT_RESET_Ris 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, andADC_ST_CNVare 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
Miclaus, Antoniu
maintainerQuoted 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_MSKQuoted 10 lines
Quoted 10 lines
Quoted 2 lines
twice instead of checking both
SOFT_RESET_MSK(bit 0) andSOFT_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_RandSOFT_RESETbits to "1", and waits for them to be cleared. But the Table 43 does not mention thatSOFT_RESET_Ris 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, andADC_ST_CNVare 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
Quoted 8 lines · Antoniu
Quoted 8 lines
From: Jonathan Cameron <[email protected]>
Sent: Friday, January 23, 2026 11:44 AMQuoted 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_RandSOFT_RESETbits to "1", and waits for them to be cleared. But the Table 43 does not mention thatSOFT_RESET_Ris 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, andADC_ST_CNVare 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_MSKis 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