clock.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * linux/arch/arm/mach-nomadik/clock.c
  3. *
  4. * Copyright (C) 2009 Alessandro Rubini
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/module.h>
  8. #include <linux/errno.h>
  9. #include <linux/clk.h>
  10. #include <linux/clkdev.h>
  11. #include "clock.h"
  12. /*
  13. * The nomadik board uses generic clocks, but the serial pl011 file
  14. * calls clk_enable(), clk_disable(), clk_get_rate(), so we provide them
  15. */
  16. unsigned long clk_get_rate(struct clk *clk)
  17. {
  18. return clk->rate;
  19. }
  20. EXPORT_SYMBOL(clk_get_rate);
  21. /* enable and disable do nothing */
  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. static struct clk clk_24 = {
  32. .rate = 2400000,
  33. };
  34. static struct clk clk_48 = {
  35. .rate = 48 * 1000 * 1000,
  36. };
  37. /*
  38. * Catch-all default clock to satisfy drivers using the clk API. We don't
  39. * model the actual hardware clocks yet.
  40. */
  41. static struct clk clk_default;
  42. #define CLK(_clk, dev) \
  43. { \
  44. .clk = _clk, \
  45. .dev_id = dev, \
  46. }
  47. static struct clk_lookup lookups[] = {
  48. {
  49. .con_id = "apb_pclk",
  50. .clk = &clk_default,
  51. },
  52. CLK(&clk_24, "mtu0"),
  53. CLK(&clk_24, "mtu1"),
  54. CLK(&clk_48, "uart0"),
  55. CLK(&clk_48, "uart1"),
  56. CLK(&clk_default, "gpio.0"),
  57. CLK(&clk_default, "gpio.1"),
  58. CLK(&clk_default, "gpio.2"),
  59. CLK(&clk_default, "gpio.3"),
  60. CLK(&clk_default, "rng"),
  61. };
  62. int __init clk_init(void)
  63. {
  64. clkdev_add_table(lookups, ARRAY_SIZE(lookups));
  65. return 0;
  66. }