1
2
3
4
5
6
7
8
9
10
11#ifndef __LINUX_CLK_PROVIDER_H
12#define __LINUX_CLK_PROVIDER_H
13
14#include <linux/io.h>
15#include <linux/of.h>
16#include <linux/of_clk.h>
17
18#ifdef CONFIG_COMMON_CLK
19
20
21
22
23
24
25
26
27#define CLK_SET_RATE_GATE BIT(0)
28#define CLK_SET_PARENT_GATE BIT(1)
29#define CLK_SET_RATE_PARENT BIT(2)
30#define CLK_IGNORE_UNUSED BIT(3)
31
32#define CLK_IS_BASIC BIT(5)
33#define CLK_GET_RATE_NOCACHE BIT(6)
34#define CLK_SET_RATE_NO_REPARENT BIT(7)
35#define CLK_GET_ACCURACY_NOCACHE BIT(8)
36#define CLK_RECALC_NEW_RATES BIT(9)
37#define CLK_SET_RATE_UNGATE BIT(10)
38#define CLK_IS_CRITICAL BIT(11)
39
40#define CLK_OPS_PARENT_ENABLE BIT(12)
41
42struct clk;
43struct clk_hw;
44struct clk_core;
45struct dentry;
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61struct clk_rate_request {
62 unsigned long rate;
63 unsigned long min_rate;
64 unsigned long max_rate;
65 unsigned long best_parent_rate;
66 struct clk_hw *best_parent_hw;
67};
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195struct clk_ops {
196 int (*prepare)(struct clk_hw *hw);
197 void (*unprepare)(struct clk_hw *hw);
198 int (*is_prepared)(struct clk_hw *hw);
199 void (*unprepare_unused)(struct clk_hw *hw);
200 int (*enable)(struct clk_hw *hw);
201 void (*disable)(struct clk_hw *hw);
202 int (*is_enabled)(struct clk_hw *hw);
203 void (*disable_unused)(struct clk_hw *hw);
204 unsigned long (*recalc_rate)(struct clk_hw *hw,
205 unsigned long parent_rate);
206 long (*round_rate)(struct clk_hw *hw, unsigned long rate,
207 unsigned long *parent_rate);
208 int (*determine_rate)(struct clk_hw *hw,
209 struct clk_rate_request *req);
210 int (*set_parent)(struct clk_hw *hw, u8 index);
211 u8 (*get_parent)(struct clk_hw *hw);
212 int (*set_rate)(struct clk_hw *hw, unsigned long rate,
213 unsigned long parent_rate);
214 int (*set_rate_and_parent)(struct clk_hw *hw,
215 unsigned long rate,
216 unsigned long parent_rate, u8 index);
217 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
218 unsigned long parent_accuracy);
219 int (*get_phase)(struct clk_hw *hw);
220 int (*set_phase)(struct clk_hw *hw, int degrees);
221 void (*init)(struct clk_hw *hw);
222 void (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
223};
224
225
226
227
228
229
230
231
232
233
234
235struct clk_init_data {
236 const char *name;
237 const struct clk_ops *ops;
238 const char * const *parent_names;
239 u8 num_parents;
240 unsigned long flags;
241};
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258struct clk_hw {
259 struct clk_core *core;
260 struct clk *clk;
261 const struct clk_init_data *init;
262};
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278struct clk_fixed_rate {
279 struct clk_hw hw;
280 unsigned long fixed_rate;
281 unsigned long fixed_accuracy;
282 u8 flags;
283};
284
285#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw)
286
287extern const struct clk_ops clk_fixed_rate_ops;
288struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
289 const char *parent_name, unsigned long flags,
290 unsigned long fixed_rate);
291struct clk_hw *clk_hw_register_fixed_rate(struct device *dev, const char *name,
292 const char *parent_name, unsigned long flags,
293 unsigned long fixed_rate);
294struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev,
295 const char *name, const char *parent_name, unsigned long flags,
296 unsigned long fixed_rate, unsigned long fixed_accuracy);
297void clk_unregister_fixed_rate(struct clk *clk);
298struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev,
299 const char *name, const char *parent_name, unsigned long flags,
300 unsigned long fixed_rate, unsigned long fixed_accuracy);
301void clk_hw_unregister_fixed_rate(struct clk_hw *hw);
302
303void of_fixed_clk_setup(struct device_node *np);
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325struct clk_gate {
326 struct clk_hw hw;
327 void __iomem *reg;
328 u8 bit_idx;
329 u8 flags;
330 spinlock_t *lock;
331};
332
333#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
334
335#define CLK_GATE_SET_TO_DISABLE BIT(0)
336#define CLK_GATE_HIWORD_MASK BIT(1)
337
338extern const struct clk_ops clk_gate_ops;
339struct clk *clk_register_gate(struct device *dev, const char *name,
340 const char *parent_name, unsigned long flags,
341 void __iomem *reg, u8 bit_idx,
342 u8 clk_gate_flags, spinlock_t *lock);
343struct clk_hw *clk_hw_register_gate(struct device *dev, const char *name,
344 const char *parent_name, unsigned long flags,
345 void __iomem *reg, u8 bit_idx,
346 u8 clk_gate_flags, spinlock_t *lock);
347void clk_unregister_gate(struct clk *clk);
348void clk_hw_unregister_gate(struct clk_hw *hw);
349int clk_gate_is_enabled(struct clk_hw *hw);
350
351struct clk_div_table {
352 unsigned int val;
353 unsigned int div;
354};
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393struct clk_divider {
394 struct clk_hw hw;
395 void __iomem *reg;
396 u8 shift;
397 u8 width;
398 u8 flags;
399 const struct clk_div_table *table;
400 spinlock_t *lock;
401};
402
403#define clk_div_mask(width) ((1 << (width)) - 1)
404#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
405
406#define CLK_DIVIDER_ONE_BASED BIT(0)
407#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
408#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
409#define CLK_DIVIDER_HIWORD_MASK BIT(3)
410#define CLK_DIVIDER_ROUND_CLOSEST BIT(4)
411#define CLK_DIVIDER_READ_ONLY BIT(5)
412#define CLK_DIVIDER_MAX_AT_ZERO BIT(6)
413
414extern const struct clk_ops clk_divider_ops;
415extern const struct clk_ops clk_divider_ro_ops;
416
417unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
418 unsigned int val, const struct clk_div_table *table,
419 unsigned long flags, unsigned long width);
420long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
421 unsigned long rate, unsigned long *prate,
422 const struct clk_div_table *table,
423 u8 width, unsigned long flags);
424long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
425 unsigned long rate, unsigned long *prate,
426 const struct clk_div_table *table, u8 width,
427 unsigned long flags, unsigned int val);
428int divider_get_val(unsigned long rate, unsigned long parent_rate,
429 const struct clk_div_table *table, u8 width,
430 unsigned long flags);
431
432struct clk *clk_register_divider(struct device *dev, const char *name,
433 const char *parent_name, unsigned long flags,
434 void __iomem *reg, u8 shift, u8 width,
435 u8 clk_divider_flags, spinlock_t *lock);
436struct clk_hw *clk_hw_register_divider(struct device *dev, const char *name,
437 const char *parent_name, unsigned long flags,
438 void __iomem *reg, u8 shift, u8 width,
439 u8 clk_divider_flags, spinlock_t *lock);
440struct clk *clk_register_divider_table(struct device *dev, const char *name,
441 const char *parent_name, unsigned long flags,
442 void __iomem *reg, u8 shift, u8 width,
443 u8 clk_divider_flags, const struct clk_div_table *table,
444 spinlock_t *lock);
445struct clk_hw *clk_hw_register_divider_table(struct device *dev,
446 const char *name, const char *parent_name, unsigned long flags,
447 void __iomem *reg, u8 shift, u8 width,
448 u8 clk_divider_flags, const struct clk_div_table *table,
449 spinlock_t *lock);
450void clk_unregister_divider(struct clk *clk);
451void clk_hw_unregister_divider(struct clk_hw *hw);
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477struct clk_mux {
478 struct clk_hw hw;
479 void __iomem *reg;
480 u32 *table;
481 u32 mask;
482 u8 shift;
483 u8 flags;
484 spinlock_t *lock;
485};
486
487#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
488
489#define CLK_MUX_INDEX_ONE BIT(0)
490#define CLK_MUX_INDEX_BIT BIT(1)
491#define CLK_MUX_HIWORD_MASK BIT(2)
492#define CLK_MUX_READ_ONLY BIT(3)
493#define CLK_MUX_ROUND_CLOSEST BIT(4)
494
495extern const struct clk_ops clk_mux_ops;
496extern const struct clk_ops clk_mux_ro_ops;
497
498struct clk *clk_register_mux(struct device *dev, const char *name,
499 const char * const *parent_names, u8 num_parents,
500 unsigned long flags,
501 void __iomem *reg, u8 shift, u8 width,
502 u8 clk_mux_flags, spinlock_t *lock);
503struct clk_hw *clk_hw_register_mux(struct device *dev, const char *name,
504 const char * const *parent_names, u8 num_parents,
505 unsigned long flags,
506 void __iomem *reg, u8 shift, u8 width,
507 u8 clk_mux_flags, spinlock_t *lock);
508
509struct clk *clk_register_mux_table(struct device *dev, const char *name,
510 const char * const *parent_names, u8 num_parents,
511 unsigned long flags,
512 void __iomem *reg, u8 shift, u32 mask,
513 u8 clk_mux_flags, u32 *table, spinlock_t *lock);
514struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name,
515 const char * const *parent_names, u8 num_parents,
516 unsigned long flags,
517 void __iomem *reg, u8 shift, u32 mask,
518 u8 clk_mux_flags, u32 *table, spinlock_t *lock);
519
520int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags,
521 unsigned int val);
522unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index);
523
524void clk_unregister_mux(struct clk *clk);
525void clk_hw_unregister_mux(struct clk_hw *hw);
526
527void of_fixed_factor_clk_setup(struct device_node *node);
528
529
530
531
532
533
534
535
536
537
538
539
540
541struct clk_fixed_factor {
542 struct clk_hw hw;
543 unsigned int mult;
544 unsigned int div;
545};
546
547#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)
548
549extern const struct clk_ops clk_fixed_factor_ops;
550struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
551 const char *parent_name, unsigned long flags,
552 unsigned int mult, unsigned int div);
553void clk_unregister_fixed_factor(struct clk *clk);
554struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
555 const char *name, const char *parent_name, unsigned long flags,
556 unsigned int mult, unsigned int div);
557void clk_hw_unregister_fixed_factor(struct clk_hw *hw);
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572struct clk_fractional_divider {
573 struct clk_hw hw;
574 void __iomem *reg;
575 u8 mshift;
576 u8 mwidth;
577 u32 mmask;
578 u8 nshift;
579 u8 nwidth;
580 u32 nmask;
581 u8 flags;
582 void (*approximation)(struct clk_hw *hw,
583 unsigned long rate, unsigned long *parent_rate,
584 unsigned long *m, unsigned long *n);
585 spinlock_t *lock;
586};
587
588#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)
589
590extern const struct clk_ops clk_fractional_divider_ops;
591struct clk *clk_register_fractional_divider(struct device *dev,
592 const char *name, const char *parent_name, unsigned long flags,
593 void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth,
594 u8 clk_divider_flags, spinlock_t *lock);
595struct clk_hw *clk_hw_register_fractional_divider(struct device *dev,
596 const char *name, const char *parent_name, unsigned long flags,
597 void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth,
598 u8 clk_divider_flags, spinlock_t *lock);
599void clk_hw_unregister_fractional_divider(struct clk_hw *hw);
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622struct clk_multiplier {
623 struct clk_hw hw;
624 void __iomem *reg;
625 u8 shift;
626 u8 width;
627 u8 flags;
628 spinlock_t *lock;
629};
630
631#define to_clk_multiplier(_hw) container_of(_hw, struct clk_multiplier, hw)
632
633#define CLK_MULTIPLIER_ZERO_BYPASS BIT(0)
634#define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1)
635
636extern const struct clk_ops clk_multiplier_ops;
637
638
639
640
641
642
643
644
645
646
647
648
649struct clk_composite {
650 struct clk_hw hw;
651 struct clk_ops ops;
652
653 struct clk_hw *mux_hw;
654 struct clk_hw *rate_hw;
655 struct clk_hw *gate_hw;
656
657 const struct clk_ops *mux_ops;
658 const struct clk_ops *rate_ops;
659 const struct clk_ops *gate_ops;
660};
661
662#define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)
663
664struct clk *clk_register_composite(struct device *dev, const char *name,
665 const char * const *parent_names, int num_parents,
666 struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
667 struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
668 struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
669 unsigned long flags);
670void clk_unregister_composite(struct clk *clk);
671struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
672 const char * const *parent_names, int num_parents,
673 struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
674 struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
675 struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
676 unsigned long flags);
677void clk_hw_unregister_composite(struct clk_hw *hw);
678
679
680
681
682
683
684
685
686
687
688
689struct clk_gpio {
690 struct clk_hw hw;
691 struct gpio_desc *gpiod;
692};
693
694#define to_clk_gpio(_hw) container_of(_hw, struct clk_gpio, hw)
695
696extern const struct clk_ops clk_gpio_gate_ops;
697struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
698 const char *parent_name, struct gpio_desc *gpiod,
699 unsigned long flags);
700struct clk_hw *clk_hw_register_gpio_gate(struct device *dev, const char *name,
701 const char *parent_name, struct gpio_desc *gpiod,
702 unsigned long flags);
703void clk_hw_unregister_gpio_gate(struct clk_hw *hw);
704
705
706
707
708
709
710
711
712
713
714
715extern const struct clk_ops clk_gpio_mux_ops;
716struct clk *clk_register_gpio_mux(struct device *dev, const char *name,
717 const char * const *parent_names, u8 num_parents, struct gpio_desc *gpiod,
718 unsigned long flags);
719struct clk_hw *clk_hw_register_gpio_mux(struct device *dev, const char *name,
720 const char * const *parent_names, u8 num_parents, struct gpio_desc *gpiod,
721 unsigned long flags);
722void clk_hw_unregister_gpio_mux(struct clk_hw *hw);
723
724
725
726
727
728
729
730
731
732
733
734
735struct clk *clk_register(struct device *dev, struct clk_hw *hw);
736struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw);
737
738int __must_check clk_hw_register(struct device *dev, struct clk_hw *hw);
739int __must_check devm_clk_hw_register(struct device *dev, struct clk_hw *hw);
740
741void clk_unregister(struct clk *clk);
742void devm_clk_unregister(struct device *dev, struct clk *clk);
743
744void clk_hw_unregister(struct clk_hw *hw);
745void devm_clk_hw_unregister(struct device *dev, struct clk_hw *hw);
746
747
748const char *__clk_get_name(const struct clk *clk);
749const char *clk_hw_get_name(const struct clk_hw *hw);
750struct clk_hw *__clk_get_hw(struct clk *clk);
751unsigned int clk_hw_get_num_parents(const struct clk_hw *hw);
752struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw);
753struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw,
754 unsigned int index);
755unsigned int __clk_get_enable_count(struct clk *clk);
756unsigned long clk_hw_get_rate(const struct clk_hw *hw);
757unsigned long __clk_get_flags(struct clk *clk);
758unsigned long clk_hw_get_flags(const struct clk_hw *hw);
759bool clk_hw_is_prepared(const struct clk_hw *hw);
760bool clk_hw_rate_is_protected(const struct clk_hw *hw);
761bool clk_hw_is_enabled(const struct clk_hw *hw);
762bool __clk_is_enabled(struct clk *clk);
763struct clk *__clk_lookup(const char *name);
764int __clk_mux_determine_rate(struct clk_hw *hw,
765 struct clk_rate_request *req);
766int __clk_determine_rate(struct clk_hw *core, struct clk_rate_request *req);
767int __clk_mux_determine_rate_closest(struct clk_hw *hw,
768 struct clk_rate_request *req);
769int clk_mux_determine_rate_flags(struct clk_hw *hw,
770 struct clk_rate_request *req,
771 unsigned long flags);
772void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent);
773void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate,
774 unsigned long max_rate);
775
776static inline void __clk_hw_set_clk(struct clk_hw *dst, struct clk_hw *src)
777{
778 dst->clk = src->clk;
779 dst->core = src->core;
780}
781
782static inline long divider_round_rate(struct clk_hw *hw, unsigned long rate,
783 unsigned long *prate,
784 const struct clk_div_table *table,
785 u8 width, unsigned long flags)
786{
787 return divider_round_rate_parent(hw, clk_hw_get_parent(hw),
788 rate, prate, table, width, flags);
789}
790
791static inline long divider_ro_round_rate(struct clk_hw *hw, unsigned long rate,
792 unsigned long *prate,
793 const struct clk_div_table *table,
794 u8 width, unsigned long flags,
795 unsigned int val)
796{
797 return divider_ro_round_rate_parent(hw, clk_hw_get_parent(hw),
798 rate, prate, table, width, flags,
799 val);
800}
801
802
803
804
805unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate);
806
807struct of_device_id;
808
809struct clk_onecell_data {
810 struct clk **clks;
811 unsigned int clk_num;
812};
813
814struct clk_hw_onecell_data {
815 unsigned int num;
816 struct clk_hw *hws[];
817};
818
819extern struct of_device_id __clk_of_table;
820
821#define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
822
823
824
825
826
827#define CLK_OF_DECLARE_DRIVER(name, compat, fn) \
828 static void __init name##_of_clk_init_driver(struct device_node *np) \
829 { \
830 of_node_clear_flag(np, OF_POPULATED); \
831 fn(np); \
832 } \
833 OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver)
834
835#define CLK_HW_INIT(_name, _parent, _ops, _flags) \
836 (&(struct clk_init_data) { \
837 .flags = _flags, \
838 .name = _name, \
839 .parent_names = (const char *[]) { _parent }, \
840 .num_parents = 1, \
841 .ops = _ops, \
842 })
843
844#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \
845 (&(struct clk_init_data) { \
846 .flags = _flags, \
847 .name = _name, \
848 .parent_names = _parents, \
849 .num_parents = ARRAY_SIZE(_parents), \
850 .ops = _ops, \
851 })
852
853#define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \
854 (&(struct clk_init_data) { \
855 .flags = _flags, \
856 .name = _name, \
857 .parent_names = NULL, \
858 .num_parents = 0, \
859 .ops = _ops, \
860 })
861
862#define CLK_FIXED_FACTOR(_struct, _name, _parent, \
863 _div, _mult, _flags) \
864 struct clk_fixed_factor _struct = { \
865 .div = _div, \
866 .mult = _mult, \
867 .hw.init = CLK_HW_INIT(_name, \
868 _parent, \
869 &clk_fixed_factor_ops, \
870 _flags), \
871 }
872
873#ifdef CONFIG_OF
874int of_clk_add_provider(struct device_node *np,
875 struct clk *(*clk_src_get)(struct of_phandle_args *args,
876 void *data),
877 void *data);
878int of_clk_add_hw_provider(struct device_node *np,
879 struct clk_hw *(*get)(struct of_phandle_args *clkspec,
880 void *data),
881 void *data);
882int devm_of_clk_add_hw_provider(struct device *dev,
883 struct clk_hw *(*get)(struct of_phandle_args *clkspec,
884 void *data),
885 void *data);
886void of_clk_del_provider(struct device_node *np);
887void devm_of_clk_del_provider(struct device *dev);
888struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
889 void *data);
890struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec,
891 void *data);
892struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
893struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec,
894 void *data);
895int of_clk_parent_fill(struct device_node *np, const char **parents,
896 unsigned int size);
897int of_clk_detect_critical(struct device_node *np, int index,
898 unsigned long *flags);
899
900#else
901
902static inline int of_clk_add_provider(struct device_node *np,
903 struct clk *(*clk_src_get)(struct of_phandle_args *args,
904 void *data),
905 void *data)
906{
907 return 0;
908}
909static inline int of_clk_add_hw_provider(struct device_node *np,
910 struct clk_hw *(*get)(struct of_phandle_args *clkspec,
911 void *data),
912 void *data)
913{
914 return 0;
915}
916static inline int devm_of_clk_add_hw_provider(struct device *dev,
917 struct clk_hw *(*get)(struct of_phandle_args *clkspec,
918 void *data),
919 void *data)
920{
921 return 0;
922}
923static inline void of_clk_del_provider(struct device_node *np) {}
924static inline void devm_of_clk_del_provider(struct device *dev) {}
925static inline struct clk *of_clk_src_simple_get(
926 struct of_phandle_args *clkspec, void *data)
927{
928 return ERR_PTR(-ENOENT);
929}
930static inline struct clk_hw *
931of_clk_hw_simple_get(struct of_phandle_args *clkspec, void *data)
932{
933 return ERR_PTR(-ENOENT);
934}
935static inline struct clk *of_clk_src_onecell_get(
936 struct of_phandle_args *clkspec, void *data)
937{
938 return ERR_PTR(-ENOENT);
939}
940static inline struct clk_hw *
941of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data)
942{
943 return ERR_PTR(-ENOENT);
944}
945static inline int of_clk_parent_fill(struct device_node *np,
946 const char **parents, unsigned int size)
947{
948 return 0;
949}
950static inline int of_clk_detect_critical(struct device_node *np, int index,
951 unsigned long *flags)
952{
953 return 0;
954}
955#endif
956
957
958
959
960
961
962#if IS_ENABLED(CONFIG_PPC)
963
964static inline u32 clk_readl(u32 __iomem *reg)
965{
966 return ioread32be(reg);
967}
968
969static inline void clk_writel(u32 val, u32 __iomem *reg)
970{
971 iowrite32be(val, reg);
972}
973
974#else
975
976static inline u32 clk_readl(u32 __iomem *reg)
977{
978 return readl(reg);
979}
980
981static inline void clk_writel(u32 val, u32 __iomem *reg)
982{
983 writel(val, reg);
984}
985
986#endif
987
988#endif
989#endif
990