Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754716AbbHYGma (ORCPT ); Tue, 25 Aug 2015 02:42:30 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:46147 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751026AbbHYGm1 (ORCPT ); Tue, 25 Aug 2015 02:42:27 -0400 X-IronPort-AV: E=Sophos;i="5.15,744,1432566000"; d="scan'";a="193036843" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <87k2sj7tzs.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Stephen Boyd , Michael Turquette CC: Simon Horman , Magnus , Linux-SH , Linux-Kernel , Geert Uytterhoeven , In-Reply-To: <87lhcz7u2i.wl%kuninori.morimoto.gx@renesas.com> References: <87lhcz7u2i.wl%kuninori.morimoto.gx@renesas.com> Subject: [PATCH 1/2] clk: shmobile: add Renesas R-Car Gen3 CPG support User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Tue, 25 Aug 2015 06:42:20 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0032.jpnprd01.prod.outlook.com (25.164.162.142) To HKXPR06MB0599.apcprd06.prod.outlook.com (25.161.181.148) X-Microsoft-Exchange-Diagnostics: 1;HKXPR06MB0599;2:YoskHMe9OykxnRjxWzic1+89eMCznXXGuGFJ9Cy2jAUFkMdCpANs/b69bgMdM/4jpWor0sbXCmx15ielP4fF3dG50bSXcqz7BNDYxwb0gj8azO5vN90VAY8WBMCWqA/db6/ZjXMknz3Q5KEpDGtFsMmrp1NVPiHAF5NQ47zzzKs=;3:iE7+WUfYXkHsX/7HREc1va/0O9KuI5wowXL6ZEK8FxflTt6SbB1AQMRUKCLXieb+0V02uUE+zuL6411eczsL1SJO+BzF7JamuYxhC/S4blZjd4cX7QDKVZF1ydFj7A60izytEj8AkWESVBeRG4aMSQ==;25:dNrbS4T7aCx2jovWpZzRs56091eB0NscEjl17N0VPD0TYnAkz/uKO5C8jl9xg3okyriu4DtBFZEyS0MMNNgTPf2zP49feB1dPISzXaGLPU/9xW4jeTltDsZk+pi6f6+6r8YjtxrGTWevIcuckfmGzOumbs2iMRs3nBDh7n9gSY9lZCVGqb3/XQOnDDm3S96CJoCiLMOvs//b8c/2ym7nfJ0xeMFN7rRpbxssRHBCzhDyaJxaB33JmcHXEToUy1sTsplWI9A1+3MGjg3AToGkEw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB0599;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB246; X-Microsoft-Exchange-Diagnostics: 1;HKXPR06MB0599;20:ARpP/LGQCu1QYmiF7bTHBzqrmHJRkgkIIbWio3WfPImBcM0+JrUhvscPZqKWyRLcaNe90AGU9OhDzMVI/Rb3lQlyKJuM8ySJKLx9U2VkLsU1FVS4Ukya5HCrN9L7NddZ0QAXW/3slNrJQXULTdPA0PHbsY8zUyyfIbjHFpptG2OTQVOAL5DuBInWv/jwigV7q/rVNKhA9CCIkaG9oFqinLITLCQGo5UrU76fxs83qYnPgjtUdVKu9KbENILj8fBrL8XtxZ114HmMdOh2auTN477Z5AIBxlj22R5sET+5SofWXAqDkXDBzkNC8hUikUni/89m/3hGvsF8kPIT2CW3lk2KuxT6SVSW07QZay4sSrx6J94IATvPuBBLkfmLZxqtOkiNHATu2rgZx+qjVDE82Uy+Ph4AxtHRO9hpS6u87S6Gvt/MP5cQR2JwHOFdbh23flGnH77xOSbMqWHA6RwBy1cSHpMNRt8QDY3BFskNBoWO+DCtbZnUhGpWx67fRid5;4:7eYK6uAkH/8pzVwqwMmf6XjZHCDNvMBWyLsPXLuY+QhBqs+XrL/Fzpd9WNWpdC6781H6yxWygHeWLvU8ah4t7E0cMN6mh5BcVzl2ExIyHN61cjQqD1vMSmeOtOLPJn629z456mnyghvyzyl4zan5/9Q1BiGhUqj85iqawRX01TXWGsdef45L2BfckbmfRdSi1hOZ6cZ+ONiFFsUYzPFkzYWj6Fw30LwuGfKMXtTAAmj0xQYly7r8GzUn6p6GtpEsS3t0RtTpuMqom7v41c3MsREGoPSIuLtElLND9ZZjztGiv0kXnWDRCux0agR5zrqB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(8121501046)(5005006)(3002001);SRVR:HKXPR06MB0599;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB0599; X-Forefront-PRVS: 06793E740F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(189002)(53416004)(83506001)(2950100001)(42186005)(101416001)(46102003)(106356001)(19580405001)(50986999)(69596002)(76176999)(54356999)(64706001)(105586002)(87976001)(575784001)(47776003)(86362001)(229853001)(66066001)(77096005)(50466002)(19580395003)(36756003)(4001350100001)(5001960100002)(122386002)(81156007)(40100003)(62966003)(77156002)(68736005)(33646002)(4001540100001)(23726002)(97736004)(92566002)(5007970100001)(5001860100001)(189998001)(5001770100001)(5004730100002)(46406003)(5001830100001)(2004002);DIR:OUT;SFP:1102;SCL:1;SRVR:HKXPR06MB0599;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HKXPR06MB0599;23:abS07X3KNK0EGRtqatWBGcktfYNFo54/q+lo6pu4z?= =?us-ascii?Q?wNdOMmZ7kBLCkUd0inDMn1TR4rP5KYxlBAo8AZ6FNQ7E33MMEvKGXRfF5CZ/?= =?us-ascii?Q?TkWMGEdnE8LBDoDkFCbGzdX2Bo7amLPq2elNYCoTu9uw3vH+0bGVNBBopfDl?= =?us-ascii?Q?FqS+lDm8lQriZkaTzDsnd8rV3B15sv3mDI1NP07CUNu8wlxJp8cCM6g4B4BH?= =?us-ascii?Q?mVfgaOcqrnsokGS/eVmL1Fw0C50j6iBngtRSvERTu5E1Ov/ct4kCZE+anB9K?= =?us-ascii?Q?/JFxGMh6SnHTeGTe9UX7Vp7/mMqZZXYKVQppLAPcvoiNfexpEF/FUVOChxcq?= =?us-ascii?Q?LypOoC4I6PjoN+OaxihyTzcxbWt40m5hpHbxl3jVwVC6jBbW8MdvME9ywCSv?= =?us-ascii?Q?kkhIW33laIIdRWg8yqmVuUdgclgETi60qm/kCAcNaTkRJfiC+857SlVrls0U?= =?us-ascii?Q?PcksT5oHNFLpbxLBjOPMXjDlA1LnDNYY9TyCzKCvGrlBCvSBXnrrR6YNGeUl?= =?us-ascii?Q?OGaI7ugA1a2O4mB9R8U6OsxhtfuJUfB1i7MrJGtA+VCIjMg3wpP+9DBoBB6t?= =?us-ascii?Q?qbQFnVZ4/qRtlc3ZtAVxtxQtG9fuTc/el/Af2tYYCGtrx6kzg/9xtfvR1Syn?= =?us-ascii?Q?e6q96O77E3RKjlnfJ62PPpxy2o8MeiIjsbztJIKnrMAN7Lg0wg1MyiK7fmr/?= =?us-ascii?Q?AOjnSJnqoJQALeN+w4+Cg1b6dvuHQ2rPqbH6nPJL0HXA+NMZexMle0tpZcaj?= =?us-ascii?Q?u+WP6jEVQrXiCj3geKoX5MqlNJK2bbk6w1TfCHc/O4ijsC1tpvhPbeYI+aSI?= =?us-ascii?Q?lcVUkeI45Cn2gJHQbHsD8w9M4Ua7DEkmhDsDnIkcT/g+thFxIkqa4BVkRebR?= =?us-ascii?Q?rVzyttVYO5g3IBzEigotruBY6BJgu9mJQW3bA9rDZRCeV6nE65AWPTP/5gPc?= =?us-ascii?Q?vmysYMAuKI3V0IY1C8XxjVfRIcJyio7w1PkUzABVLsOa9/agbrOzS0jePKRZ?= =?us-ascii?Q?dssk9s2Ry0E0MpLPeLB3tcmN/OkGyGDsB40pYnuHYLs8zefiWVLGQ0q5r781?= =?us-ascii?Q?WBLbhvCaH6FsGphm00IzTB6PSZaw1oCKJIc4mNFHQaZsXjfE2ywx1HvCSRxk?= =?us-ascii?Q?3l58cZC43YI1Z6jKvHC0SwQa8uGcRTRWd1GVE7/A/llemqeejlz9qbxpGH21?= =?us-ascii?Q?swQSzTQpgJMbiKjYmJI9HvGYjKmf+xuH4eQp+l2zBGHo3aPLLaj8sJCvSWXj?= =?us-ascii?Q?KPTcf/Rx2XzgjA1ZnHQZOOSDyT85Obu3Ab/Umha/qI1RzYTBn5vN7cDOISPn?= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1;HKXPR06MB0599;5:ZeuT1OxmpaGPXm4/Juz+Rd++6RCXtiFhMEmRjmnyZ5vNzqsXbvsPgAVYHTRBJfKPk/Yb1mxzwI0JaMRod169uBhmz3WvWOjT7usF0xhzPw2M7M+vKmttigQdQVz01UG4EhO8IjLL3ZIr9TMzKTR1cA==;24:fugnzxojcgSY+G20aqy4A2dt45nRHo8qc+45Z41oxd6DSbXzNDwH3Eas4vFW//wRtNy/9CGlBrO7bK5tVbdVi6y55to/iq3KFH8jT2QzLso=;20:hMFKdiac6Juqp9T9I4RADEB9wgaPxy1lChFVixtnIXAj+OSKqOFdHj/zq+jKqZZoRDYO5S5EJ4/S3oA27R+BiWLsaaCdb/Q+pqp7THndpmgPB3Jm4oYxobmKS4QhaGskPTq22R2VZ8oIiPludRoawcYf4lDwA9sBjw9Npw3rQHA= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2015 06:42:20.2663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB0599 X-Microsoft-Exchange-Diagnostics: 1;HKXPR06MB246;2:ya2i3YEYtET/e8dGbnEBu1MmEMpFzo0X3Cl7En6mO61K3Tz7p2Q8RQ9u3KAOxa5bpNPBb8n4VbDKGLFtwskc6ZtkM+9F+9NzSyUENsUkpI3vg0ZPJbpff6gBDfkTEWqCEu3YEefxME8erE+kPyEXnYrxZvuvrghLobyzN4+HYB0=;3:nc4eT9DQRleIuSffFAK5k5iPRrf8YVX2sHG9FtK8S2U9QWvtwNgoEm4/z/QFFrCZo7fvfbFbqu5Eg2ZaUdqTvyhTclCcgZH5jQKRJs06fXMcoM8PxBlTU8Zw6UER7KKio69Fj0WjbIx3bp8agUzQFQ==;25:JwkkxHnqp7YmX43Y3sSAc0peNj0hksXQ2JsSgrF6uO4KEbhlcYV3CCrPAdueLSMBFOvapTzV0LdpUIzR3MpVyuBqymTS6T9UyOzYk+qfXJCqSa5/eYjlloy90KOkMNIuqP/Z1ju35r3G1mWXvmLTKniiy15a0iRdNTVHkLR8WlmE1KV7bYQuj9PZEXCu5E7j+McSUJaP0gOZOzwokwp8FYO+IySAfKBjxXp667CXzCqN/d6b3ww0DviTV285ucCGlZf2LDaRucoxuUIDhTF8kQ==;23:XvwarEKO9nCHNqUVlGYRf8jSAS+tArj5SsUjS1e0HhH0p9WEQYCIIyT28w39Lqca7IESpp7zlgzwvcgJVB2D+p/oIKlhYPx3laE+xd0P1McP4oRiB+cg9hPitGfDWykmy4UZhAmI9UIw/YuF4mpiKaK78867eO5F+hkuFcHKeT4qlF0wSnfceut9e1poZjfx X-OriginatorOrg: renesas.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9656 Lines: 311 From: Gaku Inami This patch adds very initial CPG support. R-Car Gen3 write function should use CPG write protection method which is shared with MSTP driver. This patch has it but not used. Signed-off-by: Gaku Inami Signed-off-by: Kuninori Morimoto --- .../clock/renesas,rcar-gen3-cpg-clocks.txt | 31 +++ drivers/clk/shmobile/Makefile | 1 + drivers/clk/shmobile/clk-rcar-gen3.c | 232 +++++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,rcar-gen3-cpg-clocks.txt create mode 100644 drivers/clk/shmobile/clk-rcar-gen3.c diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-gen3-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-gen3-cpg-clocks.txt new file mode 100644 index 0000000..b1a7e01 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/renesas,rcar-gen3-cpg-clocks.txt @@ -0,0 +1,31 @@ +* Renesas R-Car Gen3 Clock Pulse Generator (CPG) + +The CPG generates core clocks for the R-Car Gen3 SoCs. It includes three PLLs +and several fixed ratio dividers. + +Required Properties: + + - compatible: Must be one of + - "renesas,r8a7795-cpg-clocks" for the r8a7795 CPG + - "renesas,rcar-gen3-cpg-clocks" for the generic R-Car Gen3 CPG + + - reg: Base address and length of the memory resource used by the CPG + + - clocks: References to the parent clocks: first to the EXTAL clock + - #clock-cells: Must be 1 + - clock-output-names: The names of the clocks. Supported clocks are + "main", "pll0", "pll1", "pll2", "pll3", "pll4" + + +Example +------- + + cpg_clocks: cpg_clocks@e6150000 { + compatible = "renesas,r8a7795-cpg-clocks", + "renesas,rcar-gen3-cpg-clocks"; + reg = <0 0xe6150000 0 0x1000>; + clocks = <&extal_clk>; + #clock-cells = <1>; + clock-output-names = "main", "pll0", "pll1","pll2", + "pll3", "pll4"; + }; diff --git a/drivers/clk/shmobile/Makefile b/drivers/clk/shmobile/Makefile index 97c71c8..4e70a73 100644 --- a/drivers/clk/shmobile/Makefile +++ b/drivers/clk/shmobile/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o +obj-$(CONFIG_ARCH_RCAR_GEN3) += clk-rcar-gen3.o obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-div6.o obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-mstp.o diff --git a/drivers/clk/shmobile/clk-rcar-gen3.c b/drivers/clk/shmobile/clk-rcar-gen3.c new file mode 100644 index 0000000..098caac --- /dev/null +++ b/drivers/clk/shmobile/clk-rcar-gen3.c @@ -0,0 +1,232 @@ +/* + * rcar_gen3 Core CPG Clocks + * + * Copyright (C) 2015 Renesas Electronics Corp. + * + * Based on rcar_gen2 Core CPG Clocks driver. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct rcar_gen3_cpg { + struct clk_onecell_data data; + spinlock_t lock; + void __iomem *reg; +}; + +#define CPG_PLL0CR 0x00d8 +#define CPG_PLL2CR 0x002c + +/* + * common function + */ +#define rcar_clk_readl(cpg, _reg) clk_readl(cpg->reg + _reg) + +/* + * Reset register definitions. + */ +#define MODEMR 0xe6160060 + +static u32 rcar_gen3_read_mode_pins(void) +{ + static u32 mode; + static bool mode_valid; + + if (!mode_valid) { + void __iomem *modemr = ioremap_nocache(MODEMR, 4); + + BUG_ON(!modemr); + mode = ioread32(modemr); + iounmap(modemr); + mode_valid = true; + } + + return mode; +} + +/* ----------------------------------------------------------------------------- + * CPG Clock Data + */ + +/* + * MD EXTAL PLL0 PLL1 PLL2 PLL3 PLL4 + * 14 13 19 17 (MHz) *1 *1 *1 + *------------------------------------------------------------------- + * 0 0 0 0 16.66 x 1 x180/2 x192/2 x144/2 x192 x144 + * 0 0 0 1 16.66 x 1 x180/2 x192/2 x144/2 x128 x144 + * 0 0 1 0 Prohibited setting + * 0 0 1 1 16.66 x 1 x180/2 x192/2 x144/2 x192 x144 + * 0 1 0 0 20 x 1 x150/2 x156/2 x120/2 x156 x120 + * 0 1 0 1 20 x 1 x150/2 x156/2 x120/2 x106 x120 + * 0 1 1 0 Prohibited setting + * 0 1 1 1 20 x 1 x150/2 x156/2 x120/2 x156 x120 + * 1 0 0 0 25 x 1 x120/2 x128/2 x96/2 x128 x96 + * 1 0 0 1 25 x 1 x120/2 x128/2 x96/2 x84 x96 + * 1 0 1 0 Prohibited setting + * 1 0 1 1 25 x 1 x120/2 x128/2 x96/2 x128 x96 + * 1 1 0 0 33.33 / 2 x180/2 x192/2 x144/2 x192 x144 + * 1 1 0 1 33.33 / 2 x180/2 x192/2 x144/2 x128 x144 + * 1 1 1 0 Prohibited setting + * 1 1 1 1 33.33 / 2 x180/2 x192/2 x144/2 x192 x144 + * + * *1 : datasheet indicates VCO output (PLLx = VCO/2) + * + */ +#define CPG_PLL_CONFIG_INDEX(md) ((((md) & BIT(14)) >> 11) | \ + (((md) & BIT(13)) >> 11) | \ + (((md) & BIT(19)) >> 18) | \ + (((md) & BIT(17)) >> 17)) +struct cpg_pll_config { + unsigned int extal_div; + unsigned int pll1_mult; + unsigned int pll3_mult; + unsigned int pll4_mult; +}; + +static const struct cpg_pll_config cpg_pll_configs[16] __initconst = { +/* EXTAL div PLL1 PLL3 PLL4 */ + { 1, 192, 192, 144, }, + { 1, 192, 128, 144, }, + { 0, 0, 0, 0, }, /* Prohibited setting */ + { 1, 192, 192, 144, }, + { 1, 156, 156, 120, }, + { 1, 156, 106, 120, }, + { 0, 0, 0, 0, }, /* Prohibited setting */ + { 1, 156, 156, 120, }, + { 1, 128, 128, 96, }, + { 1, 128, 84, 96, }, + { 0, 0, 0, 0, }, /* Prohibited setting */ + { 1, 128, 128, 96, }, + { 2, 192, 192, 144, }, + { 2, 192, 128, 144, }, + { 0, 0, 0, 0, }, /* Prohibited setting */ + { 2, 192, 192, 144, }, +}; + +/* ----------------------------------------------------------------------------- + * Initialization + */ + +static u32 cpg_mode __initdata; + +static struct clk * __init +rcar_gen3_cpg_register_clock(struct device_node *np, struct rcar_gen3_cpg *cpg, + const struct cpg_pll_config *config, + const char *name) +{ + const char *parent_name; + unsigned int mult = 1; + unsigned int div = 1; + + if (!strcmp(name, "main")) { + parent_name = of_clk_get_parent_name(np, 0); + div = config->extal_div; + } else if (!strcmp(name, "pll0")) { + /* PLL0 is a configurable multiplier clock. Register it as a + * fixed factor clock for now as there's no generic multiplier + * clock implementation and we currently have no need to change + * the multiplier value. + */ + u32 value = rcar_clk_readl(cpg, CPG_PLL0CR); + + parent_name = "main"; + mult = ((value >> 24) & ((1 << 7) - 1)) + 1; + } else if (!strcmp(name, "pll1")) { + parent_name = "main"; + mult = config->pll1_mult / 2; + } else if (!strcmp(name, "pll2")) { + /* PLL2 is a configurable multiplier clock. Register it as a + * fixed factor clock for now as there's no generic multiplier + * clock implementation and we currently have no need to change + * the multiplier value. + */ + u32 value = rcar_clk_readl(cpg, CPG_PLL2CR); + + parent_name = "main"; + mult = ((value >> 24) & ((1 << 7) - 1)) + 1; + } else if (!strcmp(name, "pll3")) { + parent_name = "main"; + mult = config->pll3_mult; + } else if (!strcmp(name, "pll4")) { + parent_name = "main"; + mult = config->pll4_mult; + } else { + return ERR_PTR(-EINVAL); + } + + return clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); +} + +static void __init rcar_gen3_cpg_clocks_init(struct device_node *np) +{ + const struct cpg_pll_config *config; + struct rcar_gen3_cpg *cpg; + struct clk **clks; + unsigned int i; + int num_clks; + + cpg_mode = rcar_gen3_read_mode_pins(); + + num_clks = of_property_count_strings(np, "clock-output-names"); + if (num_clks < 0) { + pr_err("%s: failed to count clocks\n", __func__); + return; + } + + cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); + clks = kzalloc((num_clks * sizeof(*clks)), GFP_KERNEL); + if (cpg == NULL || clks == NULL) { + /* We're leaking memory on purpose, there's no point in cleaning + * up as the system won't boot anyway. + */ + pr_err("%s: failed to allocate cpg\n", __func__); + return; + } + + spin_lock_init(&cpg->lock); + + cpg->data.clks = clks; + cpg->data.clk_num = num_clks; + + cpg->reg = of_iomap(np, 0); + if (WARN_ON(cpg->reg == NULL)) + return; + + config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; + if (!config->extal_div) { + pr_err("%s: Prohibited setting (cpg_mode=0x%x)\n", + __func__, cpg_mode); + return; + } + + for (i = 0; i < num_clks; ++i) { + const char *name; + struct clk *clk; + + of_property_read_string_index(np, "clock-output-names", i, + &name); + + clk = rcar_gen3_cpg_register_clock(np, cpg, config, name); + if (IS_ERR(clk)) + pr_err("%s: failed to register %s %s clock (%ld)\n", + __func__, np->name, name, PTR_ERR(clk)); + else + cpg->data.clks[i] = clk; + } + + of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); +} +CLK_OF_DECLARE(rcar_gen3_cpg_clks, "renesas,rcar-gen3-cpg-clocks", + rcar_gen3_cpg_clocks_init); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/