From patchwork Tue Jan 20 01:27:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 5661691 Return-Path: X-Original-To: patchwork-linux-sh@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 1F6279F444 for ; Tue, 20 Jan 2015 01:27:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38FD120394 for ; Tue, 20 Jan 2015 01:27:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B921203A5 for ; Tue, 20 Jan 2015 01:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751401AbbATB1Q (ORCPT ); Mon, 19 Jan 2015 20:27:16 -0500 Received: from kirsty.vergenet.net ([202.4.237.240]:59921 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbbATB1P (ORCPT ); Mon, 19 Jan 2015 20:27:15 -0500 Received: from ayumi.isobedori.kobe.vergenet.net (p8130-ipbfp1005kobeminato.hyogo.ocn.ne.jp [118.10.149.130]) by kirsty.vergenet.net (Postfix) with ESMTP id EE76126717E; Tue, 20 Jan 2015 12:27:11 +1100 (EST) Received: by ayumi.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id 8CF04EDE5C6; Tue, 20 Jan 2015 10:27:10 +0900 (JST) From: Simon Horman To: linux-sh@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Magnus Damm , Geert Uytterhoeven , Simon Horman Subject: [PATCH 3/3] ARM: shmobile: R-Mobile: Special-case PM domains with memory-controllers Date: Tue, 20 Jan 2015 10:27:09 +0900 Message-Id: <1632ff162f305f38667632c465e4bfaab8ef87a2.1421715134.git.horms+renesas@verge.net.au> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: 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=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 From: Geert Uytterhoeven 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 Signed-off-by: Simon Horman --- 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 e4c3f7d..9501820 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; }