summaryrefslogtreecommitdiff
path: root/board/microchip/pic32mzda/pic32mzda.c
blob: 3d31d3d0620a8efad5d23f98c7a8e74ea167cec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Microchip PIC32MZ[DA] Starter Kit board
 *
 * Copyright (C) 2015, Microchip Technology Inc.
 * Purna Chandra Mandal <purna.mandal@microchip.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 *
 */

#include <common.h>
#include <dm.h>
#include <clk.h>
#include <dt-bindings/clock/microchip,clock.h>
#include <mach/pic32.h>

#ifdef CONFIG_DISPLAY_BOARDINFO
int checkboard(void)
{
	ulong rate;
	struct udevice *dev;
	struct clk clk;
	int ret;

	printf("Core: %s\n", get_core_name());

	if (uclass_get_device(UCLASS_CLK, 0, &dev))
		return 0;

	clk.id = PB7CLK;
	ret = clk_request(dev, &clk);
	if (ret < 0)
		return 0;

	rate = clk_get_rate(&clk);
	printf("CPU Speed: %lu MHz\n", rate / 1000000);

	clk_free(&clk);

	return 0;
}
#endif