From patchwork Thu Oct 28 17:23:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12590649 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C38AAC433F5 for ; Thu, 28 Oct 2021 17:25:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95F79611AD for ; Thu, 28 Oct 2021 17:25:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 95F79611AD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FecjTkta4bZpLXGEI4gFBf/mnK50B/Mc7hasb1KGQhA=; b=G81pW89L9TO4zx a4Pcol9sWQhioLm8HV7KZMB+996QlH28fPAx+xkSVxcObS4h+GLsEZQlsqdNo6fho4FmLDQmx89jk YeO2C07u3tmkPB0RHfNBPRlYLW1KyQUXtydBBCsWu5Cx0SXuWYF0N9IntO6MDGZM++AQCZsNZcLqm BjYo/pxb6siUDVGuQ0uro7SslCxOV7bemDNZ2VyxDGxfwSdpIZPVBDHbv0WYiJJc0oUPW2yNv5VQa SgUnm07ED46/tLaH2TDqQTq4VCBYWOMO7OsTrB5H11vjttcJBBsyt9Zm6Lf9+Tf0dcloxeWDZ16GO 5LugtMrD2r6qOPfWAWNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg98N-008j5C-48; Thu, 28 Oct 2021 17:24:11 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg97h-008iqv-RI for linux-arm-kernel@lists.infradead.org; Thu, 28 Oct 2021 17:23:31 +0000 Received: by mail-pl1-x629.google.com with SMTP id v20so4909812plo.7 for ; Thu, 28 Oct 2021 10:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2RKkDNLdJnq4A2BSmMNFHi7ZNvXEVLrWpln1RnpbQ84=; b=mIjYJzIRfft82DhqEGECkDX9LHm4NnbWhsG1fGHgoS0f7ms33Z87vnyKI5uM0AI5Zp 82p+ftxZu9RkcE/+mqqvxXJcjEwsPEs8geF/mHglBfgnNma6yIj95VW2iPMo7bi8H4Gl aK3NCLTprmeLGZDkom9Dv+6iUJ4mrkKxgi+uROdbCjHDjxDRqsSemsxn6vgnsEN6ZHAy 2g0n3QAYsFsJvWHGFUFoI0SB+LALYhf2islf7tNaBqF1/Lk2/MN+kM9ZdOqWdRf0luyX pToJfIJAsuCNZcm+lgoReySHpHk+0S6GUhhblvquVpX6lIhwB0LcUa7GGi0mxWaJ91uU 4WSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2RKkDNLdJnq4A2BSmMNFHi7ZNvXEVLrWpln1RnpbQ84=; b=G0NXTYHBcciSI7/xz3AdphD5Qt0tz9umW7kVBV0H4cYO09cccn/NYsTyxmR/WE+scJ dWq2djWHPv9swBIMmlJsmdUh2TdpOa6PySprVBnNt2i4OsvE0OrFLWtKha61d687msc8 ENPDUbOd82ofz/TmWxgt6JHGhj6JmtDZGNEc+s90Dq/FaZEKrKpQLqGoztJknOgzWxce HGZiQVjzD1/l6CxGbPXiW9QoK5viNUKOkhFuNdtDgcWayT+jWybWsh+8fhLp1NDmoR7T Fj3k4egh31bjDm+U20ZyX34lMaZ6MFshuflsszG06mNkte3f5gYKzp18+1XlbKTZO7rx H6HQ== X-Gm-Message-State: AOAM531+6qiYVXa2m4KAJ15EHZkEiVBMpCTo/IgHWtne7UUrBILE3xoI fo9wZmXgSAoZHloYDuUakknzmKQxw3w= X-Google-Smtp-Source: ABdhPJwHjhoDxNVqfzSn3yRcRis3LwJ3IG+q6WQL9QaTHeha9ltR+mN/A6imgl6Cv9Zj67of4VoXjg== X-Received: by 2002:a17:903:24c:b0:13f:2377:ef3a with SMTP id j12-20020a170903024c00b0013f2377ef3amr5157648plh.59.1635441809012; Thu, 28 Oct 2021 10:23:29 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l20sm3222499pgo.67.2021.10.28.10.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 10:23:28 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: rafal@milecki.pl, Florian Fainelli , Wim Van Sebroeck , Guenter Roeck , Rob Herring , Thomas Bogendoerfer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM BCM63XX ARM ARCHITECTURE), Justin Chen , linux-watchdog@vger.kernel.org (open list:WATCHDOG DEVICE DRIVERS), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-mips@vger.kernel.org (open list:MIPS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM63XX ARM ARCHITECTURE) Subject: [PATCH 3/7] watchdog: bcm7038_wdt: Support platform data configuration Date: Thu, 28 Oct 2021 10:23:18 -0700 Message-Id: <20211028172322.4021440-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028172322.4021440-1-f.fainelli@gmail.com> References: <20211028172322.4021440-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_102329_956167_C7C0B6B7 X-CRM114-Status: GOOD ( 21.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The BCM7038 watchdog driver needs to be able to obtain a specific clock name on BCM63xx platforms which is the "periph" clock ticking at 50MHz. make it possible to specify the clock name to obtain via platform data. Signed-off-by: Florian Fainelli Reviewed-by: Guenter Roeck --- drivers/watchdog/bcm7038_wdt.c | 8 +++++++- include/linux/platform_data/bcm7038_wdt.h | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 include/linux/platform_data/bcm7038_wdt.h diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c index acaaa0005d5b..506cd7ef9c77 100644 --- a/drivers/watchdog/bcm7038_wdt.c +++ b/drivers/watchdog/bcm7038_wdt.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -133,8 +134,10 @@ static void bcm7038_clk_disable_unprepare(void *data) static int bcm7038_wdt_probe(struct platform_device *pdev) { + struct bcm7038_wdt_platform_data *pdata = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct bcm7038_watchdog *wdt; + const char *clk_name = NULL; int err; wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); @@ -147,7 +150,10 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) if (IS_ERR(wdt->base)) return PTR_ERR(wdt->base); - wdt->clk = devm_clk_get(dev, NULL); + if (pdata && pdata->clk_name) + clk_name = pdata->clk_name; + + wdt->clk = devm_clk_get(dev, clk_name); /* If unable to get clock, use default frequency */ if (!IS_ERR(wdt->clk)) { err = clk_prepare_enable(wdt->clk); diff --git a/include/linux/platform_data/bcm7038_wdt.h b/include/linux/platform_data/bcm7038_wdt.h new file mode 100644 index 000000000000..e18cfd9ec8f9 --- /dev/null +++ b/include/linux/platform_data/bcm7038_wdt.h @@ -0,0 +1,8 @@ +#ifndef __BCM7038_WDT_PDATA_H +#define __BCM7038_WDT_PDATA_H + +struct bcm7038_wdt_platform_data { + const char *clk_name; +}; + +#endif /* __BCM7038_WDT_PDATA_H */