Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5204474imm; Tue, 19 Jun 2018 06:49:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJOrBcNmFGZVw4ePjBpL+P50dazMQaCzyuiuewK6JKY9+K35YlgK4ip+SHO065hTylU02YJ X-Received: by 2002:a17:902:2884:: with SMTP id f4-v6mr19040570plb.204.1529416193500; Tue, 19 Jun 2018 06:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529416193; cv=none; d=google.com; s=arc-20160816; b=RMXWBkgV5XE6+Xo0cFG+VK1yJHRvxQjXSfh+WM5kUyu96xfXYj9aR0sKkwjyAY47SD uZou/YrbGn24At/03i1846r3PkfIoUAgvhQpQwF0HG8BloP80Y1VsVa1Gg8gpH+O+xGF vKgTehI07FfEO7N+XaPhBP1IJI0h5DUEe8H1Gln9VXSJB8QdpwLxwgi1hArzv8YZSttN 1++4Ir1zi06M0KhYjCX2p239HdslgXOSWwL3X/jIjdWktX/LTX1s/6r2v53zEP4rAJ7k CDb8LDeFM7GkXvUz+XFQxUjYx0A+ZsGB49OtmYPsZR2MHtMcI2b6IKMbC1fdJOiQBqgE IUBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=F5DkV0MtCiIhtBxPJBC7XshHP3IoP7TxazBGSGHZJ70=; b=f+a1GhWNz2wp4eZy9k97WLpSSzRYKoy62IpNywn+yyKIVAWi0nvWZGfz6v5PTpLZ0O YJkeIQTyuVobxtTouHU81t5GtXxIMXp+Yg40SE2YfSIRmP3nEH2fGXBpgMQh4GXjOZZg YIT1omUojeREnWs11dTtYu7ZvPChuVGZYCc/JgtODZJ0C43GYJ220gmcFLlcX9xoieXH t/rmZ7dJtRu7nElqbd8dC28mCVTZGKH5B7+HDqM/50+2M6QX2gN8KWvLi36+t3KeQrIG E9n2/aBpdxT3fKa19CEBYHRTwjEP1mdfHRMMn/77wvA9DTsZrr6EJ9RmIP95a0t+1NVJ g+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=YXq9bZp2; dkim=pass header.i=@codeaurora.org header.s=default header.b=V6rQXKAk; 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 p14-v6si14135482pgv.255.2018.06.19.06.49.39; Tue, 19 Jun 2018 06:49:53 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=YXq9bZp2; dkim=pass header.i=@codeaurora.org header.s=default header.b=V6rQXKAk; 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 S966545AbeFSNq3 (ORCPT + 99 others); Tue, 19 Jun 2018 09:46:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40720 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965599AbeFSNqZ (ORCPT ); Tue, 19 Jun 2018 09:46:25 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 609D560B18; Tue, 19 Jun 2018 13:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529415984; bh=mKFYBUhQhFrxTII6ZEExCHQnN8fHIOHpTpjqVUDE0rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YXq9bZp2xZNf3cE1UibJeOfLBTdC7KnBcY6sdpVn2v+f15j5qa2PX3HkDeMJ2VD7y P9QqsgnCUUzLNfT+LlPdlbmsLuyFHK2Mv+78XD09/VFbTgw4fv9AtmOnP1bP/lQ/c7 GA1w4RLf80XIwsriPywgqvBbgJXM/zv7YbIV3csQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from srichara-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0577660B15; Tue, 19 Jun 2018 13:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529415983; bh=mKFYBUhQhFrxTII6ZEExCHQnN8fHIOHpTpjqVUDE0rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V6rQXKAkOhdNlflru/ML3qwZ+pz1B+wdS9O9+vGP5qxLIsYSrZB9P+QJn2gAmEbjm e2mMRGBRLWytF7orb6Vyd08QXvQZySjWjZfehgyB6/SQ26TZhW3/e5pZOKp98Vhmuc y/wgsZuKbHT997BdwfzBd4ZF/DUQqGoz3NuZSud4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0577660B15 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sricharan@codeaurora.org From: Sricharan R To: robh@kernel.org, viresh.kumar@linaro.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@codeaurora.org, linux@armlinux.org.uk, andy.gross@linaro.org, david.brown@linaro.org, rjw@rjwysocki.net, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux@arm.linux.org.uk, thierry.escande@linaro.org, ctatlor97@gmail.com Cc: sricharan@codeaurora.org Subject: [PATCH v10 08/14] clk: qcom: Add KPSS ACC/GCC driver Date: Tue, 19 Jun 2018 19:15:19 +0530 Message-Id: <1529415925-28915-9-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1529415925-28915-1-git-send-email-sricharan@codeaurora.org> References: <1529415925-28915-1-git-send-email-sricharan@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd The ACC and GCC regions present in KPSSv1 contain registers to control clocks and power to each Krait CPU and L2. For CPUfreq purposes probe these devices and expose a mux clock that chooses between PXO and PLL8. Cc: Signed-off-by: Stephen Boyd --- drivers/clk/qcom/Kconfig | 8 +++++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/kpss-xcc.c | 87 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 drivers/clk/qcom/kpss-xcc.c diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 66894d2..b17f638 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -262,6 +262,14 @@ config QCOM_HFPLL Say Y if you want to support CPU frequency scaling on devices such as MSM8974, APQ8084, etc. +config KPSS_XCC + tristate "KPSS Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the Krait ACC and GCC clock controllers. Say Y + if you want to support CPU frequency scaling on devices such + as MSM8960, APQ8064, etc. + config KRAIT_CLOCKS bool select KRAIT_L2_ACCESSORS diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index 82615ed..b9cf068 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -43,4 +43,5 @@ obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o +obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o obj-$(CONFIG_QCOM_HFPLL) += hfpll.o diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c new file mode 100644 index 0000000..8590b5e --- /dev/null +++ b/drivers/clk/qcom/kpss-xcc.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2018, The Linux Foundation. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *aux_parents[] = { + "pll8_vote", + "pxo", +}; + +static unsigned int aux_parent_map[] = { + 3, + 0, +}; + +static const struct of_device_id kpss_xcc_match_table[] = { + { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL }, + { .compatible = "qcom,kpss-gcc" }, + {} +}; +MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); + +static int kpss_xcc_driver_probe(struct platform_device *pdev) +{ + const struct of_device_id *id; + struct clk *clk; + struct resource *res; + void __iomem *base; + const char *name; + + id = of_match_device(kpss_xcc_match_table, &pdev->dev); + if (!id) + return -ENODEV; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + if (id->data) { + if (of_property_read_string_index(pdev->dev.of_node, + "clock-output-names", + 0, &name)) + return -ENODEV; + base += 0x14; + } else { + name = "acpu_l2_aux"; + base += 0x28; + } + + clk = clk_register_mux_table(&pdev->dev, name, aux_parents, + ARRAY_SIZE(aux_parents), 0, base, 0, 0x3, + 0, aux_parent_map, NULL); + + platform_set_drvdata(pdev, clk); + + return PTR_ERR_OR_ZERO(clk); +} + +static int kpss_xcc_driver_remove(struct platform_device *pdev) +{ + clk_unregister_mux(platform_get_drvdata(pdev)); + return 0; +} + +static struct platform_driver kpss_xcc_driver = { + .probe = kpss_xcc_driver_probe, + .remove = kpss_xcc_driver_remove, + .driver = { + .name = "kpss-xcc", + .of_match_table = kpss_xcc_match_table, + }, +}; +module_platform_driver(kpss_xcc_driver); + +MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:kpss-xcc"); -- 1.9.1