From patchwork Mon Aug 31 14:25:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 7100021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D25D3BEEC1 for ; Mon, 31 Aug 2015 14:28:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD579206AF for ; Mon, 31 Aug 2015 14:28:01 +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 C20F3206AD for ; Mon, 31 Aug 2015 14:28:00 +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 1ZWQ1z-00077L-3L; Mon, 31 Aug 2015 14:25:55 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZWQ1v-00071N-RI for linux-arm-kernel@lists.infradead.org; Mon, 31 Aug 2015 14:25:52 +0000 Received: by padhy3 with SMTP id hy3so36471645pad.0 for ; Mon, 31 Aug 2015 07:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=OT1Fx0QhCa92+MZn+1B5YIcy8Z1N3uXy5/8qZUdzKTk=; b=fI46MWVD5LUIHqIV6343zF72+bsfEGQhvixUtxwAfudWi63QGdRXyhtsi7hH+em29V jY+MKyJoSt1cWIjm/m8OgmB2I/pLMLmFyGEULAt+sNferZD5/6tfK5VnS2wqQjtD7Uzw qoIfDy4aJfpzw5BeW+kA6vZvOl4wN4hLNJ3sIf/ohvc1Br6j+4YP2oeqRQNnK4xeyNxc /notOOoK5ubLxefYBT44WFxkQK0ekICIWmu4tL/Vew3OCL7CqtqmZrU0k37TvEjcUr/Z 5Knjqhp2qR1chZVYw9Ik9J1lAxpKbnIrS87AUWvlzcDGoUe5AkzYe5HzldCSNhvVSEJs CKUQ== X-Received: by 10.68.190.38 with SMTP id gn6mr38209781pbc.125.1441031130848; Mon, 31 Aug 2015 07:25:30 -0700 (PDT) Received: from localhost.localdomain ([182.225.40.2]) by smtp.gmail.com with ESMTPSA id fu4sm14783895pbb.59.2015.08.31.07.25.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Aug 2015 07:25:30 -0700 (PDT) From: Chanho Park To: kgene@kernel.org, k.kozlowski@samsung.com Subject: [PATCH] ARM: EXYNOS: reset KFC cores when cpu is up Date: Mon, 31 Aug 2015 23:25:11 +0900 Message-Id: <1441031111-6549-1-git-send-email-parkch98@gmail.com> X-Mailer: git-send-email 2.1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150831_072552_044908_ACBE3214 X-CRM114-Status: GOOD ( 17.70 ) X-Spam-Score: -2.5 (--) 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: linux-samsung-soc@vger.kernel.org, Joonyoung Shim , Kevin Hilman , Mauro Ribeiro , Chanho Park , Heesub Shin , Chanwoo Choi , Przemyslaw Marczak , Abhilash Kesavan , linux-arm-kernel@lists.infradead.org, Marek Szyprowski 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=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 The cpu booting of exynos5422 has been still broken since we discussed it in last year[1]. This patch is inspired from odroid xu3 code(Actually, it was from samsung exynos vendor kernel)[2]. This weird reset code was founded exynos5420 octa cores series SoCs and only required for the first boot core is the little core(kingfisher core). Some of the exynos5420 boards and all of the exynos5422 boards will be required this code. There is two ways to check the little core is the first cpu. One is checking GPG2CON[1] gpio value and the other is checking the cluster number of the first cpu. I selected the latter because it's more easier than the former. Changes since RFC[3]: - drop checking soc_is_exynos5800 to extend this codes to exynos5420/5422 boards. - kfc cores will be reset only if the cpu0 is kfc core. - Rebase top of the kukjin's for-next branch [1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2015-June/350632.html [2]:https://patchwork.kernel.org/patch/6782891/ [3]:http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/356610.html Cc: Joonyoung Shim Cc: Chanwoo Choi Cc: Kevin Hilman Cc: Heesub Shin Cc: Mauro Ribeiro Cc: Abhilash Kesavan Cc: Przemyslaw Marczak Cc: Marek Szyprowski Cc: Krzysztof Kozlowski Signed-off-by: Chanho Park --- arch/arm/mach-exynos/mcpm-exynos.c | 18 +++++++++++++++++- arch/arm/mach-exynos/regs-pmu.h | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 9bdf547..5b69ed2 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "regs-pmu.h" #include "common.h" @@ -70,7 +71,22 @@ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster) cluster >= EXYNOS5420_NR_CLUSTERS) return -EINVAL; - exynos_cpu_power_up(cpunr); + if (!exynos_cpu_power_state(cpunr)) { + exynos_cpu_power_up(cpunr); + + /* This assumes the cluster number of the eagle is 0 and the + * kfc is 1. When the system was booted from the kfc core, + * they should be reset */ + if (cluster && + cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) { + while (!pmu_raw_readl(S5P_PMU_SPARE2)) + udelay(10); + + pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu), + EXYNOS_SWRESET); + } + } + return 0; } diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index b761433..fba9068 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -513,6 +513,12 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr) #define SPREAD_ENABLE 0xF #define SPREAD_USE_STANDWFI 0xF +#define EXYNOS5420_KFC_CORE_RESET0 BIT(8) +#define EXYNOS5420_KFC_ETM_RESET0 BIT(20) + +#define EXYNOS5420_KFC_CORE_RESET(_nr) \ + ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) << (_nr)) + #define EXYNOS5420_BB_CON1 0x0784 #define EXYNOS5420_BB_SEL_EN BIT(31) #define EXYNOS5420_BB_PMOS_EN BIT(7)