All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Hawkins, Nick" <nick.hawkins@hpe.com>,
	"Verdun, Jean-Marie" <verdun@hpe.com>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>
Subject: Re: [PATCH v6 3/8] watchdog: hpe-wdt: Introduce HPE GXP Watchdog
Date: Tue, 3 May 2022 09:53:37 -0700	[thread overview]
Message-ID: <d88523a8-a240-915d-9ae7-54b2277e424a@roeck-us.net> (raw)
In-Reply-To: <PH0PR84MB1718D28F1846F54DB5766E6D88C09@PH0PR84MB1718.NAMPRD84.PROD.OUTLOOK.COM>

On 5/3/22 09:22, Hawkins, Nick wrote:
> On 5/2/22 13:40, nick.hawkins@hpe.com wrote:
>>> +#include <linux/of_address.h>
>>> +#include <linux/of_platform.h>
> 
>> Where are those of_ includes used ?
> 
> They were not used anymore with latest changes. Thank you for pointing this out. I will remember to check in the future for each new commit to double check this.
> 
>>> +#define WDT_MAX_TIMEOUT_MS	655000
> 
>> Shouldn't that be 655350 ?
> 
> Yes it should be. I will correct this.
> 
>>> +static int gxp_wdt_set_timeout(struct watchdog_device *wdd,
>>> +			       unsigned int timeout)
>>> +{
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +	u32 actual;
>>> +
>>> +	wdd->timeout = timeout;
>>> +	actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000);
>>> +	writew(SECS_TO_WDOG_TICKS(actual), drvdata->base + GXP_WDT_CNT_OFS);
> 
>> First, the accuracy of actual is reduced to 1 second, then SECS_TO_WDOG_TICKS() multiplies the result with 100, meaning the actual accuracy is 10ms. Why not just use 10 ms ?
> 
>> 	actual = min(timeout * 100, wdd->max_hw_heartbeat_ms / 10);
>> 	writew(actual, drvdata->base + GXP_WDT_CNT_OFS);
> 
> I have replaced the mention code with what you recommended above.
> 
>>> +
>>> +static int gxp_restart(struct watchdog_device *wdd, unsigned long action,
>>> +		       void *data)
>>> +{
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +
>>> +	writew(10, drvdata->base + GXP_WDT_CNT_OFS);
> 
>> Doesn't that translate to 100 ms timeout ? Why such a large reboot delay instead of writing 1 ?
> 
> This has been changed to 1.
> 
>>> +	gxp_wdt_enable_reload(drvdata);
>>> +	mdelay(100);
>>> +	return 0;
>>> +}
>>> +
>>> +static int gxp_wdt_probe(struct platform_device *pdev) {
>>> +	struct device *dev = &pdev->dev;
>>> +	struct gxp_wdt *drvdata;
>>> +	int err;
>>> +	u8 val;
>>> +
>>> +	drvdata = devm_kzalloc(dev, sizeof(struct gxp_wdt), GFP_KERNEL);
>>> +	if (!drvdata)
>>> +		return -ENOMEM;
>>> +
>>> +	drvdata->base = (void __iomem *)dev->platform_data;
> 
>> I'd personaly prefer if the address was passed as resource.
> 
> Just to clarify for my understanding are you asking that in the device structure I use the "void *platform_data" to pass "struct *resource"? If I am incorrect here can you elaborate on what you would like to be done? Based on feedback in review for the device tree; the watchdog is being created as a child to the timer. Therefore the conclusion reached was there should not be a gxp-wdt listed in the device tree files. I took this implementation based on what I found in ixp4xx_wdt.c.
> 

One bad deed tends to multiply.

No, I didn't ask to pass a struct resource as platform data.
That would be no different to the current code. Resources
can be added to a platform device using
platform_device_add_resources(), and the platform driver
can then use platform_get_resource() to use it. This
would make it independent of a "private" mechanism.

Thanks,
Guenter

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: "Hawkins, Nick" <nick.hawkins@hpe.com>,
	"Verdun, Jean-Marie" <verdun@hpe.com>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>
Subject: Re: [PATCH v6 3/8] watchdog: hpe-wdt: Introduce HPE GXP Watchdog
Date: Tue, 3 May 2022 09:53:37 -0700	[thread overview]
Message-ID: <d88523a8-a240-915d-9ae7-54b2277e424a@roeck-us.net> (raw)
In-Reply-To: <PH0PR84MB1718D28F1846F54DB5766E6D88C09@PH0PR84MB1718.NAMPRD84.PROD.OUTLOOK.COM>

On 5/3/22 09:22, Hawkins, Nick wrote:
> On 5/2/22 13:40, nick.hawkins@hpe.com wrote:
>>> +#include <linux/of_address.h>
>>> +#include <linux/of_platform.h>
> 
>> Where are those of_ includes used ?
> 
> They were not used anymore with latest changes. Thank you for pointing this out. I will remember to check in the future for each new commit to double check this.
> 
>>> +#define WDT_MAX_TIMEOUT_MS	655000
> 
>> Shouldn't that be 655350 ?
> 
> Yes it should be. I will correct this.
> 
>>> +static int gxp_wdt_set_timeout(struct watchdog_device *wdd,
>>> +			       unsigned int timeout)
>>> +{
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +	u32 actual;
>>> +
>>> +	wdd->timeout = timeout;
>>> +	actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000);
>>> +	writew(SECS_TO_WDOG_TICKS(actual), drvdata->base + GXP_WDT_CNT_OFS);
> 
>> First, the accuracy of actual is reduced to 1 second, then SECS_TO_WDOG_TICKS() multiplies the result with 100, meaning the actual accuracy is 10ms. Why not just use 10 ms ?
> 
>> 	actual = min(timeout * 100, wdd->max_hw_heartbeat_ms / 10);
>> 	writew(actual, drvdata->base + GXP_WDT_CNT_OFS);
> 
> I have replaced the mention code with what you recommended above.
> 
>>> +
>>> +static int gxp_restart(struct watchdog_device *wdd, unsigned long action,
>>> +		       void *data)
>>> +{
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +
>>> +	writew(10, drvdata->base + GXP_WDT_CNT_OFS);
> 
>> Doesn't that translate to 100 ms timeout ? Why such a large reboot delay instead of writing 1 ?
> 
> This has been changed to 1.
> 
>>> +	gxp_wdt_enable_reload(drvdata);
>>> +	mdelay(100);
>>> +	return 0;
>>> +}
>>> +
>>> +static int gxp_wdt_probe(struct platform_device *pdev) {
>>> +	struct device *dev = &pdev->dev;
>>> +	struct gxp_wdt *drvdata;
>>> +	int err;
>>> +	u8 val;
>>> +
>>> +	drvdata = devm_kzalloc(dev, sizeof(struct gxp_wdt), GFP_KERNEL);
>>> +	if (!drvdata)
>>> +		return -ENOMEM;
>>> +
>>> +	drvdata->base = (void __iomem *)dev->platform_data;
> 
>> I'd personaly prefer if the address was passed as resource.
> 
> Just to clarify for my understanding are you asking that in the device structure I use the "void *platform_data" to pass "struct *resource"? If I am incorrect here can you elaborate on what you would like to be done? Based on feedback in review for the device tree; the watchdog is being created as a child to the timer. Therefore the conclusion reached was there should not be a gxp-wdt listed in the device tree files. I took this implementation based on what I found in ixp4xx_wdt.c.
> 

One bad deed tends to multiply.

No, I didn't ask to pass a struct resource as platform data.
That would be no different to the current code. Resources
can be added to a platform device using
platform_device_add_resources(), and the platform driver
can then use platform_get_resource() to use it. This
would make it independent of a "private" mechanism.

Thanks,
Guenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-03 16:53 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 20:40 [PATCH v6 1/8] ARM: hpe: Introduce the HPE GXP architecture nick.hawkins
2022-05-02 20:40 ` nick.hawkins
2022-05-02 20:40 ` [PATCH v6 2/8] ARM: configs: multi_v7_defconfig: Add HPE GXP ARCH nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-02 20:40 ` [PATCH v6 3/8] watchdog: hpe-wdt: Introduce HPE GXP Watchdog nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-03  2:19   ` Guenter Roeck
2022-05-03  2:19     ` Guenter Roeck
2022-05-03 16:22     ` Hawkins, Nick
2022-05-03 16:22       ` Hawkins, Nick
2022-05-03 16:53       ` Guenter Roeck [this message]
2022-05-03 16:53         ` Guenter Roeck
2022-05-03 18:51         ` Arnd Bergmann
2022-05-03 18:51           ` Arnd Bergmann
2022-05-04 16:25           ` Hawkins, Nick
2022-05-04 16:25             ` Hawkins, Nick
2022-05-05 21:29             ` Guenter Roeck
2022-05-05 21:29               ` Guenter Roeck
2022-05-02 20:40 ` [PATCH v6 4/8] clocksource/drivers/timer-gxp: Add HPE GXP Timer nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-03 10:34   ` Arnd Bergmann
2022-05-03 10:34     ` Arnd Bergmann
2022-05-02 20:40 ` [PATCH v6 5/8] dt-bindings: timer: hpe,gxp-timer: Creation nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-03  9:58   ` Krzysztof Kozlowski
2022-05-03  9:58     ` Krzysztof Kozlowski
2022-05-03 17:39   ` Rob Herring
2022-05-03 17:39     ` Rob Herring
2022-05-02 20:40 ` [PATCH v6 6/8] dt-bindings: arm: hpe: add GXP Support nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-03  9:59   ` Krzysztof Kozlowski
2022-05-03  9:59     ` Krzysztof Kozlowski
2022-05-03 17:40   ` Rob Herring
2022-05-03 17:40     ` Rob Herring
2022-05-02 20:40 ` [PATCH v6 7/8] ARM: dts: Introduce HPE GXP Device tree nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-03 10:00   ` Krzysztof Kozlowski
2022-05-03 10:00     ` Krzysztof Kozlowski
2022-05-03 14:08     ` Hawkins, Nick
2022-05-03 14:08       ` Hawkins, Nick
2022-05-03 10:45   ` Arnd Bergmann
2022-05-03 10:45     ` Arnd Bergmann
2022-05-03 15:07     ` Hawkins, Nick
2022-05-03 15:07       ` Hawkins, Nick
2022-05-03 18:19       ` Arnd Bergmann
2022-05-03 18:19         ` Arnd Bergmann
2022-05-02 20:40 ` [PATCH v6 8/8] MAINTAINERS: Introduce HPE GXP Architecture nick.hawkins
2022-05-02 20:40   ` nick.hawkins
2022-05-03 10:05   ` Krzysztof Kozlowski
2022-05-03 10:05     ` Krzysztof Kozlowski

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=d88523a8-a240-915d-9ae7-54b2277e424a@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=arnd@arndb.de \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=nick.hawkins@hpe.com \
    --cc=verdun@hpe.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.