clock.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * linux/arch/arm/mach-versatile/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/clkdev.h>
  21. #include <asm/hardware/icst307.h>
  22. #include "clock.h"
  23. int clk_enable(struct clk *clk)
  24. {
  25. return 0;
  26. }
  27. EXPORT_SYMBOL(clk_enable);
  28. void clk_disable(struct clk *clk)
  29. {
  30. }
  31. EXPORT_SYMBOL(clk_disable);
  32. unsigned long clk_get_rate(struct clk *clk)
  33. {
  34. return clk->rate;
  35. }
  36. EXPORT_SYMBOL(clk_get_rate);
  37. long clk_round_rate(struct clk *clk, unsigned long rate)
  38. {
  39. struct icst307_vco vco;
  40. vco = icst307_khz_to_vco(clk->params, rate / 1000);
  41. return icst307_khz(clk->params, vco) * 1000;
  42. }
  43. EXPORT_SYMBOL(clk_round_rate);
  44. int clk_set_rate(struct clk *clk, unsigned long rate)
  45. {
  46. int ret = -EIO;
  47. if (clk->setvco) {
  48. struct icst307_vco vco;
  49. vco = icst307_khz_to_vco(clk->params, rate / 1000);
  50. clk->rate = icst307_khz(clk->params, vco) * 1000;
  51. clk->setvco(clk, vco);
  52. ret = 0;
  53. }
  54. return ret;
  55. }
  56. EXPORT_SYMBOL(clk_set_rate);