mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>,
	"wim@linux-watchdog.org" <wim@linux-watchdog.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"andrew@codeconstruct.com.au" <andrew@codeconstruct.com.au>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	BMC-SW <BMC-SW@aspeedtech.com>
Subject: Re: [PATCH 2/3] watchdog: aspeed: Support variable number of reset mask registers
Date: Tue, 7 Oct 2025 21:21:03 -0700	[thread overview]
Message-ID: <c5cab3a0-b17f-494b-b856-ebf2fb68db60@roeck-us.net> (raw)
In-Reply-To: <TYZPR06MB52035407C39249441F09AA18B2E1A@TYZPR06MB5203.apcprd06.prod.outlook.com>

On 10/7/25 20:29, Chin-Ting Kuo wrote:
> Hi Guenter,
> 
> Thanks for the quick review.
> 
>> -----Original Message-----
>> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
>> Sent: Tuesday, October 7, 2025 10:55 PM
>> Subject: Re: [PATCH 2/3] watchdog: aspeed: Support variable number of reset
>> mask registers
>>
>> On 10/7/25 01:36, Chin-Ting Kuo wrote:
>>> Starting from the AST2600 platform, the SoC design has become more
>>> complex, with an increased number of reset mask registers.
>>> To support this, introduce a new field 'num_reset_masks' in the
>>> 'aspeed_wdt_config' structure to specify the number of reset mask
>>> registers per platform. This change removes the need for hardcoded
>>> platform-specific logic and improves scalability for future SoCs.
>>>
>>> Signed-off-by: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
>>> ---
>>>    drivers/watchdog/aspeed_wdt.c | 12 ++++++++----
>>>    1 file changed, 8 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/watchdog/aspeed_wdt.c
>>> b/drivers/watchdog/aspeed_wdt.c index 837e15701c0e..e15f70c5e416
>>> 100644
>>> --- a/drivers/watchdog/aspeed_wdt.c
>>> +++ b/drivers/watchdog/aspeed_wdt.c
>>> @@ -35,6 +35,7 @@ struct aspeed_wdt_config {
>>>    	u32 irq_shift;
>>>    	u32 irq_mask;
>>>    	struct aspeed_wdt_scu scu;
>>> +	u32 num_reset_masks;
>>>    };
>>>
>>>    struct aspeed_wdt {
>>> @@ -54,6 +55,7 @@ static const struct aspeed_wdt_config ast2400_config =
>> {
>>>    		.wdt_reset_mask = 0x1,
>>>    		.wdt_reset_mask_shift = 1,
>>>    	},
>>> +	.num_reset_masks = 1,
>>
>> Looking at this again: Why set it on ast2400 ?
>>
> 
> This should be removed for AST2400 platform. I will update it in the next patch version.
> 
>>>    };
>>>
>>>    static const struct aspeed_wdt_config ast2500_config = { @@ -66,6
>>> +68,7 @@ static const struct aspeed_wdt_config ast2500_config = {
>>>    		.wdt_reset_mask = 0x1,
>>>    		.wdt_reset_mask_shift = 2,
>>>    	},
>>> +	.num_reset_masks = 1,
>>>    };
>>>
>>>    static const struct aspeed_wdt_config ast2600_config = { @@ -78,6
>>> +81,7 @@ static const struct aspeed_wdt_config ast2600_config = {
>>>    		.wdt_reset_mask = 0xf,
>>>    		.wdt_reset_mask_shift = 16,
>>>    	},
>>> +	.num_reset_masks = 2,
>>>    };
>>>
>>>    static const struct of_device_id aspeed_wdt_of_table[] = { @@ -482,8
>>> +486,9 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
>>>    	if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) ||
>>>    		(of_device_is_compatible(np, "aspeed,ast2600-wdt"))) {
>>
>> ... because the code here only evaluates it if this is an ast2500 or ast2600.
>>
>> If num_reset_masks would be set to 0 for ast2400, the value could be used
>> here.
>>
>> 	if (wdt->cfg->num_reset_masks) {
>> 		...
>> 	}
>>
>> and it would not be necessary to add of_device_is_compatible() for new chips.
>>
> 
> This "if" conditional statement includes not only reset mask configuration but also pulse polarity and driving type of reset output signal.
> How about changing this "if" statement to the below one?
> 	if (!of_device_is_compatible(np, "aspeed,ast2400-wdt")) {
> 		...
> 	}
> It will also not need to add of_device_is_compatible() for new chips.
> 

Ok..

Thanks,
Guenter


  reply	other threads:[~2025-10-08  4:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07  8:36 [PATCH 0/3] watchdog: aspeed: Add AST2700 support Chin-Ting Kuo
2025-10-07  8:36 ` [PATCH 1/3] dt-bindings: watchdog: aspeed,ast2400-wdt: Add support for AST2700 Chin-Ting Kuo
2025-10-07  8:36 ` [PATCH 2/3] watchdog: aspeed: Support variable number of reset mask registers Chin-Ting Kuo
2025-10-07 14:46   ` Guenter Roeck
2025-10-07 14:55   ` Guenter Roeck
2025-10-08  3:29     ` Chin-Ting Kuo
2025-10-08  4:21       ` Guenter Roeck [this message]
2025-10-07  8:36 ` [PATCH 3/3] watchdog: aspeed: Add support for AST2700 platform Chin-Ting Kuo

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=c5cab3a0-b17f-494b-b856-ebf2fb68db60@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=BMC-SW@aspeedtech.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=chin-ting_kuo@aspeedtech.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=wim@linux-watchdog.org \
    /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

all inboxes | Powered by JetHome®