blob: e7337deea7fa886571a94fd547cce06f42db789d [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Purna Chandra Mandal44da3a12016-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 Mandal44da3a12016-01-28 15:30:17 +05308 */
9
10#include <common.h>
11#include <dm.h>
12#include <clk.h>
Simon Glass691d7192020-05-10 11:40:02 -060013#include <init.h>
Simon Glass336d4612020-02-03 07:36:16 -070014#include <malloc.h>
Stephen Warren135aa952016-06-17 09:44:00 -060015#include <dt-bindings/clock/microchip,clock.h>
Purna Chandra Mandal44da3a12016-01-28 15:30:17 +053016#include <mach/pic32.h>
17
18#ifdef CONFIG_DISPLAY_BOARDINFO
19int checkboard(void)
20{
Stephen Warren135aa952016-06-17 09:44:00 -060021 ulong rate;
Purna Chandra Mandal44da3a12016-01-28 15:30:17 +053022 struct udevice *dev;
Stephen Warren135aa952016-06-17 09:44:00 -060023 struct clk clk;
24 int ret;
Purna Chandra Mandal44da3a12016-01-28 15:30:17 +053025
26 printf("Core: %s\n", get_core_name());
27
Stephen Warren135aa952016-06-17 09:44:00 -060028 if (uclass_get_device(UCLASS_CLK, 0, &dev))
29 return 0;
30
31 clk.id = PB7CLK;
32 ret = clk_request(dev, &clk);
33 if (ret < 0)
34 return 0;
35
36 rate = clk_get_rate(&clk);
37 printf("CPU Speed: %lu MHz\n", rate / 1000000);
38
39 clk_free(&clk);
Purna Chandra Mandal44da3a12016-01-28 15:30:17 +053040
41 return 0;
42}
43#endif