From patchwork Wed Oct 15 17:23:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kever Yang X-Patchwork-Id: 5086401 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF61F9F2BA for ; Wed, 15 Oct 2014 17:24:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2076720138 for ; Wed, 15 Oct 2014 17:24:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 42B4A2012E for ; Wed, 15 Oct 2014 17:24:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XeSJ4-0006Qq-Rv; Wed, 15 Oct 2014 17:24:14 +0000 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XeSIa-0006E6-4S; Wed, 15 Oct 2014 17:23:45 +0000 Received: by mail-pa0-f52.google.com with SMTP id fb1so1662781pad.25 for ; Wed, 15 Oct 2014 10:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=OKRCtkr26UQYRTxRZZK9CgULO5Q5SHFOcPrgiChnBPw=; b=rvbebOr/tTE5ValhSrvNGe3+EywXI6EkugjtXgyV+nxipJau6IvagQJ9n/DjbdTcCP vLrJjiKyId6ayqpjIWC3Sbs2B3Ynsh+c2QifNnc5k++fWQzwkCbyS0a17ZJ4SUrEqs2H xP/TvMSSX7cnM1yh2meuaQB/c2k5HiHW71xvADOANYsMX+qoG4MLfr1ZTmPg3y4EXQbx r5bgT2FcvtKrHPmgfoRnhSyASdVYd/GDg9bSl5obw1UzmqZzfe4UWARhie3A22tHhXSL FZ2o0ECZFo1/08HMdGhv3Sx1WjikydfyPDmmsc8Q8lhTmUl0JDmF/AylDnyrGvpez8u0 p56g== X-Received: by 10.68.183.34 with SMTP id ej2mr13912214pbc.75.1413393803096; Wed, 15 Oct 2014 10:23:23 -0700 (PDT) Received: from kever-X240.corp.google.com (dhcp-172-22-52-129.mtv.corp.google.com [172.22.52.129]) by mx.google.com with ESMTPSA id zw1sm14760882pbb.82.2014.10.15.10.23.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Oct 2014 10:23:22 -0700 (PDT) From: Kever Yang To: heiko@sntech.de Subject: [PATCH v5 2/6] ARM: rockchip: add option to access the pmu via a phandle in smp_operations Date: Wed, 15 Oct 2014 10:23:01 -0700 Message-Id: <1413393785-26783-3-git-send-email-kever.yang@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413393785-26783-1-git-send-email-kever.yang@rock-chips.com> References: <1413393785-26783-1-git-send-email-kever.yang@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141015_102344_248938_F1848BC3 X-CRM114-Status: GOOD ( 12.67 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , Catalin Marinas , Kever Yang , Rohit Vaswani , xjq@rock-chips.com, Lorenzo Pieralisi , Russell King , Pawel Moll , linux-rockchip@lists.infradead.org, hj@rock-chips.com, huangtao@rock-chips.com, devicetree@vger.kernel.org, addy.ke@rock-chips.com, Arnd Bergmann , Ian Campbell , cf@rock-chips.com, Rob Herring , sonnyrao@chromium.org, linux-arm-kernel@lists.infradead.org, Marc Carino , dianders@chromium.org, linux-kernel@vger.kernel.org, Kumar Gala , Olof Johansson , Maxime Ripard X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Heiko Stuebner Makes it possible to define a rockchip,pmu phandle in the cpus node directly referencing the pmu syscon instead of searching for specific compatible. The old way of finding the pmu stays of course available. Signed-off-by: Heiko Stuebner Signed-off-by: Kever Yang --- Changes in v5: None Changes in v4: - add rockchip,pmu property into cpus.txt Changes in v3: - add this patch Changes in v2: None Documentation/devicetree/bindings/arm/cpus.txt | 9 +++++++++ arch/arm/mach-rockchip/platsmp.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index fc44634..b2aacbe 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt @@ -227,6 +227,15 @@ nodes to be present and contain the properties described below. # List of phandles to idle state nodes supported by this cpu [3]. + - rockchip,pmu + Usage: optional for systems that have an "enable-method" + property value of "rockchip,rk3066-smp" + While optional, it is the preferred way to get access to + the cpu-core power-domains. + Value type: + Definition: Specifies the syscon node controlling the cpu core + power domains. + Example 1 (dual-cluster big.LITTLE system 32-bit): cpus { diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c index 4c36fbf..57b53b3 100644 --- a/arch/arm/mach-rockchip/platsmp.c +++ b/arch/arm/mach-rockchip/platsmp.c @@ -155,6 +155,19 @@ static int __init rockchip_smp_prepare_pmu(void) struct device_node *node; void __iomem *pmu_base; + /* + * This function is only called via smp_ops->smp_prepare_cpu(). + * That only happens if a "/cpus" device tree node exists + * and has an "enable-method" property that selects the SMP + * operations defined herein. + */ + node = of_find_node_by_path("/cpus"); + + pmu = syscon_regmap_lookup_by_phandle(node, "rockchip,pmu"); + of_node_put(node); + if (!IS_ERR(pmu)) + return 0; + pmu = syscon_regmap_lookup_by_compatible("rockchip,rk3066-pmu"); if (!IS_ERR(pmu)) return 0;