From patchwork Wed May 11 21:36:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Brand X-Patchwork-Id: 9075121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2E31D9F30C for ; Wed, 11 May 2016 21:38:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 408202017D for ; Wed, 11 May 2016 21:38:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B01420155 for ; Wed, 11 May 2016 21:38:14 +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 1b0bo7-0001vY-2p; Wed, 11 May 2016 21:36:39 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0bnZ-0001LM-Vb for linux-arm-kernel@lists.infradead.org; Wed, 11 May 2016 21:36:08 +0000 Received: by mail-pf0-x235.google.com with SMTP id 77so22583401pfv.2 for ; Wed, 11 May 2016 14:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YxCkmduwOtGaLzMaPLP7BAXTQHw95uSRsaiwPwSH2Zg=; b=d8kLEs5eY3Kp1QDus69w+efMx3FQ7AQb7W/AQ7XYhB1Qgdz3T3kqjPoXLPeZzwvOTL FQWkFL7YlOxrkUR1QC3gIT2elzbbcYhiHweW2bOE6lcjlCegFkJxf3cXCYDrHrkgGkmw tl0BvrN3x6WD+SWkjG1k0ETUBqGA8trgHHuwc= 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=YxCkmduwOtGaLzMaPLP7BAXTQHw95uSRsaiwPwSH2Zg=; b=TJPC0LyjeXLtshpxePvH5Wipdly0RWPsyPsHUHvDX9qzYxlQU2md9u48Ljx1WgR3Or /gaVgKmALbawAQpN5g5D+Kc6/UZCa29M3QUFS/fEq1VA+GYilUdJBrz7k4qZUWa7Mq98 MBrGPP+8QOPLyFuYF0l7dvDUF3F3hM2I7bFc3xpy9uilEDUSVwlGP3NOhPLxwN/fIio9 9MXHTH04t0qWrky3hLsTXefMWlvKXvJwBq7wC2wZ6bMQhFHqOcXXddeakpe7M+SUryMd as5so4jb23kkSXPav8+7s+QeJzcanC17caG/85K6WQVv8yVkbGnXJmf15eTn0JGlfGLX AL7Q== X-Gm-Message-State: AOPr4FWzfbCfGQfFMt95pIeRptaoIH/0WdShxwuRTzSn1L5+2sftWoVr+9BgLkOcfrrmrWe7 X-Received: by 10.98.77.6 with SMTP id a6mr8274712pfb.133.1463002545007; Wed, 11 May 2016 14:35:45 -0700 (PDT) Received: from lbrmn-lnxub61.ric.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id ym8sm14459263pab.22.2016.05.11.14.35.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 14:35:44 -0700 (PDT) From: Chris Brand To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Florian Fainelli , Ray Jui , Scott Branden , linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree@vger.kernel.org Subject: [PATCH v2 5/6] arm: BCM23550 SMP support Date: Wed, 11 May 2016 14:36:21 -0700 Message-Id: <1463002582-6875-6-git-send-email-chris.brand@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463002582-6875-1-git-send-email-chris.brand@broadcom.com> References: <1463002582-6875-1-git-send-email-chris.brand@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160511_143606_282255_A0E34E5C X-CRM114-Status: GOOD ( 17.21 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Raymond Ngun MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 BCM23550 has a Cluster Dormant Control IP block that holds cores in an idle state. Support a new CPU enable method in which the CDC is accessed to bring the core online. Signed-off-by: Raymond Ngun Signed-off-by: Chris Brand --- arch/arm/mach-bcm/platsmp.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/arm/mach-bcm/platsmp.c b/arch/arm/mach-bcm/platsmp.c index cfae9c71fb74..33c4d8349f95 100644 --- a/arch/arm/mach-bcm/platsmp.c +++ b/arch/arm/mach-bcm/platsmp.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -255,6 +256,57 @@ static int kona_boot_secondary(unsigned int cpu, struct task_struct *idle) return -ENXIO; } +/* Cluster Dormant Control command to bring CPU into a running state */ +#define CDC_CMD 6 +#define CDC_CMD_OFFSET 0 +#define CDC_CMD_REG(cpu) (CDC_CMD_OFFSET + 4*(cpu)) + +/* + * BCM23550 has a Cluster Dormant Control block that keeps the core in + * idle state. A command needs to be sent to the block to bring the CPU + * into running state. + */ +static int bcm23550_boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + void __iomem *cdc_base; + struct device_node *dn; + char *name; + int ret; + + /* Make sure a CDC node exists before booting the + * secondary core. + */ + name = "brcm,bcm23550-cdc"; + dn = of_find_compatible_node(NULL, NULL, name); + if (!dn) { + pr_err("unable to find cdc node\n"); + return -ENODEV; + } + + cdc_base = of_iomap(dn, 0); + of_node_put(dn); + + if (!cdc_base) { + pr_err("unable to remap cdc base register\n"); + return -ENOMEM; + } + + /* Boot the secondary core */ + ret = kona_boot_secondary(cpu, idle); + if (ret) + goto out; + + /* Bring this CPU to RUN state so that nIRQ nFIQ + * signals are unblocked. + */ + writel_relaxed(CDC_CMD, cdc_base + CDC_CMD_REG(cpu)); + +out: + iounmap(cdc_base); + + return ret; +} + static int nsp_boot_secondary(unsigned int cpu, struct task_struct *idle) { int ret; @@ -283,6 +335,12 @@ static const struct smp_operations bcm_smp_ops __initconst = { CPU_METHOD_OF_DECLARE(bcm_smp_bcm281xx, "brcm,bcm11351-cpu-method", &bcm_smp_ops); +static const struct smp_operations bcm23550_smp_ops __initconst = { + .smp_boot_secondary = bcm23550_boot_secondary, +}; +CPU_METHOD_OF_DECLARE(bcm_smp_bcm23550, "brcm,bcm23550", + &bcm23550_smp_ops); + static const struct smp_operations nsp_smp_ops __initconst = { .smp_prepare_cpus = bcm_smp_prepare_cpus, .smp_boot_secondary = nsp_boot_secondary,