From patchwork Wed Jul 24 03:06:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 11055635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66EAD746 for ; Wed, 24 Jul 2019 03:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54B2128761 for ; Wed, 24 Jul 2019 03:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 491AF28780; Wed, 24 Jul 2019 03:15:40 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA8C528761 for ; Wed, 24 Jul 2019 03:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=r73+JTj5QtKjENet4YXIJ9W+PM8YJOz8FkkzXkRYmlM=; b=Ez2 EotwbmEN0Sax9pSoHmZZAp2bMc6WoM8cKA8gHnhW7Gk3AbtEvSFLnZrt/2HBwZcFJke/ejvaKhlXV YsssliGH628PUbTKyuaixg7apMvT+z+uOosShjv4OZax2tZJcXxlnECg7juPl3XPsFvpzDhYAzwN5 Wip4KsFzJ8/ZX27IzoDRdd+LU5mjENF80UKO1AaUewsRNTVCxGIFpueXbetgqMa56NL8ASgx8LJHx P/8cCnpjQU3apFTGFTRAW9ZtPjKNdNHA0oCGgTE+Tcy8YkPiTZLHp8vnZlDSs2q27KnC/2T0dokeg klGxPq8EwhhXm/TNu8vXLMPApu3hZqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hq7kh-0006TY-G6; Wed, 24 Jul 2019 03:15:39 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hq7kd-0006Sw-MU for linux-arm-kernel@lists.infradead.org; Wed, 24 Jul 2019 03:15:37 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B31402000E2; Wed, 24 Jul 2019 05:15:31 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 88AE7200034; Wed, 24 Jul 2019 05:15:25 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id CA888402F6; Wed, 24 Jul 2019 11:15:17 +0800 (SGT) From: Anson.Huang@nxp.com To: mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, gustavo@embeddedor.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: imx7ulp: Make sure earlycon's clock is enabled Date: Wed, 24 Jul 2019 11:06:00 +0800 Message-Id: <20190724030600.17839-1-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.9.5 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190723_201535_876045_7A359E84 X-CRM114-Status: UNSURE ( 7.39 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux-imx@nxp.com 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 From: Anson Huang Earlycon's clock could be disabled during kernel boot up, if earlycon is enabled and its clock is gated, then kernel boot up will fail. Make sure earlycon's clock is enabled during kernel boot up. Signed-off-by: Anson Huang --- drivers/clk/imx/clk-imx7ulp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c index 42e4667..2022d9b 100644 --- a/drivers/clk/imx/clk-imx7ulp.c +++ b/drivers/clk/imx/clk-imx7ulp.c @@ -42,6 +42,19 @@ static const struct clk_div_table ulp_div_table[] = { { .val = 7, .div = 64, }, }; +static const int pcc2_uart_clk_ids[] __initconst = { + IMX7ULP_CLK_LPUART4, + IMX7ULP_CLK_LPUART5, +}; + +static const int pcc3_uart_clk_ids[] __initconst = { + IMX7ULP_CLK_LPUART6, + IMX7ULP_CLK_LPUART7, +}; + +static struct clk **pcc2_uart_clks[ARRAY_SIZE(pcc2_uart_clk_ids) + 1] __initdata; +static struct clk **pcc3_uart_clks[ARRAY_SIZE(pcc3_uart_clk_ids) + 1] __initdata; + static void __init imx7ulp_clk_scg1_init(struct device_node *np) { struct clk_hw_onecell_data *clk_data; @@ -135,6 +148,7 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np) struct clk_hw_onecell_data *clk_data; struct clk_hw **clks; void __iomem *base; + int i; clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_PCC2_END), GFP_KERNEL); @@ -173,6 +187,14 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np) imx_check_clk_hws(clks, clk_data->num); of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); + + for (i = 0; i < ARRAY_SIZE(pcc2_uart_clk_ids); i++) { + int index = pcc2_uart_clk_ids[i]; + + pcc2_uart_clks[i] = &clks[index]->clk; + } + + imx_register_uart_clocks(pcc2_uart_clks); } CLK_OF_DECLARE(imx7ulp_clk_pcc2, "fsl,imx7ulp-pcc2", imx7ulp_clk_pcc2_init); @@ -181,6 +203,7 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np) struct clk_hw_onecell_data *clk_data; struct clk_hw **clks; void __iomem *base; + int i; clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_PCC3_END), GFP_KERNEL); @@ -218,6 +241,14 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np) imx_check_clk_hws(clks, clk_data->num); of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); + + for (i = 0; i < ARRAY_SIZE(pcc3_uart_clk_ids); i++) { + int index = pcc3_uart_clk_ids[i]; + + pcc3_uart_clks[i] = &clks[index]->clk; + } + + imx_register_uart_clocks(pcc3_uart_clks); } CLK_OF_DECLARE(imx7ulp_clk_pcc3, "fsl,imx7ulp-pcc3", imx7ulp_clk_pcc3_init);