From patchwork Wed Nov 26 11:17:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 5384801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 66B4F9F319 for ; Wed, 26 Nov 2014 11:21:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37154201CD for ; Wed, 26 Nov 2014 11:21:36 +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 17EE2201C0 for ; Wed, 26 Nov 2014 11:21:35 +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 1Xtacg-0007kE-AP; Wed, 26 Nov 2014 11:19:02 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XtacY-0007dd-R7 for linux-arm-kernel@lists.infradead.org; Wed, 26 Nov 2014 11:18:56 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFN00IYW8QPDH80@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Nov 2014 20:18:25 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 4B.7E.19034.107B5745; Wed, 26 Nov 2014 20:18:25 +0900 (KST) X-AuditID: cbfee691-f79b86d000004a5a-d4-5475b701f199 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B8.27.09430.107B5745; Wed, 26 Nov 2014 20:18:25 +0900 (KST) Received: from abhilash-ubuntu.sisodomain.com ([107.108.73.92]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NFN00FF48PKTQE0@mmp2.samsung.com>; Wed, 26 Nov 2014 20:18:25 +0900 (KST) From: Abhilash Kesavan To: linux-arm-kernel@lists.infradead.org, tomasz.figa@gmail.com, s.nawrocki@samsung.com, mturquette@linaro.org Subject: [PATCH 1/4] clk: samsung: exynos7: add clocks for CPU block Date: Wed, 26 Nov 2014 16:47:48 +0530 Message-id: <1417000671-11996-2-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1417000671-11996-1-git-send-email-a.kesavan@samsung.com> References: <1417000671-11996-1-git-send-email-a.kesavan@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsWyRsSkTpdxe2mIwdqP2hZr/ipZbHp8jdVi xvl9TBZPJ1xkszj8pp3VYtWuP4wObB47Z91l97hzbQ+bx+Yl9R59W1YxenzeJBfAGsVlk5Ka k1mWWqRvl8CVsfDefvaCSQ4VJ46eZm5g3G3WxcjJISFgIvHzfQ8bhC0mceHeeiCbi0NIYCmj xMKOs8wwRfv+t7NCJKYzSqz7v5ARJCEk0MckceqLIIjNJqAnseDfV7AGEYECidMzZ4DZzAKO Equ+z2UCsYUFXCRuvf3CAmKzCKhKLF56lB3E5hVwlXh97CJQnANomYLEnEk2IGFOATeJFdvX sUCscpW4d+wx2HESAv3sEm3T97FCzBGQ+Db5EFSvrMSmA1A3S0ocXHGDZQKj8AJGhlWMoqkF yQXFSelFpnrFibnFpXnpesn5uZsYgWF9+t+ziT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3SBteWdZvJKvimGUbzLHnlpbQhos6k/ocO59VTwwpiWr20r Vv/Zq9ra9EjsfEtnPcfKwyLPrD4KHdvIVnlzjxJLcUaioRZzUXEiAMa99uywAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141126_031855_050435_F4A7B1A5 X-CRM114-Status: GOOD ( 12.26 ) X-Spam-Score: -5.0 (-----) Cc: kesavan.abhilash@gmail.com, linux-samsung-soc@vger.kernel.org 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 Add clock support for the Atlas CPU block in Exynos7. Signed-off-by: Abhilash Kesavan --- .../devicetree/bindings/clock/exynos7-clock.txt | 6 + drivers/clk/samsung/clk-exynos7.c | 121 ++++++++++++++++++++ include/dt-bindings/clock/exynos7-clk.h | 20 +++- 3 files changed, 146 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/exynos7-clock.txt b/Documentation/devicetree/bindings/clock/exynos7-clock.txt index 6d3d5f8..0b4ba7f 100644 --- a/Documentation/devicetree/bindings/clock/exynos7-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos7-clock.txt @@ -28,6 +28,7 @@ Required Properties for Clock Controller: - "samsung,exynos7-clock-topc" - "samsung,exynos7-clock-top0" - "samsung,exynos7-clock-top1" + - "samsung,exynos7-clock-atlas" - "samsung,exynos7-clock-ccore" - "samsung,exynos7-clock-peric0" - "samsung,exynos7-clock-peric1" @@ -61,6 +62,11 @@ Input clocks for top1 clock controller: - dout_sclk_cc_pll - dout_sclk_mfc_pll +Input clocks for atlas clock controller: + - fin_pll + - fout_atlas_pll + - mout_sclk_bus0_pll_atlas + Input clocks for ccore clock controller: - fin_pll - dout_aclk_ccore_133 diff --git a/drivers/clk/samsung/clk-exynos7.c b/drivers/clk/samsung/clk-exynos7.c index a79bf23..78f66b4 100644 --- a/drivers/clk/samsung/clk-exynos7.c +++ b/drivers/clk/samsung/clk-exynos7.c @@ -35,6 +35,34 @@ #define DIV_TOPC1 0x0604 #define DIV_TOPC3 0x060C +static const struct samsung_pll_rate_table pll1450x_24mhz_tbl[] = { + /* rate, m, p, s */ + PLL_35XX_RATE(2496000000, 208, 2, 0), + PLL_35XX_RATE(2400000000, 200, 2, 0), + PLL_35XX_RATE(2304000000, 288, 3, 0), + PLL_35XX_RATE(2200000000, 275, 3, 0), + PLL_35XX_RATE(2100000000, 175, 2, 0), + PLL_35XX_RATE(2000000000, 250, 3, 0), + PLL_35XX_RATE(1896000000, 158, 2, 0), + PLL_35XX_RATE(1800000000, 150, 2, 0), + PLL_35XX_RATE(1704000000, 142, 2, 0), + PLL_35XX_RATE(1600000000, 200, 3, 0), + PLL_35XX_RATE(1500000000, 250, 2, 1), + PLL_35XX_RATE(1400000000, 350, 3, 1), + PLL_35XX_RATE(1300000000, 325, 3, 1), + PLL_35XX_RATE(1200000000, 200, 2, 1), + PLL_35XX_RATE(1100000000, 275, 3, 1), + PLL_35XX_RATE(1000000000, 250, 3, 1), + PLL_35XX_RATE(900000000, 150, 2, 1), + PLL_35XX_RATE(800000000, 200, 3, 1), + PLL_35XX_RATE(700000000, 350, 3, 2), + PLL_35XX_RATE(600000000, 200, 2, 2), + PLL_35XX_RATE(500000000, 250, 3, 2), + PLL_35XX_RATE(400000000, 200, 3, 2), + PLL_35XX_RATE(300000000, 200, 2, 3), + PLL_35XX_RATE(200000000, 200, 3, 3), +}; + static struct samsung_fixed_factor_clock topc_fixed_factor_clks[] __initdata = { FFACTOR(0, "ffac_topc_bus0_pll_div2", "mout_bus0_pll_ctrl", 1, 2, 0), FFACTOR(0, "ffac_topc_bus0_pll_div4", @@ -50,6 +78,8 @@ PNAME(mout_bus1_pll_ctrl_p) = { "fin_pll", "fout_bus1_pll" }; PNAME(mout_cc_pll_ctrl_p) = { "fin_pll", "fout_cc_pll" }; PNAME(mout_mfc_pll_ctrl_p) = { "fin_pll", "fout_mfc_pll" }; +PNAME(mout_topc_group1) = { "mout_bus0_pll_ctrl", "ffac_topc_bus0_pll_div2", + "mout_bus1_pll_ctrl", "mout_cci_pll" }; PNAME(mout_topc_group2) = { "mout_sclk_bus0_pll_cmuc", "mout_sclk_bus1_pll_cmuc", "mout_sclk_cc_pll_cmuc", "mout_sclk_mfc_pll_cmuc" }; @@ -104,6 +134,8 @@ static struct samsung_mux_clock topc_mux_clks[] __initdata = { MUX(0, "mout_sclk_bus0_pll_out", mout_sclk_bus0_pll_out_p, MUX_SEL_TOPC1, 16, 1), + MUX(MOUT_SCLK_BUS0_PLL_ATLAS, "mout_sclk_bus0_pll_atlas", + mout_topc_group1, MUX_SEL_TOPC1, 4, 2), MUX(0, "mout_aclk_ccore_133", mout_topc_group2, MUX_SEL_TOPC2, 4, 2), @@ -402,6 +434,95 @@ static void __init exynos7_clk_top1_init(struct device_node *np) CLK_OF_DECLARE(exynos7_clk_top1, "samsung,exynos7-clock-top1", exynos7_clk_top1_init); +/* Register Offset definitions for CMU_ATLAS (0x11800000) */ +#define ATLAS_PLL_LOCK 0x0000 +#define ATLAS_PLL_CON0 0x0100 +#define MUX_SEL_ATLAS0 0x0200 +#define MUX_SEL_ATLAS1 0x0204 +#define MUX_SEL_ATLAS2 0x0208 +#define DIV_ATLAS0 0x0600 +#define DIV_ATLAS1 0x0604 +#define ENABLE_IP_ATLAS0 0x0B00 + +/* List of parent clocks for Muxes in CMU_ATLAS */ +PNAME(mout_atlas_pll_ctrl_p) = { "fin_pll", "fout_atlas_pll" }; +PNAME(mout_bus_pll_atlas_p) = { "fin_pll", "mout_sclk_bus0_pll_atlas" }; +PNAME(mout_atlas_p) = { "mout_atlas_pll_ctrl", "mout_bus_pll_atlas" }; + +static unsigned long atlas_clk_regs[] __initdata = { + ATLAS_PLL_LOCK, + ATLAS_PLL_CON0, + MUX_SEL_ATLAS0, + MUX_SEL_ATLAS1, + MUX_SEL_ATLAS2, + DIV_ATLAS0, + DIV_ATLAS1, + ENABLE_IP_ATLAS0, +}; + +static struct samsung_mux_clock atlas_mux_clks[] __initdata = { + MUX_F(MOUT_ATLAS_PLL_CTRL, "mout_atlas_pll_ctrl", mout_atlas_pll_ctrl_p, + MUX_SEL_ATLAS0, 0, 1, CLK_SET_RATE_PARENT, 0), + MUX_F(MOUT_BUS_PLL_ATLAS, "mout_bus_pll_atlas", mout_bus_pll_atlas_p, + MUX_SEL_ATLAS1, 0, 1, CLK_SET_RATE_PARENT, 0), + MUX_F(MOUT_ATLAS, "mout_atlas", mout_atlas_p, + MUX_SEL_ATLAS2, 0, 1, CLK_SET_RATE_PARENT, 0), +}; + +static struct samsung_div_clock atlas_div_clks[] __initdata = { + DIV(DOUT_PCLK_DBG_CLK_ATLAS, "dout_pclk_dbg_clk_atlas", "dout_atlas2", + DIV_ATLAS0, 26, 6), + DIV(DOUT_ATCLK_ATLAS, "dout_atclk_atlas", "dout_atlas2", + DIV_ATLAS0, 20, 6), + DIV(DOUT_PCLK_ATLAS, "dout_pclk_atlas", "dout_atlas2", + DIV_ATLAS0, 12, 6), + DIV(DOUT_ACLK_ATLAS, "dout_aclk_atlas", "dout_atlas2", + DIV_ATLAS0, 8, 3), + DIV(DOUT_ATLAS2, "dout_atlas2", "dout_atlas1", + DIV_ATLAS0, 4, 3), + DIV(DOUT_ATLAS1, "dout_atlas1", "mout_atlas", + DIV_ATLAS0, 0, 3), + + DIV(DOUT_CNTCLK_ATLAS, "dout_cntclk_atlas", "dout_atlas2", + DIV_ATLAS1, 8, 4), + DIV(DOUT_SCLK_HPM_ATLAS, "dout_sclk_hpm_atlas", "mout_atlas", + DIV_ATLAS1, 4, 3), + DIV(DOUT_ATLAS_PLL, "dout_atlas_pll", "mout_atlas", + DIV_ATLAS1, 0, 3), +}; + +static struct samsung_gate_clock atlas_gate_clks[] __initdata = { + GATE(CLK_ATLAS, "atlas", "dout_sclk_atlas_pll", + ENABLE_IP_ATLAS0, 0, CLK_IGNORE_UNUSED, 0), +}; + +static struct samsung_pll_clock atlas_pll_clks[] __initdata = { + PLL(pll_1450x, FOUT_ATLAS_PLL, "fout_atlas_pll", "fin_pll", + ATLAS_PLL_LOCK, ATLAS_PLL_CON0, + pll1450x_24mhz_tbl), +}; + +static struct samsung_cmu_info atlas_cmu_info __initdata = { + .pll_clks = atlas_pll_clks, + .nr_pll_clks = ARRAY_SIZE(atlas_pll_clks), + .mux_clks = atlas_mux_clks, + .nr_mux_clks = ARRAY_SIZE(atlas_mux_clks), + .div_clks = atlas_div_clks, + .nr_div_clks = ARRAY_SIZE(atlas_div_clks), + .gate_clks = atlas_gate_clks, + .nr_gate_clks = ARRAY_SIZE(atlas_gate_clks), + .nr_clk_ids = ATLAS_NR_CLK, + .clk_regs = atlas_clk_regs, + .nr_clk_regs = ARRAY_SIZE(atlas_clk_regs), +}; + +static void __init exynos7_clk_atlas_init(struct device_node *np) +{ + samsung_cmu_register_one(np, &atlas_cmu_info); +} + +CLK_OF_DECLARE(exynos7_clk_atlas, "samsung,exynos7-clock-atlas", + exynos7_clk_atlas_init); /* Register Offset definitions for CMU_CCORE (0x105B0000) */ #define MUX_SEL_CCORE 0x0200 #define DIV_CCORE 0x0600 diff --git a/include/dt-bindings/clock/exynos7-clk.h b/include/dt-bindings/clock/exynos7-clk.h index e0bad38..93c78f9 100644 --- a/include/dt-bindings/clock/exynos7-clk.h +++ b/include/dt-bindings/clock/exynos7-clk.h @@ -17,7 +17,8 @@ #define DOUT_SCLK_CC_PLL 4 #define DOUT_SCLK_MFC_PLL 5 #define DOUT_ACLK_CCORE_133 6 -#define TOPC_NR_CLK 7 +#define MOUT_SCLK_BUS0_PLL_ATLAS 7 +#define TOPC_NR_CLK 8 /* TOP0 */ #define DOUT_ACLK_PERIC1 1 @@ -39,6 +40,23 @@ #define CLK_SCLK_MMC0 8 #define TOP1_NR_CLK 9 +/* ATLAS */ +#define FOUT_ATLAS_PLL 1 +#define MOUT_ATLAS_PLL_CTRL 2 +#define MOUT_BUS_PLL_ATLAS 3 +#define MOUT_ATLAS 4 +#define DOUT_PCLK_DBG_CLK_ATLAS 5 +#define DOUT_ATCLK_ATLAS 6 +#define DOUT_PCLK_ATLAS 7 +#define DOUT_ACLK_ATLAS 8 +#define DOUT_ATLAS2 9 +#define DOUT_ATLAS1 10 +#define DOUT_CNTCLK_ATLAS 11 +#define CLK_ATLAS 12 +#define DOUT_SCLK_HPM_ATLAS 13 +#define DOUT_ATLAS_PLL 14 +#define ATLAS_NR_CLK 15 + /* CCORE */ #define PCLK_RTC 1 #define CCORE_NR_CLK 2