From patchwork Thu May 13 15:34:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Dudziak X-Patchwork-Id: 12255919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92B61C43461 for ; Thu, 13 May 2021 15:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F2EF611AB for ; Thu, 13 May 2021 15:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234928AbhEMPhe (ORCPT ); Thu, 13 May 2021 11:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234896AbhEMPh2 (ORCPT ); Thu, 13 May 2021 11:37:28 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA90CC06175F for ; Thu, 13 May 2021 08:36:17 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id u21so40423069ejo.13 for ; Thu, 13 May 2021 08:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snejp.pl; s=gmail; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RckDkE4qxGZvjN5zfkyL3EzM+dPcbREpj6loS+q+SAE=; b=Z1bjBN1rPw1kra+FSpbyjHXyc/0KOwdODLr6/25TeA63e6qPQRiBsIcjGYjuI9AGKO QhH+Hu+0DFv9H5gPzunFiRj9W/u9yie/W2h5WbfYoug7FUip8MTzI27vMTGgUvutGORe KSheWdpGjrVbODw/a9Llf8RmCLWrc6ZF22TRUpeALRmD9351hZMe/TJjZ9EivmIEVGUL fTxoc/A7sRoGhuzChAb8BgkbZs2KeEvZf/hvL5Y9dWLQSiV6hltgEL+VX9Tyt/keM8pC cXofJK5Ytoce6gw3qbw7l1x7jEfUyb9PUGgDainNHb1T0GnSLJ1McLDdERv3QBG2B1AN LEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RckDkE4qxGZvjN5zfkyL3EzM+dPcbREpj6loS+q+SAE=; b=JcJz6Kyq8kZ4eZxP78wrVs+Th/IXD1JPwK/iLrvsVMfmcmkH3pl9AJBgnI3Cf/CEq0 ppuBNzD6PZZ8YXUBKiSXasKDJqOPFL7BOREBiogHyQ/oAteRLqEehd7x3kTz7ujtJOxL 57ghW1ZVVdFWOGsnwKD03a2cJm5v5fc5Vf01Ko3mJVDNZRxthdOkJtEX2lPjGQuptO12 HaRde2uhcrFDLjliXutwlxKmXx1oozgRe3UHtybuuM7F/rSsFCP5T+eNevdxHB9TNAHu M1Vg1q0NWRwgfK06Ws+ETlYbACP6AWCj2Ib263cppw7zXf4q9rK7Hx8mSRRNoywWHKiW xS9w== X-Gm-Message-State: AOAM5317G3a/9f/NcwexP6fzvx3ZS5kLKq+wRz4NpV15q+Wiygw2dTMA uOphIVWOQUA1Mmsju8Escekn3A== X-Google-Smtp-Source: ABdhPJyKtgSTJRy3WlO2USF9K2vb/hRxtEk/WS3n7MnW/wxd6N5U3N3Iska23ccWXSgspmzDb3lKhg== X-Received: by 2002:a17:906:b191:: with SMTP id w17mr44527233ejy.200.1620920176435; Thu, 13 May 2021 08:36:16 -0700 (PDT) Received: from PackardBell (192038133011.mbb.telenor.dk. [192.38.133.11]) by smtp.googlemail.com with ESMTPSA id gb26sm2217950ejc.25.2021.05.13.08.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 08:36:16 -0700 (PDT) Received: from localhost (PackardBell [local]) by PackardBell (OpenSMTPD) with ESMTPA id fb9dc804; Thu, 13 May 2021 15:35:48 +0000 (UTC) From: Bartosz Dudziak To: Rob Herring , Andy Gross , Bjorn Andersson , Russell King , David Sterba , Jens Axboe , Bartosz Dudziak , Lorenzo Pieralisi , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] dt-bindings: arm: Document qcom,cpss-acc Date: Thu, 13 May 2021 17:34:41 +0200 Message-Id: <20210513153442.52941-2-bartosz.dudziak@snejp.pl> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210513153442.52941-1-bartosz.dudziak@snejp.pl> References: <20210513153442.52941-1-bartosz.dudziak@snejp.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The CPSS ACC binding describes the clock, reset, and power domain controller for a Cortex-A7 CPU. Signed-off-by: Bartosz Dudziak --- .../devicetree/bindings/arm/cpus.yaml | 7 ++-- .../bindings/arm/msm/qcom,cpss-acc.yaml | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,cpss-acc.yaml diff --git a/Documentation/devicetree/bindings/arm/cpus.yaml b/Documentation/devicetree/bindings/arm/cpus.yaml index 26b886b20b..f391e15184 100644 --- a/Documentation/devicetree/bindings/arm/cpus.yaml +++ b/Documentation/devicetree/bindings/arm/cpus.yaml @@ -204,6 +204,7 @@ properties: - marvell,mmp3-smp - mediatek,mt6589-smp - mediatek,mt81xx-tz-smp + - qcom,cpss-acc - qcom,gcc-msm8660 - qcom,kpss-acc-v1 - qcom,kpss-acc-v2 @@ -276,7 +277,7 @@ properties: Specifies the SAW* node associated with this CPU. Required for systems that have an "enable-method" property - value of "qcom,kpss-acc-v1" or "qcom,kpss-acc-v2" + value of "qcom,kpss-acc-v1", "qcom,kpss-acc-v2" or "qcom,cpss-acc" * arm/msm/qcom,saw2.txt @@ -286,9 +287,9 @@ properties: Specifies the ACC* node associated with this CPU. Required for systems that have an "enable-method" property - value of "qcom,kpss-acc-v1" or "qcom,kpss-acc-v2" + value of "qcom,kpss-acc-v1", "qcom,kpss-acc-v2" or "qcom,cpss-acc" - * arm/msm/qcom,kpss-acc.txt + * arm/msm/qcom,kpss-acc.txt or arm/msm/qcom,cpss-acc.yaml rockchip,pmu: $ref: '/schemas/types.yaml#/definitions/phandle' diff --git a/Documentation/devicetree/bindings/arm/msm/qcom,cpss-acc.yaml b/Documentation/devicetree/bindings/arm/msm/qcom,cpss-acc.yaml new file mode 100644 index 0000000000..54efbc5e3d --- /dev/null +++ b/Documentation/devicetree/bindings/arm/msm/qcom,cpss-acc.yaml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/msm/qcom,cpss-acc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortex-A7 Processor Sub-system (CPSS) Application Clock Controller (ACC) + +maintainers: + - Kumar Gala + +description: | + The CPSS ACC provides clock, power domain, and reset control to a Cortex-A7 + processor. There is one ACC register region per CPU within the PSS remapped + region as well as an alias register region that remaps accesses to the ACC + associated with the CPU accessing the region. + +properties: + compatible: + enum: + - qcom,cpss-acc + + reg: + minItems: 1 + maxItems: 2 + items: + - description: ACC base register region + - description: optional ACC alias register region + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + clock-controller@f9088000 { + compatible = "qcom,cpss-acc"; + reg = <0xf9088000 0x1000>, <0xf9008000 0x1000>; + }; From patchwork Thu May 13 15:34:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Dudziak X-Patchwork-Id: 12255921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 413A9C433B4 for ; Thu, 13 May 2021 15:36:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A1B3611AB for ; Thu, 13 May 2021 15:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234955AbhEMPiA (ORCPT ); Thu, 13 May 2021 11:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234920AbhEMPhj (ORCPT ); Thu, 13 May 2021 11:37:39 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11DC3C061756 for ; Thu, 13 May 2021 08:36:24 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id t15so3776244edr.11 for ; Thu, 13 May 2021 08:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snejp.pl; s=gmail; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=I1jcRoiTwZROLEGK3W13nn0z7cF0FHWZcsDuLrXIOJo=; b=V4amHLQIiQwPZ7mdIoVOdaBLuHN/l/9A6qc/a+VKzXvOm7BmZj3KoPOb6mM+b3YIsV C9SNJ5NB6Yk3WOiV+3biktSAp8C9FyeFk6Hnc3zRlvhM8+ns1OBVZr0ErxrFNjf0Lykz UXD8klcen6ZX3YK9sM19sl1IjlzdKUaBEFdikZYRGYyQCpF2nUIqnEKLKKUDuE8ri/WL 2nReZpm+sBnFZ1lEeRkV7JT+oXfrxKhPzrnWzS87OLmFP6BJ0ttZ3oF9utpVuN4czAwX vpam0BxROCT4bZX57bBD3HPaWZFdRnB57J7xPPf4/Roo/dETDXMLzQDygDhV8nyE3dPg Wn6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I1jcRoiTwZROLEGK3W13nn0z7cF0FHWZcsDuLrXIOJo=; b=WYYYgxPcQyTJ+YWPWU5HJb6cv7ESfFslp+M0mnLp6Aw6gbmxAAhwH0+S2xL+QTTjTt 7Tp/NG//v2I46kU6scabNbyeNSYK8ixUDVuhY0CSaHSWH/dsviScxgdIPh3n3woQFyIW eUkpH8rNwLKh90j0sKWstnlSzijA451H/cADnyK9oKuCA89LiVsMFfoQ5lJNZEix9cWY 5yqNrMIM7HosTZxH/az2OjEwtFCQHcqXguYfeBgG6lSncXYuSJEbkg6i5qheOffJEwOF Op9z++uM6ZV1+ao+odTGqCjALaGb/GVUTd+lcOhgt4b+kfXWeLuLhee2ywAdeVou3sZF o3hw== X-Gm-Message-State: AOAM533cFIfs0IV94QZlTkj/9qemt6HbGAzWBSdSh/TbNF/WlQoxcGyE eROZg72xKAXL9ay4tWTG9l2E+A== X-Google-Smtp-Source: ABdhPJztK9wj1Z3IOAtL4fptZucOx8vwrzydF45R+1QkUTxsZj+AGhGZL9ImYJcq4iUljsDnYZx2Ag== X-Received: by 2002:a05:6402:341:: with SMTP id r1mr50979929edw.113.1620920182857; Thu, 13 May 2021 08:36:22 -0700 (PDT) Received: from PackardBell (192038133011.mbb.telenor.dk. [192.38.133.11]) by smtp.googlemail.com with ESMTPSA id p5sm2001723ejm.115.2021.05.13.08.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 08:36:22 -0700 (PDT) Received: from localhost (PackardBell [local]) by PackardBell (OpenSMTPD) with ESMTPA id acc32ad6; Thu, 13 May 2021 15:35:48 +0000 (UTC) From: Bartosz Dudziak To: Rob Herring , Andy Gross , Bjorn Andersson , Russell King , David Sterba , Jens Axboe , Bartosz Dudziak , Lorenzo Pieralisi , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] arm: qcom: Add SMP support for Cortex-A7 Date: Thu, 13 May 2021 17:34:42 +0200 Message-Id: <20210513153442.52941-3-bartosz.dudziak@snejp.pl> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210513153442.52941-1-bartosz.dudziak@snejp.pl> References: <20210513153442.52941-1-bartosz.dudziak@snejp.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Implement support for Cortex-A7 CPU release sequence. Signed-off-by: Bartosz Dudziak --- arch/arm/mach-qcom/platsmp.c | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c index 630a038f45..10780bf14a 100644 --- a/arch/arm/mach-qcom/platsmp.c +++ b/arch/arm/mach-qcom/platsmp.c @@ -29,6 +29,7 @@ #define COREPOR_RST BIT(5) #define CORE_RST BIT(4) #define L2DT_SLP BIT(3) +#define CORE_MEM_CLAMP BIT(1) #define CLAMP BIT(0) #define APC_PWR_GATE_CTL 0x14 @@ -75,6 +76,63 @@ static int scss_release_secondary(unsigned int cpu) return 0; } +static int cortex_a7_release_secondary(unsigned int cpu) +{ + int ret = 0; + void __iomem *reg; + struct device_node *cpu_node, *acc_node; + u32 reg_val; + + cpu_node = of_get_cpu_node(cpu, NULL); + if (!cpu_node) + return -ENODEV; + + acc_node = of_parse_phandle(cpu_node, "qcom,acc", 0); + if (!acc_node) { + ret = -ENODEV; + goto out_acc; + } + + reg = of_iomap(acc_node, 0); + if (!reg) { + ret = -ENOMEM; + goto out_acc_map; + } + + /* Put the CPU into reset. */ + reg_val = CORE_RST | COREPOR_RST | CLAMP | CORE_MEM_CLAMP; + writel(reg_val, reg + APCS_CPU_PWR_CTL); + + /* Turn on the BHS, set the BHS_CNT to 16 XO clock cycles */ + writel(BHS_EN | (0x10 << BHS_CNT_SHIFT), reg + APC_PWR_GATE_CTL); + /* Wait for the BHS to settle */ + udelay(2); + + reg_val &= ~CORE_MEM_CLAMP; + writel(reg_val, reg + APCS_CPU_PWR_CTL); + + reg_val |= L2DT_SLP; + writel(reg_val, reg + APCS_CPU_PWR_CTL); + udelay(2); + + reg_val = (reg_val | BIT(17)) & ~CLAMP; + writel(reg_val, reg + APCS_CPU_PWR_CTL); + udelay(2); + + /* Release CPU out of reset and bring it to life. */ + reg_val &= ~(CORE_RST | COREPOR_RST); + writel(reg_val, reg + APCS_CPU_PWR_CTL); + reg_val |= CORE_PWRD_UP; + writel(reg_val, reg + APCS_CPU_PWR_CTL); + +out_acc_map: + of_node_put(acc_node); +out_acc: + of_node_put(cpu_node); + + return ret; +} + static int kpssv1_release_secondary(unsigned int cpu) { int ret = 0; @@ -281,6 +339,11 @@ static int msm8660_boot_secondary(unsigned int cpu, struct task_struct *idle) return qcom_boot_secondary(cpu, scss_release_secondary); } +static int cortex_a7_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + return qcom_boot_secondary(cpu, cortex_a7_release_secondary); +} + static int kpssv1_boot_secondary(unsigned int cpu, struct task_struct *idle) { return qcom_boot_secondary(cpu, kpssv1_release_secondary); @@ -315,6 +378,15 @@ static const struct smp_operations smp_msm8660_ops __initconst = { }; CPU_METHOD_OF_DECLARE(qcom_smp, "qcom,gcc-msm8660", &smp_msm8660_ops); +static const struct smp_operations qcom_smp_cortex_a7_ops __initconst = { + .smp_prepare_cpus = qcom_smp_prepare_cpus, + .smp_boot_secondary = cortex_a7_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_die = qcom_cpu_die, +#endif +}; +CPU_METHOD_OF_DECLARE(qcom_smp_cortex_a7, "qcom,cpss-acc", &qcom_smp_cortex_a7_ops); + static const struct smp_operations qcom_smp_kpssv1_ops __initconst = { .smp_prepare_cpus = qcom_smp_prepare_cpus, .smp_boot_secondary = kpssv1_boot_secondary,