diff options
author | Alex Raimondi <raimondi@miromico.ch> | 2008-09-22 15:40:55 -0400 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-10-05 13:33:48 -0400 |
commit | 300bb762513f12068bf6166e0a1a02a4031a979c (patch) | |
tree | bfebd28b2753936a7009cda2559265364f65783c /arch/avr32/mach-at32ap/at32ap700x.c | |
parent | 787928e7473246991177e8cd7eeaf4cb1b3a8fbc (diff) |
avr32: Replace static clock list with dynamic linked list
This replaces the at32_clock_list array with a linked list.
Clocks can now be registered (added) to the list.
Signed-off-by: Alex Raimondi <raimondi@miromico.ch>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index c28dd172f627..fd306c49194b 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -2028,7 +2028,7 @@ static struct clk gclk4 = { | |||
2028 | .index = 4, | 2028 | .index = 4, |
2029 | }; | 2029 | }; |
2030 | 2030 | ||
2031 | struct clk *at32_clock_list[] = { | 2031 | static __initdata struct clk *init_clocks[] = { |
2032 | &osc32k, | 2032 | &osc32k, |
2033 | &osc0, | 2033 | &osc0, |
2034 | &osc1, | 2034 | &osc1, |
@@ -2092,7 +2092,6 @@ struct clk *at32_clock_list[] = { | |||
2092 | &gclk3, | 2092 | &gclk3, |
2093 | &gclk4, | 2093 | &gclk4, |
2094 | }; | 2094 | }; |
2095 | unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list); | ||
2096 | 2095 | ||
2097 | void __init setup_platform(void) | 2096 | void __init setup_platform(void) |
2098 | { | 2097 | { |
@@ -2123,14 +2122,19 @@ void __init setup_platform(void) | |||
2123 | genclk_init_parent(&abdac0_sample_clk); | 2122 | genclk_init_parent(&abdac0_sample_clk); |
2124 | 2123 | ||
2125 | /* | 2124 | /* |
2126 | * Turn on all clocks that have at least one user already, and | 2125 | * Build initial dynamic clock list by registering all clocks |
2127 | * turn off everything else. We only do this for module | 2126 | * from the array. |
2128 | * clocks, and even though it isn't particularly pretty to | 2127 | * At the same time, turn on all clocks that have at least one |
2129 | * check the address of the mode function, it should do the | 2128 | * user already, and turn off everything else. We only do this |
2130 | * trick... | 2129 | * for module clocks, and even though it isn't particularly |
2130 | * pretty to check the address of the mode function, it should | ||
2131 | * do the trick... | ||
2131 | */ | 2132 | */ |
2132 | for (i = 0; i < ARRAY_SIZE(at32_clock_list); i++) { | 2133 | for (i = 0; i < ARRAY_SIZE(init_clocks); i++) { |
2133 | struct clk *clk = at32_clock_list[i]; | 2134 | struct clk *clk = init_clocks[i]; |
2135 | |||
2136 | /* first, register clock */ | ||
2137 | at32_clk_register(clk); | ||
2134 | 2138 | ||
2135 | if (clk->users == 0) | 2139 | if (clk->users == 0) |
2136 | continue; | 2140 | continue; |