clk.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * (C) Copyright 2007
  3. * Stelian Pop <stelian.pop@leadtechdesign.com>
  4. * Lead Tech Design <www.leadtechdesign.com>
  5. * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __ASM_ARM_ARCH_CLK_H__
  26. #define __ASM_ARM_ARCH_CLK_H__
  27. #include <asm/arch/hardware.h>
  28. #include <asm/global_data.h>
  29. static inline unsigned long get_cpu_clk_rate(void)
  30. {
  31. DECLARE_GLOBAL_DATA_PTR;
  32. return gd->cpu_clk_rate_hz;
  33. }
  34. static inline unsigned long get_main_clk_rate(void)
  35. {
  36. DECLARE_GLOBAL_DATA_PTR;
  37. return gd->main_clk_rate_hz;
  38. }
  39. static inline unsigned long get_mck_clk_rate(void)
  40. {
  41. DECLARE_GLOBAL_DATA_PTR;
  42. return gd->mck_rate_hz;
  43. }
  44. static inline unsigned long get_plla_clk_rate(void)
  45. {
  46. DECLARE_GLOBAL_DATA_PTR;
  47. return gd->plla_rate_hz;
  48. }
  49. static inline unsigned long get_pllb_clk_rate(void)
  50. {
  51. DECLARE_GLOBAL_DATA_PTR;
  52. return gd->pllb_rate_hz;
  53. }
  54. static inline u32 get_pllb_init(void)
  55. {
  56. DECLARE_GLOBAL_DATA_PTR;
  57. return gd->at91_pllb_usb_init;
  58. }
  59. static inline unsigned long get_macb_pclk_rate(unsigned int dev_id)
  60. {
  61. return get_mck_clk_rate();
  62. }
  63. static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
  64. {
  65. return get_mck_clk_rate();
  66. }
  67. static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
  68. {
  69. return get_mck_clk_rate();
  70. }
  71. static inline unsigned long get_spi_clk_rate(unsigned int dev_id)
  72. {
  73. return get_mck_clk_rate();
  74. }
  75. static inline unsigned long get_twi_clk_rate(unsigned int dev_id)
  76. {
  77. return get_mck_clk_rate();
  78. }
  79. static inline unsigned long get_mci_clk_rate(void)
  80. {
  81. return get_mck_clk_rate();
  82. }
  83. int at91_clock_init(unsigned long main_clock);
  84. #endif /* __ASM_ARM_ARCH_CLK_H__ */