1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Microchip PIC32MZ[DA] Starter Kit board 4 * 5 * Copyright (C) 2015, Microchip Technology Inc. 6 * Purna Chandra Mandal <purna.mandal@microchip.com> 7 * 8 */ 9 10 #include <common.h> 11 #include <dm.h> 12 #include <clk.h> 13 #include <dt-bindings/clock/microchip,clock.h> 14 #include <mach/pic32.h> 15 16 #ifdef CONFIG_DISPLAY_BOARDINFO 17 int checkboard(void) 18 { 19 ulong rate; 20 struct udevice *dev; 21 struct clk clk; 22 int ret; 23 24 printf("Core: %s\n", get_core_name()); 25 26 if (uclass_get_device(UCLASS_CLK, 0, &dev)) 27 return 0; 28 29 clk.id = PB7CLK; 30 ret = clk_request(dev, &clk); 31 if (ret < 0) 32 return 0; 33 34 rate = clk_get_rate(&clk); 35 printf("CPU Speed: %lu MHz\n", rate / 1000000); 36 37 clk_free(&clk); 38 39 return 0; 40 } 41 #endif 42