Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Microchip PIC32MZ[DA] Starter Kit board |
| 3 | * |
| 4 | * Copyright (C) 2015, Microchip Technology Inc. |
| 5 | * Purna Chandra Mandal <purna.mandal@microchip.com> |
| 6 | * |
| 7 | * SPDX-License-Identifier: GPL-2.0+ |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <dm.h> |
| 13 | #include <clk.h> |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 14 | #include <dt-bindings/clock/microchip,clock.h> |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 15 | #include <mach/pic32.h> |
| 16 | |
| 17 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 18 | int checkboard(void) |
| 19 | { |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 20 | ulong rate; |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 21 | struct udevice *dev; |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 22 | struct clk clk; |
| 23 | int ret; |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 24 | |
| 25 | printf("Core: %s\n", get_core_name()); |
| 26 | |
Stephen Warren | 135aa95 | 2016-06-17 09:44:00 -0600 | [diff] [blame] | 27 | if (uclass_get_device(UCLASS_CLK, 0, &dev)) |
| 28 | return 0; |
| 29 | |
| 30 | clk.id = PB7CLK; |
| 31 | ret = clk_request(dev, &clk); |
| 32 | if (ret < 0) |
| 33 | return 0; |
| 34 | |
| 35 | rate = clk_get_rate(&clk); |
| 36 | printf("CPU Speed: %lu MHz\n", rate / 1000000); |
| 37 | |
| 38 | clk_free(&clk); |
Purna Chandra Mandal | 44da3a1 | 2016-01-28 15:30:17 +0530 | [diff] [blame] | 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | #endif |