From patchwork Wed Oct 4 12:34:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 13408691 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 58969E7B605 for ; Wed, 4 Oct 2023 12:36:03 +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:MIME-Version: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:In-Reply-To:References: List-Owner; bh=63g3xJfYKH1uxqKUClGNo5c+7/+SvBkvlLfxK+9Ketc=; b=NUrXK/QAakFNi9 Qbn10QdK8h4sIi73VnkLAEBE3rkfcmGZjR8ZI3LiEWyJFLsK0QUqEV/xxCWCT/vus3vKiNl72JKtc yBP2oVmxOV8NN+ul/HuZhkkFoA6rSq9Z29iNY0iDAx8bXG/RRtCnx07NVJfy8z0367a64OiKaHzx8 AzH0a5HQ/OJh5nUBjVkTPhbaUO+GYjn5StEqW4sfV+WW+YBryKNhnUgPoowOGI284Xvnp+7/p9tMJ 446qSVyssA2xu3J4RZyvaFPhVVgzQD/stTkbAZEQI8nI5k1l7AZxnHd11ofiQEYGYU/EB6R3gAmSX vdjczu1lwTeC7ZnviXmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qo16B-00019G-1x; Wed, 04 Oct 2023 12:35:31 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qo166-00018g-1Z for linux-arm-kernel@lists.infradead.org; Wed, 04 Oct 2023 12:35:28 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-690f8e63777so479825b3a.0 for ; Wed, 04 Oct 2023 05:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696422921; x=1697027721; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5pIhEk6TIXWTRC7Pe7bfqLe0piZFrp1Th9jvIcny7Gk=; b=FVb6dk+R+a8fT2qnFXs48gZezI7POSLgFC86PjX/XZb5gIrbLaBamzzB9a5gG6Fybb louWP9U3BKfqPEP8LOGz1Hf35dOpRuajJMbVZBLmPPKsKlwLM9yBjA620mMktTzEDlsr XPDyJ4bemUKaj7wynRo9Qdi1ta6YqK7yBZyjG5zvFqctFqFa/jzUVrRi1LWKzJiTDC5Z jWS6nHNF4sbHEOX5C8scd97pvbaFez91/dLTRaZGrIPEk/4ttVk3nvDdK3ke1WWan/Yg C7BgxTWrTFvAACBz8QlLjYYRE/q04hYOcEtWEQefpsIFHr5sBK1SsDslu8o7SDMYE4/y 8hkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696422921; x=1697027721; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5pIhEk6TIXWTRC7Pe7bfqLe0piZFrp1Th9jvIcny7Gk=; b=NIDECWsM2DduI0PI3OsD8Dr7m+zftA8XtzO5WaWsTx5vSPQSTtL6aPZWmI35AhA7Yk Ao93Fldvcw3JbIqVbAR8hKwrwCYZ60ei1BIYOJEVFqZyhUmlP7kKCigjvGtOlGIS2edw M9ATlmZ/Vx/QhNvlisQalHmlgVy+S91JUeUn6CioUIdWfpS7ZSc/pTj8A8oKOnUCQtmA RrKaHGeYl64J18A/FQcaQUHBROb7k0V6ulHBTl3ETDmX4682YKbkFhnSbaCxQ5BL9ouD f2gEkGYjjCyGmII7rTuBn45POVwqpb7LGbgBgpbQVwl3mUvDlk2KfxD57WR9XtEPEIZf QzYg== X-Gm-Message-State: AOJu0YynH1PiokCVfaahFdL7B5fPCtVP2vQtfZaGFXmHvHsQmVo66nRI en/VhTbCxAgKQUN4ZLKUoo0= X-Google-Smtp-Source: AGHT+IHvJKpX4xhe5mzK66nCOVIvRp8Dgnyd1jVbM/5cK/1BG0Rc6rF/KvEzao3C8M/GgSrrWHul4A== X-Received: by 2002:a17:902:da87:b0:1c6:2902:24f9 with SMTP id j7-20020a170902da8700b001c6290224f9mr2484301plx.1.1696422921280; Wed, 04 Oct 2023 05:35:21 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b61:cb87:d6f:eb43:afca]) by smtp.gmail.com with ESMTPSA id o12-20020a170902778c00b001bdc8a5e96csm3575570pll.169.2023.10.04.05.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:35:20 -0700 (PDT) From: Fabio Estevam To: abelvesa@kernel.org Cc: peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Fabio Estevam , Abel Vesa Subject: [PATCH RESEND v4] clk: imx: imx6sx: Allow a different LCDIF1 clock parent Date: Wed, 4 Oct 2023 09:34:58 -0300 Message-Id: <20231004123458.2251635-1-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_053526_534726_6E465874 X-CRM114-Status: GOOD ( 13.99 ) 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 From: Fabio Estevam It is not a good idea to hardcode the LCDIF1 parent inside the clock driver because some users may want to use a different clock parent for LCDIF1. One of the reasons could be related to EMI tests. Remove the harcoded LCDIF1 parent when the LCDIF1 parent is described via devicetree. Old dtb's that do not describe the LCDIF1 parent via devicetree will use the same PLL5 clock as parent to keep the original behavior. Signed-off-by: Fabio Estevam Reviewed-by: Abel Vesa --- Changes since v3: - Check for the presence of 'assigned-clock-parents'. (Stephen) drivers/clk/imx/clk-imx6sx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c index 3f1502933e59..69f8f6f9ca49 100644 --- a/drivers/clk/imx/clk-imx6sx.c +++ b/drivers/clk/imx/clk-imx6sx.c @@ -121,6 +121,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node) { struct device_node *np; void __iomem *base; + bool lcdif1_assigned_clk; clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, IMX6SX_CLK_CLK_END), GFP_KERNEL); @@ -498,9 +499,16 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node) clk_set_parent(hws[IMX6SX_CLK_EIM_SLOW_SEL]->clk, hws[IMX6SX_CLK_PLL2_PFD2]->clk); clk_set_rate(hws[IMX6SX_CLK_EIM_SLOW]->clk, 132000000); - /* set parent clock for LCDIF1 pixel clock */ - clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk, hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk); - clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk, hws[IMX6SX_CLK_LCDIF1_PODF]->clk); + np = of_find_node_by_path("/soc/bus@2200000/spba-bus@2240000/lcdif@2220000"); + lcdif1_assigned_clk = of_find_property(np, "assigned-clock-parents", NULL); + + /* Set parent clock for LCDIF1 pixel clock if not done via devicetree */ + if (!lcdif1_assigned_clk) { + clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk, + hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk); + clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk, + hws[IMX6SX_CLK_LCDIF1_PODF]->clk); + } /* Set the parent clks of PCIe lvds1 and pcie_axi to be pcie ref, axi */ if (clk_set_parent(hws[IMX6SX_CLK_LVDS1_SEL]->clk, hws[IMX6SX_CLK_PCIE_REF_125M]->clk))