clock.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * SH-Mobile Clock Framework
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. *
  6. * Used together with arch/arm/common/clkdev.c and drivers/sh/clk.c.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #include <linux/export.h>
  19. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/sh_clk.h>
  22. #include "clock.h"
  23. #include "common.h"
  24. unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
  25. {
  26. struct clk_ratio *p = clk->priv;
  27. return clk->parent->rate / p->div * p->mul;
  28. };
  29. struct sh_clk_ops shmobile_fixed_ratio_clk_ops = {
  30. .recalc = shmobile_fixed_ratio_clk_recalc,
  31. };
  32. int __init shmobile_clk_init(void)
  33. {
  34. /* Kick the child clocks.. */
  35. recalculate_root_clocks();
  36. /* Enable the necessary init clocks */
  37. clk_enable_init_clocks();
  38. return 0;
  39. }