clock.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Dummy clk implementations for powerpc.
  3. * These need to be overridden in platform code.
  4. */
  5. #include <linux/clk.h>
  6. #include <linux/err.h>
  7. #include <linux/errno.h>
  8. #include <linux/export.h>
  9. #include <asm/clk_interface.h>
  10. struct clk_interface clk_functions;
  11. struct clk *clk_get(struct device *dev, const char *id)
  12. {
  13. if (clk_functions.clk_get)
  14. return clk_functions.clk_get(dev, id);
  15. return ERR_PTR(-ENOSYS);
  16. }
  17. EXPORT_SYMBOL(clk_get);
  18. void clk_put(struct clk *clk)
  19. {
  20. if (clk_functions.clk_put)
  21. clk_functions.clk_put(clk);
  22. }
  23. EXPORT_SYMBOL(clk_put);
  24. int clk_enable(struct clk *clk)
  25. {
  26. if (clk_functions.clk_enable)
  27. return clk_functions.clk_enable(clk);
  28. return -ENOSYS;
  29. }
  30. EXPORT_SYMBOL(clk_enable);
  31. void clk_disable(struct clk *clk)
  32. {
  33. if (clk_functions.clk_disable)
  34. clk_functions.clk_disable(clk);
  35. }
  36. EXPORT_SYMBOL(clk_disable);
  37. unsigned long clk_get_rate(struct clk *clk)
  38. {
  39. if (clk_functions.clk_get_rate)
  40. return clk_functions.clk_get_rate(clk);
  41. return 0;
  42. }
  43. EXPORT_SYMBOL(clk_get_rate);
  44. long clk_round_rate(struct clk *clk, unsigned long rate)
  45. {
  46. if (clk_functions.clk_round_rate)
  47. return clk_functions.clk_round_rate(clk, rate);
  48. return -ENOSYS;
  49. }
  50. EXPORT_SYMBOL(clk_round_rate);
  51. int clk_set_rate(struct clk *clk, unsigned long rate)
  52. {
  53. if (clk_functions.clk_set_rate)
  54. return clk_functions.clk_set_rate(clk, rate);
  55. return -ENOSYS;
  56. }
  57. EXPORT_SYMBOL(clk_set_rate);
  58. struct clk *clk_get_parent(struct clk *clk)
  59. {
  60. if (clk_functions.clk_get_parent)
  61. return clk_functions.clk_get_parent(clk);
  62. return ERR_PTR(-ENOSYS);
  63. }
  64. EXPORT_SYMBOL(clk_get_parent);
  65. int clk_set_parent(struct clk *clk, struct clk *parent)
  66. {
  67. if (clk_functions.clk_set_parent)
  68. return clk_functions.clk_set_parent(clk, parent);
  69. return -ENOSYS;
  70. }
  71. EXPORT_SYMBOL(clk_set_parent);