clk-gate-v1.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_GATE_H
  15. #define __DRV_CLK_GATE_H
  16. /*
  17. * This is a private header file. DO NOT include it except clk-*.c.
  18. */
  19. #include <linux/clk.h>
  20. #include <linux/clk-provider.h>
  21. struct mtk_clk_gate {
  22. struct clk_hw hw;
  23. void __iomem *set_addr;
  24. void __iomem *clr_addr;
  25. void __iomem *sta_addr;
  26. u8 bit;
  27. u32 flags;
  28. };
  29. #define to_clk_gate(_hw) container_of(_hw, struct mtk_clk_gate, hw)
  30. #define CLK_GATE_INVERSE BIT(0)
  31. #define CLK_GATE_NO_SETCLR_REG BIT(1)
  32. struct clk *mtk_clk_register_gate(
  33. const char *name,
  34. const char *parent_name,
  35. void __iomem *set_addr,
  36. void __iomem *clr_addr,
  37. void __iomem *sta_addr,
  38. u8 bit,
  39. u32 flags);
  40. #endif /* __DRV_CLK_GATE_H */