linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] ARM: EXYNOS: Add initial support of PMU for Exynos5260
Date: Tue, 15 Apr 2014 20:34:19 +0200	[thread overview]
Message-ID: <534D7BAB.30503@gmail.com> (raw)
In-Reply-To: <1395061795-17777-3-git-send-email-vikas.sajjan@samsung.com>

Hi Vikas,

On 17.03.2014 14:09, Vikas Sajjan wrote:
> Adds PMU support of PMU for Exynos5260. Suspend-to-RAM can be built on
> top this.
>
> Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
> Signed-off-by: Vikas Sajjan <vikas.sajjan@samsung.com>
> ---
>   arch/arm/mach-exynos/common.h            |   26 ++++
>   arch/arm/mach-exynos/pm.c                |   34 +++--
>   arch/arm/mach-exynos/pmu.c               |  238 ++++++++++++++++++++++++++++++
>   arch/arm/mach-exynos/regs-pmu.h          |  232 +++++++++++++++++++++++++++++
>   arch/arm/plat-samsung/include/plat/cpu.h |    8 +
>   5 files changed, 529 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
> index aba6a2a..a17f701 100644
> --- a/arch/arm/mach-exynos/common.h
> +++ b/arch/arm/mach-exynos/common.h
> @@ -56,6 +56,32 @@ enum sys_powerdown {
>   	NUM_SYS_POWERDOWN,
>   };
>
> +enum running_cpu {
> +	EXYNOS5_KFC,
> +	EXYNOS5_ARM,
> +};
> +
> +enum reg_op {
> +	REG_INIT,	/* write new value */
> +	REG_RESET,	/* clear with zero */
> +	REG_SET,	/* bit set */
> +	REG_CLEAR,	/* bit clear */
> +};
> +
> +/* reg/value set */
> +#define EXYNOS_PMU_REG(REG, VAL, OP)		\
> +{						\
> +	.reg	=	(void __iomem *)REG,	\
> +	.val	=	VAL,			\
> +	.op	=	OP,			\
> +}
> +
> +struct exynos_pmu_init_reg {
> +	void __iomem *reg;
> +	unsigned int val;
> +	enum reg_op op;
> +};
> +
>   extern unsigned long l2x0_regs_phys;
>   struct exynos_pmu_conf {
>   	void __iomem *reg;
> diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
> index 15af0ce..dbe9670 100644
> --- a/arch/arm/mach-exynos/pm.c
> +++ b/arch/arm/mach-exynos/pm.c
> @@ -109,7 +109,7 @@ static int exynos_cpu_suspend(unsigned long arg)
>   	outer_flush_all();
>   #endif
>
> -	if (soc_is_exynos5250())
> +	if (soc_is_exynos5250() || soc_is_exynos5260())
>   		flush_cache_all();

I think it's the right time for this code to be restructured. Adding 
more and more SoCs over this cruft is making this code worse and worse.

I believe this should be done as follows:

  - a generic struct describing particular PMU variant should be 
defined, with things like

	bool flush_cache_on_suspend;
	struct exynos_pmu_conf *pmu_conf;

or even function pointers, like

	void (*cpu_suspend)(unsigned long arg);

to handle things done currently using soc_is_*() macros, which we should 
get rid of.

- a DT match table would bind particular compatible strings with 
respective PMU variants structs,

- in general, this code should be made more like a normal driver, e.g. 
bind to a DT node and map registers dynamically.

Best regards,
Tomasz

  reply	other threads:[~2014-04-15 18:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 13:09 [PATCH v2 0/3] Add initial support of PMU for exynos5260 Vikas Sajjan
2014-03-17 13:09 ` [PATCH v2 1/3] ARM: EXYNOS: Map PMU address through DT Vikas Sajjan
2014-03-17 14:23   ` Sachin Kamat
2014-03-19 16:01     ` Tomasz Figa
2014-04-15 18:28   ` Tomasz Figa
2014-04-17  3:44   ` Chanwoo Choi
2014-03-17 13:09 ` [PATCH v2 2/3] ARM: EXYNOS: Add initial support of PMU for Exynos5260 Vikas Sajjan
2014-04-15 18:34   ` Tomasz Figa [this message]
2014-04-16  5:34     ` Vikas Sajjan
2014-04-16 11:54       ` Tomasz Figa
2014-03-17 13:09 ` [PATCH v2 3/3] arm: exynos5260: add support for S2R Vikas Sajjan
2014-04-15 18:41   ` Tomasz Figa
2014-04-11 13:16 ` [PATCH v2 0/3] Add initial support of PMU for exynos5260 Vikas Sajjan

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=534D7BAB.30503@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).