[U-Boot-Users] IDE patch

Hi everybody,
The attached patch makes the IDE and FAT commands working on our custom board.
CHANGELOG: * adds a return value for the fpga command * fixes an endianess problem in fat.h * adds an ide_preinit function called in ide_init if CONFIG_IDE_PREINIT is defined. If the ide_preinit fails, the ide_init is aborted. * adds the CFG_ATA_STRIDE configuration variable, which defines the spacing between ATA registers. The default value is 1, but it can be modified in the board configuration file.
Best regards
diff -Naur u-boot/common/cmd_fpga.c u-boot-1.0.0/common/cmd_fpga.c --- u-boot/common/cmd_fpga.c 2003-07-01 23:07:07.000000000 +0200 +++ u-boot-1.0.0/common/cmd_fpga.c 2003-11-21 09:26:14.000000000 +0100 @@ -70,6 +70,7 @@ void *fpga_data = NULL; char *devstr = getenv("fpga"); char *datastr = getenv("fpgadata"); + int ret_val = FPGA_FAIL;
if ( devstr ) dev = (int)simple_strtoul( devstr, NULL, 16 ); if ( datastr ) fpga_data = (void *)simple_strtoul( datastr, NULL, 16 ); @@ -106,15 +107,15 @@ break;
case FPGA_INFO: - fpga_info( dev ); + ret_val = fpga_info( dev ); break;
case FPGA_LOAD: - fpga_load( dev, fpga_data, data_size ); + ret_val = fpga_load( dev, fpga_data, data_size ); break;
case FPGA_DUMP: - fpga_dump( dev, fpga_data, data_size ); + ret_val = fpga_dump( dev, fpga_data, data_size ); break;
default: @@ -122,7 +123,7 @@ fpga_usage( cmdtp ); break; } - return 0; + return (ret_val); }
static void fpga_usage ( cmd_tbl_t *cmdtp ) diff -Naur u-boot/common/cmd_ide.c u-boot-1.0.0/common/cmd_ide.c --- u-boot/common/cmd_ide.c 2003-11-07 14:42:26.000000000 +0100 +++ u-boot-1.0.0/common/cmd_ide.c 2003-11-24 09:14:59.000000000 +0100 @@ -487,6 +487,13 @@ char *s; #endif
+#ifdef CONFIG_IDE_PREINIT + if (ide_preinit ()) { + puts ("ide_preinit failed\n"); + return; + } +#endif + #ifdef CONFIG_IDE_8xx_PCCARD extern int pcmcia_on (void); extern int ide_devices_found; /* Initialized in check_ide_device() */ @@ -756,12 +763,12 @@ static void __inline__ ide_outb(int dev, int port, unsigned char val) { + PRINTF ("ide_outb (dev= %d, port= %d, val= 0x%02x) : @ 0x%08lx\n", + dev, port, val, (ATA_CURR_BASE(dev)+port)); + /* Ensure I/O operations complete */ __asm__ volatile("eieio"); *((uchar *)(ATA_CURR_BASE(dev)+port)) = val; -#if 0 - printf ("ide_outb: 0x%08lx <== 0x%02x\n", ATA_CURR_BASE(dev)+port, val); -#endif } #else /* ! __PPC__ */ static void __inline__ @@ -780,9 +787,8 @@ /* Ensure I/O operations complete */ __asm__ volatile("eieio"); val = *((uchar *)(ATA_CURR_BASE(dev)+port)); -#if 0 - printf ("ide_inb: 0x%08lx ==> 0x%02x\n", ATA_CURR_BASE(dev)+port, val); -#endif + PRINTF ("ide_inb (dev= %d, port= %d) : @ 0x%08lx -> 0x%02x\n", + dev, port, (ATA_CURR_BASE(dev)+port), val); return (val); } #else /* ! __PPC__ */ diff -Naur u-boot/include/ata.h u-boot-1.0.0/include/ata.h --- u-boot/include/ata.h 2002-11-03 01:54:21.000000000 +0100 +++ u-boot-1.0.0/include/ata.h 2003-11-20 16:51:30.000000000 +0100 @@ -37,10 +37,13 @@ * 8-bit (register) and 16-bit (data) accesses might use different * address spaces. This is implemented by the following definitions. */ +#ifndef CFG_ATA_STRIDE +#define CFG_ATA_STRIDE 1 +#endif
-#define ATA_IO_DATA(x) (CFG_ATA_DATA_OFFSET+(x)) -#define ATA_IO_REG(x) (CFG_ATA_REG_OFFSET +(x)) -#define ATA_IO_ALT(x) (CFG_ATA_ALT_OFFSET +(x)) +#define ATA_IO_DATA(x) (CFG_ATA_DATA_OFFSET+(x * CFG_ATA_STRIDE)) +#define ATA_IO_REG(x) (CFG_ATA_REG_OFFSET +(x * CFG_ATA_STRIDE)) +#define ATA_IO_ALT(x) (CFG_ATA_ALT_OFFSET +(x * CFG_ATA_STRIDE))
/* * I/O Register Descriptions diff -Naur u-boot/include/fat.h u-boot-1.0.0/include/fat.h --- u-boot/include/fat.h 2003-09-11 00:30:55.000000000 +0200 +++ u-boot-1.0.0/include/fat.h 2003-11-21 16:12:53.000000000 +0100 @@ -89,7 +89,7 @@ #define FAT2CPU16 le16_to_cpu #define FAT2CPU32 le32_to_cpu #else -#if 1 +#ifdef __LITTLE_ENDIAN #define FAT2CPU16(x) (x) #define FAT2CPU32(x) (x) #else

In message 3FC21CC9.20709@staubli.com you wrote:
The attached patch makes the IDE and FAT commands working on our custom board.
CHANGELOG: * adds a return value for the fpga command * fixes an endianess problem in fat.h * adds an ide_preinit function called in ide_init if CONFIG_IDE_PREINIT is defined. If the ide_preinit fails, the ide_init is aborted. * adds the CFG_ATA_STRIDE configuration variable, which defines the spacing between ATA registers. The default value is 1, but it can be modified in the board configuration file.
Thanks, added.
Best regards,
Wolfgang Denk
participants (2)
-
Pierre AUBERT
-
Wolfgang Denk