From patchwork Mon Dec 14 13:58:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 58348 Delivered-To: patch@linaro.org Received: by 10.112.73.68 with SMTP id j4csp1487451lbv; Mon, 14 Dec 2015 05:58:38 -0800 (PST) X-Received: by 10.66.236.229 with SMTP id ux5mr43975181pac.91.1450101515614; Mon, 14 Dec 2015 05:58:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u84si3535968pfi.160.2015.12.14.05.58.35; Mon, 14 Dec 2015 05:58:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932594AbbLNN6Y (ORCPT + 6 others); Mon, 14 Dec 2015 08:58:24 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38534 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753036AbbLNN6U (ORCPT ); Mon, 14 Dec 2015 08:58:20 -0500 Received: by wmpp66 with SMTP id p66so61933828wmp.1 for ; Mon, 14 Dec 2015 05:58:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oC/HeL9DUPB2nR1zyCvJXQ4tRBZzl8mfpqLHpyUjuaE=; b=xzqjJFOIKuL7yPDi0c7b6c3P9/7WnbGidV/IwdZXxY5KtfzvSRSI6V5Mp3CWhFhh0/ QFnuab0DmbSAWTHKGi7MzHWvzejd7noQcLQNDtzNlakcJF7EcCzvpm+qLxHmhtd64bmY RGgYFCSO5nDikDKHDmRPgtUO9GnxkUYt24+2V6v0HJdL+zTeRw+PU2kGtuJ6kzrbsarX sgsHk2zzqkxyB8PHM6BXKe2UypQmmD9EPSY+1LKv7utrP8ymVM5NPNhNOU2Lv237B/c6 2JbVdfTjXSJNZbiI/8qoQJ+mnVhM0432c+WpXca8Ry3MnP7bZvMrghygJ0YK/1xCIzZ6 cPMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oC/HeL9DUPB2nR1zyCvJXQ4tRBZzl8mfpqLHpyUjuaE=; b=XAN/v7pi1v/t2MGPbrUs0Kp3lSxsl7zq9Wn3z/uCN1LsU6vimwruku6dIxbdBzULX9 x5PKnFaX6fvLoRdnBV57y7fshW+Ne7/CB4RoKgSx/MC6wAlXjRC373cEg5qGejA4/VJ2 S4TkVH+lpDKaCPVAAUbHpu7GdPZOgfwU5f36MeVY+BorjlRYjdVQuSpHcTogTx+Gu+Z6 H1Ad2tCL8bz3/ieSAuMqY6MZMSGsYQ/rXj+c58aww6c2FHgiTCBxUIs0B0lzU/99p6C1 9S35tG42qrVQAYSlPMrBpByo4zbcF/SCB5Vte2Iqw0mqFHuyKEb/fVDrA6EWiDhtnNK4 yLag== X-Gm-Message-State: ALoCoQlMsKBqZaOmLSZ13sL21rq/4FgVifMZD/tmHsdddwkcT3pukLa/A8N10TZViSEtMMFEMtR5ZhNMS+r68eWnoHk+zPc0qg== X-Received: by 10.28.125.201 with SMTP id y192mr25087343wmc.23.1450101497734; Mon, 14 Dec 2015 05:58:17 -0800 (PST) Received: from mms.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id w124sm6846546wmg.17.2015.12.14.05.58.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Dec 2015 05:58:16 -0800 (PST) From: Georgi Djakov To: sboyd@codeaurora.org Cc: mturquette@baylibre.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v4 1/3] clk: qcom: Add A53 PLL support Date: Mon, 14 Dec 2015 15:58:01 +0200 Message-Id: <1450101483-23509-2-git-send-email-georgi.djakov@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1450101483-23509-1-git-send-email-georgi.djakov@linaro.org> References: <1450101483-23509-1-git-send-email-georgi.djakov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add support for the PLL, which generates the higher range of CPU frequencies on MSM8916 platforms. Signed-off-by: Georgi Djakov --- .../devicetree/bindings/clock/qcom,a53-pll.txt | 18 ++++ drivers/clk/qcom/Kconfig | 9 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/a53-pll.c | 100 ++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,a53-pll.txt create mode 100644 drivers/clk/qcom/a53-pll.c -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/clock/qcom,a53-pll.txt b/Documentation/devicetree/bindings/clock/qcom,a53-pll.txt new file mode 100644 index 000000000000..5cf0af1eecf9 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/qcom,a53-pll.txt @@ -0,0 +1,18 @@ +A53 PLL Binding +--------------- +The A53 PLL is the main CPU PLL used for frequencies above 1GHz. + +Required properties : +- compatible : Shall contain only one of the following: + + "qcom,a53-pll" + +- reg : shall contain base register location and length + +Example: + + a53pll: a53pll@0b016000 { + compatible = "qcom,a53-pll"; + reg = <0x0b016000 0x40>; + }; + diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index b552eceec2be..d06cf687be4f 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -123,3 +123,12 @@ config MSM_MMCC_8996 Support for the multimedia clock controller on msm8996 devices. Say Y if you want to support multimedia devices such as display, graphics, video encode/decode, camera, etc. + +config QCOM_A53PLL + bool "A53 PLL" + depends on COMMON_CLK_QCOM + help + Support for the A53 PLL on some Qualcomm devices. It provides + support for CPU frequencies above 1GHz. + Say Y if you want to support CPU frequency scaling on devices + such as MSM8916. diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index dc4280b85db1..c7c26eeab67c 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -25,3 +25,4 @@ obj-$(CONFIG_MSM_GCC_8996) += gcc-msm8996.o obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o +obj-$(CONFIG_QCOM_A53PLL) += a53-pll.o diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c new file mode 100644 index 000000000000..01176240f728 --- /dev/null +++ b/drivers/clk/qcom/a53-pll.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2015, Linaro Limited + * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include + +#include "clk-pll.h" +#include "clk-regmap.h" + +static struct pll_freq_tbl a53pll_freq[] = { + { 998400000, 52, 0x0, 0x1, 0 }, + { 1094400000, 57, 0x0, 0x1, 0 }, + { 1152000000, 62, 0x0, 0x1, 0 }, + { 1209600000, 65, 0x0, 0x1, 0 }, + { 1401600000, 73, 0x0, 0x1, 0 }, +}; + +static const struct regmap_config a53pll_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .max_register = 0x40, + .fast_io = true, + .val_format_endian = REGMAP_ENDIAN_LITTLE, +}; + +static const struct of_device_id qcom_a53pll_match_table[] = { + { .compatible = "qcom,a53-pll" }, + { } +}; +MODULE_DEVICE_TABLE(of, qcom_a53pll_match_table); + +static int qcom_a53pll_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct clk_pll *pll; + struct resource *res; + void __iomem *base; + struct clk *clk; + struct regmap *regmap; + struct clk_init_data init; + + pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + if (!pll) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + regmap = devm_regmap_init_mmio(dev, base, &a53pll_regmap_config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + pll->l_reg = 0x04, + pll->m_reg = 0x08, + pll->n_reg = 0x0c, + pll->config_reg = 0x14, + pll->mode_reg = 0x00, + pll->status_reg = 0x1c, + pll->status_bit = 16, + pll->freq_tbl = a53pll_freq, + + init.name = "a53pll", + init.parent_names = (const char *[]){ "xo" }, + init.num_parents = 1, + init.ops = &clk_pll_sr2_ops, + pll->clkr.hw.init = &init; + + clk = devm_clk_register_regmap(dev, &pll->clkr); + + return PTR_ERR_OR_ZERO(clk); +} + +static struct platform_driver qcom_a53pll_driver = { + .probe = qcom_a53pll_probe, + .driver = { + .name = "qcom-a53pll", + .of_match_table = qcom_a53pll_match_table, + }, +}; + +module_platform_driver(qcom_a53pll_driver); +MODULE_DESCRIPTION("Qualcomm A53 PLL Driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:qcom-a53pll");