From patchwork Wed Jan 14 12:11:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 5630631 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@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 6A1DCC058E for ; Wed, 14 Jan 2015 12:11:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F901203A0 for ; Wed, 14 Jan 2015 12:11:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 70CA5203AD for ; Wed, 14 Jan 2015 12:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752132AbbANMLk (ORCPT ); Wed, 14 Jan 2015 07:11:40 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:34667 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbbANMLc (ORCPT ); Wed, 14 Jan 2015 07:11:32 -0500 Received: from ayla.of.borg ([84.193.93.87]) by michel.telenet-ops.be with bizsmtp id foBW1p0091t5w8s06oBW6J; Wed, 14 Jan 2015 13:11:30 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1YBMnJ-0002kE-Rs; Wed, 14 Jan 2015 13:11:29 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1YBMnN-0004Om-ND; Wed, 14 Jan 2015 13:11:33 +0100 From: Geert Uytterhoeven To: Simon Horman , Magnus Damm Cc: linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 4/6] ARM: shmobile: R-Mobile: Special-case PM domains with memory-controllers Date: Wed, 14 Jan 2015 13:11:22 +0100 Message-Id: <1421237484-16847-5-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421237484-16847-1-git-send-email-geert+renesas@glider.be> References: <1421237484-16847-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Add a special case for PM domains containing a memory-controller. Such a PM domain must not be turned off if memory is in use. On sh73a0 PM domains A4BC0 and A4BC1 each contain an SDRAM Bus State Controller (SBSC). On r8a73a4 PM domain A3BC contains two DDR Bus Controllers (DBSC). In both cases, there are no other devices in these PM domains, so they were eligible for power down, crashing the system. On r8a7740 the DDR3 Bus State Controller (DBSC3) is located in A4S, whose child domain A3SM contains the CPU core. Hence A4S is never turned off, and no crash happened. Signed-off-by: Geert Uytterhoeven --- v2: - Rename PD_SBSC to PD_MEMCTL, - Reword code comments and patch description. --- arch/arm/mach-shmobile/pm-rmobile.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index e4c3f7de48e2ccf2..95018209ff0b37cc 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c @@ -222,6 +222,7 @@ enum pd_types { PD_CPU, PD_CONSOLE, PD_DEBUG, + PD_MEMCTL, }; #define MAX_NUM_SPECIAL_PDS 16 @@ -233,6 +234,14 @@ static struct special_pd { static unsigned int num_special_pds __initdata; +static const struct of_device_id special_ids[] __initconst = { + { .compatible = "arm,coresight-etm3x", .data = (void *)PD_DEBUG }, + { .compatible = "renesas,dbsc-r8a73a4", .data = (void *)PD_MEMCTL, }, + { .compatible = "renesas,dbsc3-r8a7740", .data = (void *)PD_MEMCTL, }, + { .compatible = "renesas,sbsc-sh73a0", .data = (void *)PD_MEMCTL, }, + { /* sentinel */ }, +}; + static void __init add_special_pd(struct device_node *np, enum pd_types type) { unsigned int i; @@ -265,6 +274,7 @@ static void __init add_special_pd(struct device_node *np, enum pd_types type) static void __init get_special_pds(void) { struct device_node *np; + const struct of_device_id *id; /* PM domains containing CPUs */ for_each_node_by_type(np, "cpu") @@ -274,12 +284,9 @@ static void __init get_special_pds(void) if (of_stdout) add_special_pd(of_stdout, PD_CONSOLE); - /* PM domain containing Coresight-ETM */ - np = of_find_compatible_node(NULL, NULL, "arm,coresight-etm3x"); - if (np) { - add_special_pd(np, PD_DEBUG); - of_node_put(np); - } + /* PM domains containing other special devices */ + for_each_matching_node_and_match(np, special_ids, &id) + add_special_pd(np, (enum pd_types)id->data); } static void __init put_special_pds(void) @@ -334,6 +341,16 @@ static void __init rmobile_setup_pm_domain(struct device_node *np, pd->suspend = rmobile_pd_suspend_busy; break; + case PD_MEMCTL: + /* + * This domain contains a memory-controller and therefore it + * should only be turned off if memory is not in use. + */ + pr_debug("PM domain %s contains MEMCTL\n", name); + pd->gov = &pm_domain_always_on_gov; + pd->suspend = rmobile_pd_suspend_busy; + break; + case PD_NORMAL: break; }