mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Hawkins, Nick" <nick.hawkins@hpe.com>
Cc: "Verdun, Jean-Marie" <verdun@hpe.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>
Subject: Re: [PATCH v3 03/10] drivers: wdt: Introduce HPE GXP SoC Watchdog
Date: Mon, 4 Apr 2022 09:41:09 -0700	[thread overview]
Message-ID: <817c20de-3ebc-e444-a14e-b18773da9f19@roeck-us.net> (raw)
In-Reply-To: <PH0PR84MB171847EBCFEF79A06434CE8488E59@PH0PR84MB1718.NAMPRD84.PROD.OUTLOOK.COM>

On 4/4/22 09:25, Hawkins, Nick wrote:
> 
> 
> -----Original Message-----
> From: Guenter Roeck [mailto:linux@roeck-us.net]
> Sent: Monday, April 4, 2022 9:29 AM
> To: Hawkins, Nick <nick.hawkins@hpe.com>
> Cc: Verdun, Jean-Marie <verdun@hpe.com>; Wim Van Sebroeck <wim@linux-watchdog.org>; linux-kernel@vger.kernel.org; linux-watchdog@vger.kernel.org
> Subject: Re: [PATCH v3 03/10] drivers: wdt: Introduce HPE GXP SoC Watchdog
> 
> On Thu, Mar 10, 2022 at 01:52:22PM -0600, nick.hawkins@hpe.com wrote:
>>> From: Nick Hawkins <nick.hawkins@hpe.com>
>>>
>>> Adding support for the HPE GXP Watchdog. It is new to the linux
>>> community and this along with several other patches is the first
>>> support for it. The GXP asic contains a full compliment of timers one
>>> of which is the watchdog timer. The watchdog timer is 16 bit and has
>>> 10ms resolution.
>>>
>>> Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
>>> ---
>>>   drivers/watchdog/Kconfig   |   8 ++
>>>   drivers/watchdog/Makefile  |   1 +
>>>   drivers/watchdog/gxp-wdt.c | 191
>>> +++++++++++++++++++++++++++++++++++++
>>>   3 files changed, 200 insertions(+)
>>>   create mode 100644 drivers/watchdog/gxp-wdt.c
>>>
>>> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index
>>> c8fa79da23b3..cb210d2978d2 100644
>>> --- a/drivers/watchdog/Kconfig
>>> +++ b/drivers/watchdog/Kconfig
>>> @@ -1820,6 +1820,14 @@ config RALINK_WDT
>>>   	help
>>>   	  Hardware driver for the Ralink SoC Watchdog Timer.
>>>   
>>> +config GXP_WATCHDOG
>>> +	tristate "HPE GXP watchdog support"
>>> +	depends on ARCH_HPE_GXP
>>> +	select WATCHDOG_CORE
>>> +	help
>>> +	  Say Y here to include support for the watchdog timer
>>> +	  in HPE GXP SoCs.
>>> +
>>>   config MT7621_WDT
>>>   	tristate "Mediatek SoC watchdog"
>>>   	select WATCHDOG_CORE
>>> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
>>> index f7da867e8782..e2acf3a0d0fc 100644
>>> --- a/drivers/watchdog/Makefile
>>> +++ b/drivers/watchdog/Makefile
>>> @@ -92,6 +92,7 @@ obj-$(CONFIG_RTD119X_WATCHDOG) += rtd119x_wdt.o
>>>   obj-$(CONFIG_SPRD_WATCHDOG) += sprd_wdt.o
>>>   obj-$(CONFIG_PM8916_WATCHDOG) += pm8916_wdt.o
>>>   obj-$(CONFIG_ARM_SMC_WATCHDOG) += arm_smc_wdt.o
>>> +obj-$(CONFIG_GXP_WATCHDOG) += gxp-wdt.o
>>>   obj-$(CONFIG_VISCONTI_WATCHDOG) += visconti_wdt.o
>>>   obj-$(CONFIG_MSC313E_WATCHDOG) += msc313e_wdt.o
>>>   obj-$(CONFIG_APPLE_WATCHDOG) += apple_wdt.o diff --git
>>> a/drivers/watchdog/gxp-wdt.c b/drivers/watchdog/gxp-wdt.c new file
>>> mode 100644 index 000000000000..d2b489cb4774
>>> --- /dev/null
>>> +++ b/drivers/watchdog/gxp-wdt.c
>>> @@ -0,0 +1,191 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/* Copyright (C) 2022 Hewlett-Packard Enterprise Development Company, L.P.
>>> + *
>>> + *
>>> + * This program is free software; you can redistribute it and/or
>>> +modify
>>> + * it under the terms of the GNU General Public License version 2 as
>>> + * published by the Free Software Foundation.
>>> + */
>>> +
>>> +#include <linux/delay.h>
>>> +#include <linux/io.h>
>>> +#include <linux/module.h>
>>> +#include <linux/platform_device.h>
>>> +#include <linux/of_address.h>
>>> +#include <linux/of_platform.h>
>>> +#include <linux/types.h>
>>> +#include <linux/watchdog.h>
>>> +
>>> +#define MASK_WDGCS_ENABLE	0x01
>>> +#define MASK_WDGCS_RELOAD	0x04
>>> +#define MASK_WDGCS_NMIEN	0x08
>>> +#define MASK_WDGCS_WARN		0x80
>>> +
>>> +#define WDT_MAX_TIMEOUT_MS	655000
>>> +#define WDT_DEFAULT_TIMEOUT	30
>>> +#define SECS_TO_WDOG_TICKS(x) ((x) * 100) #define
>>> +WDOG_TICKS_TO_SECS(x) ((x) / 100)
>>> +
>>> +struct gxp_wdt {
>>> +	void __iomem	*counter;
>>> +	void __iomem	*control;
>>> +	struct watchdog_device	wdd;
> 
>> Odd variable alignment. Might as well just use spaces before the variable names.
> 
> Fixed
> 
>>> +};
>>> +
>>> +static void gxp_wdt_enable_reload(struct gxp_wdt *drvdata) {
>>> +	uint8_t val;
>>> +
>>> +	val = readb(drvdata->control);
>>> +	val |= (MASK_WDGCS_ENABLE | MASK_WDGCS_RELOAD);
>>> +	writeb(val, drvdata->control);
>>> +}
>>> +
>>> +static int gxp_wdt_start(struct watchdog_device *wdd) {
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +
>>> +	writew((SECS_TO_WDOG_TICKS(wdd->timeout)), drvdata->counter);
> 
>> Unnecessary iand confusing () around SECS_TO_WDOG_TICKS().
> 
> Fixed
> 
>>> +	gxp_wdt_enable_reload(drvdata);
>>> +	return 0;
>>> +}
>>> +
>>> +static int gxp_wdt_stop(struct watchdog_device *wdd) {
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +	uint8_t val;
>>> +
>>> +	val = readb_relaxed(drvdata->control);
>>> +	val &= ~MASK_WDGCS_ENABLE;
>>> +	writeb(val, drvdata->control);
>>> +	return 0;
>>> +}
>>> +
>>> +static int gxp_wdt_set_timeout(struct watchdog_device *wdd,
>>> +			       unsigned int timeout)
>>> +{
>>> +	struct gxp_wdt *drvdata = watchdog_get_drvdata(wdd);
>>> +	uint32_t actual;
> 
>> Please use u32 as suggested by checkpatch. Same everywhere.
> 
> Fixed, checkpatch did not flag this, is there an option I should be using with checkpatch.pl?

--strict

Guenter

  reply	other threads:[~2022-04-04 21:51 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 19:52 [PATCH v3 01/10] arch: arm: mach-hpe: Introduce the HPE GXP architecture nick.hawkins
2022-03-10 19:52 ` [PATCH v3 02/10] arch: arm: configs: multi_v7_defconfig nick.hawkins
2022-03-10 19:52 ` [PATCH v3 03/10] drivers: wdt: Introduce HPE GXP SoC Watchdog nick.hawkins
2022-04-04 14:28   ` Guenter Roeck
2022-04-04 16:25     ` Hawkins, Nick
2022-04-04 16:41       ` Guenter Roeck [this message]
2022-03-10 19:52 ` [PATCH v3 04/10] clocksource/drivers: Add HPE GXP timer nick.hawkins
2022-04-06 11:13   ` Daniel Lezcano
2022-04-06 22:02     ` Hawkins, Nick
2022-03-10 19:52 ` [PATCH v3 05/10] dt-bindings: timer: Add HPE GXP Timer Binding nick.hawkins
2022-03-11  9:32   ` Krzysztof Kozlowski
2022-03-11 15:40   ` Rob Herring
2022-03-11 16:22     ` Hawkins, Nick
2022-03-11 17:13       ` Krzysztof Kozlowski
2022-03-10 19:52 ` [PATCH v3 06/10] dt-bindings: watchdog: Add HPE GXP Watchdog timer binding nick.hawkins
2022-03-11  9:34   ` Krzysztof Kozlowski
2022-03-10 19:52 ` [PATCH v3 07/10] dt-bindings: arm: Add HPE GXP Binding nick.hawkins
2022-03-11 10:20   ` Krzysztof Kozlowski
2022-03-10 19:52 ` [PATCH v3 08/10] dt-bindings: arm: Add HPE GXP CPU Init nick.hawkins
2022-03-11 10:22   ` Krzysztof Kozlowski
2022-03-16 21:33     ` Hawkins, Nick
2022-03-10 19:52 ` [PATCH v3 09/10] arch: arm: boot: dts: Introduce HPE GXP Device tree nick.hawkins
2022-03-11  8:17   ` Arnd Bergmann
2022-03-11 10:29   ` Krzysztof Kozlowski
2022-03-16 15:41     ` Hawkins, Nick
2022-03-16 15:50       ` Krzysztof Kozlowski
2022-03-16 20:10         ` Hawkins, Nick
2022-03-17  8:36           ` Krzysztof Kozlowski
2022-03-29 19:38             ` Hawkins, Nick
2022-03-29 21:13               ` Arnd Bergmann
2022-03-29 21:45                 ` Hawkins, Nick
2022-03-30 22:27                   ` Hawkins, Nick
2022-03-31  9:30                     ` Arnd Bergmann
2022-03-31 21:09                       ` Hawkins, Nick
2022-03-31 21:52                         ` Arnd Bergmann
2022-04-01 16:05                           ` Hawkins, Nick
2022-04-01 16:30                             ` Arnd Bergmann
2022-04-04 20:22                               ` Hawkins, Nick
2022-04-04 22:02                                 ` Arnd Bergmann
2022-04-05 21:21                                   ` Hawkins, Nick
2022-04-06  7:24                                     ` Arnd Bergmann
2022-04-13 16:48                                       ` Hawkins, Nick
2022-04-13 17:42                                         ` Arnd Bergmann
2022-03-10 19:52 ` [PATCH v3 10/10] maintainers: Introduce HPE GXP Architecture nick.hawkins
2022-03-11 10:33   ` Joe Perches
2022-03-11  7:21 ` [PATCH v3 01/10] arch: arm: mach-hpe: Introduce the HPE GXP architecture kernel test robot
2022-03-11  8:06 ` Arnd Bergmann
2022-03-11 12:40 ` kernel test robot
2022-03-12 13:27 ` kernel test robot
2022-03-12 15:14   ` Arnd Bergmann

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=817c20de-3ebc-e444-a14e-b18773da9f19@roeck-us.net \
    --to=linux@roeck-us.net \
    --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 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®