blob: 8bfdee91e56ecda00b9e3bd2a189214f5d40dcc1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Purna Chandra Mandal745dd322016-01-28 15:30:17 +05302/*
3 * Microchip PIC32MZ[DA] Starter Kit board
4 *
5 * Copyright (C) 2015, Microchip Technology Inc.
6 * Purna Chandra Mandal <purna.mandal@microchip.com>
7 *
Purna Chandra Mandal745dd322016-01-28 15:30:17 +05308 */
9
10#include <common.h>
11#include <dm.h>
12#include <clk.h>
Stephen Warrena9622432016-06-17 09:44:00 -060013#include <dt-bindings/clock/microchip,clock.h>
Purna Chandra Mandal745dd322016-01-28 15:30:17 +053014#include <mach/pic32.h>
15
16#ifdef CONFIG_DISPLAY_BOARDINFO
17int checkboard(void)
18{
Stephen Warrena9622432016-06-17 09:44:00 -060019 ulong rate;
Purna Chandra Mandal745dd322016-01-28 15:30:17 +053020 struct udevice *dev;
Stephen Warrena9622432016-06-17 09:44:00 -060021 struct clk clk;
22 int ret;
Purna Chandra Mandal745dd322016-01-28 15:30:17 +053023
24 printf("Core: %s\n", get_core_name());
25
Stephen Warrena9622432016-06-17 09:44:00 -060026 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);
Purna Chandra Mandal745dd322016-01-28 15:30:17 +053038
39 return 0;
40}
41#endif