clock.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * linux/arch/arm/mach-realview/clock.c
  3. *
  4. * Copyright (C) 2004 ARM Limited.
  5. * Written by Deep Blue Solutions Limited.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/kernel.h>
  13. #include <linux/device.h>
  14. #include <linux/list.h>
  15. #include <linux/errno.h>
  16. #include <linux/err.h>
  17. #include <linux/string.h>
  18. #include <linux/clk.h>
  19. #include <linux/mutex.h>
  20. #include <asm/hardware/icst307.h>
  21. #include "clock.h"
  22. int clk_enable(struct clk *clk)
  23. {
  24. return 0;
  25. }
  26. EXPORT_SYMBOL(clk_enable);
  27. void clk_disable(struct clk *clk)
  28. {
  29. }
  30. EXPORT_SYMBOL(clk_disable);
  31. unsigned long clk_get_rate(struct clk *clk)
  32. {
  33. return clk->rate;
  34. }
  35. EXPORT_SYMBOL(clk_get_rate);
  36. long clk_round_rate(struct clk *clk, unsigned long rate)
  37. {
  38. struct icst307_vco vco;
  39. vco = icst307_khz_to_vco(clk->params, rate / 1000);
  40. return icst307_khz(clk->params, vco) * 1000;
  41. }
  42. EXPORT_SYMBOL(clk_round_rate);
  43. int clk_set_rate(struct clk *clk, unsigned long rate)
  44. {
  45. int ret = -EIO;
  46. if (clk->setvco) {
  47. struct icst307_vco vco;
  48. vco = icst307_khz_to_vco(clk->params, rate / 1000);
  49. clk->rate = icst307_khz(clk->params, vco) * 1000;
  50. clk->setvco(clk, vco);
  51. ret = 0;
  52. }
  53. return ret;
  54. }
  55. EXPORT_SYMBOL(clk_set_rate);