clk.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2013, Steffen Trumtrar <s.trumtrar@pengutronix.de>
  3. *
  4. * based on drivers/clk/tegra/clk.h
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. */
  16. #ifndef __SOCFPGA_CLK_H
  17. #define __SOCFPGA_CLK_H
  18. #include <linux/clk-provider.h>
  19. /* Clock Manager offsets */
  20. #define CLKMGR_CTRL 0x0
  21. #define CLKMGR_BYPASS 0x4
  22. #define CLKMGR_DBCTRL 0x10
  23. #define CLKMGR_L4SRC 0x70
  24. #define CLKMGR_PERPLL_SRC 0xAC
  25. #define SOCFPGA_MAX_PARENTS 5
  26. #define streq(a, b) (strcmp((a), (b)) == 0)
  27. #define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
  28. ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
  29. #define SYSMGR_SDMMC_CTRL_SET_AS10(smplsel, drvsel) \
  30. ((((smplsel) & 0x7) << 4) | (((drvsel) & 0x7) << 0))
  31. extern void __iomem *clk_mgr_base_addr;
  32. extern void __iomem *clk_mgr_a10_base_addr;
  33. void __init socfpga_pll_init(struct device_node *node);
  34. void __init socfpga_periph_init(struct device_node *node);
  35. void __init socfpga_gate_init(struct device_node *node);
  36. void socfpga_a10_pll_init(struct device_node *node);
  37. void socfpga_a10_periph_init(struct device_node *node);
  38. void socfpga_a10_gate_init(struct device_node *node);
  39. struct socfpga_pll {
  40. struct clk_gate hw;
  41. };
  42. struct socfpga_gate_clk {
  43. struct clk_gate hw;
  44. char *parent_name;
  45. u32 fixed_div;
  46. void __iomem *div_reg;
  47. struct regmap *sys_mgr_base_addr;
  48. u32 width; /* only valid if div_reg != 0 */
  49. u32 shift; /* only valid if div_reg != 0 */
  50. u32 clk_phase[2];
  51. };
  52. struct socfpga_periph_clk {
  53. struct clk_gate hw;
  54. char *parent_name;
  55. u32 fixed_div;
  56. void __iomem *div_reg;
  57. u32 width; /* only valid if div_reg != 0 */
  58. u32 shift; /* only valid if div_reg != 0 */
  59. };
  60. #endif /* SOCFPGA_CLK_H */