mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Chenhui Zhao <chenhui.zhao@freescale.com>
Cc: <linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
	<leoli@freescale.com>, <Jason.Jin@freescale.com>
Subject: Re: [PATCH 6/9] powerpc/85xx: support sleep feature on QorIQ SoCs with RCPM
Date: Tue, 11 Mar 2014 19:00:27 -0500	[thread overview]
Message-ID: <1394582427.13761.74.camel@snotra.buserror.net> (raw)
In-Reply-To: <1394168285-32275-6-git-send-email-chenhui.zhao@freescale.com>

On Fri, 2014-03-07 at 12:58 +0800, Chenhui Zhao wrote:
> In sleep mode, the clocks of e500 cores and unused IP blocks is
> turned off. The IP blocks which are allowed to wake up the processor
> are still running.
> 
> The sleep mode is equal to the Standby state in Linux. Use the
> command to enter sleep mode:
>   echo standby > /sys/power/state
> 
> Signed-off-by: Chenhui Zhao <chenhui.zhao@freescale.com>
> ---
>  arch/powerpc/Kconfig                   |    4 +-
>  arch/powerpc/platforms/85xx/Makefile   |    3 +
>  arch/powerpc/platforms/85xx/qoriq_pm.c |   78 ++++++++++++++++++++++++++++++++
>  3 files changed, 83 insertions(+), 2 deletions(-)
>  create mode 100644 arch/powerpc/platforms/85xx/qoriq_pm.c
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 05f6323..e1d6510 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -222,7 +222,7 @@ config ARCH_HIBERNATION_POSSIBLE
>  config ARCH_SUSPEND_POSSIBLE
>  	def_bool y
>  	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
> -		   (PPC_85xx && !PPC_E500MC) || PPC_86xx || PPC_PSERIES \
> +		   FSL_SOC_BOOKE || PPC_86xx || PPC_PSERIES \
>  		   || 44x || 40x
>  
>  config PPC_DCR_NATIVE
> @@ -709,7 +709,7 @@ config FSL_PCI
>  config FSL_PMC
>  	bool
>  	default y
> -	depends on SUSPEND && (PPC_85xx || PPC_86xx)
> +	depends on SUSPEND && (PPC_85xx && !PPC_E500MC || PPC_86xx)

Don't mix && and || without parentheses.

Maybe convert this into being selected (similar to FSL_RCPM), rather
than default y?

> diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
> index 25cebe7..7fae817 100644
> --- a/arch/powerpc/platforms/85xx/Makefile
> +++ b/arch/powerpc/platforms/85xx/Makefile
> @@ -2,6 +2,9 @@
>  # Makefile for the PowerPC 85xx linux kernel.
>  #
>  obj-$(CONFIG_SMP) += smp.o
> +ifeq ($(CONFIG_FSL_CORENET_RCPM), y)
> +obj-$(CONFIG_SUSPEND)	+= qoriq_pm.o
> +endif

There should probably be a kconfig symbol for this.

> diff --git a/arch/powerpc/platforms/85xx/qoriq_pm.c b/arch/powerpc/platforms/85xx/qoriq_pm.c
> new file mode 100644
> index 0000000..915b13b
> --- /dev/null
> +++ b/arch/powerpc/platforms/85xx/qoriq_pm.c
> @@ -0,0 +1,78 @@
> +/*
> + * Support Power Management feature
> + *
> + * Copyright 2014 Freescale Semiconductor Inc.
> + *
> + * Author: Chenhui Zhao <chenhui.zhao@freescale.com>
> + *
> + * This program is free software; you can redistribute	it and/or modify it
> + * under  the terms of	the GNU General	 Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/suspend.h>
> +#include <linux/of_platform.h>
> +
> +#include <sysdev/fsl_soc.h>
> +
> +#define FSL_SLEEP		0x1
> +#define FSL_DEEP_SLEEP		0x2

FSL_DEEP_SLEEP is unused.

> +
> +/* specify the sleep state of the present platform */
> +int sleep_pm_state;
> +/* supported sleep modes by the present platform */
> +static unsigned int sleep_modes;

Why is one signed and the other unsigned?

