diff options
author | Fabio Porcedda <fabio.porcedda@gmail.com> | 2013-02-15 12:24:52 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-02-15 18:25:51 +0100 |
commit | 61c5f054f7bab453106730d6f0af937774de0f2f (patch) | |
tree | bb51b8e044a30bc4eb4ecc5f23f7ec14398173ea /arch/arm/boards/at91sam9260ek | |
parent | 494e07aa8cef656af89c305805c39f857b366a5b (diff) | |
download | barebox-61c5f054f7bab453106730d6f0af937774de0f2f.tar.gz barebox-61c5f054f7bab453106730d6f0af937774de0f2f.tar.xz |
at91sam9260/9g20ek: use IS_ENABLED instead of #if/#ifdef
Using IS_ENABLED instead of #if/#ifdef the compiler can check
all the code.
Using IS_ENABLED for configuring smc->mode is an optimization,
reduce init.o text from 905 to 877.
Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/at91sam9260ek')
-rw-r--r-- | arch/arm/boards/at91sam9260ek/init.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c index 06a53f2ab8..77ca6bbe8f 100644 --- a/arch/arm/boards/at91sam9260ek/init.c +++ b/arch/arm/boards/at91sam9260ek/init.c @@ -37,9 +37,8 @@ static void ek_set_board_type(void) { if (machine_is_at91sam9g20ek()) { armlinux_set_architecture(MACH_TYPE_AT91SAM9G20EK); -#ifdef CONFIG_AT91_HAVE_2MMC - armlinux_set_revision(HAVE_2MMC); -#endif + if (IS_ENABLED(CONFIG_AT91_HAVE_2MMC)) + armlinux_set_revision(HAVE_2MMC); } else { armlinux_set_architecture(MACH_TYPE_AT91SAM9260EK); } @@ -51,11 +50,6 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, -#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16) - .bus_width_16 = 1, -#else - .bus_width_16 = 0, -#endif .on_flash_bbt = 1, }; @@ -107,10 +101,12 @@ static void ek_add_device_nand(void) smc = &ek_9260_nand_smc_config; /* setup bus-width (8 or 16) */ - if (nand_pdata.bus_width_16) + if (IS_ENABLED(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)) { + nand_pdata.bus_width_16 = 1; smc->mode |= AT91_SMC_DBW_16; - else + } else { smc->mode |= AT91_SMC_DBW_8; + } /* configure chip-select 3 (NAND) */ sam9_smc_configure(0, 3, smc); @@ -157,7 +153,6 @@ static void at91sam9260ek_phy_reset(void) /* * MCI (SD/MMC) */ -#if defined(CONFIG_MCI_ATMEL) static struct atmel_mci_platform_data __initdata ek_mci_data = { .bus_width = 4, .slot_b = 1, @@ -165,14 +160,14 @@ static struct atmel_mci_platform_data __initdata ek_mci_data = { static void ek_usb_add_device_mci(void) { + if (!IS_ENABLED(CONFIG_MCI_ATMEL)) + return; + if (machine_is_at91sam9g20ek()) ek_mci_data.detect_pin = AT91_PIN_PC9; at91_add_device_mci(0, &ek_mci_data); } -#else -static void ek_usb_add_device_mci(void) {} -#endif /* * USB Host port @@ -209,10 +204,10 @@ static void __init ek_add_led(void) { int i; -#ifdef CONFIG_AT91_HAVE_2MMC - leds[0].gpio = AT91_PIN_PB8; - leds[1].gpio = AT91_PIN_PB9; -#endif + if (IS_ENABLED(CONFIG_AT91_HAVE_2MMC)) { + leds[0].gpio = AT91_PIN_PB8; + leds[1].gpio = AT91_PIN_PB9; + } for (i = 0; i < ARRAY_SIZE(leds); i++) { at91_set_gpio_output(leds[i].gpio, leds[i].active_low); |