blob: 469c221176651ff952a8b3e1f900cdcd320d2193 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Wenyou Yangc64a75a2015-10-30 09:55:52 +08002/*
3 * Copyright (C) 2015 Atmel Corporation
4 * Wenyou Yang <wenyou.yang@atmel.com>
Wenyou Yangc64a75a2015-10-30 09:55:52 +08005 */
6
Wenyou Yangc64a75a2015-10-30 09:55:52 +08007#include <asm/io.h>
Wenyou Yangc64a75a2015-10-30 09:55:52 +08008#include <asm/arch/clk.h>
9#include <asm/arch/sama5d2.h>
10
Alexander Dahl3f775062019-03-22 14:25:54 +010011int _cpu_is_sama5d2(void)
Wenyou Yangc64a75a2015-10-30 09:55:52 +080012{
Wenyou Yang9366fd02017-09-13 14:58:53 +080013 unsigned int chip_id = get_chip_id();
14
15 return ((chip_id == ARCH_ID_SAMA5D2) ||
16 (chip_id == ARCH_ID_SAMA5D2_SIP)) ? 1 : 0;
17}
18
19char *get_cpu_name(void)
20{
21 unsigned int chip_id = get_chip_id();
Wenyou Yangc64a75a2015-10-30 09:55:52 +080022 unsigned int extension_id = get_extension_chip_id();
23
Wenyou Yang9366fd02017-09-13 14:58:53 +080024 if (chip_id == ARCH_ID_SAMA5D2) {
Wenyou Yangc64a75a2015-10-30 09:55:52 +080025 switch (extension_id) {
26 case ARCH_EXID_SAMA5D21CU:
27 return "SAMA5D21";
28 case ARCH_EXID_SAMA5D22CU:
29 return "SAMA5D22-CU";
30 case ARCH_EXID_SAMA5D22CN:
31 return "SAMA5D22-CN";
32 case ARCH_EXID_SAMA5D23CU:
33 return "SAMA5D23-CU";
34 case ARCH_EXID_SAMA5D24CX:
35 return "SAMA5D24-CX";
36 case ARCH_EXID_SAMA5D24CU:
37 return "SAMA5D24-CU";
38 case ARCH_EXID_SAMA5D26CU:
39 return "SAMA5D26-CU";
40 case ARCH_EXID_SAMA5D27CU:
41 return "SAMA5D27-CU";
42 case ARCH_EXID_SAMA5D27CN:
43 return "SAMA5D27-CN";
44 case ARCH_EXID_SAMA5D28CU:
45 return "SAMA5D28-CU";
46 case ARCH_EXID_SAMA5D28CN:
47 return "SAMA5D28-CN";
Hari Prasath03ecb902021-07-14 19:13:41 +053048 case ARCH_EXID_SAMA5D29CN:
49 return "SAMA5D29-CN";
Wenyou Yangc64a75a2015-10-30 09:55:52 +080050 }
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";
Nicolas Ferre08eb7c62019-08-08 07:48:23 +000061 case ARCH_EXID_SAMA5D27C_LD1G:
62 return "SAMA5D27 1G bits LPDDR2 SDRAM";
63 case ARCH_EXID_SAMA5D27C_LD2G:
64 return "SAMA5D27 2G bits LPDDR2 SDRAM";
Wenyou Yang9366fd02017-09-13 14:58:53 +080065 case ARCH_EXID_SAMA5D28C_D1G:
66 return "SAMA5D28 1G bits DDR2 SDRAM";
Nicolas Ferre08eb7c62019-08-08 07:48:23 +000067 case ARCH_EXID_SAMA5D28C_LD1G:
68 return "SAMA5D28 1G bits LPDDR2 SDRAM";
69 case ARCH_EXID_SAMA5D28C_LD2G:
70 return "SAMA5D28 2G bits LPDDR2 SDRAM";
Wenyou Yang9366fd02017-09-13 14:58:53 +080071 }
72 }
73
Wenyou Yangc64a75a2015-10-30 09:55:52 +080074 return "Unknown CPU type";
75}
76
77#ifdef CONFIG_USB_GADGET_ATMEL_USBA
78void at91_udp_hw_init(void)
79{
Wenyou Yangb5d886a2016-02-02 11:11:52 +080080 at91_upll_clk_enable();
Wenyou Yangc64a75a2015-10-30 09:55:52 +080081
82 at91_periph_clk_enable(ATMEL_ID_UDPHS);
83}
84#endif