2 * Copyright (C) 2013 Atmel Corporation
3 * Bo Shen <voice.shen@atmel.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/at91_common.h>
11 #include <asm/arch/at91_pmc.h>
12 #include <asm/arch/at91_wdt.h>
13 #include <asm/arch/clk.h>
16 static void at91_disable_wdt(void)
18 struct at91_wdt
*wdt
= (struct at91_wdt
*)ATMEL_BASE_WDT
;
20 writel(AT91_WDT_MR_WDDIS
, &wdt
->mr
);
23 void at91_plla_init(u32 pllar
)
25 struct at91_pmc
*pmc
= (struct at91_pmc
*)ATMEL_BASE_PMC
;
27 writel(pllar
, &pmc
->pllar
);
28 while (!(readl(&pmc
->sr
) & (AT91_PMC_LOCKA
| AT91_PMC_MCKRDY
)))
32 void at91_mck_init(u32 mckr
)
34 struct at91_pmc
*pmc
= (struct at91_pmc
*)ATMEL_BASE_PMC
;
37 tmp
= readl(&pmc
->mckr
);
38 tmp
&= ~(AT91_PMC_MCKR_PRES_MASK
|
39 AT91_PMC_MCKR_MDIV_MASK
|
40 AT91_PMC_MCKR_PLLADIV_2
);
41 tmp
|= mckr
& (AT91_PMC_MCKR_PRES_MASK
|
42 AT91_PMC_MCKR_MDIV_MASK
|
43 AT91_PMC_MCKR_PLLADIV_2
);
44 writel(tmp
, &pmc
->mckr
);
46 while (!(readl(&pmc
->sr
) & AT91_PMC_MCKRDY
))
51 u32
spl_boot_device(void)
53 #ifdef CONFIG_SYS_USE_MMC
54 return BOOT_DEVICE_MMC1
;
56 return BOOT_DEVICE_NONE
;
59 u32
spl_boot_mode(void)
61 switch (spl_boot_device()) {
62 #ifdef CONFIG_SYS_USE_MMC
63 case BOOT_DEVICE_MMC1
:
64 return MMCSD_MODE_FAT
;
67 case BOOT_DEVICE_NONE
:
75 /* disable watchdog */
78 /* PMC configuration */
81 at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK
);
87 preloader_console_init();