Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4395017ooa; Tue, 14 Aug 2018 05:31:11 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwIUmcapvYOKiLQWpNrbkor6TcmwfipGZl7b66eKPIXfi7luQdl4UdBVFq4Xvv50DsBsOmx X-Received: by 2002:a62:778c:: with SMTP id s134-v6mr23150821pfc.189.1534249871411; Tue, 14 Aug 2018 05:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534249871; cv=none; d=google.com; s=arc-20160816; b=sqpD9CekJII2aMm4Yc4Z2kkS2ITOR7SBFicDg8XGD+U0sm4S7UxITLPFPpvCvHJrJP 7C8m23+Cd/PlkgGCo8T6JUYyzWbEbkxnjnutOXQhYPwI7XX5e+3aOgqXmx19GSNK8xlu dUTaua8YWfhXzqtslteR8F0tZTYDy8WjI/wqAD27MkoYNbGsv4bPRdxmmwPiCYRg7hn7 w3LrWWQ/uf0HuuVJZ1wkeEoG8KUuHG92o6o5Rtz8kGYZN/ItVgGjQ07f450hsSmT3sHD mtULnQ/kQFbbsS9Th4eqZ2SEZJcod3/0OTO7PlJo+el5sAhpf5x3RKh6MmHouTtmld+I 8YDw== 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=So50TO/nGDtceJ1f1rmmitdpUulkGNXUlEFn/wUg8wk=; b=E65nsvMXtZf8pPIinynjY/iijVJGpXZCO9r3Mgqj8y4y8xb+woPYyoMj7TY7w+HV3F 4NGPLzsAnNTeG42+fyVroFdwzaMcFgZlOHOHMYOOuEHXgaAAzBG6Tu7ANoty735sMqpP r4lqruOaHsoItclsfXzrc0ZRjB6qOq4//5oQJfQ3obLffFHh3s6Ijz5k7ukQVS/jt4eh AjfMwDXCzqDpSVyS2clu8BXj7wXK61Abms8Q+iGrpxzf+PhL0mQsgNkHikPRCv6h3HMx B+j7WqDQk2imkvZTX7c+95LEv0B4233fyLLVV3PHyk4VADz+Sm8OfqL9ddbSKL/CnzlL 3YuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=RaSbzm9r; dkim=pass header.i=@codeaurora.org header.s=default header.b="GYvCMI/E"; 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 r7-v6si15801639ple.309.2018.08.14.05.30.46; Tue, 14 Aug 2018 05:31:11 -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=RaSbzm9r; dkim=pass header.i=@codeaurora.org header.s=default header.b="GYvCMI/E"; 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 S1732483AbeHNPBP (ORCPT + 99 others); Tue, 14 Aug 2018 11:01:15 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42126 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732433AbeHNPBO (ORCPT ); Tue, 14 Aug 2018 11:01:14 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2256360DBB; Tue, 14 Aug 2018 12:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534248860; bh=CQnlWJrCtbOvD91ZPy0s55aKholOblDk0bH2mMCfSk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RaSbzm9rv27lQDWexnDAqYnst6A5y2DhNxjLiEC+nAMcSZNQVy3OEPXtmKd6OJrqm bD97ZRRTPWT4n6YNuGOYxxYWi9TIfKBW6HoH6jyUK+cVgVnLPHf2bQbFK7v4miMItg SnUEIJPliT4+pOmF3yIop0ilssPFFFl1tgM+6mXc= 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 A7D7A60DAA; Tue, 14 Aug 2018 12:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534248825; bh=CQnlWJrCtbOvD91ZPy0s55aKholOblDk0bH2mMCfSk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYvCMI/EnEnMjv0yToA732bBCplWkpfuz50PY1G+4xi5QjH8jXWTx/rqLeNc3NbCa g+DOD0Y3xF9dj3KLF+ehQmGOOe5r1wDTisFvqstIuX6g+mNmY5WGnquyCSATtihTNi LME+DHNo7Yo99ZKWQ63I8h4EHGdfK0IG8g7rrnrk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A7D7A60DAA 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: mark.rutland@arm.com, robh@kernel.org, sudeep.holla@arm.com, linux@arm.linux.org.uk, ctatlor97@gmail.com, rjw@rjwysocki.net, viresh.kumar@linaro.org, mturquette@baylibre.com, linux-pm@vger.kernel.org, sboyd@codeaurora.org, linux@armlinux.org.uk, thierry.escande@linaro.org, linux-kernel@vger.kernel.org, david.brown@linaro.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, andy.gross@linaro.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, niklas.cassel@linaro.org Cc: sricharan@codeaurora.org Subject: [PATCH v12 08/14] clk: qcom: Add KPSS ACC/GCC driver Date: Tue, 14 Aug 2018 17:42:27 +0530 Message-Id: <1534248753-2440-9-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1534248753-2440-1-git-send-email-sricharan@codeaurora.org> References: <1534248753-2440-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 Signed-off-by: Sricharan R --- 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 ada4160..7a99627 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -281,6 +281,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 506c4cf..92310ee 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -45,4 +45,5 @@ obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.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"); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation