clock-clksrc.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* linux/arch/arm/plat-samsung/include/plat/clock-clksrc.h
  2. *
  3. * Parts taken from arch/arm/plat-s3c64xx/clock.c
  4. * Copyright 2008 Openmoko, Inc.
  5. * Copyright 2008 Simtec Electronics
  6. * Ben Dooks <ben@simtec.co.uk>
  7. * http://armlinux.simtec.co.uk/
  8. *
  9. * Copyright 2009 Ben Dooks <ben-linux@fluff.org>
  10. * Copyright 2009 Harald Welte
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. /**
  17. * struct clksrc_sources - list of sources for a given clock
  18. * @sources: array of pointers to clocks
  19. * @nr_sources: The size of @sources
  20. */
  21. struct clksrc_sources {
  22. unsigned int nr_sources;
  23. struct clk **sources;
  24. };
  25. /**
  26. * struct clksrc_reg - register definition for clock control bits
  27. * @reg: pointer to the register in virtual memory.
  28. * @shift: the shift in bits to where the bitfield is.
  29. * @size: the size in bits of the bitfield.
  30. *
  31. * This specifies the size and position of the bits we are interested
  32. * in within the register specified by @reg.
  33. */
  34. struct clksrc_reg {
  35. void __iomem *reg;
  36. unsigned short shift;
  37. unsigned short size;
  38. };
  39. /**
  40. * struct clksrc_clk - class of clock for newer style samsung devices.
  41. * @clk: the standard clock representation
  42. * @sources: the sources for this clock
  43. * @reg_src: the register definition for selecting the clock's source
  44. * @reg_div: the register definition for the clock's output divisor
  45. *
  46. * This clock implements the features required by the newer SoCs where
  47. * the standard clock block provides an input mux and a post-mux divisor
  48. * to provide the periperhal's clock.
  49. *
  50. * The array of @sources provides the mapping of mux position to the
  51. * clock, and @reg_src shows the code where to modify to change the mux
  52. * position. The @reg_div defines how to change the divider settings on
  53. * the output.
  54. */
  55. struct clksrc_clk {
  56. struct clk clk;
  57. struct clksrc_sources *sources;
  58. struct clksrc_reg reg_src;
  59. struct clksrc_reg reg_div;
  60. };
  61. /**
  62. * s3c_set_clksrc() - setup the clock from the register settings
  63. * @clk: The clock to setup.
  64. * @announce: true to announce the setting to printk().
  65. *
  66. * Setup the clock from the current register settings, for when the
  67. * kernel boots or if it is resuming from a possibly unknown state.
  68. */
  69. extern void s3c_set_clksrc(struct clksrc_clk *clk, bool announce);
  70. /**
  71. * s3c_register_clksrc() register clocks from an array of clksrc clocks
  72. * @srcs: The array of clocks to register
  73. * @size: The size of the @srcs array.
  74. *
  75. * Initialise and register the array of clocks described by @srcs.
  76. */
  77. extern void s3c_register_clksrc(struct clksrc_clk *srcs, int size);