mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v3 08/18] i.MX: serial: Distil common clock ungating code
Date: Thu, 7 May 2015 09:56:37 +0200	[thread overview]
Message-ID: <20150507075637.GO6325@pengutronix.de> (raw)
In-Reply-To: <1430940733-4415-9-git-send-email-andrew.smirnov@gmail.com>

On Wed, May 06, 2015 at 12:32:03PM -0700, Andrey Smirnov wrote:
> Move all of the common clock ungating code in early UART
> initialization into a dedicated subroutine that can be shared by all
> of the users.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  .../arm/boards/freescale-mx6sx-sabresdb/lowlevel.c |  9 +--------
>  arch/arm/boards/guf-santaro/lowlevel.c             |  7 ++-----
>  arch/arm/boards/karo-tx6x/lowlevel.c               | 10 +---------
>  arch/arm/boards/phytec-phycard-imx6/lowlevel.c     | 10 +---------
>  arch/arm/boards/phytec-phyflex-imx6/lowlevel.c     | 10 +---------
>  arch/arm/boards/variscite-mx6/lowlevel.c           | 10 +---------
>  arch/arm/mach-imx/include/mach/debug_ll.h          | 22 ++++++++++++++++++++++
>  7 files changed, 29 insertions(+), 49 deletions(-)
> 
> diff --git a/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c b/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c
> index 5fdd9df..af26557 100644
> --- a/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c
> +++ b/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c
> @@ -21,16 +21,9 @@
>  
>  static inline void setup_uart(void)
>  {
> -	void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR;
>  	void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
>  
> -	writel(0xffffffff, ccmbase + 0x68);
> -	writel(0xffffffff, ccmbase + 0x6c);
> -	writel(0xffffffff, ccmbase + 0x70);
> -	writel(0xffffffff, ccmbase + 0x74);
> -	writel(0xffffffff, ccmbase + 0x78);
> -	writel(0xffffffff, ccmbase + 0x7c);
> -	writel(0xffffffff, ccmbase + 0x80);
> +	imx6_ungate_all_peripherals();
>  
>  	writel(0x0, iomuxbase + 0x24);
>  	writel(0x1b0b1, iomuxbase + 0x036C);
> diff --git a/arch/arm/boards/guf-santaro/lowlevel.c b/arch/arm/boards/guf-santaro/lowlevel.c
> index 3ccabf4..d57502b 100644
> --- a/arch/arm/boards/guf-santaro/lowlevel.c
> +++ b/arch/arm/boards/guf-santaro/lowlevel.c
> @@ -13,6 +13,7 @@ static inline void setup_uart(void)
>  
>  	writel(0x1, iomuxbase + 0x2b0);
>  
> +	imx6_ungate_all_peripherals();
>  	imx6_uart_setup_ll();
>  
>  	putc_ll('>');
> @@ -29,12 +30,8 @@ ENTRY_FUNCTION(start_imx6q_guf_santaro, r0, r1, r2)
>  
>  	arm_setup_stack(0x00920000 - 8);
>  
> -	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> -		for (i = 0x68; i <= 0x80; i += 4)
> -			writel(0xffffffff, MX6_CCM_BASE_ADDR + i);

This leads to an unused variable warning. Fixed.

> diff --git a/arch/arm/mach-imx/include/mach/debug_ll.h b/arch/arm/mach-imx/include/mach/debug_ll.h
> index b9d1796..8eb59f6 100644
> --- a/arch/arm/mach-imx/include/mach/debug_ll.h
> +++ b/arch/arm/mach-imx/include/mach/debug_ll.h
> @@ -84,6 +84,21 @@ static inline void imx6_uart_setup_ll(void)
>  #endif
>  }
>  
> +#define __IMX_CCM_BASE(soc) soc##_CCM_BASE_ADDR
> +#define IMX_CCM_BASE(soc) __IMX_CCM_BASE(soc)

Unused, removed these.

> +
> +static inline void imx_ungate_all_peripherals(void __iomem *ccmbase)
> +{
> +	int i;
> +	for (i = 0x68; i <= 0x80; i += 4)
> +		writel(0xffffffff, ccmbase + i);
> +}
> +
> +static inline void imx6_ungate_all_peripherals(void)
> +{
> +	imx_ungate_all_peripherals(IOMEM(MX6_CCM_BASE_ADDR));
> +}
> +

I moved these out of the #ifdef CONFIG_DEBUG_LL since it's called from
the boards only when CONFIG_DEBUG_LL is enabled anyway. Even if not, it
may be desirable to be able to just ungate the clocks as a regular
usecase, not just when debugging is enabled. We might move these
functions out of debug_ll some day.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-05-07  7:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 19:31 [PATCH v3 00/18] i.MX serial cleanup, bootstrap code fixes, boot via IRAM Andrey Smirnov
2015-05-06 19:31 ` [PATCH v3 01/18] i.MX: Move UART definitions into a separate file Andrey Smirnov
2015-05-06 19:31 ` [PATCH v3 02/18] i.MX: serial: Add constants for UART clock divisor Andrey Smirnov
2015-05-06 19:31 ` [PATCH v3 03/18] i.MX: serial: Add baud rate calculation convenience functions Andrey Smirnov
2015-05-06 19:31 ` [PATCH v3 04/18] i.MX: serial: Add UART init functions for DEBUG_LL Andrey Smirnov
2015-05-07  7:52   ` Sascha Hauer
2015-05-06 19:32 ` [PATCH v3 05/18] i.MX: serial: Convert PUTC_LL to use IOMEM Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 06/18] i.MX: serial: Convert i.MX51 and i.MX6 to use 'imx*_uart_setup_ll' Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 07/18] i.MX51: babbage: Implement CONFIG_DEBUG_LL Andrey Smirnov
2015-05-07  7:57   ` Sascha Hauer
2015-05-06 19:32 ` [PATCH v3 08/18] i.MX: serial: Distil common clock ungating code Andrey Smirnov
2015-05-07  7:56   ` Sascha Hauer [this message]
2015-05-06 19:32 ` [PATCH v3 09/18] Makefile.lib: Make 'check_file_size' more flexible Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 10/18] i.MX: Add provisions to boot from IRAM Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 11/18] imx-image: Correctly fill image size in prepended header Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 12/18] bootstrap: Fix potential memory leak in 'read_image_head' Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 13/18] bootstrap_read_devfs(): Check for errors from devfs_add_partition() Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 14/18] bootstrap_read_devfs(): Close file after we are done with it Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 15/18] bootstrap_read_devfs(): Fix potential memory leak Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 16/18] bootstrap_read_devfs(): Check for errors from dev_add_bb_dev() Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 17/18] bootstrap_read_devfs(): Remove all partitions upon function completion Andrey Smirnov
2015-05-06 19:32 ` [PATCH v3 18/18] bootstrap: Warn if image size in BB header is zero Andrey Smirnov
2015-05-07  7:51 ` [PATCH v3 00/18] i.MX serial cleanup, bootstrap code fixes, boot via IRAM Sascha Hauer

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=20150507075637.GO6325@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@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