Suneel Garapati | 03c2288 | 2019-10-19 18:37:55 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2018 Marvell International Ltd. |
| 4 | * |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/arch/board.h> |
| 11 | #include <asm/arch/clock.h> |
| 12 | |
| 13 | /** |
| 14 | * Returns the I/O clock speed in Hz |
| 15 | */ |
| 16 | u64 octeontx_get_io_clock(void) |
| 17 | { |
| 18 | union rst_boot rst_boot; |
| 19 | |
| 20 | rst_boot.u = readq(RST_BOOT); |
| 21 | |
| 22 | return rst_boot.s.pnr_mul * PLL_REF_CLK; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Returns the core clock speed in Hz |
| 27 | */ |
| 28 | u64 octeontx_get_core_clock(void) |
| 29 | { |
| 30 | union rst_boot rst_boot; |
| 31 | |
| 32 | rst_boot.u = readq(RST_BOOT); |
| 33 | |
| 34 | return rst_boot.s.c_mul * PLL_REF_CLK; |
| 35 | } |