clock.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. */
  22. #include <linux/kernel.h>
  23. #include <linux/init.h>
  24. #include <linux/sh_clk.h>
  25. #include <linux/export.h>
  26. #include <mach/clock.h>
  27. #include <mach/common.h>
  28. unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
  29. {
  30. struct clk_ratio *p = clk->priv;
  31. return clk->parent->rate / p->div * p->mul;
  32. };
  33. struct sh_clk_ops shmobile_fixed_ratio_clk_ops = {
  34. .recalc = shmobile_fixed_ratio_clk_recalc,
  35. };
  36. int __init shmobile_clk_init(void)
  37. {
  38. /* Kick the child clocks.. */
  39. recalculate_root_clocks();
  40. /* Enable the necessary init clocks */
  41. clk_enable_init_clocks();
  42. return 0;
  43. }
  44. int __clk_get(struct clk *clk)
  45. {
  46. return 1;
  47. }
  48. EXPORT_SYMBOL(__clk_get);
  49. void __clk_put(struct clk *clk)
  50. {
  51. }
  52. EXPORT_SYMBOL(__clk_put);