Commit 19be2ea2ef41300fd720b229caa764d70de48297

Authored by Pavel Herrmann
Committed by Tom Rini
1 parent 28920b1fd2
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

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

... ... @@ -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)