blob: 6473320097060c57d08b467c7871fc5bbbbaf9a2 [file] [log] [blame]
Bo Shenc5e88852013-11-15 11:12:38 +08001/*
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 Shenc5e88852013-11-15 11:12:38 +080011#include <asm/arch/at91_wdt.h>
12#include <asm/arch/clk.h>
13#include <spl.h>
14
Heiko Schocher5abc00d2014-10-31 08:31:04 +010015void at91_disable_wdt(void)
Bo Shenc5e88852013-11-15 11:12:38 +080016{
17 struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT;
18
19 writel(AT91_WDT_MR_WDDIS, &wdt->mr);
20}
21
Bo Shenc5e88852013-11-15 11:12:38 +080022u32 spl_boot_device(void)
23{
24#ifdef CONFIG_SYS_USE_MMC
25 return BOOT_DEVICE_MMC1;
Bo Shen27019e42014-03-03 14:47:17 +080026#elif CONFIG_SYS_USE_NANDFLASH
27 return BOOT_DEVICE_NAND;
Bo Shen8a45b0b2014-03-03 14:47:15 +080028#elif CONFIG_SYS_USE_SERIALFLASH
29 return BOOT_DEVICE_SPI;
Bo Shenc5e88852013-11-15 11:12:38 +080030#endif
31 return BOOT_DEVICE_NONE;
32}
33
34u32 spl_boot_mode(void)
35{
36 switch (spl_boot_device()) {
37#ifdef CONFIG_SYS_USE_MMC
38 case BOOT_DEVICE_MMC1:
Guillaume GARDET205b4f32014-10-15 17:53:11 +020039 return MMCSD_MODE_FS;
Bo Shenc5e88852013-11-15 11:12:38 +080040 break;
41#endif
42 case BOOT_DEVICE_NONE:
43 default:
44 hang();
45 }
46}