clk-integrator.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Clock driver for the ARM Integrator/AP and Integrator/CP boards
  3. * Copyright (C) 2012 Linus Walleij
  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 version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/clk-provider.h>
  10. #include <linux/clk.h>
  11. #include <linux/clkdev.h>
  12. #include <linux/err.h>
  13. #include <linux/platform_data/clk-integrator.h>
  14. #include <mach/hardware.h>
  15. #include <mach/platform.h>
  16. #include "clk-icst.h"
  17. /*
  18. * Implementation of the ARM Integrator/AP and Integrator/CP clock tree.
  19. * Inspired by portions of:
  20. * plat-versatile/clock.c and plat-versatile/include/plat/clock.h
  21. */
  22. static const struct icst_params cp_auxvco_params = {
  23. .ref = 24000000,
  24. .vco_max = ICST525_VCO_MAX_5V,
  25. .vco_min = ICST525_VCO_MIN,
  26. .vd_min = 8,
  27. .vd_max = 263,
  28. .rd_min = 3,
  29. .rd_max = 65,
  30. .s2div = icst525_s2div,
  31. .idx2s = icst525_idx2s,
  32. };
  33. static const struct clk_icst_desc __initdata cp_icst_desc = {
  34. .params = &cp_auxvco_params,
  35. .vco_offset = 0x1c,
  36. .lock_offset = INTEGRATOR_HDR_LOCK_OFFSET,
  37. };
  38. /*
  39. * integrator_clk_init() - set up the integrator clock tree
  40. * @is_cp: pass true if it's the Integrator/CP else AP is assumed
  41. */
  42. void __init integrator_clk_init(bool is_cp)
  43. {
  44. struct clk *clk;
  45. /* APB clock dummy */
  46. clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 0);
  47. clk_register_clkdev(clk, "apb_pclk", NULL);
  48. /* UART reference clock */
  49. clk = clk_register_fixed_rate(NULL, "uartclk", NULL, CLK_IS_ROOT,
  50. 14745600);
  51. clk_register_clkdev(clk, NULL, "uart0");
  52. clk_register_clkdev(clk, NULL, "uart1");
  53. if (is_cp)
  54. clk_register_clkdev(clk, NULL, "mmci");
  55. /* 24 MHz clock */
  56. clk = clk_register_fixed_rate(NULL, "clk24mhz", NULL, CLK_IS_ROOT,
  57. 24000000);
  58. clk_register_clkdev(clk, NULL, "kmi0");
  59. clk_register_clkdev(clk, NULL, "kmi1");
  60. if (!is_cp)
  61. clk_register_clkdev(clk, NULL, "ap_timer");
  62. if (!is_cp)
  63. return;
  64. /* 1 MHz clock */
  65. clk = clk_register_fixed_rate(NULL, "clk1mhz", NULL, CLK_IS_ROOT,
  66. 1000000);
  67. clk_register_clkdev(clk, NULL, "sp804");
  68. /* ICST VCO clock used on the Integrator/CP CLCD */
  69. clk = icst_clk_register(NULL, &cp_icst_desc,
  70. __io_address(INTEGRATOR_HDR_BASE));
  71. clk_register_clkdev(clk, NULL, "clcd");
  72. }