clk-mtk-v1.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2014 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_MTK_H
  15. #define __DRV_CLK_MTK_H
  16. /*
  17. * This is a private header file. DO NOT include it except clk-*.c.
  18. */
  19. #include <linux/bitops.h>
  20. #include <linux/clk.h>
  21. #include <linux/clk-provider.h>
  22. #define CLK_DEBUG 0
  23. #define DUMMY_REG_TEST 0
  24. /* #define Bring_Up */
  25. #ifdef Bring_Up
  26. #ifdef pr_debug
  27. #undef pr_debug
  28. #define pr_debug pr_warn
  29. #endif
  30. #define MT_CCF_DEBUG 1
  31. #define MT_CCF_BRINGUP 0 /* 1: only for bring up */
  32. #endif /* Bring_Up */
  33. extern spinlock_t *get_mtk_clk_lock(void);
  34. #define mtk_clk_lock(flags) spin_lock_irqsave(get_mtk_clk_lock(), flags)
  35. #define mtk_clk_unlock(flags) \
  36. spin_unlock_irqrestore(get_mtk_clk_lock(), flags)
  37. #define MAX_MUX_GATE_BIT 31
  38. #define INVALID_MUX_GATE_BIT (MAX_MUX_GATE_BIT + 1)
  39. struct clk *mtk_clk_register_mux(
  40. const char *name,
  41. const char **parent_names,
  42. u8 num_parents,
  43. void __iomem *base_addr,
  44. u8 shift,
  45. u8 width,
  46. u8 gate_bit);
  47. #endif /* __DRV_CLK_MTK_H */