1 /*
2  * Copyright (C) 2015 Atmel Corporation
3  *		      Wenyou Yang <wenyou.yang@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_pmc.h>
11 #include <asm/arch/clk.h>
12 #include <asm/arch/sama5d2.h>
13 
14 char *get_cpu_name()
15 {
16 	unsigned int extension_id = get_extension_chip_id();
17 
18 	if (cpu_is_sama5d2()) {
19 		switch (extension_id) {
20 		case ARCH_EXID_SAMA5D21CU:
21 			return "SAMA5D21";
22 		case ARCH_EXID_SAMA5D22CU:
23 			return "SAMA5D22-CU";
24 		case ARCH_EXID_SAMA5D22CN:
25 			return "SAMA5D22-CN";
26 		case ARCH_EXID_SAMA5D23CU:
27 			return "SAMA5D23-CU";
28 		case ARCH_EXID_SAMA5D24CX:
29 			return "SAMA5D24-CX";
30 		case ARCH_EXID_SAMA5D24CU:
31 			return "SAMA5D24-CU";
32 		case ARCH_EXID_SAMA5D26CU:
33 			return "SAMA5D26-CU";
34 		case ARCH_EXID_SAMA5D27CU:
35 			return "SAMA5D27-CU";
36 		case ARCH_EXID_SAMA5D27CN:
37 			return "SAMA5D27-CN";
38 		case ARCH_EXID_SAMA5D28CU:
39 			return "SAMA5D28-CU";
40 		case ARCH_EXID_SAMA5D28CN:
41 			return "SAMA5D28-CN";
42 		}
43 	}
44 
45 	return "Unknown CPU type";
46 }
47 
48 #ifdef CONFIG_USB_GADGET_ATMEL_USBA
49 void at91_udp_hw_init(void)
50 {
51 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
52 
53 	writel(AT91_PMC_UPLLEN | AT91_PMC_BIASEN, &pmc->uckr);
54 
55 	at91_periph_clk_enable(ATMEL_ID_UDPHS);
56 }
57 #endif
58