From patchwork Tue Jun 17 07:27:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 4364471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35254BEEAA for ; Tue, 17 Jun 2014 07:32:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 872E82015D for ; Tue, 17 Jun 2014 07:32:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1536E2011E for ; Tue, 17 Jun 2014 07:32:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WwnqX-0000oG-Is; Tue, 17 Jun 2014 07:30:21 +0000 Received: from webbox1416.server-home.net ([77.236.96.61]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WwnqT-00085l-RT for linux-arm-kernel@lists.infradead.org; Tue, 17 Jun 2014 07:30:19 +0000 Received: from imapserver.systec-electronic.com (unknown [212.185.67.148]) by webbox1416.server-home.net (Postfix) with ESMTPA id 1A02C27A68B; Tue, 17 Jun 2014 09:14:24 +0200 (CEST) Received: from ws-stein.systec-electronic.de (unknown [192.168.10.109]) by imapserver.systec-electronic.com (Postfix) with ESMTP id A1650DA0110; Tue, 17 Jun 2014 09:30:16 +0200 (CEST) From: Alexander Stein To: Shawn Guo , Sascha Hauer Subject: [PATCH 1/1] clk-imx35: Add clko clock support Date: Tue, 17 Jun 2014 09:27:43 +0200 Message-Id: <1402990063-26908-1-git-send-email-alexander.stein@systec-electronic.com> X-Mailer: git-send-email 1.8.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140617_003018_262283_1B7F0595 X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -0.0 (/) Cc: Russell King , linux-arm-kernel@lists.infradead.org, Alexander Stein X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a new clk which is programmable using different sources and dividers. Signed-off-by: Alexander Stein --- I know some (most) of the new lines are larger than 80 characters, but I kept the same layout as the other lines. Also lots of the clock sources are not used in linux, so I have given them a descriptive name though. arch/arm/mach-imx/clk-imx35.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 71c86a2..acf821c 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -49,6 +49,13 @@ static struct clk_onecell_data clk_data; static const char *std_sel[] = {"ppll", "arm"}; static const char *ipg_per_sel[] = {"ahb_per_div", "arm_per_div"}; +static const char *clko_select[] = {"ckil", "osc", "osc_audio", "dummy", + "mpll_075", "mpll", "ppll", "arm", + "ahb", "ipg", "ipg_per", "usbdiv", + "esdhc1_div", "ssi1_div_post", "mlb_gate", + "mshc_gate", "mpll_lock", "csi_div", + "spdif_div_post", "uart1_gate", "asrc", + "dptc", "arm_ungated", "nfc_div", "hsp"}; enum mx35_clks { ckih, mpll, ppll, mpll_075, arm, hsp, hsp_div, hsp_sel, ahb, ipg, @@ -64,7 +71,7 @@ enum mx35_clks { rtc_gate, rtic_gate, scc_gate, sdma_gate, spba_gate, spdif_gate, ssi1_gate, ssi2_gate, uart1_gate, uart2_gate, uart3_gate, usbotg_gate, wdog_gate, max_gate, admux_gate, csi_gate, csi_div, csi_sel, iim_gate, - gpu2d_gate, clk_max + gpu2d_gate, clko_sel, clko_div1, clko_div, clko_gate, clk_max }; static struct clk *clk[clk_max]; @@ -146,6 +153,10 @@ int __init mx35_clocks_init(void) clk[csi_sel] = imx_clk_mux("csi_sel", base + MX35_CCM_PDR2, 7, 1, std_sel, ARRAY_SIZE(std_sel)); clk[csi_div] = imx_clk_divider("csi_div", "csi_sel", base + MX35_CCM_PDR2, 16, 6); + clk[clko_sel] = imx_clk_mux("clko_sel", base + MX35_CCM_COSR, 0, 5, clko_select, ARRAY_SIZE(clko_select)); + clk[clko_div1] = imx_clk_divider("clko_div1", "clko_sel", base + MX35_CCM_COSR, 6, 1); + clk[clko_div] = imx_clk_divider("clko_div", "clko_div1", base + MX35_CCM_COSR, 10, 6); + clk[asrc_gate] = imx_clk_gate2("asrc_gate", "ipg", base + MX35_CCM_CGR0, 0); clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", base + MX35_CCM_CGR0, 2); clk[audmux_gate] = imx_clk_gate2("audmux_gate", "ipg", base + MX35_CCM_CGR0, 4); @@ -200,6 +211,8 @@ int __init mx35_clocks_init(void) clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", base + MX35_CCM_CGR3, 2); clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "ahb", base + MX35_CCM_CGR3, 4); + clk[clko_gate] = imx_clk_gate("clko_gate", "clko_div", base + MX35_CCM_COSR, 5); + for (i = 0; i < ARRAY_SIZE(clk); i++) if (IS_ERR(clk[i])) pr_err("i.MX35 clk %d: register failed with %ld\n", @@ -260,6 +273,7 @@ int __init mx35_clocks_init(void) clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0"); clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); clk_register_clkdev(clk[admux_gate], "audmux", NULL); + clk_register_clkdev(clk[clko_gate], NULL, "clko.0"); clk_prepare_enable(clk[spba_gate]); clk_prepare_enable(clk[gpio1_gate]); @@ -286,6 +300,11 @@ int __init mx35_clocks_init(void) mxc_timer_init(MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT); #endif + /* + * Let's initially set up CLKO parent as arm. + */ + clk_set_parent(clk[clko_sel], clk[arm]); + return 0; }