diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/geode_32.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/mfgpt_32.c | 39 |
2 files changed, 28 insertions, 16 deletions
diff --git a/arch/x86/kernel/geode_32.c b/arch/x86/kernel/geode_32.c index 9c7f7d395968..9dad6ca6cd70 100644 --- a/arch/x86/kernel/geode_32.c +++ b/arch/x86/kernel/geode_32.c | |||
@@ -163,14 +163,11 @@ EXPORT_SYMBOL_GPL(geode_gpio_setup_event); | |||
163 | 163 | ||
164 | static int __init geode_southbridge_init(void) | 164 | static int __init geode_southbridge_init(void) |
165 | { | 165 | { |
166 | int timers; | ||
167 | |||
168 | if (!is_geode()) | 166 | if (!is_geode()) |
169 | return -ENODEV; | 167 | return -ENODEV; |
170 | 168 | ||
171 | init_lbars(); | 169 | init_lbars(); |
172 | timers = geode_mfgpt_detect(); | 170 | (void) mfgpt_timer_setup(); |
173 | printk(KERN_INFO "geode: %d MFGPT timers available.\n", timers); | ||
174 | return 0; | 171 | return 0; |
175 | } | 172 | } |
176 | 173 | ||
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c index 5cf3a839530c..abdb7c71199a 100644 --- a/arch/x86/kernel/mfgpt_32.c +++ b/arch/x86/kernel/mfgpt_32.c | |||
@@ -74,28 +74,37 @@ __setup("mfgptfix", mfgpt_fix); | |||
74 | * In other cases (such as with VSAless OpenFirmware), the system firmware | 74 | * In other cases (such as with VSAless OpenFirmware), the system firmware |
75 | * leaves timers available for us to use. | 75 | * leaves timers available for us to use. |
76 | */ | 76 | */ |
77 | int __init geode_mfgpt_detect(void) | 77 | |
78 | |||
79 | static int timers = -1; | ||
80 | |||
81 | static void geode_mfgpt_detect(void) | ||
78 | { | 82 | { |
79 | int count = 0, i; | 83 | int i; |
80 | u16 val; | 84 | u16 val; |
81 | 85 | ||
86 | timers = 0; | ||
87 | |||
82 | if (disable) { | 88 | if (disable) { |
83 | printk(KERN_INFO "geode-mfgpt: Skipping MFGPT setup\n"); | 89 | printk(KERN_INFO "geode-mfgpt: MFGPT support is disabled\n"); |
84 | return 0; | 90 | goto done; |
91 | } | ||
92 | |||
93 | if (!geode_get_dev_base(GEODE_DEV_MFGPT)) { | ||
94 | printk(KERN_INFO "geode-mfgpt: MFGPT LBAR is not set up\n"); | ||
95 | goto done; | ||
85 | } | 96 | } |
86 | 97 | ||
87 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { | 98 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { |
88 | val = geode_mfgpt_read(i, MFGPT_REG_SETUP); | 99 | val = geode_mfgpt_read(i, MFGPT_REG_SETUP); |
89 | if (!(val & MFGPT_SETUP_SETUP)) { | 100 | if (!(val & MFGPT_SETUP_SETUP)) { |
90 | mfgpt_timers[i].avail = 1; | 101 | mfgpt_timers[i].avail = 1; |
91 | count++; | 102 | timers++; |
92 | } | 103 | } |
93 | } | 104 | } |
94 | 105 | ||
95 | /* set up clock event device, if desired */ | 106 | done: |
96 | i = mfgpt_timer_setup(); | 107 | printk(KERN_INFO "geode-mfgpt: %d MFGPT timers available.\n", timers); |
97 | |||
98 | return count; | ||
99 | } | 108 | } |
100 | 109 | ||
101 | int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) | 110 | int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) |
@@ -183,10 +192,16 @@ int geode_mfgpt_alloc_timer(int timer, int domain) | |||
183 | { | 192 | { |
184 | int i; | 193 | int i; |
185 | 194 | ||
186 | if (!geode_get_dev_base(GEODE_DEV_MFGPT)) | 195 | if (timers == -1) { |
187 | return -ENODEV; | 196 | /* timers haven't been detected yet */ |
197 | geode_mfgpt_detect(); | ||
198 | } | ||
199 | |||
200 | if (!timers) | ||
201 | return -1; | ||
202 | |||
188 | if (timer >= MFGPT_MAX_TIMERS) | 203 | if (timer >= MFGPT_MAX_TIMERS) |
189 | return -EIO; | 204 | return -1; |
190 | 205 | ||
191 | if (timer < 0) { | 206 | if (timer < 0) { |
192 | /* Try to find an available timer */ | 207 | /* Try to find an available timer */ |