1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2013 Atmel Corporation
4 * Bo Shen <voice.shen@atmel.com>
9 #include <asm/arch/at91_common.h>
10 #include <asm/arch/at91_wdt.h>
11 #include <asm/arch/clk.h>
14 #if !defined(CONFIG_AT91SAM9_WATCHDOG)
15 void at91_disable_wdt(void)
17 struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT;
19 writel(AT91_WDT_MR_WDDIS, &wdt->mr);
23 #if defined(CONFIG_SAMA5D2) || defined(CONFIG_SAMA5D3) || \
24 defined(CONFIG_SAMA5D4)
25 #include <asm/arch/sama5_boot.h>
28 } bootrom_stash __attribute__((section(".data")));
30 u32 spl_boot_device(void)
32 u32 dev = (bootrom_stash.r4 >> ATMEL_SAMA5_BOOT_FROM_OFF) &
33 ATMEL_SAMA5_BOOT_FROM_MASK;
34 u32 off = (bootrom_stash.r4 >> ATMEL_SAMA5_BOOT_DEV_ID_OFF) &
35 ATMEL_SAMA5_BOOT_DEV_ID_MASK;
37 #if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
38 if (dev == ATMEL_SAMA5_BOOT_FROM_MCI) {
39 #if defined(CONFIG_SPL_OF_CONTROL)
40 return BOOT_DEVICE_MMC1;
43 return BOOT_DEVICE_MMC1;
45 return BOOT_DEVICE_MMC2;
46 printf("ERROR: MMC controller %i not present!\n", dev);
52 #if defined(CONFIG_SYS_USE_SERIALFLASH) || \
53 defined(CONFIG_SYS_USE_SPIFLASH) || \
54 defined(CONFIG_SPI_BOOT)
55 if (dev == ATMEL_SAMA5_BOOT_FROM_SPI)
56 return BOOT_DEVICE_SPI;
58 if (dev == ATMEL_SAMA5_BOOT_FROM_QSPI)
59 return BOOT_DEVICE_SPI;
61 if (dev == ATMEL_SAMA5_BOOT_FROM_SMC)
62 return BOOT_DEVICE_NAND;
64 if (dev == ATMEL_SAMA5_BOOT_FROM_SAMBA)
65 return BOOT_DEVICE_USB;
67 printf("ERROR: SMC/TWI/QSPI boot device not supported!\n"
68 " Boot device %i, controller number %i\n", dev, off);
70 return BOOT_DEVICE_NONE;
73 u32 spl_boot_device(void)
75 #if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
76 return BOOT_DEVICE_MMC1;
77 #elif defined(CONFIG_SYS_USE_NANDFLASH) || defined(CONFIG_NAND_BOOT)
78 return BOOT_DEVICE_NAND;
79 #elif defined(CONFIG_SYS_USE_SERIALFLASH) || \
80 defined(CONFIG_SYS_USE_SPIFLASH) || \
81 defined(CONFIG_SPI_BOOT)
82 return BOOT_DEVICE_SPI;
84 return BOOT_DEVICE_NONE;