clock2xxx.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * clock2xxx.c - OMAP2xxx-specific clock integration code
  3. *
  4. * Copyright (C) 2005-2008 Texas Instruments, Inc.
  5. * Copyright (C) 2004-2010 Nokia Corporation
  6. *
  7. * Contacts:
  8. * Richard Woodruff <r-woodruff2@ti.com>
  9. * Paul Walmsley
  10. *
  11. * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
  12. * Gordon McNutt and RidgeRun, Inc.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. */
  18. #undef DEBUG
  19. #include <linux/kernel.h>
  20. #include <linux/errno.h>
  21. #include <linux/clk.h>
  22. #include <linux/io.h>
  23. #include <plat/cpu.h>
  24. #include <plat/clock.h>
  25. #include "clock.h"
  26. #include "clock2xxx.h"
  27. #include "cm.h"
  28. #include "cm-regbits-24xx.h"
  29. struct clk *vclk, *sclk, *dclk;
  30. /*
  31. * Omap24xx specific clock functions
  32. */
  33. /*
  34. * Set clocks for bypass mode for reboot to work.
  35. */
  36. void omap2xxx_clk_prepare_for_reboot(void)
  37. {
  38. u32 rate;
  39. if (vclk == NULL || sclk == NULL)
  40. return;
  41. rate = clk_get_rate(sclk);
  42. clk_set_rate(vclk, rate);
  43. }
  44. /*
  45. * Switch the MPU rate if specified on cmdline. We cannot do this
  46. * early until cmdline is parsed. XXX This should be removed from the
  47. * clock code and handled by the OPP layer code in the near future.
  48. */
  49. static int __init omap2xxx_clk_arch_init(void)
  50. {
  51. int ret;
  52. if (!cpu_is_omap24xx())
  53. return 0;
  54. ret = omap2_clk_switch_mpurate_at_boot("virt_prcm_set");
  55. if (!ret)
  56. omap2_clk_print_new_rates("sys_ck", "dpll_ck", "mpu_ck");
  57. return ret;
  58. }
  59. arch_initcall(omap2xxx_clk_arch_init);