summaryrefslogtreecommitdiff
path: root/board/microchip/pic32mzda/pic32mzda.c
blob: 8bfdee91e56ecda00b9e3bd2a189214f5d40dcc1 (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
// SPDX-License-Identifier: GPL-2.0+
/*
 * Microchip PIC32MZ[DA] Starter Kit board
 *
 * Copyright (C) 2015, Microchip Technology Inc.
 * Purna Chandra Mandal <purna.mandal@microchip.com>
 *
 */

#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