clk_meson.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2018 - Beniamino Galvani <b.galvani@gmail.com>
  4. * (C) Copyright 2018 - BayLibre, SAS
  5. * Author: Neil Armstrong <narmstrong@baylibre.com>
  6. */
  7. #ifndef CLK_MESON_H
  8. #define CLK_MESON_H
  9. /* Gate Structure */
  10. struct meson_gate {
  11. unsigned int reg;
  12. unsigned int bit;
  13. };
  14. #define MESON_GATE(id, _reg, _bit) \
  15. [id] = { \
  16. .reg = (_reg), \
  17. .bit = (_bit), \
  18. }
  19. /* PLL Parameters */
  20. struct parm {
  21. u16 reg_off;
  22. u8 shift;
  23. u8 width;
  24. };
  25. #define PMASK(width) GENMASK(width - 1, 0)
  26. #define SETPMASK(width, shift) GENMASK(shift + width - 1, shift)
  27. #define CLRPMASK(width, shift) (~SETPMASK(width, shift))
  28. #define PARM_GET(width, shift, reg) \
  29. (((reg) & SETPMASK(width, shift)) >> (shift))
  30. #define PARM_SET(width, shift, reg, val) \
  31. (((reg) & CLRPMASK(width, shift)) | ((val) << (shift)))
  32. /* MPLL Parameters */
  33. #define SDM_DEN 16384
  34. #define N2_MIN 4
  35. #define N2_MAX 511
  36. #endif