clock.c 591 B

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