diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-04 09:21:36 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-04 09:21:36 +0100 |
commit | 40d8780de5734a3e736abbbab25791b0d9daf594 (patch) | |
tree | 9fe2a16dfbc4e66d8fff6cd05964694355df130a /arch/arm/boards/at91sam9260ek | |
parent | 3451e2c44f247f6dbf6396dbc8bafbb86c7d55f0 (diff) | |
parent | d15b81b41aa4cc851242baa16053dcee9d99762c (diff) | |
download | barebox-40d8780de5734a3e736abbbab25791b0d9daf594.tar.gz barebox-40d8780de5734a3e736abbbab25791b0d9daf594.tar.xz |
Merge branch 'for-next/at91'
Diffstat (limited to 'arch/arm/boards/at91sam9260ek')
-rw-r--r-- | arch/arm/boards/at91sam9260ek/env/bin/init_board | 54 | ||||
-rw-r--r-- | arch/arm/boards/at91sam9260ek/init.c | 62 |
2 files changed, 46 insertions, 70 deletions
diff --git a/arch/arm/boards/at91sam9260ek/env/bin/init_board b/arch/arm/boards/at91sam9260ek/env/bin/init_board index 977430debd..27d767d33c 100644 --- a/arch/arm/boards/at91sam9260ek/env/bin/init_board +++ b/arch/arm/boards/at91sam9260ek/env/bin/init_board @@ -8,43 +8,33 @@ vendor_id=0x4321 dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r" -if [ $at91_udc0.vbus != 1 ] -then +if [ $at91_udc0.vbus != 1 ]; then echo "No USB Device cable plugged, normal boot" exit fi gpio_get_value ${dfu_button} -if [ $? != 0 ] -then - autoboot_timeout=16 - echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" - usbserial - exit -fi - -echo "${button_name} pressed detected wait ${button_wait}s" -timeout -s -a ${button_wait} - -if [ $at91_udc0.vbus != 1 ] -then - echo "No USB Device cable plugged, normal boot" - exit -fi - -gpio_get_value ${dfu_button} -if [ $? != 0 ] -then +if [ $? = 0 ]; then + echo "${button_name} pressed detected wait ${button_wait}s" + timeout -s -a ${button_wait} + + if [ $at91_udc0.vbus != 1 ]; then + echo "No USB Device cable plugged, normal boot" + exit + fi + + gpio_get_value ${dfu_button} + if [ $? = 0 ]; then + echo "" + echo "Start DFU Mode" + echo "" + led ds5 1 + dfu ${dfu_config} -P ${product_id} -V ${vendor_id} + exit + fi echo "${button_name} released, normal boot" - autoboot_timeout=16 - echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" - usbserial - exit fi -echo "" -echo "Start DFU Mode" -echo "" - -led ds5 1 -dfu ${dfu_config} -P ${product_id} -V ${vendor_id} +autoboot_timeout=16 +echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" +usbserial diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c index 144f97964b..dc2976a0c4 100644 --- a/arch/arm/boards/at91sam9260ek/init.c +++ b/arch/arm/boards/at91sam9260ek/init.c @@ -10,31 +10,21 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * */ #include <common.h> -#include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> -#include <partition.h> -#include <fs.h> -#include <fcntl.h> -#include <io.h> -#include <asm/hardware.h> #include <nand.h> #include <sizes.h> -#include <linux/mtd/nand.h> #include <mach/board.h> #include <mach/at91sam9_smc.h> #include <gpio.h> #include <mach/io.h> -#include <mach/at91_pmc.h> #include <mach/at91_rstc.h> +#include <linux/clk.h> /* * board revision encoding @@ -47,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); } @@ -61,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, }; @@ -83,7 +67,8 @@ static struct sam9_smc_config ek_9260_nand_smc_config = { .read_cycle = 5, .write_cycle = 5, - .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | + AT91_SMC_EXNWMODE_DISABLE, .tdf_cycles = 2, }; @@ -101,7 +86,8 @@ static struct sam9_smc_config ek_9g20_nand_smc_config = { .read_cycle = 7, .write_cycle = 7, - .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | + AT91_SMC_EXNWMODE_DISABLE, .tdf_cycles = 3, }; @@ -115,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); @@ -134,7 +122,9 @@ static struct at91_ether_platform_data macb_pdata = { static void at91sam9260ek_phy_reset(void) { unsigned long rstc; - at91_pmc_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_EMAC); + struct clk *clk = clk_get(NULL, "macb_clk"); + + clk_enable(clk); at91_set_gpio_input(AT91_PIN_PA14, 0); at91_set_gpio_input(AT91_PIN_PA15, 0); @@ -153,18 +143,16 @@ static void at91sam9260ek_phy_reset(void) at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_EXTRST); /* Wait for end hardware reset */ - while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL)); + while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL)) + ; /* Restore NRST value */ - at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY | - (rstc) | - AT91_RSTC_URSTEN); + at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY | (rstc) | AT91_RSTC_URSTEN); } /* * MCI (SD/MMC) */ -#if defined(CONFIG_MCI_ATMEL) static struct atmel_mci_platform_data __initdata ek_mci_data = { .bus_width = 4, .slot_b = 1, @@ -174,14 +162,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 @@ -218,10 +206,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); @@ -273,7 +261,6 @@ static int at91sam9260ek_devices_init(void) return 0; } - device_initcall(at91sam9260ek_devices_init); static int at91sam9260ek_console_init(void) @@ -281,5 +268,4 @@ static int at91sam9260ek_console_init(void) at91_register_uart(0, 0); return 0; } - console_initcall(at91sam9260ek_console_init); |