clk-mux.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. * Author: James Liao <jamesjj.liao@mediatek.com>
  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. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef __DRV_CLK_MUX_H
  15. #define __DRV_CLK_MUX_H
  16. #include <linux/clk-provider.h>
  17. struct mtk_mux_upd {
  18. int id;
  19. const char *name;
  20. const char * const *parent_names;
  21. u32 mux_ofs;
  22. u32 upd_ofs;
  23. s8 mux_shift;
  24. s8 mux_width;
  25. s8 gate_shift;
  26. s8 upd_shift;
  27. s8 num_parents;
  28. };
  29. #define MUX_UPD(_id, _name, _parents, _mux_ofs, _shift, _width, _gate, \
  30. _upd_ofs, _upd) { \
  31. .id = _id, \
  32. .name = _name, \
  33. .mux_ofs = _mux_ofs, \
  34. .upd_ofs = _upd_ofs, \
  35. .mux_shift = _shift, \
  36. .mux_width = _width, \
  37. .gate_shift = _gate, \
  38. .upd_shift = _upd, \
  39. .parent_names = _parents, \
  40. .num_parents = ARRAY_SIZE(_parents), \
  41. }
  42. struct clk *mtk_clk_register_mux_upd(const struct mtk_mux_upd *tm,
  43. void __iomem *base, spinlock_t *lock);
  44. void mtk_clk_register_mux_upds(const struct mtk_mux_upd *tms,
  45. int num, void __iomem *base, spinlock_t *lock,
  46. struct clk_onecell_data *clk_data);
  47. #endif /* __DRV_CLK_MUX_H */