time.c 673 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Carsten Langgaard, carstenl@mips.com
  4. * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
  5. *
  6. * Setting up the clock on the MIPS boards.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/time.h>
  10. #include <linux/err.h>
  11. #include <linux/clk.h>
  12. #include <asm/time.h>
  13. #include <asm/mach-ar7/ar7.h>
  14. void __init plat_time_init(void)
  15. {
  16. struct clk *cpu_clk;
  17. /* Initialize ar7 clocks so the CPU clock frequency is correct */
  18. ar7_init_clocks();
  19. cpu_clk = clk_get(NULL, "cpu");
  20. if (IS_ERR(cpu_clk)) {
  21. printk(KERN_ERR "unable to get cpu clock\n");
  22. return;
  23. }
  24. mips_hpt_frequency = clk_get_rate(cpu_clk) / 2;
  25. }