From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-ee0-f52.google.com ([74.125.83.52]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U0rbl-0007zh-Ly for barebox@lists.infradead.org; Thu, 31 Jan 2013 10:43:06 +0000 Received: by mail-ee0-f52.google.com with SMTP id b15so1352989eek.11 for ; Thu, 31 Jan 2013 02:43:04 -0800 (PST) From: Fabio Porcedda Date: Thu, 31 Jan 2013 11:42:56 +0100 Message-Id: <1359628977-20069-3-git-send-email-fabio.porcedda@gmail.com> In-Reply-To: <1359628977-20069-1-git-send-email-fabio.porcedda@gmail.com> References: <1359628977-20069-1-git-send-email-fabio.porcedda@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 2/3] at91sam9260/9g20ek: move sam9_smc_config modification inside definition To: barebox@lists.infradead.org This is a optimization. Signed-off-by: Fabio Porcedda Cc: Jean-Christophe PLAGNIOL-VILLARD --- 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