From patchwork Tue Aug 30 17:34:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9305859 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3ACE607F0 for ; Tue, 30 Aug 2016 18:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A950328CEA for ; Tue, 30 Aug 2016 18:07:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DF1428CEE; Tue, 30 Aug 2016 18:07:27 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B3B328CEA for ; Tue, 30 Aug 2016 18:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758790AbcH3SHU (ORCPT ); Tue, 30 Aug 2016 14:07:20 -0400 Received: from mail-bl2nam02on0075.outbound.protection.outlook.com ([104.47.38.75]:16587 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751158AbcH3SHS (ORCPT ); Tue, 30 Aug 2016 14:07:18 -0400 Received: from BN6PR03CA0028.namprd03.prod.outlook.com (10.175.124.14) by CY4PR03MB2439.namprd03.prod.outlook.com (10.168.163.141) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Tue, 30 Aug 2016 17:34:11 +0000 Received: from BL2FFO11FD038.protection.gbl (2a01:111:f400:7c09::188) by BN6PR03CA0028.outlook.office365.com (2603:10b6:404:10c::14) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Tue, 30 Aug 2016 17:34:11 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; 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 BL2FFO11FD038.mail.protection.outlook.com (10.173.161.134) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Tue, 30 Aug 2016 17:34:12 +0000 Received: from fabio-Latitude-E6410.am.freescale.net (fabio-Latitude-E6410.am.freescale.net [10.29.244.220]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7UHY9Uk010796; Tue, 30 Aug 2016 10:34:10 -0700 From: Fabio Estevam To: CC: , , , , Fabio Estevam Subject: [PATCH v2] clk: imx7d: Add PLL_AUDIO_TEST_DIV/POST_DIV clocks Date: Tue, 30 Aug 2016 14:34:01 -0300 Message-ID: <1472578441-11296-1-git-send-email-fabio.estevam@nxp.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131170520522012029; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(4326007)(19580405001)(19580395003)(97736004)(189998001)(81166006)(8666005)(5660300001)(356003)(36756003)(110136002)(2906002)(81156014)(626004)(33646002)(586003)(8936002)(87936001)(50226002)(5003940100001)(86362001)(11100500001)(106466001)(305945005)(92566002)(50466002)(77096005)(104016004)(229853001)(48376002)(68736007)(85426001)(2351001)(105606002)(47776003)(8676002)(7846002)(50986999)(7059030)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2439; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD038; 1:RUMYQBmwdOkDpD3EFZi5fyhMnAF1H2O43/DMEMSwMEwK2Iyn8l/+htLRXMzIGNTkeSP714HSMfBJX7XOFz8BXXhV3KW3OUX2MsOIImWMaxUsWmsHXV6XTh0ruTQrOAbYOif70bu2r+3rL6K8nXUAruohIxLDMRcZ8oQbr7XD625NuRhXiNT93t6iqKbiSRYY6V5UNz/XAQ3E1eF92wkfCtnuytmFt4ydXZcXMkA1pWWZcg/ksHdr8aCK+YA3g0qyX3PFQrOIPjkdO6yroJqp+akTOz9S7tZ9RA30/ad21ddlqFJOfdYSmvtY4Slx/e0thoJm2sPm3xaDJN+Cdc6uouEUTHSlHhk3aO50qkqX7rQ+7e9O8V8qVxt/C8ZDG1J4+k9//w5P082bue8kT9WOQ/YePhZljyHSZH2RxtSbnDdrQpWRKLQHg/NGhMRvmcOrM65eUBxt1RiFY1FUNAP78j4BCUL36H1pRo1epkfdaVup3XtIVkDsOVlYxjyaHmnTmqIljmLAJsnI2Xc4icHSTKqr+NlNQAABY9dg4NtcNEIBmbhEdEK3FQQsN+M4iS3XLEo1TX4NhlAD7Delf5JnyYjO4AfaXrsonqMT4uq8I8npKw4cQF4pUimtjQ14bJWKpZspTtLi3/14iAgCpq4nkk+Adlwi5eB/nIZo4jB+ja+LsxhkIfXBEpkumP6TJw72KE2zzk1uJx6jINX4LibwYlD2f7mKxIuNnSqXC+3YQ7w= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: fcb18fe0-e49a-4e70-541d-08d3d0fbdb2c X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2439; 2:+YL/ydPXwNP5HU+/FWh67I2L4yK9UrxNtqss1GuQ/Hidq0n2jtVzItDXZz7iJuoC41BB4mdezOeYR0+gbc9GeISwH/kNamXqWEVdR/LcsF2Sc92EryPk/oEEjW3Xs1SD12UtF5wMsH1Ey23h2IB3FGFhIg5Wease0kMP1vz487pPMWZjvUhqdnrWYQUgkwSc; 3:RpRLVsdiG0qJqJYZGl0iREZlH6dnmh0OWYkok+iHVyo8DhaJozVnCq5P/dMABy6U58DZPa6g92oqLqcOo8zLPdYblotWMpg7MZyXwVYwfCbWBQLtTp4p+Evfg9IFM2M8X6u2JryyI9DCQjWrSFDs/BnvBXkSvU3asabrZ9azPoGotHNcYahMuTZlrVRF4wfRnL/zIE9c6gRxdZfqGKc98laFUSZTbuhtcSVM3xCn9R4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR03MB2439; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2439; 25:JHhb4/wgHCsYxvrIZkG4BggOtMk5VQJo4uQEfZFhrs+7lxzrjVCcZzMmjhCWwL/xClPBLN9uu9OxMdDbMna+AZQg9IvqTR8L/LVNDD/gytKE30OIFTATPw0izHTAEapDvgcJ5NNeIt418naZYleDwSHQqtezoUiToClPd01D4AdZpGXy6klPDNKEeYtHsLflWQeDYNR2xkebYCFaXZFOPfLMwcC2g9wbBFFlrq/lgnep9AmgOOs/DUlTRj5zTzKNJHzLfr/0wlapkHME/1bdCA+Aej+V8eZxlJQ8Ijop7YAJ8/PonkePgshNG6evCZKCAliGEWy4E3eKTk9OtBjkuIN0eQP+x+hxRO1SKv/bOAg85qOUAojxxS7BYpjp1jGLXsSMLrRbxkmDdNPmUisk1fcUH8R+yJ+IK1bOn5QZfmLkXmiwQbnLaF/33FOzXmV4j/JAUo6pK29qFPqlMKZPRi71yVgtzKlwahHXiIbcBWB5zvBwatwcT+c1tXAwR32yYoHUKBBJvapavf2FqDNP+XUIc7bHRLiHNPJZ0HOY2COtpK8ShFYofhzkslncZUrHabGLSIAF43mY3YWMSMCDMhS2aEMlSPwtDh1LhyULYRd7MQRHDdvyNB2FT7bWyY3b/CTHb9ywMULB34CscKVxsrlaH3Kv/2YhXtZO99qCrYFRbdnrWq6hQ/gU0wS2WqN81yZ8CWUwcNVx2Suzh1yN7A==; 31:ChJlx/jhSDwRnNemyL15mX2CnjAsbuPT2UHkT2NyXgC7Pif8HNoQpHJkKcRtWV7awn6E06mOk78XRn1/4QQNi9qDg2KwF7FcYNfKpK9vpZz3McO4r5cW3vgqIs/nnXpJzkUi3CM+tQgMkYFNPuCb98fuwOB+BVXut5sO36QretcxY2uz3l02Ww+fqLkJhVbNsUNJGf+FEDqx3 sj1+El6brRtB/0VY8d+4PS+IOn4jaM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:CY4PR03MB2439; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2439; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2439; 4:WRLzbN2Q6LCwsm3BL17PwVPa5T1E8n6j9HVWzh/VUwMMqEeZ0lJcoFnqTy5bCg0D+XjRQ5b9rfw9dS9jWKzaJ9mkOvJ4mqQOkgo3QDxdwWOx+s/hN9SE2757aB2IeuKsJvwtGM1O70IMIdp7Uo9Odh+R4t14FdM2JV8CWluFinYKnzgD9NFrVPbCBk1lYqzSxO6STCau00E9Ycv1zT4uIr/gIvm2If7zMGxEF+G2FkjatZd9ueOYIVodhEXNFU2WJR+fwy3LMKKaAaDB27cn0rm4dd++AXEoWV5TlQixCRx4h24mjEuDsVY9LEiEc3GaVNC23cmuRrklofuPTifnkucxzqTVOC/rMQjqYlljjK0m5N8MujdiHxHYiQs3rlyyKG4Wsf5K2Yw252Mcbw778xtwbiCnMKZcbjdoX8rBV+A3Ybh2AGxcoW65yhln5ARAJCPQ1HyEERHoDJT/NeUfYKqkgJFvFJKsTUTqBJutaababhA6Yv6/Ms4sDqONhJ+DO7d3f57T64w2+UUMpc02SVuhO+GjY5wzl/zpMMRdfgU= X-Forefront-PRVS: 0050CEFE70 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2439; 23:kQM7GBzmjJDgQrl0gPDEzwBRAbm12qWk7DTXYFOID?= =?us-ascii?Q?ry8MSm+ywqkoohOrHWqVRsdAeZAzNZcK13wW5dWKhj5U46DH6tL8cND+chQ9?= =?us-ascii?Q?EIuQu6r1H34r6aK8KGwBcJJEKBwctxIFHdkBH/bpiWS4LWPuIliLUiBBYaar?= =?us-ascii?Q?4Y3F6mG1vgN8GtJWrcg7Cmlz5DaMzX0ia2bL5irxca9xUtLDXPeVEacdW48E?= =?us-ascii?Q?IKl/Wlca2R55IlPn2jpJ5oIAiPNhypU43fJ1GqMmt/AguEKWJadQ59Ehrcch?= =?us-ascii?Q?k+tNFiiJtf8pBXxoZ7UafeXWqjuiqaZW8gx074P0NnJJ44Ij7jDQM2SMsTuo?= =?us-ascii?Q?aSy93pWKLLRo0D+qlH8vDiDirpCcbbF4NNCNpQXDdcz9hK+42zNDkDVmedCr?= =?us-ascii?Q?rau+VwieSSj2PjgHp4PNzp73u4A+CeP2kkppWEwPzTKNWk8KOEAb8Ye9lued?= =?us-ascii?Q?57ywG3eLPh6MmYT3EOmCsuzoOe3PW2lyv3vWz6e60nc6CWY8dIif341Tbmx3?= =?us-ascii?Q?JgW79bwnE7fiWIuuytVzoffktwDB3dANt+XHQdHLo7z2zunwCwaegTsuD3qi?= =?us-ascii?Q?cWh0/VpB4YZ4vJhjCiAf0tDYQUwUMwxIJF21uFjiv1A5IrYuyO75YuFtSn/G?= =?us-ascii?Q?3KatxodJb3hix0dalGhkTcWEp/UaulbQkOHbNNAA3gDcdehdNFdJucdwoKHx?= =?us-ascii?Q?5GNd/E1bkRB46mCSimNpdeX87fzh11ZqNoWlRTidcEMBV8wJIRFKyzf06gy2?= =?us-ascii?Q?xlL62btP2/aRhsWMWUkammRu7+HvtyX1oHBjsjPg32XPHmjac/cZR2rKln6F?= =?us-ascii?Q?6w8AmQyflvYnhFWkhLNHYwxKT0GgqLr4fAA0mJe58ILNN6ESxyD8z44Q69VK?= =?us-ascii?Q?H235QK1osQiEg6KYB2SUrrJbFGJ8dohzatEWbTNqR2cKwXEeR1YHnzrUYpXC?= =?us-ascii?Q?TVifynAs3r6U49ihy4QrN2dFXh+w1wE4NQM/OIBU3y9hhkhV/Va8kscoCUI+?= =?us-ascii?Q?lixRMGL2ji2sapsOiyRy3GvHViG1lNHflZgVbtxo2KrqKjIaZ04chuMXDriK?= =?us-ascii?Q?UXPxPygoQ0DHgOlJG5nVreREOKW2x1qItPX0TqPOJhA+6ammK+lLyI/iV/HB?= =?us-ascii?Q?NLc5vPDuqbXUbCU6pnxNXwxZ31rdJa5936e5ZRll5mGevy/lDVLFqaXvRYic?= =?us-ascii?Q?wGQhnFw3tGWIuAs781v6bbVj/7QeP/EyMqHfKsdlgfJkqbyDql3LmAncQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2439; 6:pGLBklLNkPp+A6bVk6m6/J3Ax1FE8CqZrC1qyheIMaDoOEOriqvShQPbYFeju7zB2s+0wPbLZs8wkTKRWPhyYBV0cZIRUKWHQn5J9NdEcwnJjXDQFRtBITlkYpZEaXDTjPo62SX6/a3WJsDo4mTHS9s9FvTW3ldbns7y2g/M1UBJigHhOC4XLWhCjXzIZIJzQxdJGkO2rSPZfmHjBpKfDyLa41DJecWeuHNO2NHVdrywrx6M2U+ubxjZWg7ZBVJYmOJlvXzD3tJAvKWFus931dyq1gzojCefNhVe5oVJN1A=; 5:t4wfOiRRCvND3ysAhzV9N41c/z6eAv2vSIg3D9oyg0pR0AMuSNckkrzLP23eYTnaVvLqI8jp6HbbXgJrC7BfUM84oUCKeqLJPXFuMSI/a0Tag3kQ3VUwpYl/gk1U47Q5BLAFI2/d1CdFNIpdf/vDTRABghA17T3WTQf75ImqPkI=; 24:CP/ESiYowgBAlHY+Nb86Pxi1E+W83WfMXODdAzR+OuevZ/ug7mVRPQGKIRcc98GVCBwrZpHPb5LJN6io43WBnrAiLdn5yuMq3t0RyY8XrEo=; 7:akimh4mLIMm8QLGS24uMBX4Lr2tBeHopsG4B9Plx6nNN6JZP2cl1kG2R568Wc9zE6BlRtWsCw6XicU+yn/7i9PREj6hOmWw5UgCUik6i9V3H8B+OQZsdyi5nlWfWEhVLvtjKOzxWLrlKcDHEtlBcMP4g2QJDi6kwyqGWwigDorbzYCXU29lQGzB3yNXPUbsyHGbM3bgXGEwRjzeqwkxEZyFiWU5HzIZWbd7btKZa3Dx65EbMnWmxzyrvn51Om4cK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2016 17:34:12.0140 (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: CY4PR03MB2439 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently we see the following error when using the SAI audio driver on mx7: Division by zero in kernel. CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc3-next-20160823 Hardware name: Freescale i.MX7 Dual (Device Tree) Backtrace: [] (dump_backtrace) from [] (show_stack+0x18) r6:60000013 r5:ffffffff r4:00000000 r3:00000000 [] (show_stack) from [] (dump_stack+0xb0/0xe) [] (dump_stack) from [] (__div0+0x18/0x20) r8:00000000 r7:ffffffff r6:ffffffff r5:00000000 r4:00000000 r3:0 [] (__div0) from [] (Ldiv0_64+0x8/0x18) [] (divider_get_val) from [] (clk_divider_se) This error happens due to the lack of definition of the IMX7D_PLL_AUDIO_TEST_DIV/IMX7D_PLL_AUDIO_POST_DIV clocks. Add support for them. Tested on a imx7s-warp board. Signed-off-by: Fabio Estevam --- Changes since v1: - Also use pll_audio_post_div in the muxes. (Stefan) drivers/clk/imx/clk-imx7d.c | 101 ++++++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 40 deletions(-) diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c index 6bafcaa..86e2fdb 100644 --- a/drivers/clk/imx/clk-imx7d.c +++ b/drivers/clk/imx/clk-imx7d.c @@ -26,43 +26,59 @@ static u32 share_count_sai1; static u32 share_count_sai2; static u32 share_count_sai3; +static struct clk_div_table test_div_table[] = { + { .val = 3, .div = 1, }, + { .val = 2, .div = 1, }, + { .val = 1, .div = 2, }, + { .val = 0, .div = 4, }, + { } +}; + +static struct clk_div_table post_div_table[] = { + { .val = 3, .div = 4, }, + { .val = 2, .div = 1, }, + { .val = 1, .div = 2, }, + { .val = 0, .div = 1, }, + { } +}; + static struct clk *clks[IMX7D_CLK_END]; static const char *arm_a7_sel[] = { "osc", "pll_arm_main_clk", "pll_enet_500m_clk", "pll_dram_main_clk", - "pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_audio_main_clk", + "pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_audio_post_div", "pll_usb_main_clk", }; static const char *arm_m4_sel[] = { "osc", "pll_sys_main_240m_clk", "pll_enet_250m_clk", "pll_sys_pfd2_270m_clk", - "pll_dram_533m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_dram_533m_clk", "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", }; static const char *arm_m0_sel[] = { "osc", "pll_sys_main_120m_clk", "pll_enet_125m_clk", "pll_sys_pfd2_135m_clk", - "pll_dram_533m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_dram_533m_clk", "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", }; static const char *axi_sel[] = { "osc", "pll_sys_pfd1_332m_clk", "pll_dram_533m_clk", "pll_enet_250m_clk", "pll_sys_pfd5_clk", - "pll_audio_main_clk", "pll_video_main_clk", "pll_sys_pfd7_clk", }; + "pll_audio_post_div", "pll_video_main_clk", "pll_sys_pfd7_clk", }; static const char *disp_axi_sel[] = { "osc", "pll_sys_pfd1_332m_clk", "pll_dram_533m_clk", "pll_enet_250m_clk", "pll_sys_pfd6_clk", - "pll_sys_pfd7_clk", "pll_audio_main_clk", "pll_video_main_clk", }; + "pll_sys_pfd7_clk", "pll_audio_post_div", "pll_video_main_clk", }; static const char *enet_axi_sel[] = { "osc", "pll_sys_pfd2_270m_clk", "pll_dram_533m_clk", "pll_enet_250m_clk", - "pll_sys_main_240m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_sys_main_240m_clk", "pll_audio_post_div", "pll_video_main_clk", "pll_sys_pfd4_clk", }; static const char *nand_usdhc_bus_sel[] = { "osc", "pll_sys_pfd2_270m_clk", "pll_dram_533m_clk", "pll_sys_main_240m_clk", "pll_sys_pfd2_135m_clk", "pll_sys_pfd6_clk", "pll_enet_250m_clk", - "pll_audio_main_clk", }; + "pll_audio_post_div", }; static const char *ahb_channel_sel[] = { "osc", "pll_sys_pfd2_270m_clk", "pll_dram_533m_clk", "pll_sys_pfd0_392m_clk", - "pll_enet_125m_clk", "pll_usb_main_clk", "pll_audio_main_clk", + "pll_enet_125m_clk", "pll_usb_main_clk", "pll_audio_post_div", "pll_video_main_clk", }; static const char *dram_phym_sel[] = { "pll_dram_main_clk", @@ -73,13 +89,13 @@ static const char *dram_sel[] = { "pll_dram_main_clk", static const char *dram_phym_alt_sel[] = { "osc", "pll_dram_533m_clk", "pll_sys_main_clk", "pll_enet_500m_clk", - "pll_usb_main_clk", "pll_sys_pfd7_clk", "pll_audio_main_clk", + "pll_usb_main_clk", "pll_sys_pfd7_clk", "pll_audio_post_div", "pll_video_main_clk", }; static const char *dram_alt_sel[] = { "osc", "pll_dram_533m_clk", "pll_sys_main_clk", "pll_enet_500m_clk", "pll_enet_250m_clk", "pll_sys_pfd0_392m_clk", - "pll_audio_main_clk", "pll_sys_pfd2_270m_clk", }; + "pll_audio_post_div", "pll_sys_pfd2_270m_clk", }; static const char *usb_hsic_sel[] = { "osc", "pll_sys_main_clk", "pll_usb_main_clk", "pll_sys_pfd3_clk", "pll_sys_pfd4_clk", @@ -105,53 +121,53 @@ static const char *lcdif_pixel_sel[] = { "osc", "pll_sys_pfd5_clk", static const char *mipi_dsi_sel[] = { "osc", "pll_sys_pfd5_clk", "pll_sys_pfd3_clk", "pll_sys_main_clk", "pll_sys_pfd0_196m_clk", - "pll_dram_533m_clk", "pll_video_main_clk", "pll_audio_main_clk", }; + "pll_dram_533m_clk", "pll_video_main_clk", "pll_audio_post_div", }; static const char *mipi_csi_sel[] = { "osc", "pll_sys_pfd4_clk", "pll_sys_pfd3_clk", "pll_sys_main_clk", "pll_sys_pfd0_196m_clk", - "pll_dram_533m_clk", "pll_video_main_clk", "pll_audio_main_clk", }; + "pll_dram_533m_clk", "pll_video_main_clk", "pll_audio_post_div", }; static const char *mipi_dphy_sel[] = { "osc", "pll_sys_main_120m_clk", "pll_dram_533m_clk", "pll_sys_pfd5_clk", "ref_1m_clk", "ext_clk_2", "pll_video_main_clk", "ext_clk_3", }; static const char *sai1_sel[] = { "osc", "pll_sys_pfd2_135m_clk", - "pll_audio_main_clk", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_clk_2", }; static const char *sai2_sel[] = { "osc", "pll_sys_pfd2_135m_clk", - "pll_audio_main_clk", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_clk_2", }; static const char *sai3_sel[] = { "osc", "pll_sys_pfd2_135m_clk", - "pll_audio_main_clk", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_clk_3", }; static const char *spdif_sel[] = { "osc", "pll_sys_pfd2_135m_clk", - "pll_audio_main_clk", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_3_clk", }; static const char *enet1_ref_sel[] = { "osc", "pll_enet_125m_clk", "pll_enet_50m_clk", "pll_enet_25m_clk", - "pll_sys_main_120m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_sys_main_120m_clk", "pll_audio_post_div", "pll_video_main_clk", "ext_clk_4", }; static const char *enet1_time_sel[] = { "osc", "pll_enet_100m_clk", - "pll_audio_main_clk", "ext_clk_1", "ext_clk_2", "ext_clk_3", + "pll_audio_post_div", "ext_clk_1", "ext_clk_2", "ext_clk_3", "ext_clk_4", "pll_video_main_clk", }; static const char *enet2_ref_sel[] = { "osc", "pll_enet_125m_clk", "pll_enet_50m_clk", "pll_enet_25m_clk", - "pll_sys_main_120m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_sys_main_120m_clk", "pll_audio_post_div", "pll_video_main_clk", "ext_clk_4", }; static const char *enet2_time_sel[] = { "osc", "pll_enet_100m_clk", - "pll_audio_main_clk", "ext_clk_1", "ext_clk_2", "ext_clk_3", + "pll_audio_post_div", "ext_clk_1", "ext_clk_2", "ext_clk_3", "ext_clk_4", "pll_video_main_clk", }; static const char *enet_phy_ref_sel[] = { "osc", "pll_enet_25m_clk", "pll_enet_50m_clk", "pll_enet_125m_clk", - "pll_dram_533m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_dram_533m_clk", "pll_audio_post_div", "pll_video_main_clk", "pll_sys_pfd3_clk", }; static const char *eim_sel[] = { "osc", "pll_sys_pfd2_135m_clk", @@ -192,22 +208,22 @@ static const char *can2_sel[] = { "osc", "pll_sys_main_120m_clk", static const char *i2c1_sel[] = { "osc", "pll_sys_main_120m_clk", "pll_enet_50m_clk", "pll_dram_533m_clk", - "pll_audio_main_clk", "pll_video_main_clk", "pll_usb_main_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", "pll_sys_pfd2_135m_clk", }; static const char *i2c2_sel[] = { "osc", "pll_sys_main_120m_clk", "pll_enet_50m_clk", "pll_dram_533m_clk", - "pll_audio_main_clk", "pll_video_main_clk", "pll_usb_main_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", "pll_sys_pfd2_135m_clk", }; static const char *i2c3_sel[] = { "osc", "pll_sys_main_120m_clk", "pll_enet_50m_clk", "pll_dram_533m_clk", - "pll_audio_main_clk", "pll_video_main_clk", "pll_usb_main_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", "pll_sys_pfd2_135m_clk", }; static const char *i2c4_sel[] = { "osc", "pll_sys_main_120m_clk", "pll_enet_50m_clk", "pll_dram_533m_clk", - "pll_audio_main_clk", "pll_video_main_clk", "pll_usb_main_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", "pll_sys_pfd2_135m_clk", }; static const char *uart1_sel[] = { "osc", "pll_sys_main_240m_clk", @@ -266,32 +282,32 @@ static const char *ecspi4_sel[] = { "osc", "pll_sys_main_240m_clk", "pll_usb_main_clk", }; static const char *pwm1_sel[] = { "osc", "pll_enet_100m_clk", - "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_main_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", "ext_clk_1", "ref_1m_clk", "pll_video_main_clk", }; static const char *pwm2_sel[] = { "osc", "pll_enet_100m_clk", - "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_main_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", "ext_clk_1", "ref_1m_clk", "pll_video_main_clk", }; static const char *pwm3_sel[] = { "osc", "pll_enet_100m_clk", - "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_main_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", "ext_clk_2", "ref_1m_clk", "pll_video_main_clk", }; static const char *pwm4_sel[] = { "osc", "pll_enet_100m_clk", - "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_main_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", "ext_clk_2", "ref_1m_clk", "pll_video_main_clk", }; static const char *flextimer1_sel[] = { "osc", "pll_enet_100m_clk", - "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_main_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", "ext_clk_3", "ref_1m_clk", "pll_video_main_clk", }; static const char *flextimer2_sel[] = { "osc", "pll_enet_100m_clk", - "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_main_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", "ext_clk_3", "ref_1m_clk", "pll_video_main_clk", }; static const char *sim1_sel[] = { "osc", "pll_sys_pfd2_135m_clk", "pll_sys_main_120m_clk", "pll_dram_533m_clk", - "pll_usb_main_clk", "pll_audio_main_clk", "pll_enet_125m_clk", + "pll_usb_main_clk", "pll_audio_post_div", "pll_enet_125m_clk", "pll_sys_pfd7_clk", }; static const char *sim2_sel[] = { "osc", "pll_sys_pfd2_135m_clk", @@ -301,19 +317,19 @@ static const char *sim2_sel[] = { "osc", "pll_sys_pfd2_135m_clk", static const char *gpt1_sel[] = { "osc", "pll_enet_100m_clk", "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", - "ref_1m_clk", "pll_audio_main_clk", "ext_clk_1", }; + "ref_1m_clk", "pll_audio_post_div", "ext_clk_1", }; static const char *gpt2_sel[] = { "osc", "pll_enet_100m_clk", "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", - "ref_1m_clk", "pll_audio_main_clk", "ext_clk_2", }; + "ref_1m_clk", "pll_audio_post_div", "ext_clk_2", }; static const char *gpt3_sel[] = { "osc", "pll_enet_100m_clk", "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", - "ref_1m_clk", "pll_audio_main_clk", "ext_clk_3", }; + "ref_1m_clk", "pll_audio_post_div", "ext_clk_3", }; static const char *gpt4_sel[] = { "osc", "pll_enet_100m_clk", "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", - "ref_1m_clk", "pll_audio_main_clk", "ext_clk_4", }; + "ref_1m_clk", "pll_audio_post_div", "ext_clk_4", }; static const char *trace_sel[] = { "osc", "pll_sys_pfd2_135m_clk", "pll_sys_main_120m_clk", "pll_dram_533m_clk", @@ -327,12 +343,12 @@ static const char *wdog_sel[] = { "osc", "pll_sys_pfd2_135m_clk", static const char *csi_mclk_sel[] = { "osc", "pll_sys_pfd2_135m_clk", "pll_sys_main_120m_clk", "pll_dram_533m_clk", - "pll_enet_125m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_enet_125m_clk", "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", }; static const char *audio_mclk_sel[] = { "osc", "pll_sys_pfd2_135m_clk", "pll_sys_main_120m_clk", "pll_dram_533m_clk", - "pll_enet_125m_clk", "pll_audio_main_clk", "pll_video_main_clk", + "pll_enet_125m_clk", "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", }; static const char *wrclk_sel[] = { "osc", "pll_enet_40m_clk", @@ -346,13 +362,13 @@ static const char *clko1_sel[] = { "osc", "pll_sys_main_clk", static const char *clko2_sel[] = { "osc", "pll_sys_main_240m_clk", "pll_sys_pfd0_392m_clk", "pll_sys_pfd1_166m_clk", "pll_sys_pfd4_clk", - "pll_audio_main_clk", "pll_video_main_clk", "ckil", }; + "pll_audio_post_div", "pll_video_main_clk", "ckil", }; static const char *lvds1_sel[] = { "pll_arm_main_clk", "pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_sys_pfd1_332m_clk", "pll_sys_pfd2_270m_clk", "pll_sys_pfd3_clk", "pll_sys_pfd4_clk", "pll_sys_pfd5_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", - "pll_audio_main_clk", "pll_video_main_clk", "pll_enet_500m_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_enet_500m_clk", "pll_enet_250m_clk", "pll_enet_125m_clk", "pll_enet_100m_clk", "pll_enet_50m_clk", "pll_enet_40m_clk", "pll_enet_25m_clk", "pll_dram_main_clk", }; @@ -434,6 +450,11 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) clks[IMX7D_PLL_AUDIO_MAIN_CLK] = imx_clk_gate("pll_audio_main_clk", "pll_audio_main_bypass", base + 0xf0, 13); clks[IMX7D_PLL_VIDEO_MAIN_CLK] = imx_clk_gate("pll_video_main_clk", "pll_video_main_bypass", base + 0x130, 13); + clks[IMX7D_PLL_AUDIO_TEST_DIV] = clk_register_divider_table(NULL, "pll_audio_test_div", "pll_audio_main_clk", + CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0xf0, 19, 2, 0, test_div_table, &imx_ccm_lock); + clks[IMX7D_PLL_AUDIO_POST_DIV] = clk_register_divider_table(NULL, "pll_audio_post_div", "pll_audio_test_div", + CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0xf0, 22, 2, 0, post_div_table, &imx_ccm_lock); + clks[IMX7D_PLL_SYS_PFD0_392M_CLK] = imx_clk_pfd("pll_sys_pfd0_392m_clk", "pll_sys_main_clk", base + 0xc0, 0); clks[IMX7D_PLL_SYS_PFD1_332M_CLK] = imx_clk_pfd("pll_sys_pfd1_332m_clk", "pll_sys_main_clk", base + 0xc0, 1); clks[IMX7D_PLL_SYS_PFD2_270M_CLK] = imx_clk_pfd("pll_sys_pfd2_270m_clk", "pll_sys_main_clk", base + 0xc0, 2);