[U-Boot-Users] [PATCH] cmd_ide.c, ifdef code only needed by 8xx_direct

A big chunk of code in cmd_ide.c is only valid for boards that set CONFIG_IDE_8xx_DIRECT That makes it harder than neccesary to follow the flow since alot of calculations/variables are pointless.
* Patch by Thomas Lange, 10 Oct 2003: code only needed by CONFIG_IDE_8xx_DIRECT ifdef:ed
/Thomas
--- u-boot-0.4.8/common/cmd_ide.c 2003-07-01 23:07:07.000000000 +0200 +++ u-boot-0.4.8_new/common/cmd_ide.c 2003-10-09 00:02:42.000000000 +0200 @@ -65,6 +65,7 @@
#if (CONFIG_COMMANDS & CFG_CMD_IDE)
+#ifdef CONFIG_IDE_8xx_DIRECT /* Timings for IDE Interface * * SETUP / LENGTH / HOLD - cycles valid for 50 MHz clk @@ -101,6 +102,8 @@ static int pio_mode = CFG_PIO_MODE;
#define PCMCIA_MK_CLKS( t, T ) (( (t) * (T) + 999U ) / 1000U )
+#endif /* CONFIG_IDE_8xx_DIRECT */ + /* ------------------------------------------------------------------------- */
/* Current I/O Device */ @@ -180,8 +183,6 @@ ulong atapi_read (int device, ulong blkn
#ifdef CONFIG_IDE_8xx_DIRECT static void set_pcmcia_timing (int pmode); -#else -#define set_pcmcia_timing(a) /* dummy */ #endif
/* ------------------------------------------------------------------------- */ @@ -472,9 +473,8 @@ int do_diskboot (cmd_tbl_t *cmdtp, int f
void ide_init (void) { - DECLARE_GLOBAL_DATA_PTR; - #ifdef CONFIG_IDE_8xx_DIRECT + DECLARE_GLOBAL_DATA_PTR; volatile immap_t *immr = (immap_t *)CFG_IMMR; volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia); #endif @@ -502,6 +502,7 @@ void ide_init (void)
WATCHDOG_RESET();
+#ifdef CONFIG_IDE_8xx_DIRECT /* Initialize PIO timing tables */ for (i=0; i <= IDE_MAX_PIO_MODE; ++i) { pio_config_clk[i].t_setup = PCMCIA_MK_CLKS(pio_config_ns[i].t_setup, @@ -518,6 +519,7 @@ void ide_init (void) pio_config_ns[i].t_length, pio_config_clk[i].t_length, pio_config_ns[i].t_hold, pio_config_clk[i].t_hold); } +#endif /* CONFIG_IDE_8xx_DIRECT */
/* Reset the IDE just to be sure. * Light LED's to show @@ -528,12 +530,12 @@ void ide_init (void) #ifdef CONFIG_IDE_8xx_DIRECT /* PCMCIA / IDE initialization for common mem space */ pcmp->pcmc_pgcrb = 0; -#endif
/* start in PIO mode 0 - most relaxed timings */ pio_mode = 0; set_pcmcia_timing (pio_mode);
+#endif /* * Wait for IDE to get ready. * According to spec, this can take up to 31 seconds!

In message 3F849AAC.3090805@corelatus.com you wrote:
A big chunk of code in cmd_ide.c is only valid for boards that set CONFIG_IDE_8xx_DIRECT That makes it harder than neccesary to follow the flow since alot of calculations/variables are pointless.
- Patch by Thomas Lange, 10 Oct 2003: code only needed by CONFIG_IDE_8xx_DIRECT ifdef:ed
Added, thanks. Will show up on CVS soon.
Best regards,
Wolfgang Denk
participants (2)
-
Thomas Lange
-
Wolfgang Denk