From patchwork Tue Jan 2 17:07:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 10140151 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 91D1E601A1 for ; Tue, 2 Jan 2018 09:30:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 866D028A17 for ; Tue, 2 Jan 2018 09:30:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A76828A7E; Tue, 2 Jan 2018 09:30:47 +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=-2.3 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 660DD28A17 for ; Tue, 2 Jan 2018 09:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZvTsczAC7rj2/wxexl0cxPyVzvpI8TDmCuZRJCgI7Gg=; b=jQQR/N9cvHpAZF /kjUXES74bKrNsWQWs1eUjzKVlmTVHeKDJWNbbIlX/N8MbvTfUjLPeSoluI2SE11akZExY+uHN6Hv /5yGNU+s/77bxOAN7Dv+GKlRXXpsyq8HF5cMJH0yGiJRlS+RE/icNm7mXOckZceXaviNesUFWpVR9 spuU/F//GynKZHxt2CSjFSJNILFdiVg1G+v1mW/cRvvCfAAo6znAiNxWO/qW49cuSnJxKXVzdazA8 seDlfbIX17ROiRuctxh4gkruz5swYXJXpfQPTsv10KzlIIX24iNZGa466DESXsa8wHiwwjhNteC8n Yn4NkjDFFhu91Rrg0HLA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eWIu9-0000Jj-Rm; Tue, 02 Jan 2018 09:30:41 +0000 Received: from mail-cys01nam02on0086.outbound.protection.outlook.com ([104.47.37.86] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWIte-00075d-TP for linux-arm-kernel@lists.infradead.org; Tue, 02 Jan 2018 09:30:15 +0000 Received: from BN6PR03CA0054.namprd03.prod.outlook.com (10.173.137.16) by BN6PR03MB2689.namprd03.prod.outlook.com (10.173.144.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 2 Jan 2018 09:29:57 +0000 Received: from BY2FFO11OLC007.protection.gbl (2a01:111:f400:7c0c::150) by BN6PR03CA0054.outlook.office365.com (2603:10b6:404:4c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Tue, 2 Jan 2018 09:29:57 +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; 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 BY2FFO11OLC007.mail.protection.outlook.com (10.1.14.254) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 2 Jan 2018 09:29:32 +0000 Received: from anson-OptiPlex-790.ap.freescale.net (anson-OptiPlex-790.ap.freescale.net [10.192.242.177]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w029Tld2026857; Tue, 2 Jan 2018 02:29:52 -0700 From: Anson Huang To: , , , Subject: [PATCH 2/2] cpufreq: imx6q: add 696MHz operating point for i.mx6ul Date: Wed, 3 Jan 2018 01:07:39 +0800 Message-ID: <1514912859-17691-2-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1514912859-17691-1-git-send-email-Anson.Huang@nxp.com> References: <1514912859-17691-1-git-send-email-Anson.Huang@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131593589731104060; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(396003)(39860400002)(376002)(346002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(50466002)(7416002)(110136005)(16586007)(6666003)(54906003)(4326008)(5660300001)(2906002)(2950100002)(72206003)(77096006)(53936002)(97736004)(2201001)(48376002)(316002)(498600001)(104016004)(85426001)(36756003)(8656006)(81156014)(8936002)(81166006)(76176011)(51416003)(356003)(305945005)(59450400001)(8676002)(575784001)(86362001)(50226002)(47776003)(68736007)(105606002)(106466001)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2689; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC007; 1:vzaY9k2THcmdu06lDKNEeppmoQGMGqOq4V4NfQnnvE+Q+1muaDqWOsbYzVVCXMDPKNkglz10LCv0nQwfYIG84mWrEuEr0POet6xa5pVxYXUUQ0x8KYcEw7UyJpsFdfHO MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a353d4b-7409-43b9-153c-08d551c3551b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN6PR03MB2689; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2689; 3:N4Oio87vZQgFtbR0GNc1X8Rm2CMLWqc/uv0dgTYIXjw90f6dko+oIosq5e+9eP2zj0W6HjZNLH7a+rL+WsCKqgwUPxfwXTF43WQ8f6cmi9LVEjmpQDAa2cp1552yVvAxDmTgYjgBsSgHwppnHf87wa4bdMfANTFjzVwfajI0+rJJhRVFNvSO1/AJh39d3UPPJMo34IBlMmFW7bDgV42VCUbtpiguJV4ooh8nJcRDH6zD6n36ZMF0KrToh7LeAxVts+o4z/Vsa4Ba7lnyDRzLx4d+/aTIIhIjj/OHDyDZX5NvBXQ+dz1n0GvYQCcNe0uEEW0dhKn3QIOJQnv4YCbPvlzqEj75T9R1qm1pcIL/d0Q=; 25:qkw1mH6xh99rsUwENgv4qWc02ajBnZ2iByYk+MX5D1J5q0ChX/lpldcOOL+zHUwYt0/8fUOHBnxI6Z/Hz+j8Y8laA+aLAbnuM9i9V0aDiCy3G/orf+v5vnZQQ68PKbcKVSShCpywh8fKYR7w11fOlj4vGZ4oYX7dbg7sv6FASyGSwbIywhFRkZAn8QZztAP3v4cujVX6lcackGjXbnjcacSQxPrz94SLKew4RwLxq83zewN8SBaG3Lwtq5dVnLg4ds41BqZmaY/IU+zoJg5esQMJB3QiAKSMo3RtZTo0f7N3PlPBFqUnLQNodHVEZt4WJGhpJvfaZE+Cmq7sayyMVw== X-MS-TrafficTypeDiagnostic: BN6PR03MB2689: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2689; 31:5aLgxhJi3C5sYJr1IS/rGVv9TjzfOr4Gxg2lzwWe1R4sP1Vjm/DHCynJkagALmeOw1/yHrT2RrX6iCIBvNCsH1bSFUzDL3NmksSJxDcmRwGLyBgr/fNsoVkndkt+81/SUAP2AJNwkR/8Hdmr/PwIEsbm434zsLvAMaSKEirpP8NIAJ5W12uGLKfSyY+IM0rNpD7NgBf+oC+kikub/HhTPBJm8380TqYpYa1wt8206mU=; 4:cJGbioGcaclaQUGR1o46A/UnlZphlqwa91HAF9K91LUc6U1MXd0Plt2TzHXIA10xeEaushAttrtl/SBrEnKVq6cq0iPRKpj6qj0mVhBQc42jpuW2zp4SdvsNpbKPBN5I4HL61lXDJ+DlijBr8GKqNTKZ56xkypRx5rLo45jgXvuBxJ4rSdvJvcsP9fYynudyv1ZoEHaOPoSkMNTSwte/PvMabUN66/+3mih9wpFIvTsAA8iWiTyAJXt7fNMpGduM85yN94nGnnO7uOsmwQM7IURZzKsnRiN/p/1ARFNxSNeJkdoljC7d+24HF97jgoQL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231023)(944510075)(944921075)(946801075)(946901075)(3002001)(6055026)(6096035)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123556025)(20161123563025)(20161123565025)(201708071742011); SRVR:BN6PR03MB2689; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2689; X-Forefront-PRVS: 0540846A1D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2689; 23:DyykXWSJ/ORsvCYS96mFUAD291ZjALUdEFBxmcAiG?= =?us-ascii?Q?xH6fexZ27da0HUgmPDSvvqN5fDEVSFu1YajL1XSionhuCVYJVqCwDhhueadY?= =?us-ascii?Q?MQZbejf6kMJJXoQ1TXSaFuy8XV7xFmcRg7OG1VJMuA1JPwTRyzRAFOqaNtP1?= =?us-ascii?Q?ktMgFFH68VrKbjj16QvoWFI7BbcjAYw+1ZVuDXYOfDBuWK7NOgg6ocSFGin+?= =?us-ascii?Q?sCAq3prmTDNPFkfxQAniisbYg+MNS7C1rNBKQwZDlQ14rNjzockmmSwRXIPz?= =?us-ascii?Q?+9DUsh6OOm7R3+CA23jDzqewc3ulNTcticZov1CQpF4gRI5bALHKayrPIvK9?= =?us-ascii?Q?GqF6VmOD8zqKNMgjfsuFJLHerfWkViSmt/qvX64q0sBe/5d+EQGXRou0/1Wo?= =?us-ascii?Q?vyBR86yqS3FEJe1cFCBPFyur35wTvHkaqFmoVdcWA9WZgX9+1FFmodGwwCb7?= =?us-ascii?Q?Vz7awAopVRQ03D1/Ud5QawS3IdETARFJ2qvG4aPKPxxr9SSiYelhv+9YYytb?= =?us-ascii?Q?GEgap0g00O3B/AflKHUHjfwg9QetHqQFTAESVpKUzrzA824hTEjktptilT6E?= =?us-ascii?Q?zKrSW1yD48K5ImyHJqNsB/cH1PJGcYuzqyKAFACtPEVwh4IaYPR4O5/ZnkEX?= =?us-ascii?Q?hB7YgjWocBxhnvq0G/I7s15vGG5EJfSV1J2eN4KCv2DP5xeXsJt5lyIIa5wf?= =?us-ascii?Q?ouNHZVm3s2R1mgHeaaMBEQzxwpAcIDivYcr0lHk0vDN4isganahI/l54fbXe?= =?us-ascii?Q?UeHRb7IlQQvEG3wbtj1LeErkmg0XFcKPcoOk3B9AJsY9sJjFHOJr4IjgNQFt?= =?us-ascii?Q?yuUQkzazSY4hthD/HuxbryJnZ6EE/aO8+VfdOQqVhKEYb8bhKleNQnuNXu9P?= =?us-ascii?Q?znFF95sy0/g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; 7:cMtL2ofnLCFHVBA6hrrDTe5W2CDR+PMtOnxY8l/Q1+waEyFrw1nksS3y68Ja1aAAyzg+AIwc+l+L34wjj3y/SmX/GiejX4GKR3Zhv5jrEt6KiK7BK6F673Y79BfeA61wti+MbVbwz2n9VtgNnL/dlOEwOqn/Ui83buAdjb8EjNk8LsSv4yA5CgNrguh4+/I9IMfGLNq36KkkdvmFkpU8yj4sGxHWB8hn+NVWmpoSKAxIhDicDY9JAZoIHkcNeNae SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2018 09:29:32.9076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a353d4b-7409-43b9-153c-08d551c3551b 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: BN6PR03MB2689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180102_013011_080697_EDD1390A X-CRM114-Status: GOOD ( 15.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, aisheng.dong@nxp.com, ping.bai@nxp.com, viresh.kumar@linaro.org, rjw@rjwysocki.net, linux@armlinux.org.uk, robh+dt@kernel.org, kernel@pengutronix.de, fabio.estevam@nxp.com, shawnguo@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add 696MHz operating point for i.MX6UL, only for those parts with speed grading fuse set to 2b'10 supports 696MHz operating point, so, speed grading check is also added for i.MX6UL in this patch, the clock tree for each operating point are as below: 696MHz: pll1 696000000 pll1_bypass 696000000 pll1_sys 696000000 pll1_sw 696000000 arm 696000000 528MHz: pll2 528000000 pll2_bypass 528000000 pll2_bus 528000000 ca7_secondary_sel 528000000 step 528000000 pll1_sw 528000000 arm 528000000 396MHz: pll2_pfd2_396m 396000000 ca7_secondary_sel 396000000 step 396000000 pll1_sw 396000000 arm 396000000 198MHz: pll2_pfd2_396m 396000000 ca7_secondary_sel 396000000 step 396000000 pll1_sw 396000000 arm 198000000 Signed-off-by: Anson Huang Reviewed-by: Fabio Estevam --- drivers/cpufreq/imx6q-cpufreq.c | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index d9b2c2d..cbda0cc 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -120,6 +120,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) clk_set_parent(secondary_sel_clk, pll2_pfd2_396m_clk); clk_set_parent(step_clk, secondary_sel_clk); clk_set_parent(pll1_sw_clk, step_clk); + if (freq_hz > clk_get_rate(pll2_bus_clk)) { + clk_set_rate(pll1_sys_clk, new_freq * 1000); + clk_set_parent(pll1_sw_clk, pll1_sys_clk); + } } else { clk_set_parent(step_clk, pll2_pfd2_396m_clk); clk_set_parent(pll1_sw_clk, step_clk); @@ -244,6 +248,43 @@ static void imx6q_opp_check_speed_grading(struct device *dev) of_node_put(np); } +#define OCOTP_CFG3_6UL_SPEED_696MHZ 0x2 + +static void imx6ul_opp_check_speed_grading(struct device *dev) +{ + struct device_node *np; + void __iomem *base; + u32 val; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-ocotp"); + if (!np) + return; + + base = of_iomap(np, 0); + if (!base) { + dev_err(dev, "failed to map ocotp\n"); + goto put_node; + } + + /* + * Speed GRADING[1:0] defines the max speed of ARM: + * 2b'00: Reserved; + * 2b'01: 528000000Hz; + * 2b'10: 696000000Hz; + * 2b'11: Reserved; + * We need to set the max speed of ARM according to fuse map. + */ + val = readl_relaxed(base + OCOTP_CFG3); + val >>= OCOTP_CFG3_SPEED_SHIFT; + val &= 0x3; + if (val != OCOTP_CFG3_6UL_SPEED_696MHZ) + if (dev_pm_opp_disable(dev, 696000000)) + dev_warn(dev, "failed to disable 696MHz OPP\n"); + iounmap(base); +put_node: + of_node_put(np); +} + static int imx6q_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; @@ -311,7 +352,10 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_reg; } - imx6q_opp_check_speed_grading(cpu_dev); + if (of_machine_is_compatible("fsl,imx6ul")) + imx6ul_opp_check_speed_grading(cpu_dev); + else + imx6q_opp_check_speed_grading(cpu_dev); /* Because we have added the OPPs here, we must free them */ free_opp = true;