linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <t.figa@samsung.com>
To: Pankaj Dubey <pankaj.dubey@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk,
	vikas.sajjan@samsung.com, joshi@samsung.com, naushad@samsung.com,
	thomas.ab@samsung.com, chow.kim@samsung.com
Subject: Re: [PATCH v5 2/5] ARM: EXYNOS: Refactored code for using PMU address via DT
Date: Mon, 30 Jun 2014 18:19:48 +0200	[thread overview]
Message-ID: <53B18E24.70809@samsung.com> (raw)
In-Reply-To: <1403705032-14835-3-git-send-email-pankaj.dubey@samsung.com>

Hi Pankaj,

This looks much better now, but please see my comments inline.

On 25.06.2014 16:03, Pankaj Dubey wrote:
> Under "arm/mach-exynos" many files are using PMU register offsets.
> Since we have added support for accessing PMU base address via DT,
> now we can remove PMU mapping from exynosX_iodesc. Let's convert
> all these access using iomapped address.
> This will help us in removing static mapping of PMU base address
> as well as help in reducing dependency over machine header files.
> Thus helping for migration of PMU implementation from machine to
> driver folder which can be reused for ARM64 bsed SoC.

[snip]

> @@ -152,7 +142,7 @@ static void exynos_restart(enum reboot_mode mode, const char *cmd)
>  {
>  	struct device_node *np;
>  	u32 val = 0x1;
> -	void __iomem *addr = EXYNOS_SWRESET;
> +	void __iomem *addr = NULL;

Instead of initializing this variable to NULL, pmu_base_addr +
EXYNOS_SWRESET could be used instead.

>  
>  	if (of_machine_is_compatible("samsung,exynos5440")) {
>  		u32 status;
> @@ -165,9 +155,9 @@ static void exynos_restart(enum reboot_mode mode, const char *cmd)
>  		val = __raw_readl(addr);
>  
>  		val = (val & 0xffff0000) | (status & 0xffff);
> -	}
> -
> -	__raw_writel(val, addr);
> +		__raw_writel(val, addr);
> +	} else
> +		__raw_writel(val, pmu_base_addr + EXYNOS_SWRESET);

The above would allow this code to be left unchanged.

>  }
>  

[snip]

> diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
> index f127c0c..519aefe 100644
> --- a/arch/arm/mach-exynos/pm.c
> +++ b/arch/arm/mach-exynos/pm.c
> @@ -37,6 +37,9 @@
>  #include "regs-pmu.h"
>  #include "regs-sys.h"
>  
> +#define pmu_raw_writel(val, offset) \
> +		__raw_writel(val, pmu_base_addr + offset)

Please make this static inline.

> +
>  /**
>   * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
>   * @hwirq: Hardware IRQ signal of the GIC
> @@ -111,7 +114,7 @@ static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
>   */
>  void exynos_cpu_power_down(int cpu)
>  {
> -	__raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu));
> +	pmu_raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu));
>  }
>  
>  /**
> @@ -122,8 +125,8 @@ void exynos_cpu_power_down(int cpu)
>   */
>  void exynos_cpu_power_up(int cpu)
>  {
> -	__raw_writel(S5P_CORE_LOCAL_PWR_EN,
> -		     EXYNOS_ARM_CORE_CONFIGURATION(cpu));
> +	pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN,
> +			EXYNOS_ARM_CORE_CONFIGURATION(cpu));
>  }
>  
>  /**
> @@ -133,7 +136,7 @@ void exynos_cpu_power_up(int cpu)
>   */
>  int exynos_cpu_power_state(int cpu)
>  {
> -	return (__raw_readl(EXYNOS_ARM_CORE_STATUS(cpu)) &
> +	return (__raw_readl(pmu_base_addr + EXYNOS_ARM_CORE_STATUS(cpu)) &
>  			S5P_CORE_LOCAL_PWR_EN);

__raw_readl()s could be replaced with pmu_raw_readl()s too.

Best regards,
Tomasz

  reply	other threads:[~2014-06-30 16:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 14:03 [PATCH v5 0/5] ARM: Exynos: PMU cleanup and refactoring for using DT Pankaj Dubey
2014-06-25 14:03 ` [PATCH v5 1/5] ARM: EXYNOS: Add support for mapping PMU base address via DT Pankaj Dubey
2014-06-30 16:11   ` Tomasz Figa
2014-07-05  6:31     ` Pankaj Dubey
2014-06-25 14:03 ` [PATCH v5 2/5] ARM: EXYNOS: Refactored code for using PMU " Pankaj Dubey
2014-06-30 16:19   ` Tomasz Figa [this message]
2014-07-05  6:34     ` Pankaj Dubey
2014-06-25 14:03 ` [PATCH v5 3/5] ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c Pankaj Dubey
2014-06-30 16:20   ` Tomasz Figa
2014-07-05  6:35     ` Pankaj Dubey
2014-06-25 14:03 ` [PATCH v5 4/5] ARM: EXYNOS: Add platform driver support for Exynos PMU Pankaj Dubey
2014-06-30 17:05   ` Tomasz Figa
2014-07-05  7:09     ` Pankaj Dubey
2014-07-08 14:14       ` Tomasz Figa
2014-06-25 14:03 ` [PATCH v5 5/5] ARM: EXYNOS: Move PMU specific definitions from common.h Pankaj Dubey
2014-06-30 17:15   ` Tomasz Figa
2014-07-05  7:10     ` Pankaj Dubey
2014-06-26 11:30 ` [PATCH v5 0/5] ARM: Exynos: PMU cleanup and refactoring for using DT 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=53B18E24.70809@samsung.com \
    --to=t.figa@samsung.com \
    --cc=chow.kim@samsung.com \
    --cc=joshi@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=naushad@samsung.com \
    --cc=pankaj.dubey@samsung.com \
    --cc=thomas.ab@samsung.com \
    --cc=vikas.sajjan@samsung.com \
    /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).