Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 2 | /* |
| 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 Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <dm.h> |
| 12 | #include <clk.h> |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 13 | #include <dt-bindings/clock/microchip,clock.h> |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 14 | #include <mach/pic32.h> |
| 15 | |
| 16 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 17 | int checkboard(void) |
| 18 | { |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 19 | ulong rate; |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 20 | struct udevice *dev; |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 21 | struct clk clk; |
| 22 | int ret; |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 23 | |
| 24 | printf("Core: %s\n", get_core_name()); |
| 25 | |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 26 | 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 Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | #endif |