clk-bcm2835.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2010 Broadcom
  3. * Copyright (C) 2012 Stephen Warren
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <linux/clk-provider.h>
  20. #include <linux/clkdev.h>
  21. #include <linux/clk/bcm2835.h>
  22. /*
  23. * These are fixed clocks. They're probably not all root clocks and it may
  24. * be possible to turn them on and off but until this is mapped out better
  25. * it's the only way they can be used.
  26. */
  27. void __init bcm2835_init_clocks(void)
  28. {
  29. struct clk *clk;
  30. int ret;
  31. clk = clk_register_fixed_rate(NULL, "sys_pclk", NULL, CLK_IS_ROOT,
  32. 250000000);
  33. if (IS_ERR(clk))
  34. pr_err("sys_pclk not registered\n");
  35. clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT,
  36. 126000000);
  37. if (IS_ERR(clk))
  38. pr_err("apb_pclk not registered\n");
  39. clk = clk_register_fixed_rate(NULL, "uart0_pclk", NULL, CLK_IS_ROOT,
  40. 3000000);
  41. if (IS_ERR(clk))
  42. pr_err("uart0_pclk not registered\n");
  43. ret = clk_register_clkdev(clk, NULL, "20201000.uart");
  44. if (ret)
  45. pr_err("uart0_pclk alias not registered\n");
  46. clk = clk_register_fixed_rate(NULL, "uart1_pclk", NULL, CLK_IS_ROOT,
  47. 125000000);
  48. if (IS_ERR(clk))
  49. pr_err("uart1_pclk not registered\n");
  50. ret = clk_register_clkdev(clk, NULL, "20215000.uart");
  51. if (ret)
  52. pr_err("uart1_pclk alias not registered\n");
  53. }