aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/clock.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-01-18 18:03:15 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 12:50:13 -0500
commitd7e8f1f9d655af2c7ea90738bf567aa6990159b3 (patch)
tree6ee9ce41a078c8f6501236c258a52ca0ed8c355d /arch/arm/mach-omap1/clock.c
parentdbb674d57b5851a4fe3122ff4280e4cf87209198 (diff)
[ARM] omap: convert OMAP1 to use clkdev
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/clock.c')
-rw-r--r--arch/arm/mach-omap1/clock.c117
1 files changed, 94 insertions, 23 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 6b17da120e5f..829b9b845b85 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -20,6 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/clkdev.h>
23 24
24#include <mach/cpu.h> 25#include <mach/cpu.h>
25#include <mach/usb.h> 26#include <mach/usb.h>
@@ -32,6 +33,83 @@ static const struct clkops clkops_dspck;
32 33
33#include "clock.h" 34#include "clock.h"
34 35
36struct omap_clk {
37 u32 cpu;
38 struct clk_lookup lk;
39};
40
41#define CLK(dev, con, ck, cp) \
42 { \
43 .cpu = cp, \
44 .lk = { \
45 .dev_id = dev, \
46 .con_id = con, \
47 .clk = ck, \
48 }, \
49 }
50
51#define CK_310 (1 << 0)
52#define CK_730 (1 << 1)
53#define CK_1510 (1 << 2)
54#define CK_16XX (1 << 3)
55
56static struct omap_clk omap_clks[] = {
57 /* non-ULPD clocks */
58 CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310),
59 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310),
60 /* CK_GEN1 clocks */
61 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
62 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
63 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
64 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
65 CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
66 CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
67 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
68 CLK(NULL, "armwdt_ck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
69 CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310),
70 CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),
71 /* CK_GEN2 clocks */
72 CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310),
73 CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310),
74 CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310),
75 CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
76 CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310),
77 /* CK_GEN3 clocks */
78 CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_730),
79 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
80 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX),
81 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
82 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
83 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
84 CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
85 CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310),
86 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
87 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
88 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
89 CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_730),
90 CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310),
91 /* ULPD clocks */
92 CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310),
93 CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX),
94 CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310),
95 CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310),
96 CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX),
97 CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
98 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
99 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
100 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX),
101 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
102 CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
103 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
104 CLK(NULL, "bclk", &bclk_16xx, CK_16XX),
105 CLK("mmci-omap.0", "mmc_ck", &mmc1_ck, CK_16XX | CK_1510 | CK_310),
106 CLK("mmci-omap.1", "mmc_ck", &mmc2_ck, CK_16XX),
107 /* Virtual clocks */
108 CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
109 CLK("i2c_omap.1", "i2c_fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
110 CLK("i2c_omap.1", "i2c_ick", &i2c_ick, CK_16XX),
111};
112
35static int omap1_clk_enable_generic(struct clk * clk); 113static int omap1_clk_enable_generic(struct clk * clk);
36static int omap1_clk_enable(struct clk *clk); 114static int omap1_clk_enable(struct clk *clk);
37static void omap1_clk_disable_generic(struct clk * clk); 115static void omap1_clk_disable_generic(struct clk * clk);
@@ -677,10 +755,10 @@ static struct clk_functions omap1_clk_functions = {
677 755
678int __init omap1_clk_init(void) 756int __init omap1_clk_init(void)
679{ 757{
680 struct clk ** clkp; 758 struct omap_clk *c;
681 const struct omap_clock_config *info; 759 const struct omap_clock_config *info;
682 int crystal_type = 0; /* Default 12 MHz */ 760 int crystal_type = 0; /* Default 12 MHz */
683 u32 reg; 761 u32 reg, cpu_mask;
684 762
685#ifdef CONFIG_DEBUG_LL 763#ifdef CONFIG_DEBUG_LL
686 /* Resets some clocks that may be left on from bootloader, 764 /* Resets some clocks that may be left on from bootloader,
@@ -700,27 +778,21 @@ int __init omap1_clk_init(void)
700 /* By default all idlect1 clocks are allowed to idle */ 778 /* By default all idlect1 clocks are allowed to idle */
701 arm_idlect1_mask = ~0; 779 arm_idlect1_mask = ~0;
702 780
703 for (clkp = onchip_clks; clkp < onchip_clks+ARRAY_SIZE(onchip_clks); clkp++) { 781 cpu_mask = 0;
704 if (((*clkp)->flags &CLOCK_IN_OMAP1510) && cpu_is_omap1510()) { 782 if (cpu_is_omap16xx())
705 clk_register(*clkp); 783 cpu_mask |= CK_16XX;
706 continue; 784 if (cpu_is_omap1510())
707 } 785 cpu_mask |= CK_1510;
708 786 if (cpu_is_omap730())
709 if (((*clkp)->flags &CLOCK_IN_OMAP16XX) && cpu_is_omap16xx()) { 787 cpu_mask |= CK_730;
710 clk_register(*clkp); 788 if (cpu_is_omap310())
711 continue; 789 cpu_mask |= CK_310;
712 } 790
713 791 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
714 if (((*clkp)->flags &CLOCK_IN_OMAP730) && cpu_is_omap730()) { 792 if (c->cpu & cpu_mask) {
715 clk_register(*clkp); 793 clkdev_add(&c->lk);
716 continue; 794 clk_register(c->lk.clk);
717 }
718
719 if (((*clkp)->flags &CLOCK_IN_OMAP310) && cpu_is_omap310()) {
720 clk_register(*clkp);
721 continue;
722 } 795 }
723 }
724 796
725 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config); 797 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
726 if (info != NULL) { 798 if (info != NULL) {
@@ -831,4 +903,3 @@ int __init omap1_clk_init(void)
831 903
832 return 0; 904 return 0;
833} 905}
834