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/clk.h> 11 #include <asm/arch/sama5d2.h> 12 13 int cpu_is_sama5d2(void) 14 { 15 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 21 char *get_cpu_name(void) 22 { 23 unsigned int chip_id = get_chip_id(); 24 unsigned int extension_id = get_extension_chip_id(); 25 26 if (chip_id == ARCH_ID_SAMA5D2) { 27 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 53 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 66 return "Unknown CPU type"; 67 } 68 69 #ifdef CONFIG_USB_GADGET_ATMEL_USBA 70 void at91_udp_hw_init(void) 71 { 72 at91_upll_clk_enable(); 73 74 at91_periph_clk_enable(ATMEL_ID_UDPHS); 75 } 76 #endif 77