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 4281FC4332F for ; Tue, 12 Dec 2023 22:54:57 +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=xr826x60VSjyg2zpBAEIIOUak1jMNMJZfELaOV3xn4o=; b=zi9s7pbWVdeD/E ZKPX9n+Twb6haQgXlRgDnUp9OKVgmFHfUcBFAXpqpku0qnNKkk2jE2EUfWlAUNsST18Be0RRQMwki BVRWwqL7N7PrjYg6G2G8g0TAf6pYYsbxNetAo4rFEaOYbcd0huooPy9yEGQ9qYt+IJ/uja1+FGDqC NY5avojlnt0+29MtgVcLk+hBfZTgBJT/Gp55WBBhd7/BSYnvE468yQg2y39y08qVrdtvdp/7E9EqR yzslhmgGTUG09YDI0b3uHR0nUe4yQxnz7BrkRbltthw4FfVqXP5gbTvUp1XJ81FnYl9hWYi/zwsUH oEvv7x6pHP77hhNbivUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDBe4-00Cy2L-1s; Tue, 12 Dec 2023 22:54:32 +0000 Received: from mail-oo1-f41.google.com ([209.85.161.41]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDBe1-00Cy1K-1a for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2023 22:54:30 +0000 Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5913922ab10so713230eaf.1 for ; Tue, 12 Dec 2023 14:54:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702421668; x=1703026468; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=m5NwUkIFVAwuS2EenXpIdBy2emTYtGW416XNOQPH6X4=; b=nq05HPDJ1BXxhv5mUheiwKmUWQu4FHol1YwDTQEFhltE3ZZN4UIccOn5EMXWV3a+nf oy4u7oe4ohSfGmU9wuMBshh7CA8lMEKR+/+Wp/aq86SWPoGSonGDvmYFv9DUHvL+9kDU 1+62dtsjHSxkfaYBvwxcUhSkhkPvztdhUrCfVdu+N8yVtEU7UQEKY4HUPsnAQlnb1xxa L9MWt7WfnWbkl0g6nZu9oLOmYgUG6a97Xc08sYSd1XHyHHAk7Fm0VnM1SlVwt4gH1Gn4 2+2FHe52dtsDJWpYFu83DRvNy1nSQTJvn7jiw1hahMe5N8dST5+EpMmRfYbC+SwihEFV Of1g== X-Gm-Message-State: AOJu0YxVn7HzXkrxgMaZsAj/EZd1Roh+cBVpB7CU3eJirGclJseHNu/q jal2NedFG8abioXmDTx9LlgAdHlXwQ== X-Google-Smtp-Source: AGHT+IFzLdaSyhioYEUVyZxgKPKO9o5dwpl0nsUD9DOjNA+IvyXXKGZuJpGQqD2LpMJvNefy/yZI9Q== X-Received: by 2002:a4a:ae86:0:b0:590:8d58:f70a with SMTP id u6-20020a4aae86000000b005908d58f70amr3603134oon.18.1702421668420; Tue, 12 Dec 2023 14:54:28 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id t9-20020a4a7609000000b0058d76e8ce0dsm2688293ooc.36.2023.12.12.14.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:54:27 -0800 (PST) Received: (nullmailer pid 2979434 invoked by uid 1000); Tue, 12 Dec 2023 22:54:26 -0000 Date: Tue, 12 Dec 2023 16:54:26 -0600 From: Rob Herring To: Manivannan Sadhasivam Cc: Frank Li , bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: Re: [PATCH v3 01/13] PCI: imx6: Simplify clock handling by using HAS_CLK_* bitmask Message-ID: <20231212225426.GB2948988-robh@kernel.org> References: <20231211215842.134823-1-Frank.Li@nxp.com> <20231211215842.134823-2-Frank.Li@nxp.com> <20231212164913.GA21240@thinkpad> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231212164913.GA21240@thinkpad> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231212_145429_532352_4AE547D1 X-CRM114-Status: GOOD ( 20.79 ) 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 Tue, Dec 12, 2023 at 10:19:13PM +0530, Manivannan Sadhasivam wrote: > On Mon, Dec 11, 2023 at 04:58:30PM -0500, Frank Li wrote: > > Refactors the clock handling logic in the imx6 PCI driver by adding > > HAS_CLK_* bitmask define for drvdata::flags . Simplifies the code and makes > > it more maintainable, as future additions of SOC support will only require > > straightforward changes. The drvdata::flags and a bitmask ensures a cleaner > > and more scalable switch-case structure for handling clocks. > > > > Is there any necessity to validate each clock in the driver? I mean, can't you > just rely on devicetree to provide enough clocks for the functioning of the PCIe > controller? > > If you can rely on devicetree (everyone should in an ideal world), then you can > just use devm_clk_bulk_get_all() to get all available clocks for the SoC and > just enable/disable whatever is available. Or just use the *_get_optional() variants of functions. They return NULL such that subsequent calls are just NOPs if the resource is not present. Of course, they aren't really optional on any given platform in this case, but does that really matter. There isn't an optional variant for phys, but it can be added. > > This will greatly simplify the code. > > Only downside of this approach is, if the devicetree is not supplying enough > clocks, then it will be difficult to find why PCIe is not working. But this also > means that the devicetree is screwed. A sufficient schema should prevent that... That's what they're for, not just torturing people to learn json-schema. :) Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel