mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: mxs: add parameter to mx28_mem_init to allow custom memory config
Date: Tue, 10 May 2016 08:14:20 +0200	[thread overview]
Message-ID: <20160510061420.GY19714@pengutronix.de> (raw)
In-Reply-To: <1462791497-5107-1-git-send-email-u.kleine-koenig@pengutronix.de>

On Mon, May 09, 2016 at 12:58:17PM +0200, Uwe Kleine-König wrote:
> Rename the already global array of default memory settings to make the
> intended usage more obvious.
> 
> Also make generous use of the const keyword.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/boards/duckbill/lowlevel.c           |  2 +-
>  arch/arm/boards/freescale-mx28-evk/lowlevel.c |  2 +-
>  arch/arm/boards/karo-tx28/lowlevel.c          |  2 +-
>  arch/arm/mach-mxs/include/mach/init.h         |  4 ++--
>  arch/arm/mach-mxs/mem-init.c                  | 12 ++++++------
>  5 files changed, 11 insertions(+), 11 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/boards/duckbill/lowlevel.c b/arch/arm/boards/duckbill/lowlevel.c
> index 49563a0876e0..c00a9a0b0423 100644
> --- a/arch/arm/boards/duckbill/lowlevel.c
> +++ b/arch/arm/boards/duckbill/lowlevel.c
> @@ -55,7 +55,7 @@ static noinline void duckbill_init(void)
>  
>  	pr_debug("initializing SDRAM...\n");
>  
> -	mx28_mem_init();
> +	mx28_mem_init(mx28_dram_vals_default);
>  
>  	pr_debug("DONE\n");
>  }
> diff --git a/arch/arm/boards/freescale-mx28-evk/lowlevel.c b/arch/arm/boards/freescale-mx28-evk/lowlevel.c
> index 1f567568da54..4d45a03ba289 100644
> --- a/arch/arm/boards/freescale-mx28-evk/lowlevel.c
> +++ b/arch/arm/boards/freescale-mx28-evk/lowlevel.c
> @@ -47,7 +47,7 @@ static noinline void freescale_mx28evk_init(void)
>  
>  	pr_debug("initializing SDRAM...\n");
>  
> -	mx28_mem_init();
> +	mx28_mem_init(mx28_dram_vals_default);
>  
>  	pr_debug("DONE\n");
>  }
> diff --git a/arch/arm/boards/karo-tx28/lowlevel.c b/arch/arm/boards/karo-tx28/lowlevel.c
> index 96a8b9bfc66b..d072637de7d8 100644
> --- a/arch/arm/boards/karo-tx28/lowlevel.c
> +++ b/arch/arm/boards/karo-tx28/lowlevel.c
> @@ -47,7 +47,7 @@ static noinline void karo_tx28_init(void)
>  
>  	pr_debug("initializing SDRAM...\n");
>  
> -	mx28_mem_init();
> +	mx28_mem_init(mx28_dram_vals_default);
>  
>  	pr_debug("DONE\n");
>  }
> diff --git a/arch/arm/mach-mxs/include/mach/init.h b/arch/arm/mach-mxs/include/mach/init.h
> index 90b413e47ee4..6526d303a1a4 100644
> --- a/arch/arm/mach-mxs/include/mach/init.h
> +++ b/arch/arm/mach-mxs/include/mach/init.h
> @@ -18,11 +18,11 @@ void mx28_power_init(int __has_battery, int __use_battery_input,
>  		int __use_5v_input);
>  void mxs_power_wait_pswitch(void);
>  
> -extern uint32_t mx28_dram_vals[];
> +extern const uint32_t mx28_dram_vals_default[190];
>  extern uint32_t mx23_dram_vals[];
>  
>  void mx23_mem_init(void);
> -void mx28_mem_init(void);
> +void mx28_mem_init(const uint32_t dram_vals[190]);
>  void mxs_mem_setup_cpu_and_hbus(void);
>  void mxs_mem_setup_vdda(void);
>  void mxs_mem_init_clock(unsigned char divider);
> diff --git a/arch/arm/mach-mxs/mem-init.c b/arch/arm/mach-mxs/mem-init.c
> index 43165ac100e4..ac8bfee18e7c 100644
> --- a/arch/arm/mach-mxs/mem-init.c
> +++ b/arch/arm/mach-mxs/mem-init.c
> @@ -87,7 +87,7 @@ int mxs_early_reset_block(struct mxs_register_32 *reg)
>  	return 0;
>  }
>  
> -uint32_t mx28_dram_vals[] = {
> +const uint32_t mx28_dram_vals_default[190] = {
>  /*
>   * i.MX28 DDR2 at 200MHz
>   */
> @@ -158,12 +158,12 @@ uint32_t mx23_dram_vals[] = {
>  	0x00010000
>  };
>  
> -static void mx28_initialize_dram_values(void)
> +static void mx28_initialize_dram_values(const uint32_t dram_vals[190])
>  {
>  	int i;
>  
> -	for (i = 0; i < ARRAY_SIZE(mx28_dram_vals); i++)
> -		writel(mx28_dram_vals[i], IMX_SDRAMC_BASE + (4 * i));
> +	for (i = 0; i < 190; i++)
> +		writel(dram_vals[i], IMX_SDRAMC_BASE + (4 * i));
>  }
>  
>  static void mx23_initialize_dram_values(void)
> @@ -320,7 +320,7 @@ void mx23_mem_init(void)
>  
>  #define PINCTRL_EMI_DS_CTRL_DDR_MODE_DDR2	(0x3 << 16)
>  
> -void mx28_mem_init(void)
> +void mx28_mem_init(const uint32_t dram_vals[190])
>  {
>  	mxs_early_delay(11000);
>  
> @@ -338,7 +338,7 @@ void mx28_mem_init(void)
>  	/* Clear START bit from DRAM_CTL16 */
>  	clrbits_le32(IMX_SDRAMC_BASE + 0x40, 1);
>  
> -	mx28_initialize_dram_values();
> +	mx28_initialize_dram_values(dram_vals);
>  
>  	/* Clear SREFRESH bit from DRAM_CTL17 */
>  	clrbits_le32(IMX_SDRAMC_BASE + 0x44, 1);
> -- 
> 2.8.0.rc3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
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:[~2016-05-10  6:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09 10:58 Uwe Kleine-König
2016-05-10  6:14 ` Sascha Hauer [this message]

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=20160510061420.GY19714@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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