From patchwork Thu Mar 4 22:12:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 392876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1786C433E6 for ; Thu, 4 Mar 2021 22:12:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6554764FF4 for ; Thu, 4 Mar 2021 22:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbhCDWMx (ORCPT ); Thu, 4 Mar 2021 17:12:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230449AbhCDWMx (ORCPT ); Thu, 4 Mar 2021 17:12:53 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94266C061761 for ; Thu, 4 Mar 2021 14:12:52 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id dx17so24904090ejb.2 for ; Thu, 04 Mar 2021 14:12:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IxSjyHvfhJ/CRzXpd7kM65mxSitdSKejDB4yVJ8QdLI=; b=SGDVknug8AsUYWYZSGdHKwErk1ohZtG+21USh8vDWbvcM6aFt8ZKYPoHP34FY7/Or4 RqoAtJe0dwn1Bch/dFzWvOCOo/dEqgcOjFOFMzAB0e2Vh5Kw37/tNktSN79n3iIUqm/j jWI2HYdntIV9Dpa68IH6OENLdI+eeMvCb2PM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IxSjyHvfhJ/CRzXpd7kM65mxSitdSKejDB4yVJ8QdLI=; b=RX4tG6xPR5tczMH3upQFroRI1CObFyWQg/BldzFqDZuRp1Wh9OygkfrWbnJyBSDzjw 5C4MGQ4NnqTeQVNg/SODoI1lv/wrZrnHeDEMiRgLsXKeywhniN82IDqxwql9C9ZQm+zU xpLi4l8KR+6Wl7BrXHVDWteBOpXnsrYIcUF+fsPC0DQkNEP8m5otBVO+P49oj5CO1yr3 FAyA3uXbYRatnpLmWCrFPYa+lupLMEVnAhAmDdthJMYt8X0CU8bmK6IE10VK6I4JSslA laNBSbMmbmDhLgMmKSKGkYtGoU9rj5FrJtwf1JAdGvRfgc/pPemgpXGaHZOVrOvghbMY 9Anw== X-Gm-Message-State: AOAM531536SaEhYrzymPdA1woRioqh6129jF/PrK9DJZry/PKSCc1cuh 2gzaWmmJQrThIouHFELOKY8plQ== X-Google-Smtp-Source: ABdhPJwVN0AcFGjBUTQ8VzGydpnWSzRyWvOOXLUP2ekeX/od+/cEZvBhl2UzMVMC2N0PmxVQKV+mMg== X-Received: by 2002:a17:906:3acc:: with SMTP id z12mr6648419ejd.494.1614895971264; Thu, 04 Mar 2021 14:12:51 -0800 (PST) Received: from prevas-ravi.prevas.se ([80.208.71.141]) by smtp.gmail.com with ESMTPSA id q22sm362099ejy.5.2021.03.04.14.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 14:12:50 -0800 (PST) From: Rasmus Villemoes To: Arnd Bergmann , Guenter Roeck , Stephen Boyd Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-watchdog@vger.kernel.org, Rasmus Villemoes Subject: [PATCH v2 1/3] clk: add devm_clk_prepare_enable() helper Date: Thu, 4 Mar 2021 23:12:45 +0100 Message-Id: <20210304221247.488173-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210304221247.488173-1-linux@rasmusvillemoes.dk> References: <20210226141411.2517368-1-linux@rasmusvillemoes.dk> <20210304221247.488173-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add a managed wrapper for clk_prepare_enable(). Signed-off-by: Rasmus Villemoes --- .../driver-api/driver-model/devres.rst | 1 + drivers/clk/clk-devres.c | 29 +++++++++++++++++++ include/linux/clk.h | 13 +++++++++ 3 files changed, 43 insertions(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index cd8b6e657b94..8ee2557f9ad7 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -253,6 +253,7 @@ CLOCK devm_clk_hw_register() devm_of_clk_add_hw_provider() devm_clk_hw_register_clkdev() + devm_clk_prepare_enable() DMA dmaenginem_async_device_register() diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index be160764911b..d5bfa8cd7347 100644 --- a/drivers/clk/clk-devres.c +++ b/drivers/clk/clk-devres.c @@ -156,3 +156,32 @@ struct clk *devm_get_clk_from_child(struct device *dev, return clk; } EXPORT_SYMBOL(devm_get_clk_from_child); + +static void devm_clk_disable_unprepare(struct device *dev, void *res) +{ + clk_disable_unprepare(*(struct clk **)res); +} + +int devm_clk_prepare_enable(struct device *dev, struct clk *clk) +{ + struct clk **ptr; + int ret; + + if (!clk) + return 0; + + ptr = devres_alloc(devm_clk_disable_unprepare, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return -ENOMEM; + + ret = clk_prepare_enable(clk); + if (!ret) { + *ptr = clk; + devres_add(dev, ptr); + } else { + devres_free(ptr); + } + + return ret; +} +EXPORT_SYMBOL(devm_clk_prepare_enable); diff --git a/include/linux/clk.h b/include/linux/clk.h index 266e8de3cb51..04d135520480 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -485,6 +485,19 @@ struct clk *devm_clk_get_optional(struct device *dev, const char *id); */ struct clk *devm_get_clk_from_child(struct device *dev, struct device_node *np, const char *con_id); +/** + * devm_clk_prepare_enable - prepare and enable a clock source + * @dev: device for clock "consumer" + * @clk: clock source + * + * This function calls clk_prepare_enable() on @clk, and ensures the + * clock will automatically be disabled and unprepared when the device + * is unbound from the bus. + * + * Must not be called from within atomic context. + */ +int devm_clk_prepare_enable(struct device *dev, struct clk *clk); + /** * clk_rate_exclusive_get - get exclusivity over the rate control of a * producer From patchwork Fri Feb 26 14:14:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 387811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E958C433DB for ; Fri, 26 Feb 2021 14:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E094A64EF6 for ; Fri, 26 Feb 2021 14:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbhBZOQE (ORCPT ); Fri, 26 Feb 2021 09:16:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbhBZOPq (ORCPT ); Fri, 26 Feb 2021 09:15:46 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35955C061793 for ; Fri, 26 Feb 2021 06:14:18 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id p1so6626293edy.2 for ; Fri, 26 Feb 2021 06:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fiQu2oPApg5uagXMeqvolPXEApCItlWJFjBIgQNcT+U=; b=J5pKGpp119dXassFAQHDedxcYd25QkctzzdK/xuhuJiTm3yxPt1cK8uG+fpwUUdGy+ IiimOncJrA+KsZtTxqnEaWqkr/ahi005229VXf7F+d02ok7m5USrYAvviwADS1Fxzuay 2l1WLWwav6JcD1uEa0BWutnySL0uDe5xzN7BU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fiQu2oPApg5uagXMeqvolPXEApCItlWJFjBIgQNcT+U=; b=OOgSX/wsj0Dxxw4Q4tFWa1rPxRs5H+P/GKvq+VdLzmiCiXEIZk23y7DKnzASuUZx2q AObV+ekgCAy6McEM2/e0iGnYVunjo1QMpvSqtu8wa2+QZ+PLv3PExdmZpWq4aeSz0VMY dF2/eu/LczaUNRDzGkfJrwdIIbCBcLmyG7UTrsdoXL0kVTmEES8Yf0QDmrsUwkGzm82y nZdsvUQEZjzVQn/BFBwtuiSitg6igW762aa7RtCtDDQmbjcf1704fvY6DGDGGz5w85vy KYB1vTMnIfbSkqibWcG8OriCxCHARgaDuy+AoZg+nu1ktvBIYCupe/epXH5IcoJvbg1b VAag== X-Gm-Message-State: AOAM531hx3aGRyapPEdlkBsR+HuT6IjOtHO/BuaLhroWqryBnMd0Mn78 8cE6E6aCNX/WWnqv5DDW/wUowg== X-Google-Smtp-Source: ABdhPJw/Q9UFfy0SlSake+cTOwjAruZIS7wv4RgEF5dEECeCFkfD0F584h7BRA9fzQUyQlAlUYBC7w== X-Received: by 2002:aa7:d451:: with SMTP id q17mr3483756edr.381.1614348856948; Fri, 26 Feb 2021 06:14:16 -0800 (PST) Received: from prevas-ravi.prevas.se ([80.208.71.141]) by smtp.gmail.com with ESMTPSA id g3sm5316838ejz.91.2021.02.26.06.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 06:14:16 -0800 (PST) From: Rasmus Villemoes To: Greg Kroah-Hartman , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , linux-clk@vger.kernel.org, Rasmus Villemoes Subject: [PATCH 2/2] drivers: misc: add ripple counter driver Date: Fri, 26 Feb 2021 15:14:11 +0100 Message-Id: <20210226141411.2517368-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210226141411.2517368-1-linux@rasmusvillemoes.dk> References: <20210226141411.2517368-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The only purpose of this driver is to serve as a consumer of the input clock, to prevent it from being disabled by clk_disable_unused(). Signed-off-by: Rasmus Villemoes --- drivers/misc/Kconfig | 7 +++++++ drivers/misc/Makefile | 1 + drivers/misc/ripple-ctr.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 drivers/misc/ripple-ctr.c diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index f532c59bb59b..44b0b6ce42df 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -445,6 +445,13 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A host ports using only one USB controller. +config RIPPLE_CTR + tristate "Trivial ripple counter driver" + help + This provides a stub driver for a ripple counter, whose + only purpose is to request and enable the clock source + driving the counter. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 99b6f15a3c70..d560163068a9 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI) += habanalabs/ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o +obj-$(CONFIG_RIPPLE_CTR) += ripple-ctr.o diff --git a/drivers/misc/ripple-ctr.c b/drivers/misc/ripple-ctr.c new file mode 100644 index 000000000000..f086eaf335df --- /dev/null +++ b/drivers/misc/ripple-ctr.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include +#include +#include +#include +#include + +static int ripple_ctr_probe(struct platform_device *pdev) +{ + struct clk *clk; + + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) + return PTR_ERR(clk); + return clk_prepare_enable(clk); +} + +static const struct of_device_id ripple_ctr_ids[] = { + { .compatible = "linux,ripple-counter", }, + { } +}; +MODULE_DEVICE_TABLE(of, ripple_ctr_ids); + +static struct platform_driver ripple_ctr_driver = { + .driver = { + .name = "ripple-counter", + .of_match_table = ripple_ctr_ids, + }, + .probe = ripple_ctr_probe, +}; +module_platform_driver(ripple_ctr_driver); From patchwork Thu Mar 4 22:12:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 392875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FB56C4332E for ; Thu, 4 Mar 2021 22:13:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AEEC64FFF for ; Thu, 4 Mar 2021 22:13:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbhCDWM4 (ORCPT ); Thu, 4 Mar 2021 17:12:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231424AbhCDWMy (ORCPT ); Thu, 4 Mar 2021 17:12:54 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 231CEC06175F for ; Thu, 4 Mar 2021 14:12:54 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id bd6so23798988edb.10 for ; Thu, 04 Mar 2021 14:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UCo3mKQIbcpollGcJ9PYHtksoboB7Ro207jOYrCfzdo=; b=g1Zn6sewFIleBOXnOHM71n+XqDprG9IKVcU3vrwC/LmP7RiEYZWioiuOo6u8eay8rp 1efpcjma6Y7hUyfQyOqliLwpMX7YVcRtMkHFwd4IttHF9G22LrA/mMggvqUZaqDgqmU1 133cDV7S24kpbxsZu8wG18e2IJ81VwzKnsak4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UCo3mKQIbcpollGcJ9PYHtksoboB7Ro207jOYrCfzdo=; b=SubOXyY19rF/xK4aGD4gYUJqmruEpPq+MnbPXgonhgiMpXbTBdqTq0fty6YXI02N5W IgG6DiA+3TdZ1ouIJ+MEmDuIQstBN8PBva+epmb9lp0Wk9EI452lW0sQxASy+8JWvciE H3cIMId8mAUqNKczLtejxlcrE/RXeSCJOxqPnjCVMhTkafjXTUp2VDNiMqKIlWt5EHng LRkG8mrC9ohcjiOf0DJI4eQ1K1rmIvoECw81BYHISUyzxXDwZS2xlsvJ3g2QMns51V4j L6tyzz/j9DRtakelCqTECtz3XJgNeFiNw2MlKgxem76nmuDHlCKmYLpK3qhNz2aR4bl5 ChnA== X-Gm-Message-State: AOAM532z80GJK4zTvAhSmVej/SK8tkNBgKqr/WS+NztHv2aG+fOX1p70 UT5Vhp4eaDVbjm3QF0Kz6Yu7Iw== X-Google-Smtp-Source: ABdhPJzme5MAAWpf/zramDLF/Q+YNk0uNjfX+zRiBm3mY5cw1s0ZQPbrq+hYw2HTPbmIl+2U4okoLg== X-Received: by 2002:aa7:cd8c:: with SMTP id x12mr6809476edv.355.1614895972903; Thu, 04 Mar 2021 14:12:52 -0800 (PST) Received: from prevas-ravi.prevas.se ([80.208.71.141]) by smtp.gmail.com with ESMTPSA id q22sm362099ejy.5.2021.03.04.14.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 14:12:52 -0800 (PST) From: Rasmus Villemoes To: Arnd Bergmann , Guenter Roeck , Stephen Boyd Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-watchdog@vger.kernel.org, Rasmus Villemoes Subject: [PATCH v2 3/3] watchdog: gpio_wdt: implement support for optional "delay" clock Date: Thu, 4 Mar 2021 23:12:47 +0100 Message-Id: <20210304221247.488173-4-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210304221247.488173-1-linux@rasmusvillemoes.dk> References: <20210226141411.2517368-1-linux@rasmusvillemoes.dk> <20210304221247.488173-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org [DO NOT MERGE - see cover letter] We have a board where the reset output from the ADM706S is split in two: directly routed to an interrupt, and also to start a ripple counter, which 64 ms later than pulls the SOC's reset pin. That ripple counter only works if the RTC's 32kHz output is enabled, and since linux by default disables unused clocks, that effectively renders the watchdog useless. Add driver support for an optional "delay" clock, as documented in the preceding patch. Signed-off-by: Rasmus Villemoes --- drivers/watchdog/gpio_wdt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index 0923201ce874..f812c39bc1e8 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -111,6 +112,7 @@ static int gpio_wdt_probe(struct platform_device *pdev) enum gpiod_flags gflags; unsigned int hw_margin; const char *algo; + struct clk *clk; int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -164,6 +166,13 @@ static int gpio_wdt_probe(struct platform_device *pdev) if (priv->always_running) gpio_wdt_start(&priv->wdd); + clk = devm_clk_get_optional(dev, "delay"); + if (IS_ERR(clk)) + return PTR_ERR(clk); + ret = devm_clk_prepare_enable(dev, clk); + if (ret) + return ret; + return devm_watchdog_register_device(dev, &priv->wdd); }