clock-sh7367.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Preliminary clock framework support for sh7367
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <linux/init.h>
  20. #include <linux/module.h>
  21. #include <linux/kernel.h>
  22. #include <linux/list.h>
  23. #include <linux/clk.h>
  24. struct clk {
  25. const char *name;
  26. unsigned long rate;
  27. };
  28. #include <asm/clkdev.h>
  29. int __clk_get(struct clk *clk)
  30. {
  31. return 1;
  32. }
  33. EXPORT_SYMBOL(__clk_get);
  34. void __clk_put(struct clk *clk)
  35. {
  36. }
  37. EXPORT_SYMBOL(__clk_put);
  38. int clk_enable(struct clk *clk)
  39. {
  40. return 0;
  41. }
  42. EXPORT_SYMBOL(clk_enable);
  43. void clk_disable(struct clk *clk)
  44. {
  45. }
  46. EXPORT_SYMBOL(clk_disable);
  47. unsigned long clk_get_rate(struct clk *clk)
  48. {
  49. return clk ? clk->rate : 0;
  50. }
  51. EXPORT_SYMBOL(clk_get_rate);
  52. /* a static peripheral clock for now - enough to get sh-sci working */
  53. static struct clk peripheral_clk = {
  54. .name = "peripheral_clk",
  55. .rate = 48000000,
  56. };
  57. /* a static rclk for now - enough to get sh_cmt working */
  58. static struct clk r_clk = {
  59. .name = "r_clk",
  60. .rate = 32768,
  61. };
  62. /* a static usb0 for now - enough to get r8a66597 working */
  63. static struct clk usb0_clk = {
  64. .name = "usb0",
  65. };
  66. /* a static keysc0 clk for now - enough to get sh_keysc working */
  67. static struct clk keysc0_clk = {
  68. .name = "keysc0",
  69. };
  70. static struct clk_lookup lookups[] = {
  71. {
  72. .clk = &peripheral_clk,
  73. }, {
  74. .clk = &r_clk,
  75. }, {
  76. .clk = &usb0_clk,
  77. }, {
  78. .clk = &keysc0_clk,
  79. }
  80. };
  81. void __init sh7367_clock_init(void)
  82. {
  83. int i;
  84. for (i = 0; i < ARRAY_SIZE(lookups); i++) {
  85. lookups[i].con_id = lookups[i].clk->name;
  86. clkdev_add(&lookups[i]);
  87. }
  88. }