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

ARM: OMAP: remove plat/clock.h

Remove arch/arm/plat-omap/include/plat/clock.h by merging it into
arch/arm/mach-omap1/clock.h and arch/arm/mach-omap2/clock.h.
The goal here is to facilitate ARM single image kernels by removing
includes via the "plat/" symlink.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
[tony@atomide.com: fixed to remove duplicate clock.h includes]
Signed-off-by: Tony Lindgren <tony@atomide.com>

authored by

Paul Walmsley and committed by
Tony Lindgren
a135eaae 1fe9be82

+445 -365
+1 -1
arch/arm/mach-omap1/board-nokia770.c
··· 29 29 #include <asm/mach/map.h> 30 30 31 31 #include <mach/mux.h> 32 - #include <plat/clock.h> 33 32 34 33 #include <mach/hardware.h> 35 34 #include <mach/usb.h> 36 35 37 36 #include "common.h" 37 + #include "clock.h" 38 38 #include "mmc.h" 39 39 40 40 #define ADS7846_PENDOWN_GPIO 15
-1
arch/arm/mach-omap1/clock.c
··· 24 24 25 25 #include <plat/cpu.h> 26 26 #include <plat/usb.h> 27 - #include <plat/clock.h> 28 27 #include <plat/clkdev_omap.h> 29 28 30 29 #include <mach/hardware.h>
+152 -1
arch/arm/mach-omap1/clock.h
··· 14 14 #define __ARCH_ARM_MACH_OMAP1_CLOCK_H 15 15 16 16 #include <linux/clk.h> 17 + #include <linux/list.h> 17 18 18 - #include <plat/clock.h> 19 + struct module; 20 + struct clk; 21 + 22 + /* Temporary, needed during the common clock framework conversion */ 23 + #define __clk_get_name(clk) (clk->name) 24 + #define __clk_get_parent(clk) (clk->parent) 25 + #define __clk_get_rate(clk) (clk->rate) 26 + 27 + /** 28 + * struct clkops - some clock function pointers 29 + * @enable: fn ptr that enables the current clock in hardware 30 + * @disable: fn ptr that enables the current clock in hardware 31 + * @find_idlest: function returning the IDLEST register for the clock's IP blk 32 + * @find_companion: function returning the "companion" clk reg for the clock 33 + * @allow_idle: fn ptr that enables autoidle for the current clock in hardware 34 + * @deny_idle: fn ptr that disables autoidle for the current clock in hardware 35 + * 36 + * A "companion" clk is an accompanying clock to the one being queried 37 + * that must be enabled for the IP module connected to the clock to 38 + * become accessible by the hardware. Neither @find_idlest nor 39 + * @find_companion should be needed; that information is IP 40 + * block-specific; the hwmod code has been created to handle this, but 41 + * until hwmod data is ready and drivers have been converted to use PM 42 + * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and 43 + * @find_companion must, unfortunately, remain. 44 + */ 45 + struct clkops { 46 + int (*enable)(struct clk *); 47 + void (*disable)(struct clk *); 48 + void (*find_idlest)(struct clk *, void __iomem **, 49 + u8 *, u8 *); 50 + void (*find_companion)(struct clk *, void __iomem **, 51 + u8 *); 52 + void (*allow_idle)(struct clk *); 53 + void (*deny_idle)(struct clk *); 54 + }; 55 + 56 + /* 57 + * struct clk.flags possibilities 58 + * 59 + * XXX document the rest of the clock flags here 60 + * 61 + * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL 62 + * bits share the same register. This flag allows the 63 + * omap4_dpllmx*() code to determine which GATE_CTRL bit field 64 + * should be used. This is a temporary solution - a better approach 65 + * would be to associate clock type-specific data with the clock, 66 + * similar to the struct dpll_data approach. 67 + */ 68 + #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ 69 + #define CLOCK_IDLE_CONTROL (1 << 1) 70 + #define CLOCK_NO_IDLE_PARENT (1 << 2) 71 + #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ 72 + #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ 73 + #define CLOCK_CLKOUTX2 (1 << 5) 74 + 75 + /** 76 + * struct clk - OMAP struct clk 77 + * @node: list_head connecting this clock into the full clock list 78 + * @ops: struct clkops * for this clock 79 + * @name: the name of the clock in the hardware (used in hwmod data and debug) 80 + * @parent: pointer to this clock's parent struct clk 81 + * @children: list_head connecting to the child clks' @sibling list_heads 82 + * @sibling: list_head connecting this clk to its parent clk's @children 83 + * @rate: current clock rate 84 + * @enable_reg: register to write to enable the clock (see @enable_bit) 85 + * @recalc: fn ptr that returns the clock's current rate 86 + * @set_rate: fn ptr that can change the clock's current rate 87 + * @round_rate: fn ptr that can round the clock's current rate 88 + * @init: fn ptr to do clock-specific initialization 89 + * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) 90 + * @usecount: number of users that have requested this clock to be enabled 91 + * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div 92 + * @flags: see "struct clk.flags possibilities" above 93 + * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) 94 + * @src_offset: bitshift for source selection bitfield (OMAP1 only) 95 + * 96 + * XXX @rate_offset, @src_offset should probably be removed and OMAP1 97 + * clock code converted to use clksel. 98 + * 99 + * XXX @usecount is poorly named. It should be "enable_count" or 100 + * something similar. "users" in the description refers to kernel 101 + * code (core code or drivers) that have called clk_enable() and not 102 + * yet called clk_disable(); the usecount of parent clocks is also 103 + * incremented by the clock code when clk_enable() is called on child 104 + * clocks and decremented by the clock code when clk_disable() is 105 + * called on child clocks. 106 + * 107 + * XXX @clkdm, @usecount, @children, @sibling should be marked for 108 + * internal use only. 109 + * 110 + * @children and @sibling are used to optimize parent-to-child clock 111 + * tree traversals. (child-to-parent traversals use @parent.) 112 + * 113 + * XXX The notion of the clock's current rate probably needs to be 114 + * separated from the clock's target rate. 115 + */ 116 + struct clk { 117 + struct list_head node; 118 + const struct clkops *ops; 119 + const char *name; 120 + struct clk *parent; 121 + struct list_head children; 122 + struct list_head sibling; /* node for children */ 123 + unsigned long rate; 124 + void __iomem *enable_reg; 125 + unsigned long (*recalc)(struct clk *); 126 + int (*set_rate)(struct clk *, unsigned long); 127 + long (*round_rate)(struct clk *, unsigned long); 128 + void (*init)(struct clk *); 129 + u8 enable_bit; 130 + s8 usecount; 131 + u8 fixed_div; 132 + u8 flags; 133 + u8 rate_offset; 134 + u8 src_offset; 135 + #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 136 + struct dentry *dent; /* For visible tree hierarchy */ 137 + #endif 138 + }; 139 + 140 + struct clk_functions { 141 + int (*clk_enable)(struct clk *clk); 142 + void (*clk_disable)(struct clk *clk); 143 + long (*clk_round_rate)(struct clk *clk, unsigned long rate); 144 + int (*clk_set_rate)(struct clk *clk, unsigned long rate); 145 + int (*clk_set_parent)(struct clk *clk, struct clk *parent); 146 + void (*clk_allow_idle)(struct clk *clk); 147 + void (*clk_deny_idle)(struct clk *clk); 148 + void (*clk_disable_unused)(struct clk *clk); 149 + }; 150 + 151 + extern int mpurate; 152 + 153 + extern int clk_init(struct clk_functions *custom_clocks); 154 + extern void clk_preinit(struct clk *clk); 155 + extern int clk_register(struct clk *clk); 156 + extern void clk_reparent(struct clk *child, struct clk *parent); 157 + extern void clk_unregister(struct clk *clk); 158 + extern void propagate_rate(struct clk *clk); 159 + extern void recalculate_root_clocks(void); 160 + extern unsigned long followparent_recalc(struct clk *clk); 161 + extern void clk_enable_init_clocks(void); 162 + unsigned long omap_fixed_divisor_recalc(struct clk *clk); 163 + extern struct clk *omap_clk_get_by_name(const char *name); 164 + extern int omap_clk_enable_autoidle_all(void); 165 + extern int omap_clk_disable_autoidle_all(void); 166 + 167 + extern const struct clkops clkops_null; 168 + 169 + extern struct clk dummy_ck; 19 170 20 171 int omap1_clk_init(void); 21 172 void omap1_clk_late_init(void);
-1
arch/arm/mach-omap1/clock_data.c
··· 22 22 23 23 #include <asm/mach-types.h> /* for machine_is_* */ 24 24 25 - #include <plat/clock.h> 26 25 #include <plat/cpu.h> 27 26 #include <plat/clkdev_omap.h> 28 27
+1 -2
arch/arm/mach-omap1/pm.c
··· 49 49 #include <asm/mach/time.h> 50 50 #include <asm/mach/irq.h> 51 51 52 - #include <plat/cpu.h> 53 - #include <plat/clock.h> 54 52 #include <mach/tc.h> 55 53 #include <mach/mux.h> 56 54 #include <plat-omap/dma-omap.h> ··· 59 61 #include "../plat-omap/sram.h" 60 62 61 63 #include "iomap.h" 64 + #include "clock.h" 62 65 #include "pm.h" 63 66 64 67 static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
-1
arch/arm/mach-omap2/clkt2xxx_apll.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 24 - #include <plat/clock.h> 25 24 #include <plat/prcm.h> 26 25 27 26 #include "clock.h"
-2
arch/arm/mach-omap2/clkt2xxx_dpll.c
··· 14 14 #include <linux/clk.h> 15 15 #include <linux/io.h> 16 16 17 - #include <plat/clock.h> 18 - 19 17 #include "clock.h" 20 18 #include "cm2xxx_3xxx.h" 21 19 #include "cm-regbits-24xx.h"
-2
arch/arm/mach-omap2/clkt2xxx_dpllcore.c
··· 25 25 #include <linux/clk.h> 26 26 #include <linux/io.h> 27 27 28 - #include <plat/clock.h> 29 - 30 28 #include "../plat-omap/sram.h" 31 29 32 30 #include "clock.h"
-2
arch/arm/mach-omap2/clkt2xxx_osc.c
··· 23 23 #include <linux/clk.h> 24 24 #include <linux/io.h> 25 25 26 - #include <plat/clock.h> 27 - 28 26 #include "clock.h" 29 27 #include "clock2xxx.h" 30 28 #include "prm2xxx_3xxx.h"
-2
arch/arm/mach-omap2/clkt2xxx_sys.c
··· 22 22 #include <linux/clk.h> 23 23 #include <linux/io.h> 24 24 25 - #include <plat/clock.h> 26 - 27 25 #include "clock.h" 28 26 #include "clock2xxx.h" 29 27 #include "prm2xxx_3xxx.h"
-2
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
··· 33 33 #include <linux/cpufreq.h> 34 34 #include <linux/slab.h> 35 35 36 - #include <plat/clock.h> 37 - 38 36 #include "../plat-omap/sram.h" 39 37 40 38 #include "soc.h"
-2
arch/arm/mach-omap2/clkt34xx_dpll3m2.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 24 - #include <plat/clock.h> 25 - 26 24 #include "../plat-omap/sram.h" 27 25 28 26 #include "clock.h"
-2
arch/arm/mach-omap2/clkt_clksel.c
··· 45 45 #include <linux/io.h> 46 46 #include <linux/bug.h> 47 47 48 - #include <plat/clock.h> 49 - 50 48 #include "clock.h" 51 49 52 50 /* Private functions */
-2
arch/arm/mach-omap2/clkt_dpll.c
··· 21 21 22 22 #include <asm/div64.h> 23 23 24 - #include <plat/clock.h> 25 - 26 24 #include "soc.h" 27 25 #include "clock.h" 28 26 #include "cm-regbits-24xx.h"
-1
arch/arm/mach-omap2/clkt_iclk.c
··· 14 14 #include <linux/clk.h> 15 15 #include <linux/io.h> 16 16 17 - #include <plat/clock.h> 18 17 #include <plat/prcm.h> 19 18 20 19 #include "clock.h"
-1
arch/arm/mach-omap2/clock.c
··· 26 26 27 27 #include <asm/cpu.h> 28 28 29 - #include <plat/clock.h> 30 29 #include <plat/prcm.h> 31 30 32 31 #include <trace/events/power.h>
+283 -1
arch/arm/mach-omap2/clock.h
··· 17 17 #define __ARCH_ARM_MACH_OMAP2_CLOCK_H 18 18 19 19 #include <linux/kernel.h> 20 + #include <linux/list.h> 20 21 21 - #include <plat/clock.h> 22 + struct module; 23 + struct clk; 24 + struct clockdomain; 25 + 26 + /* Temporary, needed during the common clock framework conversion */ 27 + #define __clk_get_name(clk) (clk->name) 28 + #define __clk_get_parent(clk) (clk->parent) 29 + #define __clk_get_rate(clk) (clk->rate) 30 + 31 + /** 32 + * struct clkops - some clock function pointers 33 + * @enable: fn ptr that enables the current clock in hardware 34 + * @disable: fn ptr that enables the current clock in hardware 35 + * @find_idlest: function returning the IDLEST register for the clock's IP blk 36 + * @find_companion: function returning the "companion" clk reg for the clock 37 + * @allow_idle: fn ptr that enables autoidle for the current clock in hardware 38 + * @deny_idle: fn ptr that disables autoidle for the current clock in hardware 39 + * 40 + * A "companion" clk is an accompanying clock to the one being queried 41 + * that must be enabled for the IP module connected to the clock to 42 + * become accessible by the hardware. Neither @find_idlest nor 43 + * @find_companion should be needed; that information is IP 44 + * block-specific; the hwmod code has been created to handle this, but 45 + * until hwmod data is ready and drivers have been converted to use PM 46 + * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and 47 + * @find_companion must, unfortunately, remain. 48 + */ 49 + struct clkops { 50 + int (*enable)(struct clk *); 51 + void (*disable)(struct clk *); 52 + void (*find_idlest)(struct clk *, void __iomem **, 53 + u8 *, u8 *); 54 + void (*find_companion)(struct clk *, void __iomem **, 55 + u8 *); 56 + void (*allow_idle)(struct clk *); 57 + void (*deny_idle)(struct clk *); 58 + }; 59 + 60 + /* struct clksel_rate.flags possibilities */ 61 + #define RATE_IN_242X (1 << 0) 62 + #define RATE_IN_243X (1 << 1) 63 + #define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */ 64 + #define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */ 65 + #define RATE_IN_36XX (1 << 4) 66 + #define RATE_IN_4430 (1 << 5) 67 + #define RATE_IN_TI816X (1 << 6) 68 + #define RATE_IN_4460 (1 << 7) 69 + #define RATE_IN_AM33XX (1 << 8) 70 + #define RATE_IN_TI814X (1 << 9) 71 + 72 + #define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) 73 + #define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS) 74 + #define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX) 75 + #define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460) 76 + 77 + /* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */ 78 + #define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX) 79 + 80 + 81 + /** 82 + * struct clksel_rate - register bitfield values corresponding to clk divisors 83 + * @val: register bitfield value (shifted to bit 0) 84 + * @div: clock divisor corresponding to @val 85 + * @flags: (see "struct clksel_rate.flags possibilities" above) 86 + * 87 + * @val should match the value of a read from struct clk.clksel_reg 88 + * AND'ed with struct clk.clksel_mask, shifted right to bit 0. 89 + * 90 + * @div is the divisor that should be applied to the parent clock's rate 91 + * to produce the current clock's rate. 92 + */ 93 + struct clksel_rate { 94 + u32 val; 95 + u8 div; 96 + u16 flags; 97 + }; 98 + 99 + /** 100 + * struct clksel - available parent clocks, and a pointer to their divisors 101 + * @parent: struct clk * to a possible parent clock 102 + * @rates: available divisors for this parent clock 103 + * 104 + * A struct clksel is always associated with one or more struct clks 105 + * and one or more struct clksel_rates. 106 + */ 107 + struct clksel { 108 + struct clk *parent; 109 + const struct clksel_rate *rates; 110 + }; 111 + 112 + /** 113 + * struct dpll_data - DPLL registers and integration data 114 + * @mult_div1_reg: register containing the DPLL M and N bitfields 115 + * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg 116 + * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg 117 + * @clk_bypass: struct clk pointer to the clock's bypass clock input 118 + * @clk_ref: struct clk pointer to the clock's reference clock input 119 + * @control_reg: register containing the DPLL mode bitfield 120 + * @enable_mask: mask of the DPLL mode bitfield in @control_reg 121 + * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() 122 + * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() 123 + * @max_multiplier: maximum valid non-bypass multiplier value (actual) 124 + * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() 125 + * @min_divider: minimum valid non-bypass divider value (actual) 126 + * @max_divider: maximum valid non-bypass divider value (actual) 127 + * @modes: possible values of @enable_mask 128 + * @autoidle_reg: register containing the DPLL autoidle mode bitfield 129 + * @idlest_reg: register containing the DPLL idle status bitfield 130 + * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg 131 + * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg 132 + * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg 133 + * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg 134 + * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs 135 + * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs 136 + * @flags: DPLL type/features (see below) 137 + * 138 + * Possible values for @flags: 139 + * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs) 140 + * 141 + * @freqsel_mask is only used on the OMAP34xx family and AM35xx. 142 + * 143 + * XXX Some DPLLs have multiple bypass inputs, so it's not technically 144 + * correct to only have one @clk_bypass pointer. 145 + * 146 + * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m, 147 + * @last_rounded_n) should be separated from the runtime-fixed fields 148 + * and placed into a different structure, so that the runtime-fixed data 149 + * can be placed into read-only space. 150 + */ 151 + struct dpll_data { 152 + void __iomem *mult_div1_reg; 153 + u32 mult_mask; 154 + u32 div1_mask; 155 + struct clk *clk_bypass; 156 + struct clk *clk_ref; 157 + void __iomem *control_reg; 158 + u32 enable_mask; 159 + unsigned long last_rounded_rate; 160 + u16 last_rounded_m; 161 + u16 max_multiplier; 162 + u8 last_rounded_n; 163 + u8 min_divider; 164 + u16 max_divider; 165 + u8 modes; 166 + void __iomem *autoidle_reg; 167 + void __iomem *idlest_reg; 168 + u32 autoidle_mask; 169 + u32 freqsel_mask; 170 + u32 idlest_mask; 171 + u32 dco_mask; 172 + u32 sddiv_mask; 173 + u8 auto_recal_bit; 174 + u8 recal_en_bit; 175 + u8 recal_st_bit; 176 + u8 flags; 177 + }; 178 + 179 + /* 180 + * struct clk.flags possibilities 181 + * 182 + * XXX document the rest of the clock flags here 183 + * 184 + * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL 185 + * bits share the same register. This flag allows the 186 + * omap4_dpllmx*() code to determine which GATE_CTRL bit field 187 + * should be used. This is a temporary solution - a better approach 188 + * would be to associate clock type-specific data with the clock, 189 + * similar to the struct dpll_data approach. 190 + */ 191 + #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ 192 + #define CLOCK_IDLE_CONTROL (1 << 1) 193 + #define CLOCK_NO_IDLE_PARENT (1 << 2) 194 + #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ 195 + #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ 196 + #define CLOCK_CLKOUTX2 (1 << 5) 197 + 198 + /** 199 + * struct clk - OMAP struct clk 200 + * @node: list_head connecting this clock into the full clock list 201 + * @ops: struct clkops * for this clock 202 + * @name: the name of the clock in the hardware (used in hwmod data and debug) 203 + * @parent: pointer to this clock's parent struct clk 204 + * @children: list_head connecting to the child clks' @sibling list_heads 205 + * @sibling: list_head connecting this clk to its parent clk's @children 206 + * @rate: current clock rate 207 + * @enable_reg: register to write to enable the clock (see @enable_bit) 208 + * @recalc: fn ptr that returns the clock's current rate 209 + * @set_rate: fn ptr that can change the clock's current rate 210 + * @round_rate: fn ptr that can round the clock's current rate 211 + * @init: fn ptr to do clock-specific initialization 212 + * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) 213 + * @usecount: number of users that have requested this clock to be enabled 214 + * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div 215 + * @flags: see "struct clk.flags possibilities" above 216 + * @clksel_reg: for clksel clks, register va containing src/divisor select 217 + * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector 218 + * @clksel: for clksel clks, pointer to struct clksel for this clock 219 + * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock 220 + * @clkdm_name: clockdomain name that this clock is contained in 221 + * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime 222 + * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) 223 + * @src_offset: bitshift for source selection bitfield (OMAP1 only) 224 + * 225 + * XXX @rate_offset, @src_offset should probably be removed and OMAP1 226 + * clock code converted to use clksel. 227 + * 228 + * XXX @usecount is poorly named. It should be "enable_count" or 229 + * something similar. "users" in the description refers to kernel 230 + * code (core code or drivers) that have called clk_enable() and not 231 + * yet called clk_disable(); the usecount of parent clocks is also 232 + * incremented by the clock code when clk_enable() is called on child 233 + * clocks and decremented by the clock code when clk_disable() is 234 + * called on child clocks. 235 + * 236 + * XXX @clkdm, @usecount, @children, @sibling should be marked for 237 + * internal use only. 238 + * 239 + * @children and @sibling are used to optimize parent-to-child clock 240 + * tree traversals. (child-to-parent traversals use @parent.) 241 + * 242 + * XXX The notion of the clock's current rate probably needs to be 243 + * separated from the clock's target rate. 244 + */ 245 + struct clk { 246 + struct list_head node; 247 + const struct clkops *ops; 248 + const char *name; 249 + struct clk *parent; 250 + struct list_head children; 251 + struct list_head sibling; /* node for children */ 252 + unsigned long rate; 253 + void __iomem *enable_reg; 254 + unsigned long (*recalc)(struct clk *); 255 + int (*set_rate)(struct clk *, unsigned long); 256 + long (*round_rate)(struct clk *, unsigned long); 257 + void (*init)(struct clk *); 258 + u8 enable_bit; 259 + s8 usecount; 260 + u8 fixed_div; 261 + u8 flags; 262 + void __iomem *clksel_reg; 263 + u32 clksel_mask; 264 + const struct clksel *clksel; 265 + struct dpll_data *dpll_data; 266 + const char *clkdm_name; 267 + struct clockdomain *clkdm; 268 + #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 269 + struct dentry *dent; /* For visible tree hierarchy */ 270 + #endif 271 + }; 272 + 273 + struct clk_functions { 274 + int (*clk_enable)(struct clk *clk); 275 + void (*clk_disable)(struct clk *clk); 276 + long (*clk_round_rate)(struct clk *clk, unsigned long rate); 277 + int (*clk_set_rate)(struct clk *clk, unsigned long rate); 278 + int (*clk_set_parent)(struct clk *clk, struct clk *parent); 279 + void (*clk_allow_idle)(struct clk *clk); 280 + void (*clk_deny_idle)(struct clk *clk); 281 + void (*clk_disable_unused)(struct clk *clk); 282 + }; 283 + 284 + extern int mpurate; 285 + 286 + extern int clk_init(struct clk_functions *custom_clocks); 287 + extern void clk_preinit(struct clk *clk); 288 + extern int clk_register(struct clk *clk); 289 + extern void clk_reparent(struct clk *child, struct clk *parent); 290 + extern void clk_unregister(struct clk *clk); 291 + extern void propagate_rate(struct clk *clk); 292 + extern void recalculate_root_clocks(void); 293 + extern unsigned long followparent_recalc(struct clk *clk); 294 + extern void clk_enable_init_clocks(void); 295 + unsigned long omap_fixed_divisor_recalc(struct clk *clk); 296 + extern struct clk *omap_clk_get_by_name(const char *name); 297 + extern int omap_clk_enable_autoidle_all(void); 298 + extern int omap_clk_disable_autoidle_all(void); 299 + 300 + extern const struct clkops clkops_null; 301 + 302 + extern struct clk dummy_ck; 303 + 22 304 23 305 /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 24 306 #define CORE_CLK_SRC_32K 0x0
-2
arch/arm/mach-omap2/clock2430.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 24 - #include <plat/clock.h> 25 - 26 24 #include "soc.h" 27 25 #include "iomap.h" 28 26 #include "clock.h"
-2
arch/arm/mach-omap2/clock2xxx.c
··· 22 22 #include <linux/clk.h> 23 23 #include <linux/io.h> 24 24 25 - #include <plat/clock.h> 26 - 27 25 #include "soc.h" 28 26 #include "clock.h" 29 27 #include "clock2xxx.h"
-2
arch/arm/mach-omap2/clock34xx.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 24 - #include <plat/clock.h> 25 - 26 24 #include "clock.h" 27 25 #include "clock34xx.h" 28 26 #include "cm2xxx_3xxx.h"
-2
arch/arm/mach-omap2/clock3517.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 24 - #include <plat/clock.h> 25 - 26 24 #include "clock.h" 27 25 #include "clock3517.h" 28 26 #include "cm2xxx_3xxx.h"
-2
arch/arm/mach-omap2/clock36xx.c
··· 22 22 #include <linux/clk.h> 23 23 #include <linux/io.h> 24 24 25 - #include <plat/clock.h> 26 - 27 25 #include "clock.h" 28 26 #include "clock36xx.h" 29 27
-2
arch/arm/mach-omap2/clock3xxx.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 24 - #include <plat/clock.h> 25 - 26 24 #include "soc.h" 27 25 #include "clock.h" 28 26 #include "clock3xxx.h"
+1 -1
arch/arm/mach-omap2/clockdomain.c
··· 27 27 28 28 #include <linux/bitops.h> 29 29 30 - #include <plat/clock.h> 30 + #include "clock.h" 31 31 #include "clockdomain.h" 32 32 33 33 /* clkdm_list contains all registered struct clockdomains */
+1 -1
arch/arm/mach-omap2/clockdomain.h
··· 18 18 #include <linux/spinlock.h> 19 19 20 20 #include "powerdomain.h" 21 - #include <plat/clock.h> 21 + #include "clock.h" 22 22 #include "omap_hwmod.h" 23 23 #include <plat/cpu.h> 24 24
+1 -1
arch/arm/mach-omap2/common.c
··· 18 18 #include <linux/io.h> 19 19 #include <linux/platform_data/dsp-omap.h> 20 20 21 - #include <plat/clock.h> 22 21 #include <plat/vram.h> 23 22 24 23 #include "soc.h" 25 24 #include "iomap.h" 26 25 #include "common.h" 26 + #include "clock.h" 27 27 #include "sdrc.h" 28 28 #include "control.h" 29 29 #include "omap-secure.h"
-2
arch/arm/mach-omap2/dpll3xxx.c
··· 28 28 #include <linux/bitops.h> 29 29 #include <linux/clkdev.h> 30 30 31 - #include <plat/clock.h> 32 - 33 31 #include "soc.h" 34 32 #include "clock.h" 35 33 #include "cm2xxx_3xxx.h"
-2
arch/arm/mach-omap2/dpll44xx.c
··· 15 15 #include <linux/io.h> 16 16 #include <linux/bitops.h> 17 17 18 - #include <plat/clock.h> 19 - 20 18 #include "soc.h" 21 19 #include "clock.h" 22 20 #include "clock44xx.h"
-1
arch/arm/mach-omap2/omap_device.c
··· 91 91 92 92 #include "omap_device.h" 93 93 #include "omap_hwmod.h" 94 - #include <plat/clock.h> 95 94 96 95 /* These parameters are passed to _omap_device_{de,}activate() */ 97 96 #define USE_WAKEUP_LAT 0
+1 -1
arch/arm/mach-omap2/omap_hwmod.c
··· 139 139 #include <linux/slab.h> 140 140 #include <linux/bootmem.h> 141 141 142 - #include <plat/clock.h> 142 + #include "clock.h" 143 143 #include "omap_hwmod.h" 144 144 #include <plat/prcm.h> 145 145
+1 -1
arch/arm/mach-omap2/pm-debug.c
··· 27 27 #include <linux/module.h> 28 28 #include <linux/slab.h> 29 29 30 - #include <plat/clock.h> 30 + #include "clock.h" 31 31 #include "powerdomain.h" 32 32 #include "clockdomain.h" 33 33 #include <plat/dmtimer.h>
+1 -1
arch/arm/mach-omap2/pm24xx.c
··· 36 36 #include <asm/mach-types.h> 37 37 #include <asm/system_misc.h> 38 38 39 - #include <plat/clock.h> 40 39 #include <plat-omap/dma-omap.h> 41 40 42 41 #include "../plat-omap/sram.h" 43 42 44 43 #include "common.h" 44 + #include "clock.h" 45 45 #include "prm2xxx_3xxx.h" 46 46 #include "prm-regbits-24xx.h" 47 47 #include "cm2xxx_3xxx.h"
-2
arch/arm/mach-omap2/sdram-nokia.c
··· 18 18 #include <linux/io.h> 19 19 20 20 #include "common.h" 21 - #include <plat/clock.h> 22 - 23 21 #include "sdram-nokia.h" 24 22 #include "sdrc.h" 25 23
+2 -2
arch/arm/mach-omap2/sdrc.c
··· 23 23 #include <linux/clk.h> 24 24 #include <linux/io.h> 25 25 26 - #include "common.h" 27 - #include <plat/clock.h> 28 26 #include "../plat-omap/sram.h" 29 27 28 + #include "common.h" 29 + #include "clock.h" 30 30 #include "sdrc.h" 31 31 32 32 static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
-2
arch/arm/mach-omap2/sdrc2xxx.c
··· 24 24 #include <linux/clk.h> 25 25 #include <linux/io.h> 26 26 27 - #include <plat/clock.h> 28 - 29 27 #include "../plat-omap/sram.h" 30 28 31 29 #include "soc.h"
-1
arch/arm/plat-omap/counter_32k.c
··· 23 23 #include <asm/sched_clock.h> 24 24 25 25 #include "common.h" 26 - #include <plat/clock.h> 27 26 28 27 /* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */ 29 28 #define OMAP2_32KSYNCNT_REV_OFF 0x0
-309
arch/arm/plat-omap/include/plat/clock.h
··· 1 - /* 2 - * OMAP clock: data structure definitions, function prototypes, shared macros 3 - * 4 - * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation 5 - * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 6 - * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - 13 - #ifndef __ARCH_ARM_OMAP_CLOCK_H 14 - #define __ARCH_ARM_OMAP_CLOCK_H 15 - 16 - #include <linux/list.h> 17 - 18 - struct module; 19 - struct clk; 20 - struct clockdomain; 21 - 22 - /* Temporary, needed during the common clock framework conversion */ 23 - #define __clk_get_name(clk) (clk->name) 24 - #define __clk_get_parent(clk) (clk->parent) 25 - #define __clk_get_rate(clk) (clk->rate) 26 - 27 - /** 28 - * struct clkops - some clock function pointers 29 - * @enable: fn ptr that enables the current clock in hardware 30 - * @disable: fn ptr that enables the current clock in hardware 31 - * @find_idlest: function returning the IDLEST register for the clock's IP blk 32 - * @find_companion: function returning the "companion" clk reg for the clock 33 - * @allow_idle: fn ptr that enables autoidle for the current clock in hardware 34 - * @deny_idle: fn ptr that disables autoidle for the current clock in hardware 35 - * 36 - * A "companion" clk is an accompanying clock to the one being queried 37 - * that must be enabled for the IP module connected to the clock to 38 - * become accessible by the hardware. Neither @find_idlest nor 39 - * @find_companion should be needed; that information is IP 40 - * block-specific; the hwmod code has been created to handle this, but 41 - * until hwmod data is ready and drivers have been converted to use PM 42 - * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and 43 - * @find_companion must, unfortunately, remain. 44 - */ 45 - struct clkops { 46 - int (*enable)(struct clk *); 47 - void (*disable)(struct clk *); 48 - void (*find_idlest)(struct clk *, void __iomem **, 49 - u8 *, u8 *); 50 - void (*find_companion)(struct clk *, void __iomem **, 51 - u8 *); 52 - void (*allow_idle)(struct clk *); 53 - void (*deny_idle)(struct clk *); 54 - }; 55 - 56 - #ifdef CONFIG_ARCH_OMAP2PLUS 57 - 58 - /* struct clksel_rate.flags possibilities */ 59 - #define RATE_IN_242X (1 << 0) 60 - #define RATE_IN_243X (1 << 1) 61 - #define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */ 62 - #define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */ 63 - #define RATE_IN_36XX (1 << 4) 64 - #define RATE_IN_4430 (1 << 5) 65 - #define RATE_IN_TI816X (1 << 6) 66 - #define RATE_IN_4460 (1 << 7) 67 - #define RATE_IN_AM33XX (1 << 8) 68 - #define RATE_IN_TI814X (1 << 9) 69 - 70 - #define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) 71 - #define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS) 72 - #define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX) 73 - #define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460) 74 - 75 - /* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */ 76 - #define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX) 77 - 78 - 79 - /** 80 - * struct clksel_rate - register bitfield values corresponding to clk divisors 81 - * @val: register bitfield value (shifted to bit 0) 82 - * @div: clock divisor corresponding to @val 83 - * @flags: (see "struct clksel_rate.flags possibilities" above) 84 - * 85 - * @val should match the value of a read from struct clk.clksel_reg 86 - * AND'ed with struct clk.clksel_mask, shifted right to bit 0. 87 - * 88 - * @div is the divisor that should be applied to the parent clock's rate 89 - * to produce the current clock's rate. 90 - */ 91 - struct clksel_rate { 92 - u32 val; 93 - u8 div; 94 - u16 flags; 95 - }; 96 - 97 - /** 98 - * struct clksel - available parent clocks, and a pointer to their divisors 99 - * @parent: struct clk * to a possible parent clock 100 - * @rates: available divisors for this parent clock 101 - * 102 - * A struct clksel is always associated with one or more struct clks 103 - * and one or more struct clksel_rates. 104 - */ 105 - struct clksel { 106 - struct clk *parent; 107 - const struct clksel_rate *rates; 108 - }; 109 - 110 - /** 111 - * struct dpll_data - DPLL registers and integration data 112 - * @mult_div1_reg: register containing the DPLL M and N bitfields 113 - * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg 114 - * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg 115 - * @clk_bypass: struct clk pointer to the clock's bypass clock input 116 - * @clk_ref: struct clk pointer to the clock's reference clock input 117 - * @control_reg: register containing the DPLL mode bitfield 118 - * @enable_mask: mask of the DPLL mode bitfield in @control_reg 119 - * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() 120 - * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() 121 - * @max_multiplier: maximum valid non-bypass multiplier value (actual) 122 - * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() 123 - * @min_divider: minimum valid non-bypass divider value (actual) 124 - * @max_divider: maximum valid non-bypass divider value (actual) 125 - * @modes: possible values of @enable_mask 126 - * @autoidle_reg: register containing the DPLL autoidle mode bitfield 127 - * @idlest_reg: register containing the DPLL idle status bitfield 128 - * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg 129 - * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg 130 - * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg 131 - * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg 132 - * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs 133 - * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs 134 - * @flags: DPLL type/features (see below) 135 - * 136 - * Possible values for @flags: 137 - * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs) 138 - * 139 - * @freqsel_mask is only used on the OMAP34xx family and AM35xx. 140 - * 141 - * XXX Some DPLLs have multiple bypass inputs, so it's not technically 142 - * correct to only have one @clk_bypass pointer. 143 - * 144 - * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m, 145 - * @last_rounded_n) should be separated from the runtime-fixed fields 146 - * and placed into a different structure, so that the runtime-fixed data 147 - * can be placed into read-only space. 148 - */ 149 - struct dpll_data { 150 - void __iomem *mult_div1_reg; 151 - u32 mult_mask; 152 - u32 div1_mask; 153 - struct clk *clk_bypass; 154 - struct clk *clk_ref; 155 - void __iomem *control_reg; 156 - u32 enable_mask; 157 - unsigned long last_rounded_rate; 158 - u16 last_rounded_m; 159 - u16 max_multiplier; 160 - u8 last_rounded_n; 161 - u8 min_divider; 162 - u16 max_divider; 163 - u8 modes; 164 - void __iomem *autoidle_reg; 165 - void __iomem *idlest_reg; 166 - u32 autoidle_mask; 167 - u32 freqsel_mask; 168 - u32 idlest_mask; 169 - u32 dco_mask; 170 - u32 sddiv_mask; 171 - u8 auto_recal_bit; 172 - u8 recal_en_bit; 173 - u8 recal_st_bit; 174 - u8 flags; 175 - }; 176 - 177 - #endif 178 - 179 - /* 180 - * struct clk.flags possibilities 181 - * 182 - * XXX document the rest of the clock flags here 183 - * 184 - * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL 185 - * bits share the same register. This flag allows the 186 - * omap4_dpllmx*() code to determine which GATE_CTRL bit field 187 - * should be used. This is a temporary solution - a better approach 188 - * would be to associate clock type-specific data with the clock, 189 - * similar to the struct dpll_data approach. 190 - */ 191 - #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ 192 - #define CLOCK_IDLE_CONTROL (1 << 1) 193 - #define CLOCK_NO_IDLE_PARENT (1 << 2) 194 - #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ 195 - #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ 196 - #define CLOCK_CLKOUTX2 (1 << 5) 197 - 198 - /** 199 - * struct clk - OMAP struct clk 200 - * @node: list_head connecting this clock into the full clock list 201 - * @ops: struct clkops * for this clock 202 - * @name: the name of the clock in the hardware (used in hwmod data and debug) 203 - * @parent: pointer to this clock's parent struct clk 204 - * @children: list_head connecting to the child clks' @sibling list_heads 205 - * @sibling: list_head connecting this clk to its parent clk's @children 206 - * @rate: current clock rate 207 - * @enable_reg: register to write to enable the clock (see @enable_bit) 208 - * @recalc: fn ptr that returns the clock's current rate 209 - * @set_rate: fn ptr that can change the clock's current rate 210 - * @round_rate: fn ptr that can round the clock's current rate 211 - * @init: fn ptr to do clock-specific initialization 212 - * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) 213 - * @usecount: number of users that have requested this clock to be enabled 214 - * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div 215 - * @flags: see "struct clk.flags possibilities" above 216 - * @clksel_reg: for clksel clks, register va containing src/divisor select 217 - * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector 218 - * @clksel: for clksel clks, pointer to struct clksel for this clock 219 - * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock 220 - * @clkdm_name: clockdomain name that this clock is contained in 221 - * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime 222 - * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) 223 - * @src_offset: bitshift for source selection bitfield (OMAP1 only) 224 - * 225 - * XXX @rate_offset, @src_offset should probably be removed and OMAP1 226 - * clock code converted to use clksel. 227 - * 228 - * XXX @usecount is poorly named. It should be "enable_count" or 229 - * something similar. "users" in the description refers to kernel 230 - * code (core code or drivers) that have called clk_enable() and not 231 - * yet called clk_disable(); the usecount of parent clocks is also 232 - * incremented by the clock code when clk_enable() is called on child 233 - * clocks and decremented by the clock code when clk_disable() is 234 - * called on child clocks. 235 - * 236 - * XXX @clkdm, @usecount, @children, @sibling should be marked for 237 - * internal use only. 238 - * 239 - * @children and @sibling are used to optimize parent-to-child clock 240 - * tree traversals. (child-to-parent traversals use @parent.) 241 - * 242 - * XXX The notion of the clock's current rate probably needs to be 243 - * separated from the clock's target rate. 244 - */ 245 - struct clk { 246 - struct list_head node; 247 - const struct clkops *ops; 248 - const char *name; 249 - struct clk *parent; 250 - struct list_head children; 251 - struct list_head sibling; /* node for children */ 252 - unsigned long rate; 253 - void __iomem *enable_reg; 254 - unsigned long (*recalc)(struct clk *); 255 - int (*set_rate)(struct clk *, unsigned long); 256 - long (*round_rate)(struct clk *, unsigned long); 257 - void (*init)(struct clk *); 258 - u8 enable_bit; 259 - s8 usecount; 260 - u8 fixed_div; 261 - u8 flags; 262 - #ifdef CONFIG_ARCH_OMAP2PLUS 263 - void __iomem *clksel_reg; 264 - u32 clksel_mask; 265 - const struct clksel *clksel; 266 - struct dpll_data *dpll_data; 267 - const char *clkdm_name; 268 - struct clockdomain *clkdm; 269 - #else 270 - u8 rate_offset; 271 - u8 src_offset; 272 - #endif 273 - #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 274 - struct dentry *dent; /* For visible tree hierarchy */ 275 - #endif 276 - }; 277 - 278 - struct clk_functions { 279 - int (*clk_enable)(struct clk *clk); 280 - void (*clk_disable)(struct clk *clk); 281 - long (*clk_round_rate)(struct clk *clk, unsigned long rate); 282 - int (*clk_set_rate)(struct clk *clk, unsigned long rate); 283 - int (*clk_set_parent)(struct clk *clk, struct clk *parent); 284 - void (*clk_allow_idle)(struct clk *clk); 285 - void (*clk_deny_idle)(struct clk *clk); 286 - void (*clk_disable_unused)(struct clk *clk); 287 - }; 288 - 289 - extern int mpurate; 290 - 291 - extern int clk_init(struct clk_functions *custom_clocks); 292 - extern void clk_preinit(struct clk *clk); 293 - extern int clk_register(struct clk *clk); 294 - extern void clk_reparent(struct clk *child, struct clk *parent); 295 - extern void clk_unregister(struct clk *clk); 296 - extern void propagate_rate(struct clk *clk); 297 - extern void recalculate_root_clocks(void); 298 - extern unsigned long followparent_recalc(struct clk *clk); 299 - extern void clk_enable_init_clocks(void); 300 - unsigned long omap_fixed_divisor_recalc(struct clk *clk); 301 - extern struct clk *omap_clk_get_by_name(const char *name); 302 - extern int omap_clk_enable_autoidle_all(void); 303 - extern int omap_clk_disable_autoidle_all(void); 304 - 305 - extern const struct clkops clkops_null; 306 - 307 - extern struct clk dummy_ck; 308 - 309 - #endif