From patchwork Fri Nov 5 15:42:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12604933 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 3C3A0C433F5 for ; Fri, 5 Nov 2021 15:44:48 +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 EEDA861252 for ; Fri, 5 Nov 2021 15:44:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EEDA861252 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=dtqAQcv1rjIfu9 /NqjkwtuTKMDJOmphLhqsV12llD2eXhpl3K0BjgxXWVQEsysWZy9q/Ir10gsgXMWOfVawz3/4XNhY Uubcj6eM/NFSPBhsmQbSWA+CChe9wM7qm0VRQ8d4X4aivjA2FjNN+fgQZPOUSLLpL/UtY1Ltb7OM0 CDJcH8R1Rm2UbVcdCf+kyvhGqvPFppPqZ12OkIGuwQa2Mtrs0Xtrv8l6fnkUq5HXYXQ5xFJrH+Jen q1Ew9+56YEOhxHveKXDbL3hukYBEac42PqSSdPai1NlkFpDyRcEg8/Nv0GXBfjvjG9gYH5Gm1Q3UY bXG7F+IhhKw3ioO3tQaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mj1Mx-00BlSY-2F; Fri, 05 Nov 2021 15:43:07 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mj1MA-00BlB5-74 for linux-arm-kernel@lists.infradead.org; Fri, 05 Nov 2021 15:42:19 +0000 Received: by mail-pg1-x536.google.com with SMTP id q126so4757897pgq.13 for ; Fri, 05 Nov 2021 08:42:17 -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=KS/QFIB9iRAFf7dtvYUgDKvUDEV07sqKABKwHV353E8=; b=JoVkkcDwILwUiocAfNN7cj2sO19IjA2XBxqfzYB87vvIvITa39tkTepB/7nZAEVxGq liMEvAaTYX8Mj+SZqda9YfhioUih5VcEQkuEOfs3ECUR+ZfdIFoNtQWQVnEOGUgTF79K 2kY5kUrYvK6bDlIVQEdWAlBMh2VC0g38R0zqBGSi4SdcDTom9W9DAYEjQPU8r4mIPZtQ J3GY9zpi1RSg8KluP6FGF/ww50iuORMMH5l1NPyLOKeCuLnaHHOfVrklt9zVnrjFzmBc wzKOFq0zR/vCofN4Oxoa/SHRFUbkW34jivQrNomPjZuQdhNHQpNfh0/mWcMzCaIuYJ9P 5qhg== 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=ghPorxsp7m9SpQK8LFklgIGZ+LYfTfw2eG0moHzz0aU+NshdfZ1c2lqreP3TMEd14r Y/D69JmsW9i8aQlh9gWFKptF75CvgEMHfkpjH+HQcNlTX6P7rqY0xB3VhXABUmM7s+Hm d2UO1ZdePF2SOrrRzVUqHPk73cVMb/kmB6wsmkqxlyXxDGVdywaWWrJQa2LV45NuiV0H oUgSwKocoqPP1gRFqF65R3slGe+cCLde89ph6AdoAJAODJcGR/2bxfzyMdGiD+lP+bJb G/DIM4KjOUCtsWL6xUGwv2MIXJJU6ToI+XHyWc+saZ2/H7/+xgariXkVHPjstsbDV2sn 1rHQ== X-Gm-Message-State: AOAM532wxEL9/5FQERmY940d9Wssxh+TfLw1vAcubqA1GM+W4KdFtbcv raLEm2zp6QB5I04M+UATjpk= X-Google-Smtp-Source: ABdhPJwrEy/mXd3F+6ZsSqC0bKKGMmeEjHrZI+54vC9BIZ8bVwKr38+xbqen8ZrgaWENlv4RLwt/RQ== X-Received: by 2002:a63:86c1:: with SMTP id x184mr35817576pgd.114.1636126937333; Fri, 05 Nov 2021 08:42:17 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b8sm7547097pfi.103.2021.11.05.08.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Nov 2021 08:42:16 -0700 (PDT) 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 v4 3/7] watchdog: bcm7038_wdt: Support platform data configuration Date: Fri, 5 Nov 2021 08:42:04 -0700 Message-Id: <20211105154208.614260-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211105154208.614260-1-f.fainelli@gmail.com> References: <20211105154208.614260-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-20211105_084218_315206_FCFC3C0E X-CRM114-Status: GOOD ( 21.70 ) 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 */