Commit 19be2ea2ef41300fd720b229caa764d70de48297
Committed by
Tom Rini
1 parent
28920b1fd2
Exists in
master
and in
55 other branches
make ide_led() a weak alias
Make ide_led() a weak alias instead of global/local function/empty macro based on CONFIG_IDE_LED value and/or board-specific CONFIGs, to get rid of board-specific code in cmd_ide.c Define dummy values to get rid of compoler errors in case where ide_led() used to be an empty macro Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Showing 1 changed file with 27 additions and 36 deletions Side-by-side Diff
common/cmd_ide.c
... | ... | @@ -81,19 +81,6 @@ |
81 | 81 | block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE]; |
82 | 82 | /* ------------------------------------------------------------------------- */ |
83 | 83 | |
84 | -#ifdef CONFIG_IDE_LED | |
85 | -# if !defined(CONFIG_BMS2003) && \ | |
86 | - !defined(CONFIG_CPC45) && \ | |
87 | - !defined(CONFIG_KUP4K) && \ | |
88 | - !defined(CONFIG_KUP4X) | |
89 | -static void ide_led (uchar led, uchar status); | |
90 | -#else | |
91 | -extern void ide_led (uchar led, uchar status); | |
92 | -#endif | |
93 | -#else | |
94 | -#define ide_led(a,b) /* dummy */ | |
95 | -#endif | |
96 | - | |
97 | 84 | #ifdef CONFIG_IDE_RESET |
98 | 85 | static void ide_reset (void); |
99 | 86 | #else |
... | ... | @@ -290,6 +277,33 @@ |
290 | 277 | |
291 | 278 | /* ------------------------------------------------------------------------- */ |
292 | 279 | |
280 | +void __ide_led(uchar led, uchar status) | |
281 | +{ | |
282 | +#if defined(CONFIG_IDE_LED) && defined(PER8_BASE) /* required by LED_PORT */ | |
283 | + static uchar led_buffer; /* Buffer for current LED status */ | |
284 | + | |
285 | + uchar *led_port = LED_PORT; | |
286 | + | |
287 | + if (status) /* switch LED on */ | |
288 | + led_buffer |= led; | |
289 | + else /* switch LED off */ | |
290 | + led_buffer &= ~led; | |
291 | + | |
292 | + *led_port = led_buffer; | |
293 | +#endif | |
294 | +} | |
295 | + | |
296 | +void ide_led(uchar led, uchar status) | |
297 | + __attribute__ ((weak, alias("__ide_led"))); | |
298 | + | |
299 | +#ifndef CONFIG_IDE_LED /* define LED macros, they are not used anyways */ | |
300 | +# define DEVICE_LED(x) 0 | |
301 | +# define LED_IDE1 1 | |
302 | +# define LED_IDE2 2 | |
303 | +#endif | |
304 | + | |
305 | +/* ------------------------------------------------------------------------- */ | |
306 | + | |
293 | 307 | inline void __ide_outb(int dev, int port, unsigned char val) |
294 | 308 | { |
295 | 309 | debug("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n", |
296 | 310 | |
... | ... | @@ -442,9 +456,7 @@ |
442 | 456 | |
443 | 457 | curr_device = -1; |
444 | 458 | for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i) { |
445 | -#ifdef CONFIG_IDE_LED | |
446 | 459 | int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2; |
447 | -#endif | |
448 | 460 | ide_dev_desc[i].type = DEV_TYPE_UNKNOWN; |
449 | 461 | ide_dev_desc[i].if_type = IF_TYPE_IDE; |
450 | 462 | ide_dev_desc[i].dev = i; |
... | ... | @@ -1144,27 +1156,6 @@ |
1144 | 1156 | #endif /* CONFIG_IDE_RESET */ |
1145 | 1157 | |
1146 | 1158 | /* ------------------------------------------------------------------------- */ |
1147 | - | |
1148 | -#if defined(CONFIG_IDE_LED) && \ | |
1149 | - !defined(CONFIG_CPC45) && \ | |
1150 | - !defined(CONFIG_KUP4K) && \ | |
1151 | - !defined(CONFIG_KUP4X) | |
1152 | - | |
1153 | -static uchar led_buffer; /* Buffer for current LED status */ | |
1154 | - | |
1155 | -static void ide_led(uchar led, uchar status) | |
1156 | -{ | |
1157 | - uchar *led_port = LED_PORT; | |
1158 | - | |
1159 | - if (status) /* switch LED on */ | |
1160 | - led_buffer |= led; | |
1161 | - else /* switch LED off */ | |
1162 | - led_buffer &= ~led; | |
1163 | - | |
1164 | - *led_port = led_buffer; | |
1165 | -} | |
1166 | - | |
1167 | -#endif /* CONFIG_IDE_LED */ | |
1168 | 1159 | |
1169 | 1160 | #if defined(CONFIG_OF_IDE_FIXUP) |
1170 | 1161 | int ide_device_present(int dev) |