···11-Clock framework on SuperH architecture22-33-The framework on SH extends existing API by the function clk_set_rate_ex,44-which prototype is as follows:55-66- clk_set_rate_ex (struct clk *clk, unsigned long rate, int algo_id)77-88-The algo_id parameter is used to specify algorithm used to recalculate clocks,99-adjanced to clock, specified as first argument. It is assumed that algo_id==01010-means no changes to adjanced clock1111-1212-Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method,1313-if it is present in ops structure. The method should set the clock rate and adjust1414-all needed clocks according to the passed algo_id.1515-Exact values for algo_id are machine-dependent. For the sh7722, the following1616-values are defined:1717-1818- NO_CHANGE = 0,1919- IUS_N1_N1, /* I:U = N:1, U:Sh = N:1 */2020- IUS_322, /* I:U:Sh = 3:2:2 */2121- IUS_522, /* I:U:Sh = 5:2:2 */2222- IUS_N11, /* I:U:Sh = N:1:1 */2323- SB_N1, /* Sh:B = N:1 */2424- SB3_N1, /* Sh:B3 = N:1 */2525- SB3_32, /* Sh:B3 = 3:2 */2626- SB3_43, /* Sh:B3 = 4:3 */2727- SB3_54, /* Sh:B3 = 5:4 */2828- BP_N1, /* B:P = N:1 */2929- IP_N1 /* I:P = N:1 */3030-3131-Each of these constants means relation between clocks that can be set via the FRQCR3232-register
+2-4
arch/arm/mach-shmobile/clock-sh7372.c
···220220 __raw_writel(__raw_readl(PLLC2CR) & ~0x80000000, PLLC2CR);221221}222222223223-static int pllc2_set_rate(struct clk *clk,224224- unsigned long rate, int algo_id)223223+static int pllc2_set_rate(struct clk *clk, unsigned long rate)225224{226225 unsigned long value;227226 int idx;···462463 return 0;463464}464465465465-static int fsidiv_set_rate(struct clk *clk,466466- unsigned long rate, int algo_id)466466+static int fsidiv_set_rate(struct clk *clk, unsigned long rate)467467{468468 int idx;469469
+1-1
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
···110110 return 0;111111}112112113113-static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id)113113+static int shoc_clk_set_rate(struct clk *clk, unsigned long rate)114114{115115 unsigned long frqcr3;116116 unsigned int tmp;
+3-10
drivers/sh/clk/core.c
···455455456456int clk_set_rate(struct clk *clk, unsigned long rate)457457{458458- return clk_set_rate_ex(clk, rate, 0);459459-}460460-EXPORT_SYMBOL_GPL(clk_set_rate);461461-462462-int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id)463463-{464458 int ret = -EOPNOTSUPP;465459 unsigned long flags;466460467461 spin_lock_irqsave(&clock_lock, flags);468462469463 if (likely(clk->ops && clk->ops->set_rate)) {470470- ret = clk->ops->set_rate(clk, rate, algo_id);464464+ ret = clk->ops->set_rate(clk, rate);471465 if (ret != 0)472466 goto out_unlock;473467 } else {···479485480486 return ret;481487}482482-EXPORT_SYMBOL_GPL(clk_set_rate_ex);488488+EXPORT_SYMBOL_GPL(clk_set_rate);483489484490int clk_set_parent(struct clk *clk, struct clk *parent)485491{···647653 clkp->ops->set_parent(clkp,648654 clkp->parent);649655 if (likely(clkp->ops->set_rate))650650- clkp->ops->set_rate(clkp,651651- rate, NO_CHANGE);656656+ clkp->ops->set_rate(clkp, rate);652657 else if (likely(clkp->ops->recalc))653658 clkp->rate = clkp->ops->recalc(clkp);654659 }
+2-3
drivers/sh/clk/cpg.c
···110110 return 0;111111}112112113113-static int sh_clk_div6_set_rate(struct clk *clk,114114- unsigned long rate, int algo_id)113113+static int sh_clk_div6_set_rate(struct clk *clk, unsigned long rate)115114{116115 unsigned long value;117116 int idx;···252253 return 0;253254}254255255255-static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate, int algo_id)256256+static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate)256257{257258 struct clk_div4_table *d4t = clk->priv;258259 unsigned long value;
+3-31
include/linux/sh_clk.h
···1919};20202121struct clk_ops {2222+#ifdef CONFIG_SH_CLK_CPG_LEGACY2223 void (*init)(struct clk *clk);2424+#endif2325 int (*enable)(struct clk *clk);2426 void (*disable)(struct clk *clk);2527 unsigned long (*recalc)(struct clk *clk);2626- int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);2828+ int (*set_rate)(struct clk *clk, unsigned long rate);2729 int (*set_parent)(struct clk *clk, struct clk *parent);2830 long (*round_rate)(struct clk *clk, unsigned long rate);2931};···6866int clk_register(struct clk *);6967void clk_unregister(struct clk *);7068void clk_enable_init_clocks(void);7171-7272-/**7373- * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter7474- * @clk: clock source7575- * @rate: desired clock rate in Hz7676- * @algo_id: algorithm id to be passed down to ops->set_rate7777- *7878- * Returns success (0) or negative errno.7979- */8080-int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);8181-8282-enum clk_sh_algo_id {8383- NO_CHANGE = 0,8484-8585- IUS_N1_N1,8686- IUS_322,8787- IUS_522,8888- IUS_N11,8989-9090- SB_N1,9191-9292- SB3_N1,9393- SB3_32,9494- SB3_43,9595- SB3_54,9696-9797- BP_N1,9898-9999- IP_N1,100100-};1016910270struct clk_div_mult_table {10371 unsigned int *divisors;