berlin2-div.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2014 Marvell Technology Group Ltd.
  4. *
  5. * Alexandre Belloni <[email protected]>
  6. * Sebastian Hesselbarth <[email protected]>
  7. */
  8. #ifndef __BERLIN2_DIV_H
  9. #define __BERLIN2_DIV_H
  10. struct clk_hw;
  11. #define BERLIN2_DIV_HAS_GATE BIT(0)
  12. #define BERLIN2_DIV_HAS_MUX BIT(1)
  13. #define BERLIN2_PLL_SELECT(_off, _sh) \
  14. .pll_select_offs = _off, \
  15. .pll_select_shift = _sh
  16. #define BERLIN2_PLL_SWITCH(_off, _sh) \
  17. .pll_switch_offs = _off, \
  18. .pll_switch_shift = _sh
  19. #define BERLIN2_DIV_SELECT(_off, _sh) \
  20. .div_select_offs = _off, \
  21. .div_select_shift = _sh
  22. #define BERLIN2_DIV_SWITCH(_off, _sh) \
  23. .div_switch_offs = _off, \
  24. .div_switch_shift = _sh
  25. #define BERLIN2_DIV_D3SWITCH(_off, _sh) \
  26. .div3_switch_offs = _off, \
  27. .div3_switch_shift = _sh
  28. #define BERLIN2_DIV_GATE(_off, _sh) \
  29. .gate_offs = _off, \
  30. .gate_shift = _sh
  31. #define BERLIN2_SINGLE_DIV(_off) \
  32. BERLIN2_DIV_GATE(_off, 0), \
  33. BERLIN2_PLL_SELECT(_off, 1), \
  34. BERLIN2_PLL_SWITCH(_off, 4), \
  35. BERLIN2_DIV_SWITCH(_off, 5), \
  36. BERLIN2_DIV_D3SWITCH(_off, 6), \
  37. BERLIN2_DIV_SELECT(_off, 7)
  38. struct berlin2_div_map {
  39. u16 pll_select_offs;
  40. u16 pll_switch_offs;
  41. u16 div_select_offs;
  42. u16 div_switch_offs;
  43. u16 div3_switch_offs;
  44. u16 gate_offs;
  45. u8 pll_select_shift;
  46. u8 pll_switch_shift;
  47. u8 div_select_shift;
  48. u8 div_switch_shift;
  49. u8 div3_switch_shift;
  50. u8 gate_shift;
  51. };
  52. struct berlin2_div_data {
  53. const char *name;
  54. const u8 *parent_ids;
  55. int num_parents;
  56. unsigned long flags;
  57. struct berlin2_div_map map;
  58. u8 div_flags;
  59. };
  60. struct clk_hw *
  61. berlin2_div_register(const struct berlin2_div_map *map,
  62. void __iomem *base, const char *name, u8 div_flags,
  63. const char **parent_names, int num_parents,
  64. unsigned long flags, spinlock_t *lock);
  65. #endif /* __BERLIN2_DIV_H */