clock.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* linux/arch/arm/plat-s3c/include/plat/clock.h
  2. *
  3. * Copyright (c) 2004-2005 Simtec Electronics
  4. * http://www.simtec.co.uk/products/SWLINUX/
  5. * Written by Ben Dooks, <ben@simtec.co.uk>
  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/spinlock.h>
  12. struct clk;
  13. /**
  14. * struct clk_ops - standard clock operations
  15. * @set_rate: set the clock rate, see clk_set_rate().
  16. * @get_rate: get the clock rate, see clk_get_rate().
  17. * @round_rate: round a given clock rate, see clk_round_rate().
  18. * @set_parent: set the clock's parent, see clk_set_parent().
  19. *
  20. * Group the common clock implementations together so that we
  21. * don't have to keep setting the same fiels again. We leave
  22. * enable in struct clk.
  23. *
  24. * Adding an extra layer of indirection into the process should
  25. * not be a problem as it is unlikely these operations are going
  26. * to need to be called quickly.
  27. */
  28. struct clk_ops {
  29. int (*set_rate)(struct clk *c, unsigned long rate);
  30. unsigned long (*get_rate)(struct clk *c);
  31. unsigned long (*round_rate)(struct clk *c, unsigned long rate);
  32. int (*set_parent)(struct clk *c, struct clk *parent);
  33. };
  34. struct clk {
  35. struct list_head list;
  36. struct module *owner;
  37. struct clk *parent;
  38. const char *name;
  39. int id;
  40. int usage;
  41. unsigned long rate;
  42. unsigned long ctrlbit;
  43. struct clk_ops *ops;
  44. int (*enable)(struct clk *, int enable);
  45. };
  46. /* other clocks which may be registered by board support */
  47. extern struct clk s3c24xx_dclk0;
  48. extern struct clk s3c24xx_dclk1;
  49. extern struct clk s3c24xx_clkout0;
  50. extern struct clk s3c24xx_clkout1;
  51. extern struct clk s3c24xx_uclk;
  52. extern struct clk clk_usb_bus;
  53. /* core clock support */
  54. extern struct clk clk_f;
  55. extern struct clk clk_h;
  56. extern struct clk clk_p;
  57. extern struct clk clk_mpll;
  58. extern struct clk clk_upll;
  59. extern struct clk clk_epll;
  60. extern struct clk clk_xtal;
  61. extern struct clk clk_ext;
  62. /* S3C64XX specific clocks */
  63. extern struct clk clk_h2;
  64. extern struct clk clk_27m;
  65. extern struct clk clk_48m;
  66. extern struct clk clk_xusbxti;
  67. extern int clk_default_setrate(struct clk *clk, unsigned long rate);
  68. extern struct clk_ops clk_ops_def_setrate;
  69. /* exports for arch/arm/mach-s3c2410
  70. *
  71. * Please DO NOT use these outside of arch/arm/mach-s3c2410
  72. */
  73. extern spinlock_t clocks_lock;
  74. extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
  75. extern int s3c24xx_register_clock(struct clk *clk);
  76. extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
  77. extern void s3c_register_clocks(struct clk *clk, int nr_clks);
  78. extern void s3c_disable_clocks(struct clk *clkp, int nr_clks);
  79. extern int s3c24xx_register_baseclocks(unsigned long xtal);
  80. extern void s5p_register_clocks(unsigned long xtal_freq);
  81. extern void s3c24xx_setup_clocks(unsigned long fclk,
  82. unsigned long hclk,
  83. unsigned long pclk);
  84. extern void s3c2410_setup_clocks(void);
  85. extern void s3c2412_setup_clocks(void);
  86. extern void s3c244x_setup_clocks(void);
  87. extern void s3c2443_setup_clocks(void);
  88. /* S3C64XX specific functions and clocks */
  89. extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
  90. /* Init for pwm clock code */
  91. extern void s3c_pwmclk_init(void);