blob: de1d9b5bfb31baa59b1479aa9529788cdfb12a8a [file] [log] [blame]
Wenyou Yangc64a75a2015-10-30 09:55:52 +08001/*
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>
Wenyou Yangc64a75a2015-10-30 09:55:52 +080010#include <asm/arch/clk.h>
11#include <asm/arch/sama5d2.h>
12
Wenyou Yang9366fd02017-09-13 14:58:53 +080013int cpu_is_sama5d2(void)
Wenyou Yangc64a75a2015-10-30 09:55:52 +080014{
Wenyou Yang9366fd02017-09-13 14:58:53 +080015 unsigned int chip_id = get_chip_id();
16
17 return ((chip_id == ARCH_ID_SAMA5D2) ||
18 (chip_id == ARCH_ID_SAMA5D2_SIP)) ? 1 : 0;
19}
20
21char *get_cpu_name(void)
22{
23 unsigned int chip_id = get_chip_id();
Wenyou Yangc64a75a2015-10-30 09:55:52 +080024 unsigned int extension_id = get_extension_chip_id();
25
Wenyou Yang9366fd02017-09-13 14:58:53 +080026 if (chip_id == ARCH_ID_SAMA5D2) {
Wenyou Yangc64a75a2015-10-30 09:55:52 +080027 switch (extension_id) {
28 case ARCH_EXID_SAMA5D21CU:
29 return "SAMA5D21";
30 case ARCH_EXID_SAMA5D22CU:
31 return "SAMA5D22-CU";
32 case ARCH_EXID_SAMA5D22CN:
33 return "SAMA5D22-CN";
34 case ARCH_EXID_SAMA5D23CU:
35 return "SAMA5D23-CU";
36 case ARCH_EXID_SAMA5D24CX:
37 return "SAMA5D24-CX";
38 case ARCH_EXID_SAMA5D24CU:
39 return "SAMA5D24-CU";
40 case ARCH_EXID_SAMA5D26CU:
41 return "SAMA5D26-CU";
42 case ARCH_EXID_SAMA5D27CU:
43 return "SAMA5D27-CU";
44 case ARCH_EXID_SAMA5D27CN:
45 return "SAMA5D27-CN";
46 case ARCH_EXID_SAMA5D28CU:
47 return "SAMA5D28-CU";
48 case ARCH_EXID_SAMA5D28CN:
49 return "SAMA5D28-CN";
50 }
51 }
52
Wenyou Yang9366fd02017-09-13 14:58:53 +080053 if ((chip_id == ARCH_ID_SAMA5D2) || (chip_id == ARCH_ID_SAMA5D2_SIP)) {
54 switch (extension_id) {
55 case ARCH_EXID_SAMA5D225C_D1M:
56 return "SAMA5D225 128M bits DDR2 SDRAM";
57 case ARCH_EXID_SAMA5D27C_D5M:
58 return "SAMA5D27 512M bits DDR2 SDRAM";
59 case ARCH_EXID_SAMA5D27C_D1G:
60 return "SAMA5D27 1G bits DDR2 SDRAM";
61 case ARCH_EXID_SAMA5D28C_D1G:
62 return "SAMA5D28 1G bits DDR2 SDRAM";
63 }
64 }
65
Wenyou Yangc64a75a2015-10-30 09:55:52 +080066 return "Unknown CPU type";
67}
68
69#ifdef CONFIG_USB_GADGET_ATMEL_USBA
70void at91_udp_hw_init(void)
71{
Wenyou Yangb5d886a2016-02-02 11:11:52 +080072 at91_upll_clk_enable();
Wenyou Yangc64a75a2015-10-30 09:55:52 +080073
74 at91_periph_clk_enable(ATMEL_ID_UDPHS);
75}
76#endif