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 05B77C4828D for ; Tue, 6 Feb 2024 13:14:44 +0000 (UTC) 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N9KJgLgjKSRA5IV4Mue3kpfXlajNjHIcu6+fLjQB938=; b=u39R5A7g7aYhCw VRa/yGmVsKXikbIVWsHRKG407ujubf4u8yOzGO/wIw0qvyocxL2QDb2EZLI5KpQ000iKoNIvT/x1M CFuF9LP8ZEgQz6xCp/ydp7EqHPZ4Pl2ss098kOUBgGbvvZXHBSDJyNHoH36Stj1WKb5yk41DkP0lZ Q6bGjXegGyadJ6WVFKI4U8hHO6WZ/B3e3Tc3FsMBG5xAP8YKumyFoRYmIWBcnNlSTGDFT7Tah1oHO CuaHwvUMaMsmhJUaBwx1Q3u78OlJnWeI4Gzi6Wl65KF+bhmTWdHfjKMIi2hyI/ubqcD6NRDLl8iHK ObEpQllQMKowxPC7jE0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXLHX-00000007gPZ-2Ykn; Tue, 06 Feb 2024 13:14:35 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXLHU-00000007gO9-40t4 for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2024 13:14:34 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 416DELra027646; Tue, 6 Feb 2024 07:14:21 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707225261; bh=7f11SCnakUG398AkJtCBBbS5GxwKNqEGvbb0NtIfvmA=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=qEm0iTkcYnHherRxcYhyQQcUMD67w+Q9L+rM8q02lWxk5QnDSjRmchoq7OhN6LEp3 tWNFhLsL2jyh23k6iSxBzgZHoRJLgXHCOWNCge0H8sOqnrMbbF6OA3DbAe69CodqZz ui+qyuI1XNv+4QP94qJTDtQOZR9QFniz/waEbuK4= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 416DEKlN018551 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Feb 2024 07:14:21 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 6 Feb 2024 07:14:20 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 6 Feb 2024 07:14:20 -0600 Received: from localhost (uda0133052.dhcp.ti.com [128.247.81.232]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 416DEKqn036857; Tue, 6 Feb 2024 07:14:20 -0600 Date: Tue, 6 Feb 2024 07:14:20 -0600 From: Nishanth Menon To: Udit Kumar CC: , , , , , , , , , Subject: Re: [PATCH v2] clk: keystone: sci-clk: Adding support for non contiguous clocks Message-ID: <20240206131420.wtitflgav23jto2q@verbally> References: <20240206104357.3803517-1-u-kumar1@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240206104357.3803517-1-u-kumar1@ti.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_051433_105602_C029C856 X-CRM114-Status: GOOD ( 23.07 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 16:13-20240206, Udit Kumar wrote: > Most of clocks and their parents are defined in contiguous range, > But in few cases, there is gap in clock numbers[0]. > Driver assumes clocks to be in contiguous range, and add their clock > ids incrementally. > > New firmware started returning error while calling get_freq and is_on > API for non-available clock ids. > > In this fix, driver checks and adds only valid clock ids. > > Fixes: 3c13933c6033 ("clk: keystone: sci-clk: add support for dynamically probing clocks") > > [0] https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j7200/clocks.html > Section Clocks for NAVSS0_CPTS_0 Device, > clock id 12-15 not present. > > Signed-off-by: Udit Kumar > --- > Changelog > > Changes in v2 > - Updated commit message > - Simplified logic for valid clock id > link to v1 https://lore.kernel.org/all/20240205044557.3340848-1-u-kumar1@ti.com/ > > > P.S > Firmawre returns total num_parents count including non available ids. > For above device id NAVSS0_CPTS_0, number of parents clocks are 16 > i.e from id 2 to 17. But out of these ids few are not valid. > So driver adds only valid clock ids out ot total. > > Original logs > https://gist.github.com/uditkumarti/de4b36b21247fb36725ad909ce4812f6#file-original-logs > Line 2630 for error > > Logs with fix v2 > https://gist.github.com/uditkumarti/94e3e28d62282fd708dbfe37435ce1d9 > Line 2591 > > > drivers/clk/keystone/sci-clk.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c > index 35fe197dd303..ff249cbd54a1 100644 > --- a/drivers/clk/keystone/sci-clk.c > +++ b/drivers/clk/keystone/sci-clk.c > @@ -517,6 +517,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) > int num_clks = 0; > int num_parents; > int clk_id; > + u64 freq; > const char * const clk_names[] = { > "clocks", "assigned-clocks", "assigned-clock-parents", NULL > }; > @@ -586,16 +587,23 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) > clk_id = args.args[1] + 1; > > while (num_parents--) { > + /* Check if this clock id is valid */ > + ret = provider->ops->get_freq(provider->sci, > + sci_clk->dev_id, clk_id, &freq); get_freq is a bit expensive as it has to walk the clock tree to find the clock frequency (at least the first time?). just wondering if there is lighter alternative here? > + > + clk_id++; > + if (ret) > + continue; > + > sci_clk = devm_kzalloc(dev, > sizeof(*sci_clk), > GFP_KERNEL); > if (!sci_clk) > return -ENOMEM; > sci_clk->dev_id = args.args[0]; > - sci_clk->clk_id = clk_id++; > + sci_clk->clk_id = clk_id - 1; > sci_clk->provider = provider; > list_add_tail(&sci_clk->node, &clks); > - Spurious change. > num_clks++; > } > } > -- > 2.34.1 > -- Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel