Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1056409iob; Fri, 13 May 2022 21:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxldk+reTAuS6EVBNp4bAhNCXgf4xHBAHsdb1qE8oGjKb9KdF/Fs5d5uwdi1cijCdCR4e2W X-Received: by 2002:a05:6000:15c1:b0:20c:5825:f043 with SMTP id y1-20020a05600015c100b0020c5825f043mr6237627wry.261.1652502220249; Fri, 13 May 2022 21:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652502220; cv=none; d=google.com; s=arc-20160816; b=z92qggW43wz1SXYhYvXVCrAHwzMguZheryu63bPy2tTLkA64m6XHjJMtz6KCR6Rwh8 xdSjYcB/art9HKptAmtFhxD333c6rwSM1Is5bAUxP8CjhrBL7+I8BktwCyTMSPwlqLbW fEO3U7FBS0HuUsaKv9SHgTcip0+7pRhU+WARLvV3oceIxWXVsgOwFTP71mV6otKegLFX +f0bW9hKf1f4fFuIk88LEBzD5bnp5ddEqaUwyNlsb/0PNEqWbtn26CuSUu9SnxRTyvYx V8TZIDtvZmvOaIJzsYUP/3sgQIn4eFYlREDPC3tlx8MaLtmxeoi2x6Jn6RX1ABEbNJMH YoGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=4DgXjQ7qLUtCouOMfdCd3nk+S/RpYIcEVykY3tosRVU=; b=hVLZwM090YCk9la9B6PANinHl+/DcgCeDoH4vGYkbJWFVLPAZXaNC5flovTeFk+Wwa Kze8SOXZB1y6k98GLLmnyklhjiUWRIXjOpIwINqo9jqd0b4FHkouL/JrjKLlz9VyIYnL hl74OkSA98UaWPq60Z392hOZWYVYQ6u1SQQ07pk9kKnDymZBSNa9gist6x7+6m5415Mg Jfk3zm8Gm5IHZgOiyVKFwceqGH9N1VZ0haXHnKBbV2+CkIX0auPD3mDmI7cGnT/qHS3U 3Wj28gxhgNjtJ2dIwwJDSFoXR/Hzh4MvQelN2S5zc15sr78CZQh8Qgcdi6BM4uKuxdDz KUMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TJyCH7X4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o9-20020a5d47c9000000b0020606d7746bsi5309715wrc.1042.2022.05.13.21.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TJyCH7X4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D2D434FE0F; Fri, 13 May 2022 17:58:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380521AbiEMNCF (ORCPT + 99 others); Fri, 13 May 2022 09:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380507AbiEMNB7 (ORCPT ); Fri, 13 May 2022 09:01:59 -0400 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E3A52ED6E; Fri, 13 May 2022 06:01:58 -0700 (PDT) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-ee1e7362caso10396743fac.10; Fri, 13 May 2022 06:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=4DgXjQ7qLUtCouOMfdCd3nk+S/RpYIcEVykY3tosRVU=; b=TJyCH7X42kBB88wYoNpckQxo1LMv7TZpH9zvb3vqBFkQcGo/OeYsVqTCRoaCPRvqcM 8QdnY+S0bz8aPapnwttv+dqjooeF96VT6Mxu5907CClRSfCSozRV7/MeezKq/Wfpw76u N5WHq7eNAy+9jIpiFADRc1jpfFHGLPV34TSK2ZYKxLYmjLvnT9FyzQ+ylZgcVVNX67Vy ioZloyizHZ3IzZzccmHFAT1iybUDbAy6QRRPgb1Gw1VE4U2YMdszNhcCIHV0oENpCmVt /LhWKMSJN/sZlu2XY4SEapsYr4cTyeS07vQPTpBsgOkphTT8P74PHmjgUTlvmBv/gb+9 r1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=4DgXjQ7qLUtCouOMfdCd3nk+S/RpYIcEVykY3tosRVU=; b=Dq60huNuK7WDkaxxZ06KMkAaKojJ0N4asi2WVM70tgrxzqBtOSviXGeVaJSSrQvv2Z IZWQ6rfrtSAQa9KRWMwu6HLQWBfD5JeuyZ8qJ4hy1SZYh1GqAossMz64DPI+faXzy/Dc JSY5EBtMmk+xTAjnxJYeQIYOf4D/xLeqdWm1t2xcNu7s6Ex66y4xwQlsVrpk2LlFZjzy Vo0Gv5db1gZwBWUgYvJ3Izft8h0ojCviD1jXBIFGEuYGT6wvnE4RikvaN/rmwQdV3DSO JTnggPx+lU90qbvTo60c2TojGdhQVOUu0uuZWviadwqY+6ksQVfncN1Lp3Vbrra0Q/vR qdIg== X-Gm-Message-State: AOAM531RijfP4EOHUh0RbYNWvQDwkYSK063oo3/X8ti5RqBpvFvqbxZC IyNVEKEFB6+IDrF+Vxuz6mDt2t33JVhRVQ== X-Received: by 2002:a05:6870:2047:b0:e9:1b34:fbe with SMTP id l7-20020a056870204700b000e91b340fbemr8228003oad.64.1652446917217; Fri, 13 May 2022 06:01:57 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id a1-20020a9d5c81000000b0060603221240sm967368oti.16.2022.05.13.06.01.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 May 2022 06:01:56 -0700 (PDT) Sender: Guenter Roeck Message-ID: <0d5d8502-fec7-fc91-0932-647f3e74e7e1@roeck-us.net> Date: Fri, 13 May 2022 06:01:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v3 2/4] watchdog: simatic-ipc-wdt: convert to use P2SB accessor Content-Language: en-US To: Henning Schild , Andy Shevchenko Cc: Mark Gross , Wim Van Sebroeck , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-watchdog@vger.kernel.org, Enrico Weigelt , Gerd Haeussler References: <20220513083652.974-1-henning.schild@siemens.com> <20220513083652.974-3-henning.schild@siemens.com> From: Guenter Roeck In-Reply-To: <20220513083652.974-3-henning.schild@siemens.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Guenter Roeck > --- > 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 > #include > #include > +#include > #include > #include > #include > @@ -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))