clock.c 706 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the
  6. * Free Software Foundation; either version 2 of the License, or (at your
  7. * option) any later version.
  8. */
  9. #include <linux/clk.h>
  10. #include <linux/err.h>
  11. #include <asm/time.h>
  12. #include <platform.h>
  13. void __init plat_time_init(void)
  14. {
  15. struct clk *clk;
  16. /* Initialize LS1X clocks */
  17. ls1x_clk_init();
  18. /* setup mips r4k timer */
  19. clk = clk_get(NULL, "cpu");
  20. if (IS_ERR(clk))
  21. panic("unable to get cpu clock, err=%ld", PTR_ERR(clk));
  22. mips_hpt_frequency = clk_get_rate(clk) / 2;
  23. }