Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1245318rdh; Mon, 25 Sep 2023 07:18:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgG/hevMch8rSvYS7zJc4kjG0eyjDlYviubEU4WNjNodCkuESQi/6Mtz21002Lv7TnAZFl X-Received: by 2002:a05:6e02:2161:b0:351:211a:e86a with SMTP id s1-20020a056e02216100b00351211ae86amr9416567ilv.17.1695651526320; Mon, 25 Sep 2023 07:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695651526; cv=none; d=google.com; s=arc-20160816; b=vyrk2WGtT+k45OE5Vm6r82WzF+oRF7CeD9ioQgOsxMkMSkT5Ei2QYY7pVhVHYCpOBW EyZrF9V5oIVlhvaeu5KvOEIQ8eFvmKsgXEL0WORUeJ6jbFlJo++AGad9hFkgmuJXUDpL jrqNdmOowx7LSA6SVUiMlXT+FiZnGDWy7FvpJe1odp4BZY8zGdP5I2JXfyGVYNk/tjYc E4JK9jBLm8+y8KUYA9lJS3F6De6U3Q3A/auU3cCykzKYdRg2POWWl0vlbohqRm4zYkbW 61msjXxQ/VhxII+/Oawcn6+w//+/ZSHAAiXh/BNGnO6Dawj7/ack4vHA/5PBFyOUeuaA 13hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=t+sBQGiQz3C729qMtYzgf0M3OFSDBSoB6u+AGZ2aBJA=; fh=4vRpKw7YUk0SHJN+iLoCNYLCnqBozM8vdaF2dwUTGyA=; b=aP+m2SYy5qXt+aBQHv/Y/JmIpTyi02qV9GReUWS+djbAIttmMIqCHs9aZjKkBmxpzj 2KvzlVq4kZE63zxQj9yOvEUm4XjeI9zsjdQw3wF5Pf01PA7tGG5gv8nlILWzoUUA0zeH CbNcYTWx9/QFM7IzP06SDHoEvRHmQDu/6G4azi2tVQ6FeodNsIcU13yRUfaHXArYapV3 UXgVqBAGthaN+F4+2Ld6c3RmghxGIeig1D8Kt+A8o+nv8VFK/SxuigQGEqDeYqjZEFjE 3rjvxjcDH1JLg15QcQgK00fwkvxQEIrV21OY+59cShpXsP5Q678OxPaXNEvaocLKGJsN 8glw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=W4j8JG3U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id u18-20020a63df12000000b0057942bfab4dsi7611115pgg.395.2023.09.25.07.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 07:18:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=W4j8JG3U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6F1EB8025063; Mon, 25 Sep 2023 05:13:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbjIYMN1 (ORCPT + 99 others); Mon, 25 Sep 2023 08:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjIYMN0 (ORCPT ); Mon, 25 Sep 2023 08:13:26 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B26F19C; Mon, 25 Sep 2023 05:13:19 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c60cec8041so12636415ad.3; Mon, 25 Sep 2023 05:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695643999; x=1696248799; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=t+sBQGiQz3C729qMtYzgf0M3OFSDBSoB6u+AGZ2aBJA=; b=W4j8JG3UXftAGIRUJeekc7kRi2le2ZleGDXDtAodf+C9j30uort8jKOCWbdl2Ca1u9 qmuuHGHp2SD3J8jFTYXKyG6iic2i+8f+F7YU35CeFOK0isSeNn1B3Expou/jyVIjxzlE VwKwETTRpmuzDJkG9v3ssQ1fLHVrui4I4zqpZT5GWwGTdPiEMsd0B8KPowB+kUncaWeV 1NV595P44OTIhYJxEMuBdB1T/yxDl4gQPTcf//vpHI93e+IYY4n6F1YFI5acIOAJeaw1 xl6dCpZlhVr1elKIBX3Ss5AqdSMK07gpezrAok7GeoGeT4w5RZXQA6/aPpOFnxKbnqT2 +Cfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695643999; x=1696248799; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t+sBQGiQz3C729qMtYzgf0M3OFSDBSoB6u+AGZ2aBJA=; b=JgoK91mKK5aYHcKwliYLtxD2XbP9NuXMzP9YRzDzlrmzyjhTcY+MxiiHPyO4OF8APD Q8tkXPvLVQwRHCcLrMDiqXrmE/PL389jhlCyLIBnLsUpT6fm1iXHMy3wH8hmwgl9ucJ+ vRBmFx9Vnnlen7IXjgZqBQeDuyS8BHh6vRHtd6PDhiR+XQvws7T5jyfSJqmt/egO76+3 hFD42TuCRNwQeAB/z6yCEhpKMwcQ2o+5m8Wqf4M2K5HyjJ2COcU3tsxnQBn29pKw6yOq Q5HKozCXU6q4Gp/PFl467t+CO9GHUzgo0TpvZR1WYOfc+7LjzUHMs8RaocvxfB6OZDoJ L/gQ== X-Gm-Message-State: AOJu0YzDsWIONdUPCBJ1g2dayX8y2lpRYWL3y+sPIHq9URmvKLCLBHyr XXOqro5Ge+wKmJeja5QSSAk= X-Received: by 2002:a17:903:60d:b0:1c0:d7a8:a43e with SMTP id kg13-20020a170903060d00b001c0d7a8a43emr3599502plb.53.1695643999004; Mon, 25 Sep 2023 05:13:19 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id a7-20020a170902ecc700b001b89891bfc4sm8642906plh.199.2023.09.25.05.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 05:13:18 -0700 (PDT) Sender: Guenter Roeck Date: Mon, 25 Sep 2023 05:13:16 -0700 From: Guenter Roeck To: Linus Walleij Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] watchdog: ixp4xx: Make sure restart always works Message-ID: <8034c824-7836-48cf-a974-05f3491f133d@roeck-us.net> References: <20230925-ixp4xx-wdt-restart-v1-1-fe2b9b131dbf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230925-ixp4xx-wdt-restart-v1-1-fe2b9b131dbf@linaro.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 05:13:27 -0700 (PDT) On Mon, Sep 25, 2023 at 09:20:05AM +0200, Linus Walleij wrote: > The IXP4xx watchdog in early "A0" silicon is unreliable and > cannot be registered, however for some systems such as the > USRobotics USR8200 the watchdog is the only restart option, > so implement a "dummy" watchdog that can only support restart > in this case. > > Fixes: 1aea522809e6 ("watchdog: ixp4xx: Implement restart") > Signed-off-by: Linus Walleij > --- > Other solutions like implementing a pure restart notifier > callback catch in the driver is possible, but this method > will minimize the amount of code and reuse infrastructure > in the core. > --- > drivers/watchdog/ixp4xx_wdt.c | 28 +++++++++++++++++++++++++--- > 1 file changed, 25 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c > index 607ce4b8df57..c0bf03125ec8 100644 > --- a/drivers/watchdog/ixp4xx_wdt.c > +++ b/drivers/watchdog/ixp4xx_wdt.c > @@ -105,6 +105,25 @@ static const struct watchdog_ops ixp4xx_wdt_ops = { > .owner = THIS_MODULE, > }; > > +/* > + * The A0 version of the IXP422 had a bug in the watchdog making > + * is useless, but we still need to use it to restart the system > + * as it is the only way, so in this special case we register a > + * "dummy" watchdog that doesn't really work, but will support > + * the restart operation. > + */ > +static int ixp4xx_wdt_dummy(struct watchdog_device *wdd) > +{ > + return 0; > +} > + > +static const struct watchdog_ops ixp4xx_wdt_restart_only_ops = { > + .start = ixp4xx_wdt_dummy, > + .stop = ixp4xx_wdt_dummy, > + .restart = ixp4xx_wdt_restart, > + .owner = THIS_MODULE, > +}; > + > static const struct watchdog_info ixp4xx_wdt_info = { > .options = WDIOF_KEEPALIVEPING > | WDIOF_MAGICCLOSE > @@ -114,14 +133,17 @@ static const struct watchdog_info ixp4xx_wdt_info = { > > static int ixp4xx_wdt_probe(struct platform_device *pdev) > { > + static const struct watchdog_ops *iwdt_ops; > struct device *dev = &pdev->dev; > struct ixp4xx_wdt *iwdt; > struct clk *clk; > int ret; > > if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) { > - dev_err(dev, "Rev. A0 IXP42x CPU detected - watchdog disabled\n"); > - return -ENODEV; > + dev_err(dev, "Rev. A0 IXP42x CPU detected - only restart supported\n"); With this change this is no longer an error. > + iwdt_ops = &ixp4xx_wdt_restart_only_ops; > + } else { > + iwdt_ops = &ixp4xx_wdt_ops; > } > > iwdt = devm_kzalloc(dev, sizeof(*iwdt), GFP_KERNEL); > @@ -141,7 +163,7 @@ static int ixp4xx_wdt_probe(struct platform_device *pdev) > iwdt->rate = IXP4XX_TIMER_FREQ; > > iwdt->wdd.info = &ixp4xx_wdt_info; > - iwdt->wdd.ops = &ixp4xx_wdt_ops; > + iwdt->wdd.ops = iwdt_ops; > iwdt->wdd.min_timeout = 1; > iwdt->wdd.max_timeout = U32_MAX / iwdt->rate; > iwdt->wdd.parent = dev; > > --- > base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d > change-id: 20230924-ixp4xx-wdt-restart-d6bf28493173 > > Best regards, > -- > Linus Walleij >