From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45D7BC77B6E for ; Fri, 14 Apr 2023 12:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjDNM2W (ORCPT ); Fri, 14 Apr 2023 08:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbjDNM2V (ORCPT ); Fri, 14 Apr 2023 08:28:21 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A330AF36 for ; Fri, 14 Apr 2023 05:28:17 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id gc14so42016ejc.5 for ; Fri, 14 Apr 2023 05:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681475296; x=1684067296; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=2IJkV6Vx5TKwaqO1LbgwCrd/XJlJ7MEyOwn1DdAcAA8=; b=HHGMdc8w7jAyHnf3DTnO+F9+TV3P3GjfeaU9BME8ObPJ/dgUcklR27VL96fm+VUiJB v6FD9cN+SI3xLVazbu33X4+bmoc3mMFFqosZmMX5uG9rgCosTjB6mIG3ZBA7y7/PGkbu XFh4hCiY2+n9gEsEtebJbJsC4GQBbmMjJ1NQyKT6EogBAGhLJ6Z4D/HxJhuQFe/92DxR Epbd0L7dXxagrtyy7n/9cuS/wMHvNitdP7muzsaEUJL8lz6FV0z3sbvWnPJwyj0bD+sB OHFklIaLR8XIlAQAGlATj+c3JJW7Zl7XHB/C0j8FKJCTB6gtE1r5pwLjNv9Bdk+MLlrc 4Eyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681475296; x=1684067296; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2IJkV6Vx5TKwaqO1LbgwCrd/XJlJ7MEyOwn1DdAcAA8=; b=dGbY3r91TDdOvnxz2pHYP+yT8IcGPb0Y5UfEi0Mqjf2oyNUvMebp9IRBwiVpBgvJ/m 4JXVQkXTclfqK/x/3tTQSX/O2Sww7WcungWUjqnI2z6wGJWWDCPFWLNkd8RJLnnPNLIz Cy+bjEf2t5BXE4ajzLN5ssPCYsRpcys4QH3z6yH5HpSDJ5A/W71g02HhvOnqrEW1TjCm ouFPhXK4Q3TZpem9tRxagCwvwANSfDUAAetA4zqrzfPqP2jpN+K4LBAjNV4jJjNOKWf+ hkCeznoAEI8+4BGWahclrbYhJ9BP6gmJKHJq5Jpxaa8Qmdb/t2CU3Cte5M8q3MWCR1ZC SUYw== X-Gm-Message-State: AAQBX9eSopW93ZopKMCKp1DYocqfW0S7yS/No18etu/7xADEg6CNSSM2 AS3zfnGTazVxOv+FXU50DGxTdnwtL2JcDw1+biY= X-Google-Smtp-Source: AKy350YZi+IejTh/8DUpsdpqBZWUHt951EgYelr9S/h0i88I2IrJ+FGLh9huM0t3PTVnT7qAh48bVw== X-Received: by 2002:a17:907:d094:b0:94e:eb42:2a7c with SMTP id vc20-20020a170907d09400b0094eeb422a7cmr1444904ejc.25.1681475295927; Fri, 14 Apr 2023 05:28:15 -0700 (PDT) Received: from ?IPV6:2a02:810d:15c0:828:39b7:81a0:bd41:17b1? ([2a02:810d:15c0:828:39b7:81a0:bd41:17b1]) by smtp.gmail.com with ESMTPSA id p9-20020a05640210c900b004fa012332ecsm2076486edu.1.2023.04.14.05.28.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Apr 2023 05:28:15 -0700 (PDT) Message-ID: <512ac643-c487-ed83-9bf5-242f4890c680@linaro.org> Date: Fri, 14 Apr 2023 14:28:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [EXT] Re: [PATCH 2/2] Watchdog: Add octeontx2 GTI watchdog driver To: Bharat Bhushan , "wim@linux-watchdog.org" , "linux@roeck-us.net" , "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "linux-watchdog@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20230414102342.23696-1-bbhushan2@marvell.com> <20230414102342.23696-2-bbhushan2@marvell.com> <832d7830-be98-243c-ebf7-c23ae51e4ccc@linaro.org> Content-Language: en-US From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 14/04/2023 13:44, Bharat Bhushan wrote: > Please see inline > >> -----Original Message----- >> From: Krzysztof Kozlowski >> Sent: Friday, April 14, 2023 4:58 PM >> To: Bharat Bhushan ; wim@linux-watchdog.org; >> linux@roeck-us.net; robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org; >> linux-watchdog@vger.kernel.org; devicetree@vger.kernel.org; linux- >> kernel@vger.kernel.org >> Subject: [EXT] Re: [PATCH 2/2] Watchdog: Add octeontx2 GTI watchdog driver >> >> External Email >> >> ---------------------------------------------------------------------- >> On 14/04/2023 12:23, Bharat Bhushan wrote: >>> GTI watchdog timer are programmed in "interrupt + del3t + reset mode" >>> and del3t traps are not enabled. >>> GTI watchdog exception flow is: >>> - 1st timer expiration generates watchdog interrupt. >>> - 2nd timer expiration is ignored >>> - On 3rd timer expiration will trigger a system-wide core reset. >>> >>> Signed-off-by: Bharat Bhushan >>> --- >>> drivers/watchdog/Kconfig | 9 ++ >>> drivers/watchdog/Makefile | 1 + >>> drivers/watchdog/octeontx2_wdt.c | 238 >>> +++++++++++++++++++++++++++++++ >>> 3 files changed, 248 insertions(+) >>> create mode 100644 drivers/watchdog/octeontx2_wdt.c >>> >>> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index >>> f0872970daf9..31ff282c62ad 100644 >>> --- a/drivers/watchdog/Kconfig >>> +++ b/drivers/watchdog/Kconfig >>> @@ -2212,4 +2212,13 @@ config KEEMBAY_WATCHDOG >>> To compile this driver as a module, choose M here: the >>> module will be called keembay_wdt. >>> >>> +config OCTEONTX2_WATCHDOG >>> + tristate "OCTEONTX2 Watchdog driver" >>> + depends on ARCH_THUNDER || (COMPILE_TEST && 64BIT) >> >> Why it cannot be compile tested on 32-bit? > > Used in 64 bit configuration but no harm getting compile tested for 32bit. > Will change > >> >>> + help >>> + OCTEONTX2 GTI hardware supports watchdog timer. This watchdog >> timer are >>> + programmed in "interrupt + del3t + reset" mode. On first expiry it will >>> + generate interrupt. Second expiry (del3t) is ignored and system will reset >>> + on final timer expiry. >>> + >>> endif # WATCHDOG >>> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile >>> index 9cbf6580f16c..aa1b813ad1f9 100644 >>> --- a/drivers/watchdog/Makefile >>> +++ b/drivers/watchdog/Makefile >>> @@ -230,3 +230,4 @@ obj-$(CONFIG_MENZ069_WATCHDOG) += >> menz69_wdt.o >>> obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o >>> obj-$(CONFIG_STPMIC1_WATCHDOG) += stpmic1_wdt.o >>> obj-$(CONFIG_SL28CPLD_WATCHDOG) += sl28cpld_wdt.o >>> +obj-$(CONFIG_OCTEONTX2_WATCHDOG) += octeontx2_wdt.o >> >> Please tell me that you added it in some reasonable place, not just at the end... >> The same in Kconfig. > > Is it alphabetical order, any suggestion? 'O' is not after 'S', thus for sure you did not add it in alphabetical order. Or what is a question? If so, then yes, usually we try to keep alphabetical order. Anyway adding entries to the end is conflictprone. >>> + dev_info(dev, "Watchdog enabled (timeout=%d sec)\n", wdog_dev- >>> timeout); >>> + return 0; >>> +} >>> + >>> +static int octeontx2_wdt_remove(struct platform_device *pdev) { >>> + struct octeontx2_wdt_priv *priv = platform_get_drvdata(pdev); >>> + >>> + if (priv->irq) >> >> Is it possible? You did not reply, so I assume it is not possible. Drop. >> >>> + free_irq(priv->irq, priv); >> >> Anyway, your order of cleanup is a bit surprising. It is expected to be reversed >> from probe. In probe() you requested IRQs before watchdog, but cleanup will be >> done before watchdog release? This does not look right. > > Watchdog release happen outside this driver as we used devm_*. I know, this is why I raised the question. Don't repeat the obvious but rather address the problem mentioned here. > Will convert request_irq to devm_request_irq(). If interrupt is not shared, then looks like correct approach. Best regards, Krzysztof