]> git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/mach-at91/armv7/sama5d4_devices.c
52f486289d9a217f457399f6c54f804c4e6b37a2
[people/ms/u-boot.git] / arch / arm / mach-at91 / armv7 / sama5d4_devices.c
1 /*
2 * Copyright (C) 2014 Atmel
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>
11 #include <asm/arch/at91_pmc.h>
12 #include <asm/arch/clk.h>
13 #include <asm/arch/sama5_sfr.h>
14 #include <asm/arch/sama5d4.h>
15
16 char *get_cpu_name()
17 {
18 unsigned int extension_id = get_extension_chip_id();
19
20 if (cpu_is_sama5d4())
21 switch (extension_id) {
22 case ARCH_EXID_SAMA5D41:
23 return "SAMA5D41";
24 case ARCH_EXID_SAMA5D42:
25 return "SAMA5D42";
26 case ARCH_EXID_SAMA5D43:
27 return "SAMA5D43";
28 case ARCH_EXID_SAMA5D44:
29 return "SAMA5D44";
30 default:
31 return "Unknown CPU type";
32 }
33 else
34 return "Unknown CPU type";
35 }
36
37 #ifdef CONFIG_USB_GADGET_ATMEL_USBA
38 void at91_udp_hw_init(void)
39 {
40 struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
41
42 /* Enable UPLL clock */
43 writel(AT91_PMC_UPLLEN | AT91_PMC_BIASEN, &pmc->uckr);
44 /* Enable UDPHS clock */
45 at91_periph_clk_enable(ATMEL_ID_UDPHS);
46 }
47 #endif
48
49 #ifdef CONFIG_SPL_BUILD
50 void redirect_int_from_saic_to_aic(void)
51 {
52 struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
53 u32 key32;
54
55 if (!(readl(&sfr->aicredir) & ATMEL_SFR_AICREDIR_NSAIC)) {
56 key32 = readl(&sfr->sn1) ^ ATMEL_SFR_AICREDIR_KEY;
57 writel((key32 | ATMEL_SFR_AICREDIR_NSAIC), &sfr->aicredir);
58 }
59 }
60 #endif