Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 Atmel Corporation |
| 3 | * Bo Shen <voice.shen@atmel.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/arch/at91_common.h> |
Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 11 | #include <asm/arch/at91_wdt.h> |
| 12 | #include <asm/arch/clk.h> |
| 13 | #include <spl.h> |
| 14 | |
Heiko Schocher | 49b461f | 2015-01-21 08:38:20 +0100 | [diff] [blame] | 15 | #if defined(CONFIG_AT91SAM9_WATCHDOG) |
| 16 | void at91_disable_wdt(void) { } |
| 17 | #else |
Heiko Schocher | 5abc00d | 2014-10-31 08:31:04 +0100 | [diff] [blame] | 18 | void at91_disable_wdt(void) |
Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 19 | { |
| 20 | struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT; |
| 21 | |
| 22 | writel(AT91_WDT_MR_WDDIS, &wdt->mr); |
| 23 | } |
Heiko Schocher | 49b461f | 2015-01-21 08:38:20 +0100 | [diff] [blame] | 24 | #endif |
Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 25 | |
Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 26 | u32 spl_boot_device(void) |
| 27 | { |
| 28 | #ifdef CONFIG_SYS_USE_MMC |
| 29 | return BOOT_DEVICE_MMC1; |
Bo Shen | 27019e4 | 2014-03-03 14:47:17 +0800 | [diff] [blame] | 30 | #elif CONFIG_SYS_USE_NANDFLASH |
| 31 | return BOOT_DEVICE_NAND; |
Bo Shen | d85e891 | 2015-03-27 14:23:35 +0800 | [diff] [blame] | 32 | #elif CONFIG_SYS_USE_SERIALFLASH || CONFIG_SYS_USE_SPIFLASH |
Bo Shen | 8a45b0b | 2014-03-03 14:47:15 +0800 | [diff] [blame] | 33 | return BOOT_DEVICE_SPI; |
Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 34 | #endif |
| 35 | return BOOT_DEVICE_NONE; |
| 36 | } |
| 37 | |
| 38 | u32 spl_boot_mode(void) |
| 39 | { |
| 40 | switch (spl_boot_device()) { |
| 41 | #ifdef CONFIG_SYS_USE_MMC |
| 42 | case BOOT_DEVICE_MMC1: |
Guillaume GARDET | 205b4f3 | 2014-10-15 17:53:11 +0200 | [diff] [blame] | 43 | return MMCSD_MODE_FS; |
Bo Shen | c5e8885 | 2013-11-15 11:12:38 +0800 | [diff] [blame] | 44 | break; |
| 45 | #endif |
| 46 | case BOOT_DEVICE_NONE: |
| 47 | default: |
| 48 | hang(); |
| 49 | } |
| 50 | } |