summaryrefslogtreecommitdiff
path: root/board/microchip/pic32mzda/pic32mzda.c
blob: e7337deea7fa886571a94fd547cce06f42db789d (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
43
// 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 <init.h>
#include <malloc.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