Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1407132imp; Fri, 22 Feb 2019 02:56:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IaEZ+b7J1h1eVKXZJBmnZ4Kce7jOb0ZJlYlcCxqBduJLEd9Jx+XPh74kGrfU6MZ5lmVhX4E X-Received: by 2002:a62:e216:: with SMTP id a22mr3612796pfi.20.1550832964880; Fri, 22 Feb 2019 02:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550832964; cv=none; d=google.com; s=arc-20160816; b=bW+4Tib3vswTGv68/V+UwJJx9p5nDJxpiBeleQ98iKankvoCFGJyl/OdusMUz+yRK4 cqETL4xxgBww+MUATDoNvJZ180sPAx8LdPvLJODpqlgCuGJNb1obKnMqYrRtluOQieYl ujSrLTmI4prPz9d2YXP3gOyBUG5KKoWED0R7dVZLAOCRqoLQnFWyscsN1labbm1RetX2 ss6HojaWsP59JV2/GhNxtH6DKCWYfBUkGXM2muYxCLSWmnJ8JjJGvTa3riLipVCmJdIU i65cB3xJHhpgfAqAEkXLrX0pVFIUnSJz0SP1A7gtFeTXr+FigbcyoY+MgJ3BcDIw3TID yyoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=uV2HsAamloKaeqFODbDI/OzuwQ7jL0MV4Hw4xYoZk5A=; b=CJ52yBn1HSDs092XrM4XMSRS7uYf21y579DxBKaVfeaKC/LXYhNLogPo70vQHCfceq qf+pW5XnHrW9lm8n4alVhi/+4zwF/80YcGA0qnzSZvY1nTLqhbxMQTbyc9NAyHgq+Oje QRaeZAc3txP849dYROmUml41EZssY0tThoiu08q4nGV1xs1ZpwGQnnJCRbqXPcnsbcvZ 73tO9Y3dBQ2aIuWaEGOCP1nTwSwRYN05rwPqCY1fiUtOLRzboI9t00ZipDoxYaeLNJNo 5ShY55ygWKGjLSz4kmblI++JP12beseMhEitL1ri6vYR6rhsUuDNJCEcHJa5/snGO7oY 4Apw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si1060943plo.212.2019.02.22.02.55.49; Fri, 22 Feb 2019 02:56:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726532AbfBVKzB (ORCPT + 99 others); Fri, 22 Feb 2019 05:55:01 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:52913 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfBVKzB (ORCPT ); Fri, 22 Feb 2019 05:55:01 -0500 Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=localhost) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gx8Tk-0000oK-0I; Fri, 22 Feb 2019 11:54:52 +0100 Message-ID: <66e1685e5cc3fdcaba6ab55b3d030628c37ef8e2.camel@pengutronix.de> Subject: Re: [PATCH 1/3] clk: imx8mq: initialize clock tree earlier From: Lucas Stach To: Anson Huang , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "mturquette@baylibre.com" , "sboyd@kernel.org" , Abel Vesa , "ccaione@baylibre.com" , "agx@sigxcpu.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-clk@vger.kernel.org" Cc: dl-linux-imx Date: Fri, 22 Feb 2019 11:54:47 +0100 In-Reply-To: <1550828264-9962-1-git-send-email-Anson.Huang@nxp.com> References: <1550828264-9962-1-git-send-email-Anson.Huang@nxp.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Freitag, den 22.02.2019, 09:42 +0000 schrieb Anson Huang: > Currently on i.MX8MQ platform, clock driver is probed > later than GPIO driver, and GPIO driver does NOT have > defer probe mechanism since the GPIO clock is optional, So this is what should be fixed. If there is a clock reference in the DT, having the clock driver ready is not optional. Optional to the GPIO driver just means it won't fail if there is no clock reference at all. If there is and the clock provider is not yet there, it needs to do a PROBE_DEFER. So that's a NACK on this patch. Regards, Lucas > some platforms have GPIO clocks and some are NOT. So > it is an issue that on i.MX8MQ platform, there are GPIO > clocks defined, but due to clock tree is NOT ready during > GPIO driver probe, the GPIO clock management will fail > and cause system hang if GPIO clocks are OFF by default. > > This patch changes the i.MX8MQ clock tree initialization > using CLK_OF_DECLARE instead of platform driver model to > make clock tree ready earlier than GPIO driver. > > Signed-off-by: Anson Huang > --- > drivers/clk/imx/clk-imx8mq.c | 33 +++++++-------------------------- > 1 file changed, 7 insertions(+), 26 deletions(-) > > diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk- > imx8mq.c > index 26b57f4..2df1575 100644 > --- a/drivers/clk/imx/clk-imx8mq.c > +++ b/drivers/clk/imx/clk-imx8mq.c > @@ -269,10 +269,9 @@ static const char *imx8mq_clko2_sels[] = > {"osc_25m", "sys2_pll_200m", "sys1_pll_ > > static struct clk_onecell_data clk_data; > > -static int imx8mq_clocks_probe(struct platform_device *pdev) > +static void __init imx8mq_clocks_init(struct device_node *np) > { > - struct device *dev = &pdev->dev; > - struct device_node *np = dev->of_node; > + struct device_node *anatop_np; > void __iomem *base; > int err; > int i; > @@ -286,10 +285,10 @@ static int imx8mq_clocks_probe(struct > platform_device *pdev) > clks[IMX8MQ_CLK_EXT3] = of_clk_get_by_name(np, "clk_ext3"); > clks[IMX8MQ_CLK_EXT4] = of_clk_get_by_name(np, "clk_ext4"); > > - np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-anatop"); > - base = of_iomap(np, 0); > + anatop_np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq- > anatop"); > + base = of_iomap(anatop_np, 0); > if (WARN_ON(!base)) > - return -ENOMEM; > + return; > > clks[IMX8MQ_ARM_PLL_REF_SEL] = imx_clk_mux("arm_pll_ref_sel", > base + 0x28, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)); > clks[IMX8MQ_GPU_PLL_REF_SEL] = imx_clk_mux("gpu_pll_ref_sel", > base + 0x18, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)); > @@ -389,10 +388,9 @@ static int imx8mq_clocks_probe(struct > platform_device *pdev) > clks[IMX8MQ_SYS2_PLL_500M] = > imx_clk_fixed_factor("sys2_pll_500m", "sys2_pll_out", 1, 2); > clks[IMX8MQ_SYS2_PLL_1000M] = > imx_clk_fixed_factor("sys2_pll_1000m", "sys2_pll_out", 1, 1); > > - np = dev->of_node; > base = of_iomap(np, 0); > if (WARN_ON(!base)) > - return -ENOMEM; > + return; > > /* CORE */ > clks[IMX8MQ_CLK_A53_SRC] = imx_clk_mux2("arm_a53_src", base + > 0x8000, 24, 3, imx8mq_a53_sels, ARRAY_SIZE(imx8mq_a53_sels)); > @@ -568,22 +566,5 @@ static int imx8mq_clocks_probe(struct > platform_device *pdev) > > err = of_clk_add_provider(np, of_clk_src_onecell_get, > &clk_data); > WARN_ON(err); > - > - return err; > } > - > -static const struct of_device_id imx8mq_clk_of_match[] = { > - { .compatible = "fsl,imx8mq-ccm" }, > - { /* Sentinel */ }, > -}; > -MODULE_DEVICE_TABLE(of, imx8mq_clk_of_match); > - > - > -static struct platform_driver imx8mq_clk_driver = { > - .probe = imx8mq_clocks_probe, > - .driver = { > - .name = "imx8mq-ccm", > - .of_match_table = of_match_ptr(imx8mq_clk_of_match), > - }, > -}; > -module_platform_driver(imx8mq_clk_driver); > +CLK_OF_DECLARE(imx8mq, "fsl,imx8mq-ccm", imx8mq_clocks_init);