All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Henning Schild <henning.schild@siemens.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mark Gross <markgross@kernel.org>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	linux-watchdog@vger.kernel.org, Enrico Weigelt <lkml@metux.net>,
	Gerd Haeussler <gerd.haeussler.ext@siemens.com>
Subject: Re: [PATCH v3 2/4] watchdog: simatic-ipc-wdt: convert to use P2SB accessor
Date: Fri, 13 May 2022 06:01:54 -0700	[thread overview]
Message-ID: <0d5d8502-fec7-fc91-0932-647f3e74e7e1@roeck-us.net> (raw)
In-Reply-To: <20220513083652.974-3-henning.schild@siemens.com>

On 5/13/22 01:36, Henning Schild wrote:
> Since we have a common P2SB accessor in tree we may use it instead of
> open coded variants.
> 
> Replace custom code by p2sb_bar() call.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/Kconfig           |  1 +
>   drivers/watchdog/simatic-ipc-wdt.c | 15 ++++++++-------
>   2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index a7cd3ef5b3d8..0097fbb455ab 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -1639,6 +1639,7 @@ config SIEMENS_SIMATIC_IPC_WDT
>   	tristate "Siemens Simatic IPC Watchdog"
>   	depends on SIEMENS_SIMATIC_IPC
>   	select WATCHDOG_CORE
> +	select P2SB
>   	help
>   	  This driver adds support for several watchdogs found in Industrial
>   	  PCs from Siemens.
> diff --git a/drivers/watchdog/simatic-ipc-wdt.c b/drivers/watchdog/simatic-ipc-wdt.c
> index 8bac793c63fb..6599695dc672 100644
> --- a/drivers/watchdog/simatic-ipc-wdt.c
> +++ b/drivers/watchdog/simatic-ipc-wdt.c
> @@ -16,6 +16,7 @@
>   #include <linux/kernel.h>
>   #include <linux/module.h>
>   #include <linux/pci.h>
> +#include <linux/platform_data/x86/p2sb.h>
>   #include <linux/platform_data/x86/simatic-ipc-base.h>
>   #include <linux/platform_device.h>
>   #include <linux/sizes.h>
> @@ -54,9 +55,9 @@ static struct resource io_resource_trigger =
>   	DEFINE_RES_IO_NAMED(WD_TRIGGER_IOADR, SZ_1,
>   			    KBUILD_MODNAME " WD_TRIGGER_IOADR");
>   
> -/* the actual start will be discovered with pci, 0 is a placeholder */
> +/* the actual start will be discovered with p2sb, 0 is a placeholder */
>   static struct resource mem_resource =
> -	DEFINE_RES_MEM_NAMED(0, SZ_4, "WD_RESET_BASE_ADR");
> +	DEFINE_RES_MEM_NAMED(0, 0, "WD_RESET_BASE_ADR");
>   
>   static u32 wd_timeout_table[] = {2, 4, 6, 8, 16, 32, 48, 64 };
>   static void __iomem *wd_reset_base_addr;
> @@ -150,6 +151,7 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
>   	struct simatic_ipc_platform *plat = pdev->dev.platform_data;
>   	struct device *dev = &pdev->dev;
>   	struct resource *res;
> +	int ret;
>   
>   	switch (plat->devmode) {
>   	case SIMATIC_IPC_DEVICE_227E:
> @@ -190,15 +192,14 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
>   	if (plat->devmode == SIMATIC_IPC_DEVICE_427E) {
>   		res = &mem_resource;
>   
> -		/* get GPIO base from PCI */
> -		res->start = simatic_ipc_get_membase0(PCI_DEVFN(0x1f, 1));
> -		if (res->start == 0)
> -			return -ENODEV;
> +		ret = p2sb_bar(NULL, 0, res);
> +		if (ret)
> +			return ret;
>   
>   		/* do the final address calculation */
>   		res->start = res->start + (GPIO_COMMUNITY0_PORT_ID << 16) +
>   			     PAD_CFG_DW0_GPP_A_23;
> -		res->end += res->start;
> +		res->end = res->start + SZ_4 - 1;
>   
>   		wd_reset_base_addr = devm_ioremap_resource(dev, res);
>   		if (IS_ERR(wd_reset_base_addr))


  reply	other threads:[~2022-05-13 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13  8:36 [PATCH v3 0/4] simatic-ipc additions to p2sb apl lake gpio Henning Schild
2022-05-13  8:36 ` [PATCH v3 1/4] leds: simatic-ipc-leds: convert to use P2SB accessor Henning Schild
2022-05-13  8:36 ` [PATCH v3 2/4] watchdog: simatic-ipc-wdt: " Henning Schild
2022-05-13 13:01   ` Guenter Roeck [this message]
2022-05-13  8:36 ` [PATCH v3 3/4] platform/x86: simatic-ipc: drop custom P2SB bar code Henning Schild
2022-05-23 16:22   ` Andy Shevchenko
2022-05-13  8:36 ` [PATCH v3 4/4] leds: simatic-ipc-leds-gpio: add GPIO version of Siemens driver Henning Schild
2022-05-23 16:24 ` [PATCH v3 0/4] simatic-ipc additions to p2sb apl lake gpio Andy Shevchenko
2022-06-07 15:18   ` Andy Shevchenko
2022-06-07 16:15     ` Henning Schild

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=0d5d8502-fec7-fc91-0932-647f3e74e7e1@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gerd.haeussler.ext@siemens.com \
    --cc=henning.schild@siemens.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=lkml@metux.net \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.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 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.