clock.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * linux/arch/arm/plat-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/errno.h>
  14. #include <linux/clk.h>
  15. #include <linux/mutex.h>
  16. #include <asm/hardware/icst.h>
  17. #include <mach/clkdev.h>
  18. int clk_enable(struct clk *clk)
  19. {
  20. return 0;
  21. }
  22. EXPORT_SYMBOL(clk_enable);
  23. void clk_disable(struct clk *clk)
  24. {
  25. }
  26. EXPORT_SYMBOL(clk_disable);
  27. unsigned long clk_get_rate(struct clk *clk)
  28. {
  29. return clk->rate;
  30. }
  31. EXPORT_SYMBOL(clk_get_rate);
  32. long clk_round_rate(struct clk *clk, unsigned long rate)
  33. {
  34. long ret = -EIO;
  35. if (clk->ops && clk->ops->round)
  36. ret = clk->ops->round(clk, rate);
  37. return ret;
  38. }
  39. EXPORT_SYMBOL(clk_round_rate);
  40. int clk_set_rate(struct clk *clk, unsigned long rate)
  41. {
  42. int ret = -EIO;
  43. if (clk->ops && clk->ops->set)
  44. ret = clk->ops->set(clk, rate);
  45. return ret;
  46. }
  47. EXPORT_SYMBOL(clk_set_rate);
  48. long icst_clk_round(struct clk *clk, unsigned long rate)
  49. {
  50. struct icst_vco vco;
  51. vco = icst_hz_to_vco(clk->params, rate);
  52. return icst_hz(clk->params, vco);
  53. }
  54. EXPORT_SYMBOL(icst_clk_round);
  55. int icst_clk_set(struct clk *clk, unsigned long rate)
  56. {
  57. struct icst_vco vco;
  58. vco = icst_hz_to_vco(clk->params, rate);
  59. clk->rate = icst_hz(clk->params, vco);
  60. clk->ops->setvco(clk, vco);
  61. return 0;
  62. }
  63. EXPORT_SYMBOL(icst_clk_set);