Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: ti: autoidle: move generic autoidle handling code to clock driver

This is no longer needed in platform directory, as the legacy clock data
is gone, so move it under TI clock driver. Some static functions are
renamed also.

Signed-off-by: Tero Kristo <t-kristo@ti.com>

+119 -125
-104
arch/arm/mach-omap2/clock.c
··· 69 69 */ 70 70 static bool clkdm_control = true; 71 71 72 - static LIST_HEAD(clk_hw_omap_clocks); 73 - 74 72 struct clk_iomap { 75 73 struct regmap *regmap; 76 74 void __iomem *mem; ··· 575 577 return 1; 576 578 } 577 579 __setup("mpurate=", omap_clk_setup); 578 - 579 - /** 580 - * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock 581 - * @clk: struct clk * to initialize 582 - * 583 - * Add an OMAP clock @clk to the internal list of OMAP clocks. Used 584 - * temporarily for autoidle handling, until this support can be 585 - * integrated into the common clock framework code in some way. No 586 - * return value. 587 - */ 588 - void omap2_init_clk_hw_omap_clocks(struct clk *clk) 589 - { 590 - struct clk_hw_omap *c; 591 - 592 - if (__clk_get_flags(clk) & CLK_IS_BASIC) 593 - return; 594 - 595 - c = to_clk_hw_omap(__clk_get_hw(clk)); 596 - list_add(&c->node, &clk_hw_omap_clocks); 597 - } 598 - 599 - /** 600 - * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that 601 - * support it 602 - * 603 - * Enable clock autoidle on all OMAP clocks that have allow_idle 604 - * function pointers associated with them. This function is intended 605 - * to be temporary until support for this is added to the common clock 606 - * code. Returns 0. 607 - */ 608 - int omap2_clk_enable_autoidle_all(void) 609 - { 610 - struct clk_hw_omap *c; 611 - 612 - list_for_each_entry(c, &clk_hw_omap_clocks, node) 613 - if (c->ops && c->ops->allow_idle) 614 - c->ops->allow_idle(c); 615 - 616 - of_ti_clk_allow_autoidle_all(); 617 - 618 - return 0; 619 - } 620 - 621 - /** 622 - * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that 623 - * support it 624 - * 625 - * Disable clock autoidle on all OMAP clocks that have allow_idle 626 - * function pointers associated with them. This function is intended 627 - * to be temporary until support for this is added to the common clock 628 - * code. Returns 0. 629 - */ 630 - int omap2_clk_disable_autoidle_all(void) 631 - { 632 - struct clk_hw_omap *c; 633 - 634 - list_for_each_entry(c, &clk_hw_omap_clocks, node) 635 - if (c->ops && c->ops->deny_idle) 636 - c->ops->deny_idle(c); 637 - 638 - of_ti_clk_deny_autoidle_all(); 639 - 640 - return 0; 641 - } 642 - 643 - /** 644 - * omap2_clk_deny_idle - disable autoidle on an OMAP clock 645 - * @clk: struct clk * to disable autoidle for 646 - * 647 - * Disable autoidle on an OMAP clock. 648 - */ 649 - int omap2_clk_deny_idle(struct clk *clk) 650 - { 651 - struct clk_hw_omap *c; 652 - 653 - if (__clk_get_flags(clk) & CLK_IS_BASIC) 654 - return -EINVAL; 655 - 656 - c = to_clk_hw_omap(__clk_get_hw(clk)); 657 - if (c->ops && c->ops->deny_idle) 658 - c->ops->deny_idle(c); 659 - return 0; 660 - } 661 - 662 - /** 663 - * omap2_clk_allow_idle - enable autoidle on an OMAP clock 664 - * @clk: struct clk * to enable autoidle for 665 - * 666 - * Enable autoidle on an OMAP clock. 667 - */ 668 - int omap2_clk_allow_idle(struct clk *clk) 669 - { 670 - struct clk_hw_omap *c; 671 - 672 - if (__clk_get_flags(clk) & CLK_IS_BASIC) 673 - return -EINVAL; 674 - 675 - c = to_clk_hw_omap(__clk_get_hw(clk)); 676 - if (c->ops && c->ops->allow_idle) 677 - c->ops->allow_idle(c); 678 - return 0; 679 - } 680 580 681 581 /** 682 582 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
-3
arch/arm/mach-omap2/clock.h
··· 186 186 187 187 void __init omap2_clk_disable_clkdm_control(void); 188 188 189 - int omap2_clk_enable_autoidle_all(void); 190 - int omap2_clk_allow_idle(struct clk *clk); 191 - int omap2_clk_deny_idle(struct clk *clk); 192 189 int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); 193 190 void omap2_clk_print_new_rates(const char *hfclkin_ck_name, 194 191 const char *core_ck_name,
+111 -8
drivers/clk/ti/autoidle.c
··· 33 33 #define AUTOIDLE_LOW 0x1 34 34 35 35 static LIST_HEAD(autoidle_clks); 36 + static LIST_HEAD(clk_hw_omap_clocks); 36 37 37 - static void ti_allow_autoidle(struct clk_ti_autoidle *clk) 38 + /** 39 + * omap2_clk_deny_idle - disable autoidle on an OMAP clock 40 + * @clk: struct clk * to disable autoidle for 41 + * 42 + * Disable autoidle on an OMAP clock. 43 + */ 44 + int omap2_clk_deny_idle(struct clk *clk) 45 + { 46 + struct clk_hw_omap *c; 47 + 48 + if (__clk_get_flags(clk) & CLK_IS_BASIC) 49 + return -EINVAL; 50 + 51 + c = to_clk_hw_omap(__clk_get_hw(clk)); 52 + if (c->ops && c->ops->deny_idle) 53 + c->ops->deny_idle(c); 54 + return 0; 55 + } 56 + 57 + /** 58 + * omap2_clk_allow_idle - enable autoidle on an OMAP clock 59 + * @clk: struct clk * to enable autoidle for 60 + * 61 + * Enable autoidle on an OMAP clock. 62 + */ 63 + int omap2_clk_allow_idle(struct clk *clk) 64 + { 65 + struct clk_hw_omap *c; 66 + 67 + if (__clk_get_flags(clk) & CLK_IS_BASIC) 68 + return -EINVAL; 69 + 70 + c = to_clk_hw_omap(__clk_get_hw(clk)); 71 + if (c->ops && c->ops->allow_idle) 72 + c->ops->allow_idle(c); 73 + return 0; 74 + } 75 + 76 + static void _allow_autoidle(struct clk_ti_autoidle *clk) 38 77 { 39 78 u32 val; 40 79 ··· 87 48 ti_clk_ll_ops->clk_writel(val, clk->reg); 88 49 } 89 50 90 - static void ti_deny_autoidle(struct clk_ti_autoidle *clk) 51 + static void _deny_autoidle(struct clk_ti_autoidle *clk) 91 52 { 92 53 u32 val; 93 54 ··· 102 63 } 103 64 104 65 /** 105 - * of_ti_clk_allow_autoidle_all - enable autoidle for all clocks 66 + * _clk_generic_allow_autoidle_all - enable autoidle for all clocks 106 67 * 107 68 * Enables hardware autoidle for all registered DT clocks, which have 108 69 * the feature. 109 70 */ 110 - void of_ti_clk_allow_autoidle_all(void) 71 + static void _clk_generic_allow_autoidle_all(void) 111 72 { 112 73 struct clk_ti_autoidle *c; 113 74 114 75 list_for_each_entry(c, &autoidle_clks, node) 115 - ti_allow_autoidle(c); 76 + _allow_autoidle(c); 116 77 } 117 78 118 79 /** 119 - * of_ti_clk_deny_autoidle_all - disable autoidle for all clocks 80 + * _clk_generic_deny_autoidle_all - disable autoidle for all clocks 120 81 * 121 82 * Disables hardware autoidle for all registered DT clocks, which have 122 83 * the feature. 123 84 */ 124 - void of_ti_clk_deny_autoidle_all(void) 85 + static void _clk_generic_deny_autoidle_all(void) 125 86 { 126 87 struct clk_ti_autoidle *c; 127 88 128 89 list_for_each_entry(c, &autoidle_clks, node) 129 - ti_deny_autoidle(c); 90 + _deny_autoidle(c); 130 91 } 131 92 132 93 /** ··· 167 128 clk->flags |= AUTOIDLE_LOW; 168 129 169 130 list_add(&clk->node, &autoidle_clks); 131 + 132 + return 0; 133 + } 134 + 135 + /** 136 + * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock 137 + * @clk: struct clk * to initialize 138 + * 139 + * Add an OMAP clock @clk to the internal list of OMAP clocks. Used 140 + * temporarily for autoidle handling, until this support can be 141 + * integrated into the common clock framework code in some way. No 142 + * return value. 143 + */ 144 + void omap2_init_clk_hw_omap_clocks(struct clk *clk) 145 + { 146 + struct clk_hw_omap *c; 147 + 148 + if (__clk_get_flags(clk) & CLK_IS_BASIC) 149 + return; 150 + 151 + c = to_clk_hw_omap(__clk_get_hw(clk)); 152 + list_add(&c->node, &clk_hw_omap_clocks); 153 + } 154 + 155 + /** 156 + * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that 157 + * support it 158 + * 159 + * Enable clock autoidle on all OMAP clocks that have allow_idle 160 + * function pointers associated with them. This function is intended 161 + * to be temporary until support for this is added to the common clock 162 + * code. Returns 0. 163 + */ 164 + int omap2_clk_enable_autoidle_all(void) 165 + { 166 + struct clk_hw_omap *c; 167 + 168 + list_for_each_entry(c, &clk_hw_omap_clocks, node) 169 + if (c->ops && c->ops->allow_idle) 170 + c->ops->allow_idle(c); 171 + 172 + _clk_generic_allow_autoidle_all(); 173 + 174 + return 0; 175 + } 176 + 177 + /** 178 + * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that 179 + * support it 180 + * 181 + * Disable clock autoidle on all OMAP clocks that have allow_idle 182 + * function pointers associated with them. This function is intended 183 + * to be temporary until support for this is added to the common clock 184 + * code. Returns 0. 185 + */ 186 + int omap2_clk_disable_autoidle_all(void) 187 + { 188 + struct clk_hw_omap *c; 189 + 190 + list_for_each_entry(c, &clk_hw_omap_clocks, node) 191 + if (c->ops && c->ops->deny_idle) 192 + c->ops->deny_idle(c); 193 + 194 + _clk_generic_deny_autoidle_all(); 170 195 171 196 return 0; 172 197 }
+3
drivers/clk/ti/clock.h
··· 169 169 struct clk *ti_clk_register_clk(struct ti_clk *setup); 170 170 int ti_clk_register_legacy_clks(struct ti_clk_alias *clks); 171 171 172 + void omap2_init_clk_hw_omap_clocks(struct clk *clk); 173 + int of_ti_clk_autoidle_setup(struct device_node *node); 174 + 172 175 extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx; 173 176 extern const struct clk_hw_omap_ops clkhwops_iclk; 174 177 extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
+2
drivers/clk/ti/fixed-factor.c
··· 22 22 #include <linux/of_address.h> 23 23 #include <linux/clk/ti.h> 24 24 25 + #include "clock.h" 26 + 25 27 #undef pr_fmt 26 28 #define pr_fmt(fmt) "%s: " fmt, __func__ 27 29
+3 -10
include/linux/clk/ti.h
··· 259 259 260 260 #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) 261 261 262 - void omap2_init_clk_hw_omap_clocks(struct clk *clk); 263 262 int omap3_noncore_dpll_enable(struct clk_hw *hw); 264 263 void omap3_noncore_dpll_disable(struct clk_hw *hw); 265 264 int omap3_noncore_dpll_set_parent(struct clk_hw *hw, u8 index); ··· 287 288 int omap2_clkops_enable_clkdm(struct clk_hw *hw); 288 289 void omap2_clkops_disable_clkdm(struct clk_hw *hw); 289 290 int omap2_clk_disable_autoidle_all(void); 291 + int omap2_clk_enable_autoidle_all(void); 292 + int omap2_clk_allow_idle(struct clk *clk); 293 + int omap2_clk_deny_idle(struct clk *clk); 290 294 void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); 291 295 int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate, 292 296 unsigned long parent_rate); ··· 322 320 void ti_dt_clockdomains_setup(void); 323 321 int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, 324 322 ti_of_clk_init_cb_t func); 325 - int of_ti_clk_autoidle_setup(struct device_node *node); 326 323 int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type); 327 324 328 325 int omap3430_dt_clk_init(void); ··· 351 350 352 351 void ti_clk_setup_features(struct ti_clk_features *features); 353 352 const struct ti_clk_features *ti_clk_get_features(void); 354 - 355 - #ifdef CONFIG_OF 356 - void of_ti_clk_allow_autoidle_all(void); 357 - void of_ti_clk_deny_autoidle_all(void); 358 - #else 359 - static inline void of_ti_clk_allow_autoidle_all(void) { } 360 - static inline void of_ti_clk_deny_autoidle_all(void) { } 361 - #endif 362 353 363 354 extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll; 364 355 extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;