linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Bob Cochran <ppc@mindchasers.com>
To: Yuantian.Tang@freescale.com, b07421@freescale.com
Cc: linuxppc-dev@lists.ozlabs.org, Chenhui Zhao <chenhui.zhao@freescale.com>
Subject: Re: [PATCH v3] powerpc/rcpm: add RCPM driver
Date: Tue, 16 Jun 2015 14:00:05 -0400	[thread overview]
Message-ID: <55806425.7020505@mindchasers.com> (raw)
In-Reply-To: <1434446808-31121-1-git-send-email-Yuantian.Tang@freescale.com>

On 06/16/2015 05:26 AM, Yuantian.Tang@freescale.com wrote:
> From: Tang Yuantian <Yuantian.Tang@freescale.com>
>
> There is a RCPM (Run Control/Power Management) in Freescale QorIQ
> series processors. The device performs tasks associated with device
> run control and power management.
>
> The driver implements some features: mask/unmask irq, enter/exit low
> power states, freeze time base, etc.
>
> Signed-off-by: Chenhui Zhao <chenhui.zhao@freescale.com>
> Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
> ---
> v3:
> 	- added static and __init modifier to fsl_rcpm_init
> v2:
> 	- fix code style issues
> 	- refine compatible string match part
>
>   Documentation/devicetree/bindings/soc/fsl/rcpm.txt |  22 ++
>   arch/powerpc/include/asm/fsl_guts.h                | 105 +++++++
>   arch/powerpc/include/asm/fsl_pm.h                  |  48 +++
>   arch/powerpc/platforms/85xx/Kconfig                |   1 +
>   arch/powerpc/sysdev/Kconfig                        |   5 +
>   arch/powerpc/sysdev/Makefile                       |   1 +
>   arch/powerpc/sysdev/fsl_rcpm.c                     | 338 +++++++++++++++++++++
>   7 files changed, 520 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt
>   create mode 100644 arch/powerpc/include/asm/fsl_pm.h
>   create mode 100644 arch/powerpc/sysdev/fsl_rcpm.c
>
> diff --git a/Documentation/devicetree/bindings/soc/fsl/rcpm.txt b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> new file mode 100644
> index 0000000..5318999
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> @@ -0,0 +1,22 @@
> +* Run Control and Power Management
> +
> +The RCPM performs all device-level tasks associated with device run control
> +and power management.
> +
> +Required properites:
> +  - reg : Offset and length of the register set of RCPM block.
> +  - compatible : Specifies the compatibility list for the RCPM. The type
> +    should be string, such as "fsl,qoriq-rcpm-1.0", "fsl,qoriq-rcpm-2.0".


I just checked both my T1040 RM and datasheet, and I didn't see mention 
of the RCPM version that's used ( I assume it's 2.0 ).  Is there a 
general rule for which SoCs have which version?  If so, perhaps you'll 
want to include it here along with your examples.



> +
> +Example:
> +The RCPM node for T4240:
> +	rcpm: global-utilities@e2000 {
> +		compatible = "fsl,t4240-rcpm", "fsl,qoriq-rcpm-2.0";
> +		reg = <0xe2000 0x1000>;
> +	};
> +
> +The RCPM node for P4080:
> +	rcpm: global-utilities@e2000 {
> +		compatible = "fsl,qoriq-rcpm-1.0";
> +		reg = <0xe2000 0x1000>;
> +	};

-- cut ---

> diff --git a/arch/powerpc/include/asm/fsl_pm.h b/arch/powerpc/include/asm/fsl_pm.h
> new file mode 100644
> index 0000000..4b09f09
> --- /dev/null
> +++ b/arch/powerpc/include/asm/fsl_pm.h
> @@ -0,0 +1,48 @@
> +/*
> + * Support Power Management
> + *
> + * Copyright 2014-2015 Freescale Semiconductor Inc.
> + *
> + * 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.
> + */
> +#ifndef __PPC_FSL_PM_H
> +#define __PPC_FSL_PM_H
> +#ifdef __KERNEL__
> +
> +#define E500_PM_PH10	1
> +#define E500_PM_PH15	2
> +#define E500_PM_PH20	3
> +#define E500_PM_PH30	4
> +#define E500_PM_DOZE	E500_PM_PH10
> +#define E500_PM_NAP	E500_PM_PH15


Are you using "E500" in your labels for historical reasons? I can use 
this driver with E5500 and E6500 cores, right?  However, maybe I'm 
mistaken since some of your states don't seem to map to my E5500 / T1040 
(e.g., my RCPM doesn't seem to support PH20 or PH30, but I do have LPM10 
and LPM35, which I don't think your driver supports).  My RM states that 
LPM35 is a newer PM state, so maybe this is future work to be done?


> +
> +#define PLAT_PM_SLEEP	20
> +#define PLAT_PM_LPM20	30
> +
> +#define FSL_PM_SLEEP		(1 << 0)
> +#define FSL_PM_DEEP_SLEEP	(1 << 1)


I don't see where you use FSL_PM_DEEP_SLEEP, and I'm wondering if this 
was provisioned for LPM35, which is documented to be a deep sleep mode.


> +
> +struct fsl_pm_ops {
> +	/* mask pending interrupts to the RCPM from MPIC */
> +	void (*irq_mask)(int cpu);
> +
> +	/* unmask pending interrupts to the RCPM from MPIC */
> +	void (*irq_unmask)(int cpu);
> +	void (*cpu_enter_state)(int cpu, int state);
> +	void (*cpu_exit_state)(int cpu, int state);
> +	int (*plat_enter_sleep)(void);
> +	void (*freeze_time_base)(bool freeze);
> +
> +	/* keep the power of IP blocks during sleep/deep sleep */
> +	void (*set_ip_power)(bool enable, u32 *mask);
> +
> +	/* get platform supported power management modes */
> +	unsigned int (*get_pm_modes)(void);
> +};
> +
> +extern const struct fsl_pm_ops *qoriq_pm_ops;
> +#endif /* __KERNEL__ */
> +#endif /* __PPC_FSL_PM_H */

-- cut ---

  reply	other threads:[~2015-06-16 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16  9:26 [PATCH v3] powerpc/rcpm: add RCPM driver Yuantian.Tang
2015-06-16 18:00 ` Bob Cochran [this message]
2015-06-17  3:48   ` Yuantian Tang
2015-06-17 20:23   ` 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=55806425.7020505@mindchasers.com \
    --to=ppc@mindchasers.com \
    --cc=Yuantian.Tang@freescale.com \
    --cc=b07421@freescale.com \
    --cc=chenhui.zhao@freescale.com \
    --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;
as well as URLs for NNTP newsgroup(s).