From patchwork Fri Apr 29 09:45:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 8979421 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5649F9F39D for ; Fri, 29 Apr 2016 09:55:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 346C020212 for ; Fri, 29 Apr 2016 09:55:25 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 00D5F201C0 for ; Fri, 29 Apr 2016 09:55:24 +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 1aw57I-00030B-Qo; Fri, 29 Apr 2016 09:53:44 +0000 Received: from mail-bn1bon0095.outbound.protection.outlook.com ([157.56.111.95] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aw57F-0002on-32 for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2016 09:53:42 +0000 Received: from BN3PR0301CA0021.namprd03.prod.outlook.com (10.160.180.159) by BY1PR0301MB1223.namprd03.prod.outlook.com (10.161.203.19) with Microsoft SMTP Server (TLS) id 15.1.477.8; Fri, 29 Apr 2016 09:53:19 +0000 Received: from BL2FFO11OLC008.protection.gbl (2a01:111:f400:7c09::156) by BN3PR0301CA0021.outlook.office365.com (2a01:111:e400:4000::31) with Microsoft SMTP Server (TLS) id 15.1.477.8 via Frontend Transport; Fri, 29 Apr 2016 09:53:19 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; pengutronix.de; dkim=none (message not signed) header.d=none; pengutronix.de; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11OLC008.mail.protection.outlook.com (10.173.160.143) with Microsoft SMTP Server (TLS) id 15.1.477.4 via Frontend Transport; Fri, 29 Apr 2016 09:53:18 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u3T9rCBe014917; Fri, 29 Apr 2016 02:53:14 -0700 From: Dong Aisheng To: Subject: [RFC PATCH 1/1] clk: imx7d: move clk setting out of imx7d_clocks_init Date: Fri, 29 Apr 2016 17:45:15 +0800 Message-ID: <1461923115-16563-1-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-EOPAttributedMessage: 0 X-Matching-Connectors: 131063971984558416; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(76176999)(50986999)(586003)(2906002)(105606002)(48376002)(229853001)(50466002)(19580405001)(2351001)(19580395003)(106466001)(33646002)(50226002)(77096005)(11100500001)(81166005)(85426001)(87936001)(1220700001)(1096002)(5003940100001)(2950100001)(575784001)(86362001)(104016004)(189998001)(6806005)(5008740100001)(4326007)(110136002)(36756003)(15760500001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB1223; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC008; 1:LVQAJXSIhmsdP+xoiFE0skTDGZL0ONVEQWDBwI4i/tmOXOwf9NHEdBQ3ky4miOQRTTODNjh2hmPpILRhqY3lVjC79XOVph9pw8EOMcrzZYHnm9pHM/EXUuOiIydixEIs5zGYnO5BEjGxZ9CeWVHahCjVzH3IEeSlOJRgjvBHywqJC2P64Xdzncvps/YGjJLJUf5hm3dp/66ZTiSai9ue/+r0mw8NVret5QV8wKjQUzZb11l4taHLWV2yjWpaQYoD8S2OmQgGGaeTqLCA1xjV7vtdpPdBurNyL6LuVnp1AInareKHk+BsUiMMxxJbozScQd+AcxQhiBH8xy8jUP8c259CSJYWzoaljtCNw2CLIZnsYpJNzH9vftx7lYzpilCZaXWXniM1i6llWz/RYvxi2sxX8gKd2HWmDniWDbIs7tRtMknBGKNHm0ODPAL6W5rV8zieXlMWXr/vxqa3jwu60BKVDDEq94j5LOjDdfVYpMbEseUBvvd8F2u37QEuKGQfEHy6EPJ7GRutUvjGVChnGzaRKcEiuj0z2QFUTJIbcWg7fmOAqOpqtbCkLyWOZqyptpC0tdcQMjTBaLbeHCr0TPOxrs+g3d6NeCHum2QmK9w= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b43fb818-9a7e-4a40-6814-08d370141772 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 2:ik3D5xACp17ibwdC0Uf0QFGadMd5sWSMKDoBGP5+LTh4vI5hqK+5Yh9luTttNmdo/WTdY2R/UhOgIvVCx6YQMUC8w/wVXNFLfFf6w6TVkcYy4INvN7WkuEpz5pO4Bui3ldHf0bkLCjNMHDRcv/FlknFIuoy4tB34mYdQ6B5q/zi5by0fmyVWx7ZC4RS4z2gu; 3:/0g0a1ilxhoJ/X4aqnCJ7uenwA1kbrCiXOUtANRUIK6lzzDJkuDLa4Td9pnyy0dS3fMmqeUrdVBP/zu6u7y/qpe2/WaiAmJfthAUJxtTpBSRZkLJElYUAJs6rITwCqmYHBUeJTzRR7dXb3QrdnalBtfs2C8woL5CoG9MjV1Z+/ZB5TUsvPDtpC5pQavCDadSq2p6WTgvPqvalCn5q4GHQEFwqFOTnO799Eydcq40od4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 25:aFyY39qG6gU/+Dvj0o4SDTFNCGVTbfdOiCpIxFlFHMZxb+rCX76gJX/UAyYTkSyo6WbBjZ+dbVZgrQ+alSiV9HIwEyTrzXj5x9o9OmIVwCGH1ANiHradFJPKUguZ8SjiqEF7ZwjAHz6JZ8saUDc3oqKWkIdMC8qu03XT7CMgWqC7luGxdNRp/QJUzmhMnPEx+Jn4iJzWGhpGNbK0kIUrnz0fnzjIVX9WuFYpGKfK9tfKdG7Gjl7Dh6x7dKYWquDMjb81LjMR8crn/Tj2cLg4o7kk2yfqVaBBhQu8saUW1nsuHytmFtubDYj3Ju6H7MO+1U2IqSW5febT91LyhnaJCxjDbXfrFVY9jKZhJwNPPMaGh7fX2RK0viNsaN8Yxe6tsWtfDFshEBJHVy6nkWLWzMHVQpSgpaBAcOyzsXfBA7GLkgbr2ndEq5VWeJnhGcFaGhDyZB06yeo6eoEwsHZb0UezOVn9yndmPzNSjyF2M0H2fNTHMvYGU7tVP4L2L+cc975rtueItTd6UkWQNj87WnCTe8/XMSX9+n6d8HErdVGx/kRl91H8PVQ10JsVfXYFxhcPBnwvSxArB3jCd+zNtHtp89QRvqLEWPFJrOOQxTMEmemcm+WBw8EL6rloZVbjoQaVINasWwV9G8flUbkePA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BY1PR0301MB1223; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 4:fWDI6t41PSQMaWjcWlyWspoHwpxkF0YyJ3DUwTFpPn0JqzQiQvxQdikH/H8wHJof1VSHFePsh3oYhrtlXSveP17PWQRsjYwuuos0JTJKggv+nk5wYrg9t20SSVeHwnl7cteGH1K3k7Vdw7SnwLCEL5n9m2sdLElArE9UX9LKQtzk1DivFEzV9CmF1uNzgQ7lExioTNGoiVlMkdXV+J4CBsKeSLggyRJNmhaMpR5w4ImhKg9DwyyASLwPzsCLjAQ1zqFaJn596Plt559GNp/E1Umf4RkFuRSZYzfBef+TJeK+8Etfk+P7zFa7O4Xzgugc+rTpSh2Yjw/1NscWidL1OJNCOvIMNq49VVBquYoTYy/gdxXu1BH0KHQT2jVGhBUHNpAP1oPOh4mvXCryX1bEK+jRzBVk/3/He34dWfKAQiOIHn3qjqM9jZgUBX/WldqGs+8qEIL5QLC42sEnR0dhY9/tciyEQbq4MYJ4wNI1No0= X-Forefront-PRVS: 0927AA37C7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0301MB1223; 23:qU6md0z57/zJyIXsKVw8TtYU0Lx4TJ3gGS1fGJN?= =?us-ascii?Q?HijoT/roNBKW5dno8yJP/+vrO0LhisKDT80Jtj22mHxv742hVh6irpKjWtN+?= =?us-ascii?Q?hYnGeDm/KCJfAH5+5FyUEcwVQkPozpF1GH6vOTBryg7Vm/Rqguf3y2VQ0vZJ?= =?us-ascii?Q?L13vMxo9T9DjRVN/P1rLGlYPQ2DEfQ2HX5hUEyVxsF+9MGWDYkdytiLLSjiE?= =?us-ascii?Q?4WpLcmmsD26AtSlznFWNNC2X35tifRF/H+4XQNR+2ryi1uTvvI1iqIuhJUbh?= =?us-ascii?Q?vQNYYXlhM05aEaKSqynfcdXkyT2vt6PRfL1PNXQrjOHE47FOs32DVxIC/A7U?= =?us-ascii?Q?7A4IWXRTzHltXTewzvwfBZz3P1f1j+JoTBk/Mz/0zvV/isaIQr+8nAmhymOg?= =?us-ascii?Q?qkFUUCYazfCOoSeQFZ6gwKUc2Li1/mjGfb8/qMT/DDCwRaRB/uL20jdcQcvH?= =?us-ascii?Q?mWLrr1W8tiNBU2AVSdyWna9fzvRdrabnpRMH6TV4NHNe0x4NcSNrVLmWV3A6?= =?us-ascii?Q?RSwpPAP09cqNiSt/iB8w80tkFbjTXgnc4WnQlOn4pF73/ePs5jw7+gqI7fzp?= =?us-ascii?Q?YhRzb4GRg6FITVPa70UYj2Z+VX3H5fQdhkZLavOPWGEVJG5kyqPHYOMUmxA9?= =?us-ascii?Q?ecJ4kpTus15QuiHrUFs3BlJgAeLBtkws5XmchtXy97PYv2RbyVtxZAYch7V9?= =?us-ascii?Q?C8simK97pO98eyhT9ysjqtZL30EK/wsv9GE3Qo5h8jkKMp0Ti+oF2umpA8Nj?= =?us-ascii?Q?5BI/fyD1p23+gG8soKGTWoRy1pAnsMmKp3OVk8mYnuDWx8jY1rMSoPIfUrag?= =?us-ascii?Q?nBvIBjmB1hDCDOy9EQ3DCe1Fcpz/TkoWRq5nIJrvmuxdZVfebkMV0UMUbRyL?= =?us-ascii?Q?PsF28eu7D1K7aQTySnDAZe1WXqeNTVw4fJHCLM7dSTGPB+pl3dCJJ57wxAhP?= =?us-ascii?Q?8mjb21Eiv8jSTpK/GwVgjDV9TXcUKdabzv1qPLvqGABcc7HSmom1/GcTTKEe?= =?us-ascii?Q?+1XXJ3N6N6dyZsU9ZUA64KH6GjXmeKsSebgQ7pv+IC1bQ3OmEnmd1txBi5zM?= =?us-ascii?Q?HgtkdAyWPRQ31Uk5cOPEHc2/EFgzP?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 5:lMGCLahGvg1wFCwLKA2zuy9N3KkMkflJF1+lpC3RH6iNckQaT+bG6hFwFGFddS2EACzwBTvVJ+fiOLSkOHVHE1wxUkbLlR1rkdeSbx2pnvRdj1k+8WZGnmqV5xmhpMClaM8oqWs+11rGUtYuHmK3aZSH/6K/PSNPTgkX7a35yN8=; 24:FKbJoonhLNR6wbEkovIExHE0jQy/T16oHQn9uEvgp0Tiz5rOn7Nv6Tn96fnT4mJ6J+mEY55srnAQv1MMbmsVNOlm16zVtOoDOoUGwhcCdfI=; 7:99yJgfWlM1mYmKTHf+lRWAmghFKqxbpJT+4455O8YFU+lXMoQJLJuhsbaGOh/WjY10CqtOf2yc9ttS4k13HbAfoTTDlHRkEu9p/KolLkufp13o/us9kUpfiTd8KHT0mwL+pv7Ghe9JKoCqKJVwXyNRTKmcRVjRSZf9lVCXABPsehqi0AdwD0W36OMPALIX0J SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2016 09:53:18.2686 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1223 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160429_025341_418402_E01A43A9 X-CRM114-Status: GOOD ( 15.69 ) X-Spam-Score: -1.9 (-) 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: aisheng.dong@nxp.com, mturquette@baylibre.com, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, stefan@agner.ch, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 During kernel early booting(e.g. in time_init()), there's only one init idle task running, and the idle sched class indicates that it's not valid to schedule for idle task. If it happens the kernel will complain with a error message as follows: [ 0.000000] bad: scheduling from the idle thread! We can observe this warning on an i.MX7D SDB board. See full log below. It is caused by imx7d_clocks_init function called in time_init invokes a lot clk_prepare_enable to enable many clocks and it happens that the Audio/Video PLLs need large delay causes a sleep. Since we should not sleep during time_init, this patch fundamentally moves all clk_prepare_enable and clk_set_parent out of imx7d_clocks_init and use a postcore init function imx7d_clocks_setup to do it later instead. Then we simply reply on the bootloader settings to do early boot. [ 0.000000] bad: scheduling from the idle thread! [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.6.0-rc3-00064-gded8bc08fb45-dirty #836 [ 0.000000] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 0.000000] Backtrace: [ 0.000000] [] (dump_backtrace) from [] (show_stack+0x18/0x1c) [ 0.000000] r6:60000053 r5:00000000 r4:c0d21f9c r3:00000000 [ 0.000000] [] (show_stack) from [] (dump_stack+0xb4/0xe8) [ 0.000000] [] (dump_stack) from [] (dequeue_task_idle+0x20/0x30) [ 0.000000] r10:c08f5554 r9:c0d02b0c r8:c0d06844 r7:ef7c14d0 r6:00000001 r5:ef7c14c0 [ 0.000000] r4:ef7c14c0 r3:00000000 [ 0.000000] [] (dequeue_task_idle) from [] (deactivate_task+0x64/0x68) [ 0.000000] r4:c0d06500 r3:c0154368 [ 0.000000] [] (deactivate_task) from [] (__schedule+0x2e8/0x738) [ 0.000000] r6:c0d06500 r5:ef7c14c0 r4:c0c744c0 r3:00000002 [ 0.000000] [] (__schedule) from [] (schedule+0x48/0xa0) [ 0.000000] r10:000001b6 r9:00000003 r8:00000036 r7:00000000 r6:0007a120 r5:00000000 [ 0.000000] r4:c0d00000 [ 0.000000] [] (schedule) from [] (schedule_hrtimeout_range_clock+0xac/0x12c) [ 0.000000] r4:0006ddd0 r3:c0d06500 [ 0.000000] [] (schedule_hrtimeout_range_clock) from [] (schedule_hrtimeout_range+0x24/0x2c) [ 0.000000] r7:c0d5d434 r6:c0d02100 r5:ffff8ad1 r4:ef00c040 [ 0.000000] [] (schedule_hrtimeout_range) from [] (usleep_range+0x54/0x5c) [ 0.000000] [] (usleep_range) from [] (clk_pllv3_wait_lock+0x7c/0xb4) [ 0.000000] [] (clk_pllv3_wait_lock) from [] (clk_pllv3_prepare+0x2c/0x30) [ 0.000000] r6:00000000 r5:c15603f4 r4:ef007680 r3:0000201b [ 0.000000] [] (clk_pllv3_prepare) from [] (clk_core_prepare+0x98/0xc8) [ 0.000000] [] (clk_core_prepare) from [] (clk_prepare+0x20/0x38) [ 0.000000] r5:c15603f4 r4:ef00c100 [ 0.000000] [] (clk_prepare) from [] (imx7d_clocks_init+0x6108/0x6188) [ 0.000000] r4:ef00c100 r3:00000001 [ 0.000000] [] (imx7d_clocks_init) from [] (of_clk_init+0x10c/0x1d4) [ 0.000000] r10:00000001 r9:c0d01f68 r8:00000000 r7:c0d01f60 r6:ef7e3d60 r5:ef004340 [ 0.000000] r4:00000002 [ 0.000000] [] (of_clk_init) from [] (time_init+0x2c/0x38) [ 0.000000] r10:efffcac0 r9:c0c5ca48 r8:c0d76000 r7:c0d028c0 r6:ffffffff r5:c0d76000 [ 0.000000] r4:00000000 [ 0.000000] [] (time_init) from [] (start_kernel+0x218/0x398) [ 0.000000] [] (start_kernel) from [<8000807c>] (0x8000807c) [ 0.000000] r10:00000000 r9:410fc075 r8:8000406a r7:c0d07e8c r6:c0c5ca44 r5:c0d0296c [ 0.000000] r4:c0d76294 [ 0.000000] Architected cp15 timer(s) running at 8.00MHz (virt). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns Cc: Michael Turquette Cc: Stephen Boyd Cc: Shawn Guo Cc: Stefan Agner Cc: Lucas Stach Signed-off-by: Dong Aisheng --- drivers/clk/imx/clk-imx7d.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c index 7912be83c4af..3be2e9371491 100644 --- a/drivers/clk/imx/clk-imx7d.c +++ b/drivers/clk/imx/clk-imx7d.c @@ -378,7 +378,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) { struct device_node *np; void __iomem *base; - int i; clks[IMX7D_CLK_DUMMY] = imx_clk_fixed("dummy", 0); clks[IMX7D_OSC_24M_CLK] = of_clk_get_by_name(ccm_node, "osc"); @@ -409,13 +408,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) clks[IMX7D_PLL_AUDIO_MAIN_BYPASS] = imx_clk_mux_flags("pll_audio_main_bypass", base + 0xf0, 16, 1, pll_audio_bypass_sel, ARRAY_SIZE(pll_audio_bypass_sel), CLK_SET_RATE_PARENT); clks[IMX7D_PLL_VIDEO_MAIN_BYPASS] = imx_clk_mux_flags("pll_video_main_bypass", base + 0x130, 16, 1, pll_video_bypass_sel, ARRAY_SIZE(pll_video_bypass_sel), CLK_SET_RATE_PARENT); - clk_set_parent(clks[IMX7D_PLL_ARM_MAIN_BYPASS], clks[IMX7D_PLL_ARM_MAIN]); - clk_set_parent(clks[IMX7D_PLL_DRAM_MAIN_BYPASS], clks[IMX7D_PLL_DRAM_MAIN]); - clk_set_parent(clks[IMX7D_PLL_SYS_MAIN_BYPASS], clks[IMX7D_PLL_SYS_MAIN]); - clk_set_parent(clks[IMX7D_PLL_ENET_MAIN_BYPASS], clks[IMX7D_PLL_ENET_MAIN]); - clk_set_parent(clks[IMX7D_PLL_AUDIO_MAIN_BYPASS], clks[IMX7D_PLL_AUDIO_MAIN]); - clk_set_parent(clks[IMX7D_PLL_VIDEO_MAIN_BYPASS], clks[IMX7D_PLL_VIDEO_MAIN]); - clks[IMX7D_PLL_ARM_MAIN_CLK] = imx_clk_gate("pll_arm_main_clk", "pll_arm_main_bypass", base + 0x60, 13); clks[IMX7D_PLL_DRAM_MAIN_CLK] = imx_clk_gate("pll_dram_main_clk", "pll_dram_main_bypass", base + 0x70, 13); clks[IMX7D_PLL_SYS_MAIN_CLK] = imx_clk_gate("pll_sys_main_clk", "pll_sys_main_bypass", base + 0xb0, 13); @@ -846,6 +838,13 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) clk_data.clk_num = ARRAY_SIZE(clks); of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); +} +CLK_OF_DECLARE(imx7d, "fsl,imx7d-ccm", imx7d_clocks_init); + +static int __init imx7d_clocks_setup(void) +{ + int i; + /* TO BE FIXED LATER * Enable all clock to bring up imx7, otherwise system will be halt and block * the other part upstream Because imx7d clock design changed, clock framework @@ -855,6 +854,13 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) for (i = 0; i < IMX7D_CLK_END; i++) clk_prepare_enable(clks[i]); + clk_set_parent(clks[IMX7D_PLL_ARM_MAIN_BYPASS], clks[IMX7D_PLL_ARM_MAIN]); + clk_set_parent(clks[IMX7D_PLL_DRAM_MAIN_BYPASS], clks[IMX7D_PLL_DRAM_MAIN]); + clk_set_parent(clks[IMX7D_PLL_SYS_MAIN_BYPASS], clks[IMX7D_PLL_SYS_MAIN]); + clk_set_parent(clks[IMX7D_PLL_ENET_MAIN_BYPASS], clks[IMX7D_PLL_ENET_MAIN]); + clk_set_parent(clks[IMX7D_PLL_AUDIO_MAIN_BYPASS], clks[IMX7D_PLL_AUDIO_MAIN]); + clk_set_parent(clks[IMX7D_PLL_VIDEO_MAIN_BYPASS], clks[IMX7D_PLL_VIDEO_MAIN]); + /* use old gpt clk setting, gpt1 root clk must be twice as gpt counter freq */ clk_set_parent(clks[IMX7D_GPT1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]); @@ -874,5 +880,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) imx_register_uart_clocks(uart_clks); + return 0; } -CLK_OF_DECLARE(imx7d, "fsl,imx7d-ccm", imx7d_clocks_init); +postcore_initcall(imx7d_clocks_setup);