~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/sh_clk.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/sh_clk.h (Version linux-6.12-rc7) and /include/linux/sh_clk.h (Version linux-5.19.17)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __SH_CLOCK_H                                2 #ifndef __SH_CLOCK_H
  3 #define __SH_CLOCK_H                                3 #define __SH_CLOCK_H
  4                                                     4 
  5 #include <linux/list.h>                             5 #include <linux/list.h>
  6 #include <linux/seq_file.h>                         6 #include <linux/seq_file.h>
  7 #include <linux/cpufreq.h>                          7 #include <linux/cpufreq.h>
  8 #include <linux/types.h>                            8 #include <linux/types.h>
  9 #include <linux/kref.h>                             9 #include <linux/kref.h>
 10 #include <linux/clk.h>                             10 #include <linux/clk.h>
 11 #include <linux/err.h>                             11 #include <linux/err.h>
 12                                                    12 
 13 struct clk;                                        13 struct clk;
 14                                                    14 
 15 struct clk_mapping {                               15 struct clk_mapping {
 16         phys_addr_t             phys;              16         phys_addr_t             phys;
 17         void __iomem            *base;             17         void __iomem            *base;
 18         unsigned long           len;               18         unsigned long           len;
 19         struct kref             ref;               19         struct kref             ref;
 20 };                                                 20 };
 21                                                    21 
 22 struct sh_clk_ops {                                22 struct sh_clk_ops {
 23 #ifdef CONFIG_SH_CLK_CPG_LEGACY                    23 #ifdef CONFIG_SH_CLK_CPG_LEGACY
 24         void (*init)(struct clk *clk);             24         void (*init)(struct clk *clk);
 25 #endif                                             25 #endif
 26         int (*enable)(struct clk *clk);            26         int (*enable)(struct clk *clk);
 27         void (*disable)(struct clk *clk);          27         void (*disable)(struct clk *clk);
 28         unsigned long (*recalc)(struct clk *cl     28         unsigned long (*recalc)(struct clk *clk);
 29         int (*set_rate)(struct clk *clk, unsig     29         int (*set_rate)(struct clk *clk, unsigned long rate);
 30         int (*set_parent)(struct clk *clk, str     30         int (*set_parent)(struct clk *clk, struct clk *parent);
 31         long (*round_rate)(struct clk *clk, un     31         long (*round_rate)(struct clk *clk, unsigned long rate);
 32 };                                                 32 };
 33                                                    33 
 34 #define SH_CLK_DIV_MSK(div)     ((1 << (div))      34 #define SH_CLK_DIV_MSK(div)     ((1 << (div)) - 1)
 35 #define SH_CLK_DIV4_MSK         SH_CLK_DIV_MSK     35 #define SH_CLK_DIV4_MSK         SH_CLK_DIV_MSK(4)
 36 #define SH_CLK_DIV6_MSK         SH_CLK_DIV_MSK     36 #define SH_CLK_DIV6_MSK         SH_CLK_DIV_MSK(6)
 37                                                    37 
 38 struct clk {                                       38 struct clk {
 39         struct list_head        node;              39         struct list_head        node;
 40         struct clk              *parent;           40         struct clk              *parent;
 41         struct clk              **parent_table     41         struct clk              **parent_table; /* list of parents to */
 42         unsigned short          parent_num;        42         unsigned short          parent_num;     /* choose between */
 43         unsigned char           src_shift;         43         unsigned char           src_shift;      /* source clock field in the */
 44         unsigned char           src_width;         44         unsigned char           src_width;      /* configuration register */
 45         struct sh_clk_ops       *ops;              45         struct sh_clk_ops       *ops;
 46                                                    46 
 47         struct list_head        children;          47         struct list_head        children;
 48         struct list_head        sibling;           48         struct list_head        sibling;        /* node for children */
 49                                                    49 
 50         int                     usecount;          50         int                     usecount;
 51                                                    51 
 52         unsigned long           rate;              52         unsigned long           rate;
 53         unsigned long           flags;             53         unsigned long           flags;
 54                                                    54 
 55         void __iomem            *enable_reg;       55         void __iomem            *enable_reg;
 56         void __iomem            *status_reg;       56         void __iomem            *status_reg;
 57         unsigned int            enable_bit;        57         unsigned int            enable_bit;
 58         void __iomem            *mapped_reg;       58         void __iomem            *mapped_reg;
 59                                                    59 
 60         unsigned int            div_mask;          60         unsigned int            div_mask;
 61         unsigned long           arch_flags;        61         unsigned long           arch_flags;
 62         void                    *priv;             62         void                    *priv;
 63         struct clk_mapping      *mapping;          63         struct clk_mapping      *mapping;
 64         struct cpufreq_frequency_table *freq_t     64         struct cpufreq_frequency_table *freq_table;
 65         unsigned int            nr_freqs;          65         unsigned int            nr_freqs;
 66 };                                                 66 };
 67                                                    67 
 68 #define CLK_ENABLE_ON_INIT      BIT(0)             68 #define CLK_ENABLE_ON_INIT      BIT(0)
 69                                                    69 
 70 #define CLK_ENABLE_REG_32BIT    BIT(1)  /* def     70 #define CLK_ENABLE_REG_32BIT    BIT(1)  /* default access size */
 71 #define CLK_ENABLE_REG_16BIT    BIT(2)             71 #define CLK_ENABLE_REG_16BIT    BIT(2)
 72 #define CLK_ENABLE_REG_8BIT     BIT(3)             72 #define CLK_ENABLE_REG_8BIT     BIT(3)
 73                                                    73 
 74 #define CLK_MASK_DIV_ON_DISABLE BIT(4)             74 #define CLK_MASK_DIV_ON_DISABLE BIT(4)
 75                                                    75 
 76 #define CLK_ENABLE_REG_MASK     (CLK_ENABLE_RE     76 #define CLK_ENABLE_REG_MASK     (CLK_ENABLE_REG_32BIT | \
 77                                  CLK_ENABLE_RE     77                                  CLK_ENABLE_REG_16BIT | \
 78                                  CLK_ENABLE_RE     78                                  CLK_ENABLE_REG_8BIT)
 79                                                    79 
 80 /* drivers/sh/clk.c */                             80 /* drivers/sh/clk.c */
 81 unsigned long followparent_recalc(struct clk *     81 unsigned long followparent_recalc(struct clk *);
 82 void recalculate_root_clocks(void);                82 void recalculate_root_clocks(void);
 83 void propagate_rate(struct clk *);                 83 void propagate_rate(struct clk *);
 84 int clk_reparent(struct clk *child, struct clk     84 int clk_reparent(struct clk *child, struct clk *parent);
 85 int clk_register(struct clk *);                    85 int clk_register(struct clk *);
 86 void clk_unregister(struct clk *);                 86 void clk_unregister(struct clk *);
 87 void clk_enable_init_clocks(void);                 87 void clk_enable_init_clocks(void);
 88                                                    88 
 89 struct clk_div_mult_table {                        89 struct clk_div_mult_table {
 90         unsigned int *divisors;                    90         unsigned int *divisors;
 91         unsigned int nr_divisors;                  91         unsigned int nr_divisors;
 92         unsigned int *multipliers;                 92         unsigned int *multipliers;
 93         unsigned int nr_multipliers;               93         unsigned int nr_multipliers;
 94 };                                                 94 };
 95                                                    95 
 96 struct cpufreq_frequency_table;                    96 struct cpufreq_frequency_table;
 97 void clk_rate_table_build(struct clk *clk,         97 void clk_rate_table_build(struct clk *clk,
 98                           struct cpufreq_frequ     98                           struct cpufreq_frequency_table *freq_table,
 99                           int nr_freqs,            99                           int nr_freqs,
100                           struct clk_div_mult_    100                           struct clk_div_mult_table *src_table,
101                           unsigned long *bitma    101                           unsigned long *bitmap);
102                                                   102 
103 long clk_rate_table_round(struct clk *clk,        103 long clk_rate_table_round(struct clk *clk,
104                           struct cpufreq_frequ    104                           struct cpufreq_frequency_table *freq_table,
105                           unsigned long rate);    105                           unsigned long rate);
106                                                   106 
107 int clk_rate_table_find(struct clk *clk,          107 int clk_rate_table_find(struct clk *clk,
108                         struct cpufreq_frequen    108                         struct cpufreq_frequency_table *freq_table,
109                         unsigned long rate);      109                         unsigned long rate);
110                                                   110 
111 long clk_rate_div_range_round(struct clk *clk,    111 long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
112                               unsigned int div    112                               unsigned int div_max, unsigned long rate);
113                                                   113 
114 long clk_rate_mult_range_round(struct clk *clk    114 long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
115                                unsigned int mu    115                                unsigned int mult_max, unsigned long rate);
116                                                   116 
117 #define SH_CLK_MSTP(_parent, _enable_reg, _ena    117 #define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _status_reg, _flags) \
118 {                                                 118 {                                                                       \
119         .parent         = _parent,                119         .parent         = _parent,                                      \
120         .enable_reg     = (void __iomem *)_ena    120         .enable_reg     = (void __iomem *)_enable_reg,                  \
121         .enable_bit     = _enable_bit,            121         .enable_bit     = _enable_bit,                                  \
122         .status_reg     = _status_reg,            122         .status_reg     = _status_reg,                                  \
123         .flags          = _flags,                 123         .flags          = _flags,                                       \
124 }                                                 124 }
125                                                   125 
126 #define SH_CLK_MSTP32(_p, _r, _b, _f)             126 #define SH_CLK_MSTP32(_p, _r, _b, _f)                           \
127         SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_EN    127         SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_32BIT)
128                                                   128 
129 #define SH_CLK_MSTP32_STS(_p, _r, _b, _s, _f)     129 #define SH_CLK_MSTP32_STS(_p, _r, _b, _s, _f)                   \
130         SH_CLK_MSTP(_p, _r, _b, _s, _f | CLK_E    130         SH_CLK_MSTP(_p, _r, _b, _s, _f | CLK_ENABLE_REG_32BIT)
131                                                   131 
132 #define SH_CLK_MSTP16(_p, _r, _b, _f)             132 #define SH_CLK_MSTP16(_p, _r, _b, _f)                           \
133         SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_EN    133         SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_16BIT)
134                                                   134 
135 #define SH_CLK_MSTP8(_p, _r, _b, _f)              135 #define SH_CLK_MSTP8(_p, _r, _b, _f)                            \
136         SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_EN    136         SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_8BIT)
137                                                   137 
138 int sh_clk_mstp_register(struct clk *clks, int    138 int sh_clk_mstp_register(struct clk *clks, int nr);
139                                                   139 
140 /*                                                140 /*
141  * MSTP registration never really cared about     141  * MSTP registration never really cared about access size, despite the
142  * original enable/disable pairs assuming a 32    142  * original enable/disable pairs assuming a 32-bit access. Clocks are
143  * responsible for defining their access sizes    143  * responsible for defining their access sizes either directly or via the
144  * clock definition wrappers.                     144  * clock definition wrappers.
145  */                                               145  */
146 static inline int __deprecated sh_clk_mstp32_r    146 static inline int __deprecated sh_clk_mstp32_register(struct clk *clks, int nr)
147 {                                                 147 {
148         return sh_clk_mstp_register(clks, nr);    148         return sh_clk_mstp_register(clks, nr);
149 }                                                 149 }
150                                                   150 
151 #define SH_CLK_DIV4(_parent, _reg, _shift, _di    151 #define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
152 {                                                 152 {                                                               \
153         .parent = _parent,                        153         .parent = _parent,                                      \
154         .enable_reg = (void __iomem *)_reg,       154         .enable_reg = (void __iomem *)_reg,                     \
155         .enable_bit = _shift,                     155         .enable_bit = _shift,                                   \
156         .arch_flags = _div_bitmap,                156         .arch_flags = _div_bitmap,                              \
157         .div_mask = SH_CLK_DIV4_MSK,              157         .div_mask = SH_CLK_DIV4_MSK,                            \
158         .flags = _flags,                          158         .flags = _flags,                                        \
159 }                                                 159 }
160                                                   160 
161 struct clk_div_table {                            161 struct clk_div_table {
162         struct clk_div_mult_table *div_mult_ta    162         struct clk_div_mult_table *div_mult_table;
163         void (*kick)(struct clk *clk);            163         void (*kick)(struct clk *clk);
164 };                                                164 };
165                                                   165 
166 #define clk_div4_table clk_div_table              166 #define clk_div4_table clk_div_table
167                                                   167 
168 int sh_clk_div4_register(struct clk *clks, int    168 int sh_clk_div4_register(struct clk *clks, int nr,
169                          struct clk_div4_table    169                          struct clk_div4_table *table);
170 int sh_clk_div4_enable_register(struct clk *cl    170 int sh_clk_div4_enable_register(struct clk *clks, int nr,
171                          struct clk_div4_table    171                          struct clk_div4_table *table);
172 int sh_clk_div4_reparent_register(struct clk *    172 int sh_clk_div4_reparent_register(struct clk *clks, int nr,
173                          struct clk_div4_table    173                          struct clk_div4_table *table);
174                                                   174 
175 #define SH_CLK_DIV6_EXT(_reg, _flags, _parents    175 #define SH_CLK_DIV6_EXT(_reg, _flags, _parents,                 \
176                         _num_parents, _src_shi    176                         _num_parents, _src_shift, _src_width)   \
177 {                                                 177 {                                                               \
178         .enable_reg = (void __iomem *)_reg,       178         .enable_reg = (void __iomem *)_reg,                     \
179         .enable_bit = 0, /* unused */             179         .enable_bit = 0, /* unused */                           \
180         .flags = _flags | CLK_MASK_DIV_ON_DISA    180         .flags = _flags | CLK_MASK_DIV_ON_DISABLE,              \
181         .div_mask = SH_CLK_DIV6_MSK,              181         .div_mask = SH_CLK_DIV6_MSK,                            \
182         .parent_table = _parents,                 182         .parent_table = _parents,                               \
183         .parent_num = _num_parents,               183         .parent_num = _num_parents,                             \
184         .src_shift = _src_shift,                  184         .src_shift = _src_shift,                                \
185         .src_width = _src_width,                  185         .src_width = _src_width,                                \
186 }                                                 186 }
187                                                   187 
188 #define SH_CLK_DIV6(_parent, _reg, _flags)        188 #define SH_CLK_DIV6(_parent, _reg, _flags)                      \
189 {                                                 189 {                                                               \
190         .parent         = _parent,                190         .parent         = _parent,                              \
191         .enable_reg     = (void __iomem *)_reg    191         .enable_reg     = (void __iomem *)_reg,                 \
192         .enable_bit     = 0,    /* unused */      192         .enable_bit     = 0,    /* unused */                    \
193         .div_mask       = SH_CLK_DIV6_MSK,        193         .div_mask       = SH_CLK_DIV6_MSK,                      \
194         .flags          = _flags | CLK_MASK_DI    194         .flags          = _flags | CLK_MASK_DIV_ON_DISABLE,     \
195 }                                                 195 }
196                                                   196 
197 int sh_clk_div6_register(struct clk *clks, int    197 int sh_clk_div6_register(struct clk *clks, int nr);
198 int sh_clk_div6_reparent_register(struct clk *    198 int sh_clk_div6_reparent_register(struct clk *clks, int nr);
199                                                   199 
200 #define CLKDEV_CON_ID(_id, _clk) { .con_id = _    200 #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
201 #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _    201 #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
202 #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con    202 #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
203                                                   203 
204 /* .enable_reg will be updated to .mapping on     204 /* .enable_reg will be updated to .mapping on sh_clk_fsidiv_register() */
205 #define SH_CLK_FSIDIV(_reg, _parent)              205 #define SH_CLK_FSIDIV(_reg, _parent)            \
206 {                                                 206 {                                               \
207         .enable_reg = (void __iomem *)_reg,       207         .enable_reg = (void __iomem *)_reg,     \
208         .parent         = _parent,                208         .parent         = _parent,              \
209 }                                                 209 }
210                                                   210 
211 int sh_clk_fsidiv_register(struct clk *clks, i    211 int sh_clk_fsidiv_register(struct clk *clks, int nr);
212                                                   212 
213 #endif /* __SH_CLOCK_H */                         213 #endif /* __SH_CLOCK_H */
214                                                   214 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php