clock.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <asm/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. /* We have a fixed clock alone, for now */
  32. static struct clk clk_48 = {
  33. .rate = 48 * 1000 * 1000,
  34. };
  35. /*
  36. * Catch-all default clock to satisfy drivers using the clk API. We don't
  37. * model the actual hardware clocks yet.
  38. */
  39. static struct clk clk_default;
  40. #define CLK(_clk, dev) \
  41. { \
  42. .clk = _clk, \
  43. .dev_id = dev, \
  44. }
  45. static struct clk_lookup lookups[] = {
  46. CLK(&clk_48, "uart0"),
  47. CLK(&clk_48, "uart1"),
  48. CLK(&clk_default, "gpio.0"),
  49. CLK(&clk_default, "gpio.1"),
  50. CLK(&clk_default, "gpio.2"),
  51. CLK(&clk_default, "gpio.3"),
  52. CLK(&clk_default, "rng"),
  53. };
  54. static int __init clk_init(void)
  55. {
  56. clkdev_add_table(lookups, ARRAY_SIZE(lookups));
  57. return 0;
  58. }
  59. arch_initcall(clk_init);