root/drivers/clk/sprd/gate.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. hw_to_sprd_gate

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 //
   3 // Spreadtrum gate clock driver
   4 //
   5 // Copyright (C) 2017 Spreadtrum, Inc.
   6 // Author: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
   7 
   8 #ifndef _SPRD_GATE_H_
   9 #define _SPRD_GATE_H_
  10 
  11 #include "common.h"
  12 
  13 struct sprd_gate {
  14         u32                     enable_mask;
  15         u16                     flags;
  16         u16                     sc_offset;
  17 
  18         struct sprd_clk_common  common;
  19 };
  20 
  21 #define SPRD_SC_GATE_CLK_OPS(_struct, _name, _parent, _reg, _sc_offset, \
  22                              _enable_mask, _flags, _gate_flags, _ops)   \
  23         struct sprd_gate _struct = {                                    \
  24                 .enable_mask    = _enable_mask,                         \
  25                 .sc_offset      = _sc_offset,                           \
  26                 .flags          = _gate_flags,                          \
  27                 .common = {                                             \
  28                         .regmap         = NULL,                         \
  29                         .reg            = _reg,                         \
  30                         .hw.init        = CLK_HW_INIT(_name,            \
  31                                                       _parent,          \
  32                                                       _ops,             \
  33                                                       _flags),          \
  34                 }                                                       \
  35         }
  36 
  37 #define SPRD_GATE_CLK(_struct, _name, _parent, _reg,                    \
  38                       _enable_mask, _flags, _gate_flags)                \
  39         SPRD_SC_GATE_CLK_OPS(_struct, _name, _parent, _reg, 0,          \
  40                              _enable_mask, _flags, _gate_flags,         \
  41                              &sprd_gate_ops)
  42 
  43 #define SPRD_SC_GATE_CLK(_struct, _name, _parent, _reg, _sc_offset,     \
  44                          _enable_mask, _flags, _gate_flags)             \
  45         SPRD_SC_GATE_CLK_OPS(_struct, _name, _parent, _reg, _sc_offset, \
  46                              _enable_mask, _flags, _gate_flags,         \
  47                              &sprd_sc_gate_ops)
  48 
  49 static inline struct sprd_gate *hw_to_sprd_gate(const struct clk_hw *hw)
  50 {
  51         struct sprd_clk_common *common = hw_to_sprd_clk_common(hw);
  52 
  53         return container_of(common, struct sprd_gate, common);
  54 }
  55 
  56 extern const struct clk_ops sprd_gate_ops;
  57 extern const struct clk_ops sprd_sc_gate_ops;
  58 
  59 #endif /* _SPRD_GATE_H_ */

/* [<][>][^][v][top][bottom][index][help] */