Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1247256imm; Tue, 22 May 2018 00:35:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqQFfu6UiB7zXBWg/JnNkUnjYrYMJVgCvMexhSE937H3JDHRAFJHU1wz7Loj38juEaUI49n X-Received: by 2002:a63:990a:: with SMTP id d10-v6mr18234140pge.166.1526974529756; Tue, 22 May 2018 00:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526974529; cv=none; d=google.com; s=arc-20160816; b=Wmkm2rmoj2j4jkYX8DDU9p9d0ZvawQ7AacOC5s8blxXZGtAHy3ZgKuvQWMD20z6Own Bd8+UpUVSq+ipRbMTkBqSJVqkTOODNuO5lo5lqxZbtGPM/0kcsTtt5LDTJe7wNKTX75K S/lSCtsTi7hHaL3bWuFFg1VepWwoUcNfaxXlmHFYg5D97AxEHi0DA1IB1QbayyYkY1Cj TWDej64wj02BAIgUmBUgh2KgUW8RomAoePFBA5rc66v5BPAy0y+9HoMil3j4n+LhVUl5 pGreCRXDG2Ds3rFUkPlq5ynxESrDpAnhxrlIJzGOxnR6xn4Mn9+1AZZ48Wpj74o8P4Zy BeHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=W1KDd6mZZ1O/88GcgnBXdBvHNYSzuYxYFFKG9hLEXS4=; b=rUOCgkXhikFC34prhZPmnRMm/B3IB12FHvVs/3z7YOStuI7xfnPb0jOfG7QqbzkIIV fwK3cxPFU+xQamr6wSnqgse2d1zjXgNWiF2X/D7ccuk3koDbZbByg9q5ywfshyiIcdWB 2fT5zfky3nuZuWo9Mxh+bqRp4Vk5lw/fyy4LnxIQSl8KQEKWEadnD6o2XvJTEh9Q1ir4 ll0sjSH98L9rz8/3tvkajuhK9as0dXkUE7/8V3Vr1b1U5Oz43Z31AVVumwTsbcHeOXeP Ssn256cmPqWATXuJiAJmfF1oS4sCng7BJOK5LVorA9HmDO9OaXjM0WxThFINiDXGSK3U XuuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14-v6si15285560pfh.211.2018.05.22.00.35.14; Tue, 22 May 2018 00:35:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751443AbeEVHe7 (ORCPT + 99 others); Tue, 22 May 2018 03:34:59 -0400 Received: from 4.mo7.mail-out.ovh.net ([178.32.122.254]:43957 "EHLO 4.mo7.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbeEVHe6 (ORCPT ); Tue, 22 May 2018 03:34:58 -0400 X-Greylist: delayed 4185 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 May 2018 03:34:58 EDT Received: from player797.ha.ovh.net (unknown [10.109.105.8]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id 7F9B6A9CD0 for ; Tue, 22 May 2018 08:18:20 +0200 (CEST) Received: from localhost.localdomain (22.220.201.77.rev.sfr.net [77.201.220.22]) (Authenticated sender: sebastien.szymanski@armadeus.com) by player797.ha.ovh.net (Postfix) with ESMTPSA id A15C52E00B2; Tue, 22 May 2018 08:18:06 +0200 (CEST) From: =?UTF-8?q?S=C3=A9bastien=20Szymanski?= To: linux-arm-kernel@lists.infradead.org Cc: "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo , Sascha Hauer , Fabio Estevam , Stefan Agner , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, =?UTF-8?q?S=C3=A9bastien=20Szymanski?= Subject: [PATCH v3 1/3] cpufreq: imx6q: check speed grades for i.MX6ULL Date: Tue, 22 May 2018 08:28:51 +0200 Message-Id: <20180522062853.24799-1-sebastien.szymanski@armadeus.com> X-Mailer: git-send-email 2.16.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13126867014484710652 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedthedrgedtgddutdegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check the max speed supported from the fuses for i.MX6ULL and update the operating points table accordingly. Signed-off-by: Sébastien Szymanski --- Changes for v3: - none Changes for v2: - none drivers/cpufreq/imx6q-cpufreq.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 83cf631fc9bc..f094687cae52 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -266,6 +266,8 @@ static void imx6q_opp_check_speed_grading(struct device *dev) } #define OCOTP_CFG3_6UL_SPEED_696MHZ 0x2 +#define OCOTP_CFG3_6ULL_SPEED_792MHZ 0x2 +#define OCOTP_CFG3_6ULL_SPEED_900MHZ 0x3 static void imx6ul_opp_check_speed_grading(struct device *dev) { @@ -287,16 +289,30 @@ static void imx6ul_opp_check_speed_grading(struct device *dev) * Speed GRADING[1:0] defines the max speed of ARM: * 2b'00: Reserved; * 2b'01: 528000000Hz; - * 2b'10: 696000000Hz; - * 2b'11: Reserved; + * 2b'10: 696000000Hz on i.MX6UL, 792000000Hz on i.MX6ULL; + * 2b'11: 900000000Hz on i.MX6ULL only; * 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"); + + if (of_machine_is_compatible("fsl,imx6ul")) { + if (val != OCOTP_CFG3_6UL_SPEED_696MHZ) + if (dev_pm_opp_disable(dev, 696000000)) + dev_warn(dev, "failed to disable 696MHz OPP\n"); + } + + if (of_machine_is_compatible("fsl,imx6ull")) { + if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ) + if (dev_pm_opp_disable(dev, 792000000)) + dev_warn(dev, "failed to disable 792MHz OPP\n"); + + if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ) + if (dev_pm_opp_disable(dev, 900000000)) + dev_warn(dev, "failed to disable 900MHz OPP\n"); + } + iounmap(base); put_node: of_node_put(np); @@ -356,7 +372,8 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_reg; } - if (of_machine_is_compatible("fsl,imx6ul")) + if (of_machine_is_compatible("fsl,imx6ul") || + of_machine_is_compatible("fsl,imx6ull")) imx6ul_opp_check_speed_grading(cpu_dev); else imx6q_opp_check_speed_grading(cpu_dev); -- 2.16.1