From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A6BA9C3DA63 for ; Tue, 23 Jul 2024 23:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:To:Cc:From:Subject: References:In-Reply-To:Content-Transfer-Encoding:MIME-Version:Content-Type: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z9AV1yvKMubMSciHoxZQesjepKDsX0Mijl749Mg2EF8=; b=4BXAdX/FbBilOXSf6bg1ltU1Wx K/Ehw/wVBlgVGvlxn2MXEe/D0k2ttrF2SbifajTCyyv1LXsIQylLbz5T1RDTahR8pgXnCmra984aw JZYxaf/NCPfpndXtZoI6qOJza0QG0sstcssF9LF4MVD3s4aHnLGzO//okYjhHN+NfKShARWXIAA8B zhtvnvHjayCTHHQA9u6YKwSe/e8WsI1R3jQbqt47eZcw5kNxwlnb/EWiCd2HEJPZdbkNgNppGYVwf 4m12R4JuL4/AhmIyayvMzxPPLLRltXt8NnJk8yy/3rTOyn2XHxHrML0199b5DreymTnMmsrV7vmIP Ap+kE0qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWOxX-0000000DnPm-0huJ; Tue, 23 Jul 2024 23:30:19 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWOx9-0000000DnGQ-1AuD for linux-arm-kernel@lists.infradead.org; Tue, 23 Jul 2024 23:29:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5705260F72; Tue, 23 Jul 2024 23:29:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9694C4AF09; Tue, 23 Jul 2024 23:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721777394; bh=Tm9Wg4ZYS3BsEa6Y5aXqKa97xN1rGipxkXVPFSQTkWQ=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=P3yvualILhDdNmqGdpBTQFFuhBysGCft6KZ3Quq9gft47GW1p4JEOfBnPtrTPdljv 62CBE5z/NBOEW1CTWT7iCqEVzwkPEI4kuDeMhMGDYU8NMf2A5fPvfj4T3xlSVJgusR 19eM3gEaAoFuaHCI+Yal6FwnSivXjNWGtsCvmxVGpa8KzvBQb9pMBmIAtsI8aOXz/g n4d8KrXVTMJMB/QRXS6Mpw6kPRumXJ6CJvKtomAQtUsB282vDfA0kLXu4ZxsFkny3h qUWcg9Gvh/GBATnwPv308a3mkyKMqNYL05LiKm21A6TM4tARBYmMBNiFh4UeKMbhC+ Q4yT3Fu7jxqhA== Message-ID: <1cacce63c7263a3532cca148ad2c567f.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240720120048.36758-6-hpausten@protonmail.com> References: <20240720120048.36758-1-hpausten@protonmail.com> <20240720120048.36758-6-hpausten@protonmail.com> Subject: Re: [PATCH 5/7] clk: clocking-wizard: add user clock monitor support From: Stephen Boyd Cc: Shubhrajyoti Datta , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Harry Austen To: Conor Dooley , Harry Austen , Krzysztof Kozlowski , Michael Turquette , Michal Simek , Rob Herring Date: Tue, 23 Jul 2024 16:29:51 -0700 User-Agent: alot/0.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240723_162955_422419_BFA7119F X-CRM114-Status: GOOD ( 22.37 ) 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 Quoting Harry Austen (2024-07-20 05:01:53) > Xilinx clocking wizard IP core supports monitoring of up to four > optional user clock inputs, with a corresponding interrupt for > notification in change of clock state (stop, underrun, overrun or > glitch). Give userspace access to this monitor logic through use of the > UIO framework. >=20 > Use presence of the user monitor interrupt description in devicetree to > indicate whether or not the UIO device should be registered. Also, this > functionality is only supported from v6.0 onwards, so add indication of > support to the device match data, in order to be tied to the utilised > compatible string. >=20 > Signed-off-by: Harry Austen > --- > diff --git a/drivers/clk/xilinx/Kconfig b/drivers/clk/xilinx/Kconfig > index 051756953558b..907a435694687 100644 > --- a/drivers/clk/xilinx/Kconfig > +++ b/drivers/clk/xilinx/Kconfig > @@ -21,6 +21,7 @@ config COMMON_CLK_XLNX_CLKWZRD > tristate "Xilinx Clocking Wizard" > depends on OF > depends on HAS_IOMEM > + depends on UIO If I have a pre-v6.0 device I probably don't want UIO though. Perhaps you should use the auxiliary bus framework to register a device that is otherwise unused and then have the uio driver live in drivers/uio and match that device made here. I think you can have 'imply UIO' if you like to put a weak Kconfig dependency. > help > Support for the Xilinx Clocking Wizard IP core clock generator. > Adds support for clocking wizard and compatible. > diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xil= inx/clk-xlnx-clock-wizard.c > index 7b262d73310fe..2d419e8ad4419 100644 > --- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c > +++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c > @@ -1165,6 +1209,17 @@ static int clk_wzrd_probe(struct platform_device *= pdev) > return -EINVAL; > } > =20 > + data =3D device_get_match_data(&pdev->dev); > + if (data && data->supports_monitor) { > + irq =3D platform_get_irq(pdev, 0); > + if (irq > 0) { > + ret =3D clk_wzrd_setup_monitor(&pdev->dev, irq, > + platform_get_resourc= e(pdev, IORESOURCE_IO, 0)); Any reason this can't be ret =3D clk_wzrd_setup_monitor(pdev); if (ret) return ret; and then all the surrounding code be moved into the function, including the dev_err_probe()? > + if (ret) > + return dev_err_probe(&pdev->dev, ret, "fa= iled to setup monitor\n"); > + } > + } > + > ret =3D of_property_read_u32(np, "xlnx,nr-outputs", &nr_outputs);