public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 2/2] i.MX28: use a clear name for DDR2 initialization
Date: Tue, 17 Jul 2012 11:15:36 +0200	[thread overview]
Message-ID: <50052D38.9020402@denx.de> (raw)
In-Reply-To: <1342471182-20351-3-git-send-email-otavio@ossystems.com.br>

On 16/07/2012 22:39, Otavio Salvador wrote:
> The mx28 prefix has been added to the initialization data and function
> so it is clear by which SoC it is used as i.MX233 will have a specific
> one.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---

Hi Otavio,

>  arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c b/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
> index e17a4d7..7317a97 100644
> --- a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
> +++ b/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
> @@ -31,7 +31,7 @@
>  
>  #include "mx28_init.h"
>  
> -uint32_t dram_vals[] = {
> +uint32_t mx28_dram_vals[] = {
>  	0x00000000, 0x00000000, 0x00000000, 0x00000000,
>  	0x00000000, 0x00000000, 0x00000000, 0x00000000,
>  	0x00000000, 0x00000000, 0x00000000, 0x00000000,
> @@ -88,14 +88,14 @@ void __mx28_adjust_memory_params(uint32_t *dram_vals)
>  void mx28_adjust_memory_params(uint32_t *dram_vals)
>  	__attribute__((weak, alias("__mx28_adjust_memory_params")));


Simply a general remark - I think we can discuss further when first
patches forMX23 will be submitted. However, I think is a bad idea to
specialize functions to a specific SOC. If a driver needs such as
function, we will introduce some nasty #ifdef in driver code only to
select which function must be called. And we duplicate this problem in
all drivers.

Instead of that, we could use the same general name. Where do we put
mx23 code ? If we put it together with mx28 code (I mean in the same
directory) we could extract specific SOC function from general files and
use the mechanism provided by Makefile to compile the right one, for
example:

COBJS-$(CONFIG_MX28)	+= spl_mem_mx28.o
COBJS-$(CONFIG_MX23)	+= spl_mem_mx23.o

and spl_mem_init.c contains general code. Drivers call always the same
function. Of course, this is only an example. At the moment, most mx28
function have the mx28_ prefix, but this is acceptable because up now
the mx28 is the only one in this architecture.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  parent reply	other threads:[~2012-07-17  9:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16 20:39 [U-Boot] [RFC PATCH 0/2] i.MX28 SoC pending patches Otavio Salvador
2012-07-16 20:39 ` [U-Boot] [RFC PATCH 1/2] i.MX28: Check if we are using a valid VBUS when initializing power Otavio Salvador
2012-07-16 20:42   ` Marek Vasut
2012-07-16 21:45     ` Otavio Salvador
2012-07-16 20:39 ` [U-Boot] [RFC PATCH 2/2] i.MX28: use a clear name for DDR2 initialization Otavio Salvador
2012-07-16 20:43   ` Marek Vasut
2012-07-17  9:15   ` Stefano Babic [this message]
2012-07-17 12:16     ` Otavio Salvador
2012-07-17 12:41       ` Stefano Babic
2012-07-17 12:52         ` Otavio Salvador

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=50052D38.9020402@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.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