From patchwork Fri Nov 12 22:46:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12692459 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 1D76FC433F5 for ; Fri, 12 Nov 2021 22:52:30 +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 DDE1360E75 for ; Fri, 12 Nov 2021 22:52:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DDE1360E75 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=J1yWVFVVYQCXcpxwRei1qv82O3Ptbw6L32nCspLuSkw=; b=YulyNeCM7YRAgr Eym/UFA9zXOlqokN7f3uEC/k4pNZzjwRaei5w6qKsgXpvrt7Tqhk1Fdr/8NCC9D7ICzhkHsIdrDpI ykL2bmDYZtvqvzOkBv/epVf2mXx21t0AXpIyNxc46BfvRi1LR1VP/7J+axp1e7eErnRXOuK74Ur3a 5559ABQngfP4Km6pdIWCiXBM5ApNjk2XSM7n8Xk+7JiBS4yjc5h/HcMuduBuCqtWrKKlwMed6Zrtr 0LJJJwSI3cgJtS2Ag/XH3EvbI6F58fincJpiMvl/9Nt5G+Bx41MxrmdDSEQKbcmrl2qGJyHkrIwRZ t1PZRsiAXoxFnQejGRZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlfNd-00BpOk-Fq; Fri, 12 Nov 2021 22:50:46 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlfJk-00Bo1m-Fx for linux-arm-kernel@lists.infradead.org; Fri, 12 Nov 2021 22:46:46 +0000 Received: by mail-pj1-x102a.google.com with SMTP id np6-20020a17090b4c4600b001a90b011e06so7557064pjb.5 for ; Fri, 12 Nov 2021 14:46:43 -0800 (PST) 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=KS/QFIB9iRAFf7dtvYUgDKvUDEV07sqKABKwHV353E8=; b=BIyGn2he8gllDdl0etGy+C7nF7ouoa4payiBpYKO02FR92clorAeJyRlMuZ+vsVX3N vz9sWOo4jivx3CsPYWuWpuEz6Cu5TUDzgfo+F5KR97JWIaWeFvz8FvLzU3+W/KMq2BH+ EiSnPIpR+dALq/ewZXWf6h5I+It3CbAUbEG+YQCYbGzHW4hD164hhkkohG1z2WDu5XdO jKvWybiNzDMRiaUety1P7M9rlWeNxowMitDMYvUTwCthHa0+ch2c0ICxdYLlFs8LIWrF PvUgudb+P6bZ8yE1PZvcMX9p3WnMa+WxWv/X/djHRHjYot9IM1vSAeYaY1pJlMMx2Gk4 F3eg== 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=KS/QFIB9iRAFf7dtvYUgDKvUDEV07sqKABKwHV353E8=; b=ddOm+17i4M2SRTjHOUEchRdWb+tIWN73oeLSMnQ8+96HcX4z24gj8A5xHEWxQdqAGj 8ap24Xh15R0PCsGeNDABsN5H1O1bx93WdlRp0Wvf/xEuMyG4mIsdbfjGukxcxbQtppuZ XY/a1n1Ss9ssy7F5eT81TW/chDZvfBzVPmWXgMCnMhikeaDxZWPAhAwKUst5WcxXQFQ/ vHHDyJiilicWledOEHVahzOxDYXc+OzXsvKkQVa8fmVInLi38o2+U5WSSd9HEC3+zztl jEDXb05sv3opa2uULJF7Y1yAchJJ8K5uPQdZZ7Q6ajRvuCeHA/wjPFxra/D0C3CfGq1w R8yA== X-Gm-Message-State: AOAM532efoYnRuOMIvB2UHWg6IQfjTqFB/qfrMxCB7Ufsl31hnJPERxW dsZMMZs78/gF4QYCMMFZuhU= X-Google-Smtp-Source: ABdhPJxGsIhLDTyWc27klyD4bVPuwkTAn1EX/VDpKm9GtaZ5DqXbPZeWhXdx4UwrqhlS6IgCoAl5Wg== X-Received: by 2002:a17:902:9882:b0:143:91ca:ca6e with SMTP id s2-20020a170902988200b0014391caca6emr12127134plp.64.1636757203382; Fri, 12 Nov 2021 14:46:43 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id k14sm5647004pga.65.2021.11.12.14.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 14:46:42 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Guenter Roeck , Wim Van Sebroeck , 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 v5 3/7] watchdog: bcm7038_wdt: Support platform data configuration Date: Fri, 12 Nov 2021 14:46:32 -0800 Message-Id: <20211112224636.395101-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211112224636.395101-1-f.fainelli@gmail.com> References: <20211112224636.395101-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-20211112_144644_574004_B07A162C X-CRM114-Status: GOOD ( 21.08 ) 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. Reviewed-by: Guenter Roeck Signed-off-by: Florian Fainelli --- 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 */