> +
> +static int qoriq_suspend_enter(suspend_state_t state)
> +{
> +	int ret = 0;
> +
> +	switch (state) {
> +	case PM_SUSPEND_STANDBY:
> +
> +		if (cur_cpu_spec->cpu_flush_caches)
> +			cur_cpu_spec->cpu_flush_caches();
> +
> +		ret = qoriq_pm_ops->plat_enter_state(sleep_pm_state);
> +
> +		break;
> +
> +	default:
> +		ret = -EINVAL;
> +
> +	}
> +
> +	return ret;
> +}
> +
> +static int qoriq_suspend_valid(suspend_state_t state)
> +{
> +	if (state == PM_SUSPEND_STANDBY && (sleep_modes & FSL_SLEEP))
> +		return 1;
> +
> +	return 0;
> +}
> +
> +static const struct platform_suspend_ops qoriq_suspend_ops = {
> +	.valid = qoriq_suspend_valid,
> +	.enter = qoriq_suspend_enter,
> +};
> +
> +static int __init qoriq_suspend_init(void)
> +{
> +	struct device_node *np;
> +
> +	sleep_modes = FSL_SLEEP;
> +	sleep_pm_state = PLAT_PM_SLEEP;
> +
> +	np = of_find_compatible_node(NULL, NULL, "fsl,qoriq-rcpm-2.0");
> +	if (np)
> +		sleep_pm_state = PLAT_PM_LPM20;
> +
> +	suspend_set_ops(&qoriq_suspend_ops);
> +
> +	return 0;
> +}
> +arch_initcall(qoriq_suspend_init);

Why is this not a platform driver?  If fsl_pmc can do it...

-Scott



  reply	other threads:[~2014-03-12  0:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07  4:57 [PATCH 1/9] powerpc/fsl: add PVR definition for E500MC and E5500 Chenhui Zhao
2014-03-07  4:57 ` [PATCH 2/9] powerpc/cache: add cache flush operation for various e500 Chenhui Zhao
2014-03-07  4:57 ` [PATCH 3/9] powerpc/rcpm: add RCPM driver Chenhui Zhao
2014-03-11 23:42   ` Scott Wood
2014-03-12  3:59     ` Chenhui Zhao
2014-03-14 22:34       ` Scott Wood
2014-03-07  4:58 ` [PATCH 4/9] powerpc/85xx: support CPU hotplug for e500mc and e5500 Chenhui Zhao
2014-03-11 23:48   ` Scott Wood
2014-03-12  4:34     ` Chenhui Zhao
2014-03-07  4:58 ` [PATCH 5/9] powerpc/85xx: disable irq by hardware when suspend for 64-bit Chenhui Zhao
2014-03-11 23:51   ` Scott Wood
2014-03-12  7:46     ` Chenhui Zhao
2014-03-14 22:41       ` Scott Wood
2014-03-17  9:37         ` Chenhui Zhao
2014-03-07  4:58 ` [PATCH 6/9] powerpc/85xx: support sleep feature on QorIQ SoCs with RCPM Chenhui Zhao
2014-03-12  0:00   ` Scott Wood [this message]
2014-03-12  8:08     ` Chenhui Zhao
2014-03-14 22:46       ` Scott Wood
2014-03-07  4:58 ` [PATCH 7/9] fsl: add EPU FSM configuration for deep sleep Chenhui Zhao
2014-03-12  0:08   ` Scott Wood
2014-03-12  8:34     ` Chenhui Zhao
2014-03-14 22:51       ` Scott Wood
2014-03-17 10:27         ` Chenhui Zhao
2014-03-18 23:21           ` Scott Wood
2014-03-19  0:08             ` Chenhui Zhao
2014-03-07  4:58 ` [PATCH 8/9] powerpc/85xx: add save/restore functions for core registers Chenhui Zhao
2014-03-12  0:45   ` Scott Wood
2014-03-12  9:42     ` Chenhui Zhao
2014-03-14 23:01       ` Scott Wood
2014-03-17 10:50         ` Chenhui Zhao
2014-03-07  4:58 ` [PATCH 9/9] powerpc/pm: support deep sleep feature on T1040 Chenhui Zhao
2014-03-12  1:10   ` Scott Wood
2014-03-12  5:57     ` Kevin Hao
2014-03-12 17:43       ` Scott Wood
2014-03-13  7:46         ` Kevin Hao
2014-03-14 22:26           ` Scott Wood
2014-03-16  4:58             ` Kevin Hao
2014-03-18 23:18               ` Scott Wood
2014-03-20 11:47                 ` Kevin Hao
2014-03-20 11:59                   ` David Laight
2014-03-20 22:07                     ` Scott Wood
2014-03-21  9:21                       ` David Laight
2014-03-21 21:16                         ` Scott Wood
2014-03-20 22:17                   ` Scott Wood
2014-03-12 10:40     ` Chenhui Zhao
2014-03-14 23:18       ` Scott Wood
2014-03-17 11:19         ` Chenhui Zhao
2014-03-18 22:42           ` Scott Wood
2014-03-19  0:56             ` Chenhui Zhao
2014-03-20 23:33               ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394582427.13761.74.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=Jason.Jin@freescale.com \
    --cc=chenhui.zhao@freescale.com \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome