diff options
Diffstat (limited to 'arch/arm/mach-omap2/clock.h')
-rw-r--r-- | arch/arm/mach-omap2/clock.h | 221 |
1 files changed, 1 insertions, 220 deletions
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index baeaff229506..9917f793c3b6 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
21 | 21 | ||
22 | #include <linux/clkdev.h> | 22 | #include <linux/clkdev.h> |
23 | #include <linux/clk-provider.h> | ||
23 | 24 | ||
24 | struct omap_clk { | 25 | struct omap_clk { |
25 | u16 cpu; | 26 | u16 cpu; |
@@ -52,9 +53,6 @@ struct omap_clk { | |||
52 | #define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) | 53 | #define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) |
53 | #define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX) | 54 | #define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX) |
54 | 55 | ||
55 | #ifdef CONFIG_COMMON_CLK | ||
56 | #include <linux/clk-provider.h> | ||
57 | |||
58 | struct clockdomain; | 56 | struct clockdomain; |
59 | #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) | 57 | #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) |
60 | 58 | ||
@@ -134,48 +132,6 @@ struct clockdomain; | |||
134 | }; \ | 132 | }; \ |
135 | DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops); | 133 | DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops); |
136 | 134 | ||
137 | |||
138 | #else | ||
139 | |||
140 | struct module; | ||
141 | struct clk; | ||
142 | struct clockdomain; | ||
143 | |||
144 | /* Temporary, needed during the common clock framework conversion */ | ||
145 | #define __clk_get_name(clk) (clk->name) | ||
146 | #define __clk_get_parent(clk) (clk->parent) | ||
147 | #define __clk_get_rate(clk) (clk->rate) | ||
148 | |||
149 | /** | ||
150 | * struct clkops - some clock function pointers | ||
151 | * @enable: fn ptr that enables the current clock in hardware | ||
152 | * @disable: fn ptr that enables the current clock in hardware | ||
153 | * @find_idlest: function returning the IDLEST register for the clock's IP blk | ||
154 | * @find_companion: function returning the "companion" clk reg for the clock | ||
155 | * @allow_idle: fn ptr that enables autoidle for the current clock in hardware | ||
156 | * @deny_idle: fn ptr that disables autoidle for the current clock in hardware | ||
157 | * | ||
158 | * A "companion" clk is an accompanying clock to the one being queried | ||
159 | * that must be enabled for the IP module connected to the clock to | ||
160 | * become accessible by the hardware. Neither @find_idlest nor | ||
161 | * @find_companion should be needed; that information is IP | ||
162 | * block-specific; the hwmod code has been created to handle this, but | ||
163 | * until hwmod data is ready and drivers have been converted to use PM | ||
164 | * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and | ||
165 | * @find_companion must, unfortunately, remain. | ||
166 | */ | ||
167 | struct clkops { | ||
168 | int (*enable)(struct clk *); | ||
169 | void (*disable)(struct clk *); | ||
170 | void (*find_idlest)(struct clk *, void __iomem **, | ||
171 | u8 *, u8 *); | ||
172 | void (*find_companion)(struct clk *, void __iomem **, | ||
173 | u8 *); | ||
174 | void (*allow_idle)(struct clk *); | ||
175 | void (*deny_idle)(struct clk *); | ||
176 | }; | ||
177 | #endif | ||
178 | |||
179 | /* struct clksel_rate.flags possibilities */ | 135 | /* struct clksel_rate.flags possibilities */ |
180 | #define RATE_IN_242X (1 << 0) | 136 | #define RATE_IN_242X (1 << 0) |
181 | #define RATE_IN_243X (1 << 1) | 137 | #define RATE_IN_243X (1 << 1) |
@@ -314,7 +270,6 @@ struct dpll_data { | |||
314 | #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ | 270 | #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ |
315 | #define CLOCK_CLKOUTX2 (1 << 5) | 271 | #define CLOCK_CLKOUTX2 (1 << 5) |
316 | 272 | ||
317 | #ifdef CONFIG_COMMON_CLK | ||
318 | /** | 273 | /** |
319 | * struct clk_hw_omap - OMAP struct clk | 274 | * struct clk_hw_omap - OMAP struct clk |
320 | * @node: list_head connecting this clock into the full clock list | 275 | * @node: list_head connecting this clock into the full clock list |
@@ -367,114 +322,6 @@ struct clk_hw_omap_ops { | |||
367 | 322 | ||
368 | unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw, | 323 | unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw, |
369 | unsigned long parent_rate); | 324 | unsigned long parent_rate); |
370 | #else | ||
371 | /** | ||
372 | * struct clk - OMAP struct clk | ||
373 | * @node: list_head connecting this clock into the full clock list | ||
374 | * @ops: struct clkops * for this clock | ||
375 | * @name: the name of the clock in the hardware (used in hwmod data and debug) | ||
376 | * @parent: pointer to this clock's parent struct clk | ||
377 | * @children: list_head connecting to the child clks' @sibling list_heads | ||
378 | * @sibling: list_head connecting this clk to its parent clk's @children | ||
379 | * @rate: current clock rate | ||
380 | * @enable_reg: register to write to enable the clock (see @enable_bit) | ||
381 | * @recalc: fn ptr that returns the clock's current rate | ||
382 | * @set_rate: fn ptr that can change the clock's current rate | ||
383 | * @round_rate: fn ptr that can round the clock's current rate | ||
384 | * @init: fn ptr to do clock-specific initialization | ||
385 | * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) | ||
386 | * @usecount: number of users that have requested this clock to be enabled | ||
387 | * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div | ||
388 | * @flags: see "struct clk.flags possibilities" above | ||
389 | * @clksel_reg: for clksel clks, register va containing src/divisor select | ||
390 | * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector | ||
391 | * @clksel: for clksel clks, pointer to struct clksel for this clock | ||
392 | * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock | ||
393 | * @clkdm_name: clockdomain name that this clock is contained in | ||
394 | * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime | ||
395 | * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) | ||
396 | * @src_offset: bitshift for source selection bitfield (OMAP1 only) | ||
397 | * | ||
398 | * XXX @rate_offset, @src_offset should probably be removed and OMAP1 | ||
399 | * clock code converted to use clksel. | ||
400 | * | ||
401 | * XXX @usecount is poorly named. It should be "enable_count" or | ||
402 | * something similar. "users" in the description refers to kernel | ||
403 | * code (core code or drivers) that have called clk_enable() and not | ||
404 | * yet called clk_disable(); the usecount of parent clocks is also | ||
405 | * incremented by the clock code when clk_enable() is called on child | ||
406 | * clocks and decremented by the clock code when clk_disable() is | ||
407 | * called on child clocks. | ||
408 | * | ||
409 | * XXX @clkdm, @usecount, @children, @sibling should be marked for | ||
410 | * internal use only. | ||
411 | * | ||
412 | * @children and @sibling are used to optimize parent-to-child clock | ||
413 | * tree traversals. (child-to-parent traversals use @parent.) | ||
414 | * | ||
415 | * XXX The notion of the clock's current rate probably needs to be | ||
416 | * separated from the clock's target rate. | ||
417 | */ | ||
418 | struct clk { | ||
419 | struct list_head node; | ||
420 | const struct clkops *ops; | ||
421 | const char *name; | ||
422 | struct clk *parent; | ||
423 | struct list_head children; | ||
424 | struct list_head sibling; /* node for children */ | ||
425 | unsigned long rate; | ||
426 | void __iomem *enable_reg; | ||
427 | unsigned long (*recalc)(struct clk *); | ||
428 | int (*set_rate)(struct clk *, unsigned long); | ||
429 | long (*round_rate)(struct clk *, unsigned long); | ||
430 | void (*init)(struct clk *); | ||
431 | u8 enable_bit; | ||
432 | s8 usecount; | ||
433 | u8 fixed_div; | ||
434 | u8 flags; | ||
435 | void __iomem *clksel_reg; | ||
436 | u32 clksel_mask; | ||
437 | const struct clksel *clksel; | ||
438 | struct dpll_data *dpll_data; | ||
439 | const char *clkdm_name; | ||
440 | struct clockdomain *clkdm; | ||
441 | #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) | ||
442 | struct dentry *dent; /* For visible tree hierarchy */ | ||
443 | #endif | ||
444 | }; | ||
445 | |||
446 | struct clk_functions { | ||
447 | int (*clk_enable)(struct clk *clk); | ||
448 | void (*clk_disable)(struct clk *clk); | ||
449 | long (*clk_round_rate)(struct clk *clk, unsigned long rate); | ||
450 | int (*clk_set_rate)(struct clk *clk, unsigned long rate); | ||
451 | int (*clk_set_parent)(struct clk *clk, struct clk *parent); | ||
452 | void (*clk_allow_idle)(struct clk *clk); | ||
453 | void (*clk_deny_idle)(struct clk *clk); | ||
454 | void (*clk_disable_unused)(struct clk *clk); | ||
455 | }; | ||
456 | |||
457 | extern int mpurate; | ||
458 | |||
459 | extern int clk_init(struct clk_functions *custom_clocks); | ||
460 | extern void clk_preinit(struct clk *clk); | ||
461 | extern int clk_register(struct clk *clk); | ||
462 | extern void clk_reparent(struct clk *child, struct clk *parent); | ||
463 | extern void clk_unregister(struct clk *clk); | ||
464 | extern void propagate_rate(struct clk *clk); | ||
465 | extern void recalculate_root_clocks(void); | ||
466 | extern unsigned long followparent_recalc(struct clk *clk); | ||
467 | extern void clk_enable_init_clocks(void); | ||
468 | unsigned long omap_fixed_divisor_recalc(struct clk *clk); | ||
469 | extern struct clk *omap_clk_get_by_name(const char *name); | ||
470 | extern int omap_clk_enable_autoidle_all(void); | ||
471 | extern int omap_clk_disable_autoidle_all(void); | ||
472 | |||
473 | extern const struct clkops clkops_null; | ||
474 | |||
475 | extern struct clk dummy_ck; | ||
476 | |||
477 | #endif /* CONFIG_COMMON_CLK */ | ||
478 | 325 | ||
479 | /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ | 326 | /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ |
480 | #define CORE_CLK_SRC_32K 0x0 | 327 | #define CORE_CLK_SRC_32K 0x0 |
@@ -505,15 +352,6 @@ extern struct clk dummy_ck; | |||
505 | /* DPLL Type and DCO Selection Flags */ | 352 | /* DPLL Type and DCO Selection Flags */ |
506 | #define DPLL_J_TYPE 0x1 | 353 | #define DPLL_J_TYPE 0x1 |
507 | 354 | ||
508 | #ifndef CONFIG_COMMON_CLK | ||
509 | int omap2_clk_enable(struct clk *clk); | ||
510 | void omap2_clk_disable(struct clk *clk); | ||
511 | long omap2_clk_round_rate(struct clk *clk, unsigned long rate); | ||
512 | int omap2_clk_set_rate(struct clk *clk, unsigned long rate); | ||
513 | int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); | ||
514 | #endif /* CONFIG_COMMON_CLK */ | ||
515 | |||
516 | #ifdef CONFIG_COMMON_CLK | ||
517 | long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, | 355 | long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, |
518 | unsigned long *parent_rate); | 356 | unsigned long *parent_rate); |
519 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate); | 357 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate); |
@@ -534,37 +372,11 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw, | |||
534 | long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, | 372 | long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, |
535 | unsigned long target_rate, | 373 | unsigned long target_rate, |
536 | unsigned long *parent_rate); | 374 | unsigned long *parent_rate); |
537 | #else | ||
538 | long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); | ||
539 | unsigned long omap3_dpll_recalc(struct clk *clk); | ||
540 | unsigned long omap3_clkoutx2_recalc(struct clk *clk); | ||
541 | void omap3_dpll_allow_idle(struct clk *clk); | ||
542 | void omap3_dpll_deny_idle(struct clk *clk); | ||
543 | u32 omap3_dpll_autoidle_read(struct clk *clk); | ||
544 | int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); | ||
545 | int omap3_noncore_dpll_enable(struct clk *clk); | ||
546 | void omap3_noncore_dpll_disable(struct clk *clk); | ||
547 | int omap4_dpllmx_gatectrl_read(struct clk *clk); | ||
548 | void omap4_dpllmx_allow_gatectrl(struct clk *clk); | ||
549 | void omap4_dpllmx_deny_gatectrl(struct clk *clk); | ||
550 | long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate); | ||
551 | unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk); | ||
552 | #endif | ||
553 | 375 | ||
554 | #ifdef CONFIG_OMAP_RESET_CLOCKS | ||
555 | void omap2_clk_disable_unused(struct clk *clk); | ||
556 | #else | ||
557 | #define omap2_clk_disable_unused NULL | ||
558 | #endif | ||
559 | #ifdef CONFIG_COMMON_CLK | ||
560 | void omap2_init_clk_clkdm(struct clk_hw *clk); | 376 | void omap2_init_clk_clkdm(struct clk_hw *clk); |
561 | #else | ||
562 | void omap2_init_clk_clkdm(struct clk *clk); | ||
563 | #endif | ||
564 | void __init omap2_clk_disable_clkdm_control(void); | 377 | void __init omap2_clk_disable_clkdm_control(void); |
565 | 378 | ||
566 | /* clkt_clksel.c public functions */ | 379 | /* clkt_clksel.c public functions */ |
567 | #ifdef CONFIG_COMMON_CLK | ||
568 | u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk, | 380 | u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk, |
569 | unsigned long target_rate, | 381 | unsigned long target_rate, |
570 | u32 *new_div); | 382 | u32 *new_div); |
@@ -575,29 +387,14 @@ long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate, | |||
575 | int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate, | 387 | int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate, |
576 | unsigned long parent_rate); | 388 | unsigned long parent_rate); |
577 | int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val); | 389 | int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val); |
578 | #else | ||
579 | u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, | ||
580 | u32 *new_div); | ||
581 | void omap2_init_clksel_parent(struct clk *clk); | ||
582 | unsigned long omap2_clksel_recalc(struct clk *clk); | ||
583 | long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); | ||
584 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); | ||
585 | int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); | ||
586 | #endif | ||
587 | 390 | ||
588 | /* clkt_iclk.c public functions */ | 391 | /* clkt_iclk.c public functions */ |
589 | extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk); | 392 | extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk); |
590 | extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk); | 393 | extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk); |
591 | 394 | ||
592 | #ifdef CONFIG_COMMON_CLK | ||
593 | u8 omap2_init_dpll_parent(struct clk_hw *hw); | 395 | u8 omap2_init_dpll_parent(struct clk_hw *hw); |
594 | unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk); | 396 | unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk); |
595 | #else | ||
596 | u32 omap2_get_dpll_rate(struct clk *clk); | ||
597 | void omap2_init_dpll_parent(struct clk *clk); | ||
598 | #endif | ||
599 | 397 | ||
600 | #ifdef CONFIG_COMMON_CLK | ||
601 | int omap2_dflt_clk_enable(struct clk_hw *hw); | 398 | int omap2_dflt_clk_enable(struct clk_hw *hw); |
602 | void omap2_dflt_clk_disable(struct clk_hw *hw); | 399 | void omap2_dflt_clk_disable(struct clk_hw *hw); |
603 | int omap2_dflt_clk_is_enabled(struct clk_hw *hw); | 400 | int omap2_dflt_clk_is_enabled(struct clk_hw *hw); |
@@ -611,14 +408,6 @@ void omap2_init_clk_hw_omap_clocks(struct clk *clk); | |||
611 | int omap2_clk_enable_autoidle_all(void); | 408 | int omap2_clk_enable_autoidle_all(void); |
612 | int omap2_clk_disable_autoidle_all(void); | 409 | int omap2_clk_disable_autoidle_all(void); |
613 | void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); | 410 | void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); |
614 | #else | ||
615 | int omap2_dflt_clk_enable(struct clk *clk); | ||
616 | void omap2_dflt_clk_disable(struct clk *clk); | ||
617 | void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, | ||
618 | u8 *other_bit); | ||
619 | void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, | ||
620 | u8 *idlest_bit, u8 *idlest_val); | ||
621 | #endif | ||
622 | int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); | 411 | int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); |
623 | void omap2_clk_print_new_rates(const char *hfclkin_ck_name, | 412 | void omap2_clk_print_new_rates(const char *hfclkin_ck_name, |
624 | const char *core_ck_name, | 413 | const char *core_ck_name, |
@@ -665,17 +454,9 @@ extern const struct clksel_rate div_1_3_rates[]; | |||
665 | extern const struct clksel_rate div_1_4_rates[]; | 454 | extern const struct clksel_rate div_1_4_rates[]; |
666 | extern const struct clksel_rate div31_1to31_rates[]; | 455 | extern const struct clksel_rate div31_1to31_rates[]; |
667 | 456 | ||
668 | #ifndef CONFIG_COMMON_CLK | ||
669 | /* clocks shared between various OMAP SoCs */ | ||
670 | extern struct clk virt_19200000_ck; | ||
671 | extern struct clk virt_26000000_ck; | ||
672 | #endif | ||
673 | |||
674 | extern int am33xx_clk_init(void); | 457 | extern int am33xx_clk_init(void); |
675 | 458 | ||
676 | #ifdef CONFIG_COMMON_CLK | ||
677 | extern int omap2_clkops_enable_clkdm(struct clk_hw *hw); | 459 | extern int omap2_clkops_enable_clkdm(struct clk_hw *hw); |
678 | extern void omap2_clkops_disable_clkdm(struct clk_hw *hw); | 460 | extern void omap2_clkops_disable_clkdm(struct clk_hw *hw); |
679 | #endif | ||
680 | 461 | ||
681 | #endif | 462 | #endif |