mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/3] at91sam9260/9g20ek: move sam9_smc_config modification inside definition
Date: Thu, 31 Jan 2013 12:38:08 +0100	[thread overview]
Message-ID: <20130131113808.GY26329@game.jcrosoft.org> (raw)
In-Reply-To: <1359628977-20069-3-git-send-email-fabio.porcedda@gmail.com>

On 11:42 Thu 31 Jan     , Fabio Porcedda wrote:
> This is a optimization.

Nack

I do not what to ifdef

this make the code not easy to check via the compiler

Best Regards,
J.
> 
> Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/at91sam9260ek/init.c | 28 +++++++++++++---------------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c
> index f0d8adf..5080f2a 100644
> --- a/arch/arm/boards/at91sam9260ek/init.c
> +++ b/arch/arm/boards/at91sam9260ek/init.c
> @@ -74,7 +74,11 @@ static struct sam9_smc_config ek_9260_nand_smc_config = {
>  	.write_cycle		= 5,
>  
>  	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
> -				  AT91_SMC_EXNWMODE_DISABLE,
> +#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
> +				  AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_16,
> +#else
> +				  AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
> +#endif
>  	.tdf_cycles		= 2,
>  };
>  
> @@ -93,27 +97,21 @@ static struct sam9_smc_config ek_9g20_nand_smc_config = {
>  	.write_cycle		= 7,
>  
>  	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
> -				  AT91_SMC_EXNWMODE_DISABLE,
> +#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
> +				  AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_16,
> +#else
> +				  AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
> +#endif
>  	.tdf_cycles		= 3,
>  };
>  
>  static void ek_add_device_nand(void)
>  {
> -	struct sam9_smc_config *smc;
> -
> +	/* configure chip-select 3 (NAND) */
>  	if (machine_is_at91sam9g20ek())
> -		smc = &ek_9g20_nand_smc_config;
> -	else
> -		smc = &ek_9260_nand_smc_config;
> -
> -	/* setup bus-width (8 or 16) */
> -	if (nand_pdata.bus_width_16)
> -		smc->mode |= AT91_SMC_DBW_16;
> +		sam9_smc_configure(0, 3, &ek_9g20_nand_smc_config);
>  	else
> -		smc->mode |= AT91_SMC_DBW_8;
> -
> -	/* configure chip-select 3 (NAND) */
> -	sam9_smc_configure(0, 3, smc);
> +		sam9_smc_configure(0, 3, &ek_9260_nand_smc_config);
>  
>  	at91_add_device_nand(&nand_pdata);
>  }
> -- 
> 1.8.1.1
> 

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

  reply	other threads:[~2013-01-31 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 10:42 [PATCH 0/3] at91sam9260/9g20ek: some cleanup Fabio Porcedda
2013-01-31 10:42 ` [PATCH 1/3] at91sam9260/9g20ek: cleanup coding style Fabio Porcedda
2013-01-31 11:42   ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-04 20:49     ` Fabio Porcedda
2013-01-31 10:42 ` [PATCH 2/3] at91sam9260/9g20ek: move sam9_smc_config modification inside definition Fabio Porcedda
2013-01-31 11:38   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-01-31 10:42 ` [PATCH 3/3] at91sam9260/9g20ek: enable clock via clock framework Fabio Porcedda

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=20130131113808.GY26329@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=fabio.porcedda@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