From patchwork Sat Jan 6 10:42:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 10147575 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 8F24E601BE for ; Sat, 6 Jan 2018 03:05:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D12025404 for ; Sat, 6 Jan 2018 03:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 306CC2624C; Sat, 6 Jan 2018 03:05:53 +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 B815225404 for ; Sat, 6 Jan 2018 03:05:52 +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=AmjF2luQJw3y+XTGACNMoOTubEA68W7aThntdz0zHtg=; b=bXQ90U71o0gTV8 ONMsQqBBUF0pZyp8dg+mYRC0KlddOq7gBRh+ffn5H9XnntGojYJuzHwoNMk1UQu7csWrWM/P2CITZ i6vokPyYGF8jwPCADQDLoLqcaq5oYfwM9hHdPlfF0GwFtA7puQo60cRaku/WMAKix1XCNRNERvMrj fuTU9v0F/vm5HQOpyFE3XXaneoN8wl7r88ijNzAbLQ2Kq62Ims5arpdIHp9xs6Yb+ntC4p8IvUWmp ESpQxqtiAoUmOtmo0VmbVUIo1xGcTzlaZYg5f2tLwIXLoXvWbzXrcxOOT6RfTvnrEdWMCICAIqGo7 x7fRspPGRknqjfXD1mRg==; 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 1eXenr-0007MY-40; Sat, 06 Jan 2018 03:05:47 +0000 Received: from mail-sn1nam01on0069.outbound.protection.outlook.com ([104.47.32.69] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eXenR-0006Va-KB for linux-arm-kernel@lists.infradead.org; Sat, 06 Jan 2018 03:05:23 +0000 Received: from MWHPR03CA0002.namprd03.prod.outlook.com (10.175.133.140) by BY2PR0301MB0726.namprd03.prod.outlook.com (10.160.63.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Sat, 6 Jan 2018 03:05:08 +0000 Received: from BN1AFFO11FD021.protection.gbl (2a01:111:f400:7c10::142) by MWHPR03CA0002.outlook.office365.com (2603:10b6:300:117::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Sat, 6 Jan 2018 03:05:08 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; 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 BN1AFFO11FD021.mail.protection.outlook.com (10.58.52.81) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Sat, 6 Jan 2018 03:04:35 +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 w0634pCL005932; Fri, 5 Jan 2018 20:04:57 -0700 From: Anson Huang To: , , , , , , , , Subject: [PATCH V2 2/2] cpufreq: imx6q: add 696MHz operating point for i.mx6ul Date: Sat, 6 Jan 2018 18:42:40 +0800 Message-ID: <1515235360-1628-2-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515235360-1628-1-git-send-email-Anson.Huang@nxp.com> References: <1515235360-1628-1-git-send-email-Anson.Huang@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131596814801538717; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(376002)(39380400002)(39860400002)(346002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(97736004)(68736007)(16586007)(316002)(53936002)(59450400001)(4326008)(47776003)(76176011)(305945005)(48376002)(2906002)(86362001)(2201001)(356003)(81166006)(106466001)(50466002)(8676002)(85426001)(72206003)(81156014)(498600001)(8936002)(50226002)(51416003)(105606002)(104016004)(7416002)(5660300001)(110136005)(54906003)(36756003)(8656006)(6666003)(77096006)(2950100002)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0726; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD021; 1:RnaMEdLYmNicICMYp8aWghqSsM9qmENCLl3sHO6XTYzBg6Vv4SBdDztqNLkkxw83543xQpGJLHuf1TEv26/G1dTjMdWMVL8Xtmf6iwhkekIUOMOGcKnfmtHdimIJRfRa MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b978e4e-3a49-4780-8e9d-08d554b23a48 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BY2PR0301MB0726; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0726; 3:t8GSE/d3kObyFWMRQd2dB2fA+xJ4hyocWJfT5u+77jOSlnuB/2m2MxKEaMQ7NTyWqZXwaqVbTtTG/UxOsx2wNNz3eP7+098Z83TXj09dAqoy/enQ50PoVkLg5iIUo1qtif5j6yoi4+cp7VAC5awgZTjuv6LTwfRGVbwKoPxxFSsN6blliMas0k/z07kGuTDojKy1LetnP9t8YemzKL/OHADNGRQMnLP8MUl9c+pwiW2RAR0tVpC+ymRhIuV7vMimIjWu+uOMRomgUrnBxnwYzo0Pd9+dueTsOiG/d+ZDP+37muL6cUAm247I9e3D5YBSlnZxAsG8HDIqn2MG6KjKosBTmzoVcCFElUXzbo3qIEk=; 25:7GTAlPo3Q1zUiyeMDAv6EuqSLMbXzaWVqDdyCrH1O5fJ8va4SM2k/gIjn1JICJiepfwWt/JkXALJX+w0f6IfXcEIOTZOpfh2pT0Fy8hiHYXHfcodGGtRH+Ejz5VCcOyZK0PV4JpLRbEOnUUFVsUGaTKGeWGx8m/MVjR2SBDWxb/+rtrMyhvS5Z3hbLhjPXgIlAyCShjddJxBg+wwIhAtK4oy69TG5GNb0In821bHcSm4JfrVARkcoBeD+4RH61PUsh2NfhD/wFu37Qu/0e912ThjhbmqkYVezNcgm8hDyBi+htTwnck53Cz72kQFwU5mRCcMr3ea0YRBsrOQuEt+hA== X-MS-TrafficTypeDiagnostic: BY2PR0301MB0726: X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0726; 31:NHz3ISVtEzBPRsVs6sN0GapXLzHn/khVq/qcY1klDj2AmW9rQryo537Ej/JCtX+FhpCe8JJJDEuOpmmxft2FIvODVmh3o47KI9CNC3hqDfPuZN87SzbnYJPaBJEC0x52yG0VQ2iWLHnDne+8PdClFlw83+7DqHKKcU06hU4XEUVFMZ4UdJMIm/mzDCYutN+dGYMcvNESqoPOTFUYTU24XNASQnO2gdkbrbhoLRuacKw=; 4:fw5Ko5KupA/5SkQuS+eN1beH7f9N+2MjJvUCeuC1kroN5Ui8f6ipmUhstjo1jWa3dJzbyQ82F1FIniKTKXYjc898xPeTAdMBgVE/ffMiiIraKS6NuMI1GOSidBcvzs5m9xvzf/HwRGg08jQnIB4WFTVPymu3W3kRRVtEbtlsD93RXHnkzUArKC+GwpV8wNMXcyRwmoApGAOPdbAvpwSNn6K9UuVK+7p9z9asJLv9MIgOuJSCu3VPPVQ+MQhJFREVfV6PvSQNkMdOaYbztn+CyRc/bP2VC0LDfVJwft16bthKKfNIOx2LU9XKuXht0HFG 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)(93006095)(93001095)(10201501046)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(6055026)(6096035)(20161123565025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123561025)(20161123556025)(201708071742011); SRVR:BY2PR0301MB0726; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BY2PR0301MB0726; X-Forefront-PRVS: 0544D934E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB0726;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C2WLMY6g3xcAZX2lfNx6t+ujA3RYYwHMbJuqkSMY8s6jhET4Hj/KSj4iF/xK5QO8nM4PbHAaA/foJVI6M4AW0W+VGCJ7bVSsfDuMY/uutjbj5ZHWJcT0eSXyLEcX+M2yUx57brwWSnjwaMxshLBlsGZXQOe8/LfhKpcfP+ZZ9O3jk+tCj4s4IOZVDW/fdmzNOYN5Ec8p4lQE9dpNtteZHnw3q6fQ5zjktHJX8n+jSI0I59dNlNYl6sBH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2018 03:04:35.3491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b978e4e-3a49-4780-8e9d-08d554b23a48 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: BY2PR0301MB0726 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180105_190521_766873_D2085CB4 X-CRM114-Status: GOOD ( 15.30 ) 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.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 Acked-by: Shawn Guo --- changes since v1: redo the patch based on linux-next-pm. 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 8bfb077..741f22e 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -136,6 +136,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) clks[PLL2_PFD2_396M].clk); clk_set_parent(clks[STEP].clk, clks[SECONDARY_SEL].clk); clk_set_parent(clks[PLL1_SW].clk, clks[STEP].clk); + if (freq_hz > clk_get_rate(clks[PLL2_BUS].clk)) { + clk_set_rate(clks[PLL1_SYS].clk, new_freq * 1000); + clk_set_parent(clks[PLL1_SW].clk, clks[PLL1_SYS].clk); + } } else { clk_set_parent(clks[STEP].clk, clks[PLL2_PFD2_396M].clk); clk_set_parent(clks[PLL1_SW].clk, clks[STEP].clk); @@ -260,6 +264,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; @@ -314,7 +355,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;