From patchwork Sat Jul 2 18:46:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9211009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B86ED607D6 for ; Sat, 2 Jul 2016 18:48:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A629E284FC for ; Sat, 2 Jul 2016 18:48:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A23A28577; Sat, 2 Jul 2016 18:48:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 271E9284FC for ; Sat, 2 Jul 2016 18:48:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bJPwG-0002pG-Hp; Sat, 02 Jul 2016 18:46:48 +0000 Received: from mail.kmu-office.ch ([178.209.48.109]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bJPwD-0002lJ-Er for linux-arm-kernel@lists.infradead.org; Sat, 02 Jul 2016 18:46:46 +0000 Received: from trochilidae.lan (unknown [IPv6:2601:602:8802:504f:3e97:eff:fe92:db3b]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 80C225C02C9; Sat, 2 Jul 2016 20:42:52 +0200 (CEST) From: Stefan Agner To: aisheng.dong@nxp.com, shawnguo@kernel.org, kernel@pengutronix.de Subject: [PATCH] clk: imx7d: do not set parent of ethernet time clocks Date: Sat, 2 Jul 2016 11:46:08 -0700 Message-Id: <20160702184608.24462-1-stefan@agner.ch> X-Mailer: git-send-email 2.9.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1467484974; bh=RpicCXHH0zz/1u6U7yZS+ieDQXvaoMgI8GK9XVWzOjM=; h=From:To:Cc:Subject:Date:Message-Id; b=oieK36B7ibptYSN0afYjsctf/wZ2rILAnvefJg43L4IvSzVSoSh1gl7zX9E3yZEGmw1TLtR4VRq4zKYvT6gnGxt08uaNE+So5m0NbvKLU0nkW06pP0G0aSttkJijgj336hZPbhOOs/clKZ96xPfVCrGf1IhR/RhLO343/CAcspY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160702_114645_671716_DCF87499 X-CRM114-Status: GOOD ( 15.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mturquette@baylibre.com, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP All device trees currently in mainline specify the time clock parent using the assigned-clocks/assigned-clock-parents method, there is no need to statically assign the parent in the core clock driver. Furthermore, and the actual driver of this patch, specify parents at that early point in boot leads to a warning: bad: scheduling from the idle thread! The reason for the warning is that setting the parent enables the ENET PLL since we are using CLK_OPS_PARENT_ENABLE. Enabling the ENET PLL can cause clk_pllv3_wait_lock to sleep. See also: commit fc8726a2c021 ("clk: core: support clocks which requires parents enable (part 2)"). Note that setting the ENET AXI root clock parent (two lines above this change) also requires ENET PLL to be enabled. However, U-Boot typically leaves the ENET PLL on, hence when the framework sets the parent of the first clock, it does not need to wait for the PLL to come up. But because there is currently no user of that clock, the PLL gets disabled after setting the parent. Therefore, subsequent reparenting calls of any clock which somehow rely on the ENET PLL, need to reenable the ENET PLL which leads to a sleep. Removing those subsequent reparenting calls works around this issue. Signed-off-by: Stefan Agner --- Hi Dong, What do you think about this change? I really think there is no need to set the ethernet time roots here, and it would solve the problem for now. Also, we could move the other two parent assignments of ethernet clocks to the device tree. I see it is a bit more problematic because they are shared between the two instances. It begs the question: where would we put them. I would just put them in both ethernet instances. Of course, if they have conflicting settings, we end up in a race condition which parent would actually be used in the end... But IMHO, such a device tree would just be a buggy dt... -- Stefan drivers/clk/imx/clk-imx7d.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c index 79293ed..9bf6282 100644 --- a/drivers/clk/imx/clk-imx7d.c +++ b/drivers/clk/imx/clk-imx7d.c @@ -864,12 +864,9 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) * init enet clock source: * AXI clock source is 250MHz * Phy refrence clock is 25MHz - * 1588 time clock source is 100MHz */ clk_set_parent(clks[IMX7D_ENET_AXI_ROOT_SRC], clks[IMX7D_PLL_ENET_MAIN_250M_CLK]); clk_set_parent(clks[IMX7D_ENET_PHY_REF_ROOT_SRC], clks[IMX7D_PLL_ENET_MAIN_25M_CLK]); - clk_set_parent(clks[IMX7D_ENET1_TIME_ROOT_SRC], clks[IMX7D_PLL_ENET_MAIN_100M_CLK]); - clk_set_parent(clks[IMX7D_ENET2_TIME_ROOT_SRC], clks[IMX7D_PLL_ENET_MAIN_100M_CLK]); /* set uart module clock's parent clock source that must be great then 80MHz */ clk_set_parent(clks[IMX7D_UART1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]);