linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Kukjin Kim <kgene@kernel.org>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org,
	Tomasz Figa <tomasz.figa@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/36] ARM: samsung: make pm-debug platform independent
Date: Wed, 23 Oct 2019 12:27:50 +0200	[thread overview]
Message-ID: <20191023102750.GD10630@pi3> (raw)
In-Reply-To: <20191010203043.1241612-5-arnd@arndb.de>

On Thu, Oct 10, 2019 at 10:29:49PM +0200, Arnd Bergmann wrote:
> The pm-debug code is one of the few things shared between s3c24xx/s3c64xx
> and the newer s5pv210. In order to make s5pv210 independent of plat-samsung,
> change the common bits of this code to no longer reference the s3c specific
> bits.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/mach-s3c24xx/include/mach/pm-core.h  |  7 +--
>  arch/arm/mach-s3c64xx/include/mach/pm-core.h  | 44 +---------------
>  arch/arm/mach-s3c64xx/pm.c                    | 50 +++++++++++++++++++
>  arch/arm/mach-s5pv210/pm.c                    |  6 +--
>  .../arm/plat-samsung/include/plat/pm-common.h | 29 +++++------
>  arch/arm/plat-samsung/pm-debug.c              | 23 ++-------
>  arch/arm/plat-samsung/pm.c                    | 10 ++--
>  7 files changed, 80 insertions(+), 89 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c24xx/include/mach/pm-core.h b/arch/arm/mach-s3c24xx/include/mach/pm-core.h
> index 5e4ce89d0158..8f87606c4cdc 100644
> --- a/arch/arm/mach-s3c24xx/include/mach/pm-core.h
> +++ b/arch/arm/mach-s3c24xx/include/mach/pm-core.h
> @@ -15,6 +15,7 @@
>  
>  static inline void s3c_pm_debug_init_uart(void)
>  {
> +#ifdef CONFIG_SAMSUNG_PM_DEBUG
>  	unsigned long tmp = __raw_readl(S3C2410_CLKCON);
>  
>  	/* re-start uart clocks */
> @@ -24,6 +25,7 @@ static inline void s3c_pm_debug_init_uart(void)
>  
>  	__raw_writel(tmp, S3C2410_CLKCON);
>  	udelay(10);
> +#endif
>  }
>  
>  static inline void s3c_pm_arch_prepare_irqs(void)
> @@ -75,11 +77,6 @@ static inline void s3c_pm_arch_show_resume_irqs(void)
>  				s3c_irqwake_eintmask);
>  }
>  
> -static inline void s3c_pm_arch_update_uart(void __iomem *regs,
> -					   struct pm_uart_save *save)
> -{
> -}
> -
>  static inline void s3c_pm_restored_gpios(void) { }
>  static inline void samsung_pm_saved_gpios(void) { }
>  
> diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
> index bbf79ed28583..33cf242734a0 100644
> --- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
> +++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
> @@ -20,6 +20,7 @@
>  
>  static inline void s3c_pm_debug_init_uart(void)
>  {
> +#ifdef CONFIG_SAMSUNG_PM_DEBUG
>  	u32 tmp = __raw_readl(S3C_PCLK_GATE);
>  
>  	/* As a note, since the S3C64XX UARTs generally have multiple
> @@ -35,6 +36,7 @@ static inline void s3c_pm_debug_init_uart(void)
>  
>  	__raw_writel(tmp, S3C_PCLK_GATE);
>  	udelay(10);
> +#endif
>  }
>  
>  static inline void s3c_pm_arch_prepare_irqs(void)
> @@ -63,48 +65,6 @@ static inline void s3c_pm_arch_show_resume_irqs(void)
>  #define s3c_irqwake_intallow  0
>  #endif
>  
> -static inline void s3c_pm_arch_update_uart(void __iomem *regs,
> -					   struct pm_uart_save *save)
> -{
> -	u32 ucon = __raw_readl(regs + S3C2410_UCON);
> -	u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK;
> -	u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK;
> -	u32 new_ucon;
> -	u32 delta;
> -
> -	/* S3C64XX UART blocks only support level interrupts, so ensure that
> -	 * when we restore unused UART blocks we force the level interrupt
> -	 * settigs. */
> -	save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
> -
> -	/* We have a constraint on changing the clock type of the UART
> -	 * between UCLKx and PCLK, so ensure that when we restore UCON
> -	 * that the CLK field is correctly modified if the bootloader
> -	 * has changed anything.
> -	 */
> -	if (ucon_clk != save_clk) {
> -		new_ucon = save->ucon;
> -		delta = ucon_clk ^ save_clk;
> -
> -		/* change from UCLKx => wrong PCLK,
> -		 * either UCLK can be tested for by a bit-test
> -		 * with UCLK0 */
> -		if (ucon_clk & S3C6400_UCON_UCLK0 &&
> -		    !(save_clk & S3C6400_UCON_UCLK0) &&
> -		    delta & S3C6400_UCON_PCLK2) {
> -			new_ucon &= ~S3C6400_UCON_UCLK0;
> -		} else if (delta == S3C6400_UCON_PCLK2) {
> -			/* as an precaution, don't change from
> -			 * PCLK2 => PCLK or vice-versa */
> -			new_ucon ^= S3C6400_UCON_PCLK2;
> -		}
> -
> -		S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
> -			  ucon, new_ucon, save->ucon);
> -		save->ucon = new_ucon;
> -	}
> -}
> -
>  static inline void s3c_pm_restored_gpios(void)
>  {
>  	/* ensure sleep mode has been cleared from the system */
> diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
> index fd6dbb263ed5..a612e9779057 100644
> --- a/arch/arm/mach-s3c64xx/pm.c
> +++ b/arch/arm/mach-s3c64xx/pm.c
> @@ -305,6 +305,56 @@ static void s3c64xx_pm_prepare(void)
>  	__raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT);
>  }
>  
> +#ifdef CONFIG_SAMSUNG_PM_DEBUG
> +void s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
> +{
> +	u32 ucon;
> +	u32 ucon_clk
> +	u32 save_clk;
> +	u32 new_ucon;
> +	u32 delta;
> +
> +	if (!soc_is_s3c64xx())
> +		return;
> +
> +	ucon = __raw_readl(regs + S3C2410_UCON);
> +	ucon_clk = ucon & S3C6400_UCON_CLKMASK;
> +	sav_clk = save->ucon & S3C6400_UCON_CLKMASK;
> +
> +	/* S3C64XX UART blocks only support level interrupts, so ensure that
> +	 * when we restore unused UART blocks we force the level interrupt
> +	 * settigs. */
> +	save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
> +
> +	/* We have a constraint on changing the clock type of the UART
> +	 * between UCLKx and PCLK, so ensure that when we restore UCON
> +	 * that the CLK field is correctly modified if the bootloader
> +	 * has changed anything.
> +	 */
> +	if (ucon_clk != save_clk) {
> +		new_ucon = save->ucon;
> +		delta = ucon_clk ^ save_clk;
> +
> +		/* change from UCLKx => wrong PCLK,
> +		 * either UCLK can be tested for by a bit-test
> +		 * with UCLK0 */
> +		if (ucon_clk & S3C6400_UCON_UCLK0 &&
> +		    !(save_clk & S3C6400_UCON_UCLK0) &&
> +		    delta & S3C6400_UCON_PCLK2) {
> +			new_ucon &= ~S3C6400_UCON_UCLK0;
> +		} else if (delta == S3C6400_UCON_PCLK2) {
> +			/* as an precaution, don't change from
> +			 * PCLK2 => PCLK or vice-versa */
> +			new_ucon ^= S3C6400_UCON_PCLK2;
> +		}
> +
> +		S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
> +			  ucon, new_ucon, save->ucon);
> +		save->ucon = new_ucon;
> +	}
> +}
> +#endif
> +
>  int __init s3c64xx_pm_init(void)
>  {
>  	int i;
> diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
> index b336df0c57f3..efdb5a27c060 100644
> --- a/arch/arm/mach-s5pv210/pm.c
> +++ b/arch/arm/mach-s5pv210/pm.c
> @@ -99,8 +99,6 @@ static int s5pv210_suspend_enter(suspend_state_t state)
>  	u32 eint_wakeup_mask = s5pv210_read_eint_wakeup_mask();
>  	int ret;
>  
> -	s3c_pm_debug_init();

Your patch is not equivalent here. If there is a reason behind removal
of UART init (e.g. not needed), I prefer to make it in separate patch.

Rest looks good.

Best regards,
Krzysztof


  reply	other threads:[~2019-10-23 10:27 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 20:28 [PATCH 00/36] ARM: samsung platform cleanup Arnd Bergmann
2019-10-10 20:29 ` [PATCH 01/36] ARM: samsung: make S3C24XX_MISCCR access indirect Arnd Bergmann
2019-10-10 20:29   ` [PATCH 02/36] ARM: s3c: simplify mach/io.h Arnd Bergmann
2019-10-10 20:29   ` [PATCH 03/36] usb: gadget: s3c: use platform resources Arnd Bergmann
2019-10-23 10:06     ` Krzysztof Kozlowski
2019-10-23 12:46     ` Krzysztof Kozlowski
2019-10-23 13:26       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 04/36] usb: gadget: s3c-hsudc: remove platform header dependency Arnd Bergmann
2019-10-23 10:09     ` Krzysztof Kozlowski
2019-10-23 12:21       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 05/36] ARM: samsung: make pm-debug platform independent Arnd Bergmann
2019-10-23 10:27     ` Krzysztof Kozlowski [this message]
2019-10-23 12:13       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 06/36] ARM: samsung: move CONFIG_DEBUG_S3C_UART to Kconfig.debug Arnd Bergmann
2019-10-23 10:12     ` Krzysztof Kozlowski
2019-10-23 12:22       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 07/36] ARM: exynos: use private samsung_cpu_id copy Arnd Bergmann
2019-10-23 10:54     ` Krzysztof Kozlowski
2019-10-23 12:37       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 08/36] ARM: exynos: stop selecting PLAT_SAMSUNG Arnd Bergmann
2019-10-15 14:12     ` Ulf Hansson
2019-10-23 10:57     ` Krzysztof Kozlowski
2019-10-23 12:43       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 09/36] ARM: samsung: move pm check code to drivers/soc Arnd Bergmann
2019-10-23 11:32     ` Krzysztof Kozlowski
2019-10-23 12:45       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 10/36] ARM: s5pv210: use private pm save/restore Arnd Bergmann
2019-10-23 11:55     ` Krzysztof Kozlowski
2019-10-23 13:12       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 11/36] ARM: s5pv210: split from plat-samsung Arnd Bergmann
2019-10-11  5:51     ` Uwe Kleine-König
2019-10-22 14:01       ` Arnd Bergmann
2019-10-22 15:53         ` Uwe Kleine-König
2019-10-22 16:20           ` Arnd Bergmann
2019-10-15 14:13     ` Ulf Hansson
2019-10-15 14:23     ` Thierry Reding
2019-10-23 12:14     ` Krzysztof Kozlowski
2019-10-23 13:17       ` Arnd Bergmann
2019-10-23 14:12         ` Krzysztof Kozlowski
2019-10-10 20:29   ` [PATCH 12/36] ARM: s3c64xx: remove mach/hardware.h Arnd Bergmann
2019-10-16 10:09     ` Charles Keepax
2019-10-10 20:29   ` [PATCH 13/36] ARM: s3c: move regs-spi.h into spi driver Arnd Bergmann
2019-10-23 12:32     ` Krzysztof Kozlowski
2019-10-23 13:21       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 14/36] ARM: s3c: move irqchip driver back into platform Arnd Bergmann
2019-10-10 20:29   ` [PATCH 15/36] ARM: s3c: adc: move header to linux/soc/samsung Arnd Bergmann
2019-10-10 22:20     ` Guenter Roeck
2019-10-10 22:29       ` Dmitry Torokhov
2019-10-10 22:44         ` Sebastian Reichel
2019-10-23 12:37     ` Krzysztof Kozlowski
2019-10-23 13:23       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 16/36] ARM: s3c: move spi fiq handler into platform Arnd Bergmann
2019-10-10 20:30   ` [PATCH 17/36] ARM: s3c: h1940-audio: turn into platform driver Arnd Bergmann
2019-10-10 20:30   ` [PATCH 18/36] ARM: s3c: gta02-audio: " Arnd Bergmann
2019-10-10 20:30   ` [PATCH 19/36] ARM: s3c: rx1950: " Arnd Bergmann
2019-10-10 20:30   ` [PATCH 20/36] ASoC: samsung: s3c2412-i2s: avoid hardcoded S3C2410_PA_IIS Arnd Bergmann
2019-10-11 10:50     ` Mark Brown
2019-10-10 20:30   ` [PATCH 21/36] ARM: s3c: move iis pinctrl config into boards Arnd Bergmann
2019-10-23 12:50     ` Krzysztof Kozlowski
2019-10-23 13:29       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 22/36] ARM: s3c: leds: move setpull() calls into board files Arnd Bergmann
2019-10-10 20:30   ` [PATCH 23/36] ARM: s3c: move s3cmci pinctrl handling " Arnd Bergmann
2019-10-15 14:12     ` Ulf Hansson
2019-10-16 13:12     ` Linus Walleij
2019-10-10 20:30   ` [PATCH 24/36] ARM: s3c: include mach/irqs.h where needed Arnd Bergmann
2019-10-10 20:30   ` [PATCH 25/36] ARM: s3c: spi: avoid hardcoding fiq number in driver Arnd Bergmann
2019-10-10 20:30   ` [PATCH 26/36] ARM: s3c: bast: avoid irq_desc array usage Arnd Bergmann
2019-10-10 20:30   ` [PATCH 27/36] ARM: s3c: fix mmc gpio lookup tables Arnd Bergmann
2019-10-10 20:30   ` [PATCH 28/36] fbdev: s3c2410fb: remove mach header dependency Arnd Bergmann
2019-10-23 13:13     ` Krzysztof Kozlowski
2019-10-23 13:35       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 29/36] ARM: s3c: cpufreq: split out registers Arnd Bergmann
2019-10-10 20:30   ` [PATCH 30/36] ARM: s3c: remove cpufreq header dependencies Arnd Bergmann
2019-10-23 13:38     ` Krzysztof Kozlowski
2019-10-23 13:46       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 31/36] ARM: s3c: cpufreq: use global s3c2412_cpufreq_setrefresh Arnd Bergmann
2019-10-23 13:44     ` Krzysztof Kozlowski
2019-10-23 13:57       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 32/36] ARM: s3c: iotiming: make functions static Arnd Bergmann
2019-10-10 20:30   ` [PATCH 33/36] ARM: s3c: move low-level clk reg access into platform code Arnd Bergmann
2019-10-23 13:49     ` Krzysztof Kozlowski
2019-10-23 13:54       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 34/36] ARM: s3c: stop including mach/hardware.h from mach/io.h Arnd Bergmann
2019-10-10 21:02     ` Russell King - ARM Linux admin
2019-10-10 21:53       ` Arnd Bergmann
2019-10-15 14:52   ` [PATCH 01/36] ARM: samsung: make S3C24XX_MISCCR access indirect Tomasz Figa
2019-10-23 13:10 ` [PATCH 00/36] ARM: samsung platform cleanup Krzysztof Kozlowski
2019-10-23 13:39   ` Arnd Bergmann

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=20191023102750.GD10630@pi3 \
    --to=krzk@kernel.org \
    --cc=arnd@arndb.de \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=tomasz.figa@gmail.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).