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 void at91_disable_wdt(void)
19 struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT;
21 writel(AT91_WDT_MR_WDDIS, &wdt->mr);
25 #if defined(CONFIG_SAMA5D2) || defined(CONFIG_SAMA5D3) || \
26 defined(CONFIG_SAMA5D4)
27 #include <asm/arch/sama5_boot.h>
30 } bootrom_stash __attribute__((section(".data")));
32 u32 spl_boot_device(void)
34 u32 dev = (bootrom_stash.r4 >> ATMEL_SAMA5_BOOT_FROM_OFF) &
35 ATMEL_SAMA5_BOOT_FROM_MASK;
36 u32 off = (bootrom_stash.r4 >> ATMEL_SAMA5_BOOT_DEV_ID_OFF) &
37 ATMEL_SAMA5_BOOT_DEV_ID_MASK;
39 #if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
40 if (dev == ATMEL_SAMA5_BOOT_FROM_MCI) {
41 #if defined(CONFIG_SPL_OF_CONTROL)
42 return BOOT_DEVICE_MMC1;
45 return BOOT_DEVICE_MMC1;
47 return BOOT_DEVICE_MMC2;
48 printf("ERROR: MMC controller %i not present!\n", dev);
54 #if defined(CONFIG_SYS_USE_SERIALFLASH) || \
55 defined(CONFIG_SYS_USE_SPIFLASH) || \
56 defined(CONFIG_SPI_BOOT)
57 if (dev == ATMEL_SAMA5_BOOT_FROM_SPI)
58 return BOOT_DEVICE_SPI;
60 if (dev == ATMEL_SAMA5_BOOT_FROM_QSPI)
61 return BOOT_DEVICE_SPI;
63 if (dev == ATMEL_SAMA5_BOOT_FROM_SMC)
64 return BOOT_DEVICE_NAND;
66 if (dev == ATMEL_SAMA5_BOOT_FROM_SAMBA)
67 return BOOT_DEVICE_USB;
69 printf("ERROR: SMC/TWI/QSPI boot device not supported!\n"
70 " Boot device %i, controller number %i\n", dev, off);
72 return BOOT_DEVICE_NONE;
75 u32 spl_boot_device(void)
77 #if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
78 return BOOT_DEVICE_MMC1;
79 #elif defined(CONFIG_SYS_USE_NANDFLASH) || defined(CONFIG_NAND_BOOT)
80 return BOOT_DEVICE_NAND;
81 #elif defined(CONFIG_SYS_USE_SERIALFLASH) || \
82 defined(CONFIG_SYS_USE_SPIFLASH) || \
83 defined(CONFIG_SPI_BOOT)
84 return BOOT_DEVICE_SPI;
86 return BOOT_DEVICE_NONE;