From 0e15ddd11f1a84c465e434eb051d2ef08ef02b9b Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Thu, 8 May 2008 15:46:42 +0200 Subject: POST: replace the LOGBUFF_INITIALIZED flag in gd->post_log_word (1 << 31) with the GD_FLG_LOGINIT flag in gd->flags. This way we become able to utilize the full post_log_word for POST activities (overwise, POST ECC, which has 0x8000 ID, could be erroneously treated as started in post_output_backlog() even if there was actually no POST ECC run (because of OCM POST failure, for example). Signed-off-by: Yuri Tikhonov --- common/cmd_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/cmd_log.c b/common/cmd_log.c index b9f9ba0..c6e72ac 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -107,7 +107,7 @@ void logbuff_init_ptrs (void) if ((s = getenv ("loglevel")) != NULL) console_loglevel = (int)simple_strtoul (s, NULL, 10); - gd->post_log_word |= LOGBUFF_INITIALIZED; + gd->flags |= GD_FLG_LOGINIT; } void logbuff_reset (void) @@ -168,7 +168,7 @@ static void logbuff_puts (const char *s) void logbuff_log(char *msg) { - if ((gd->post_log_word & LOGBUFF_INITIALIZED)) { + if ((gd->flags & GD_FLG_LOGINIT)) { logbuff_printk (msg); } else { /* Can happen only for pre-relocated errors as logging */ -- cgit v1.1 From 53677ef18e25c97ac613349087c5cb33ae5a2741 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Tue, 20 May 2008 16:00:29 +0200 Subject: Big white-space cleanup. This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk --- common/cmd_autoscript.c | 2 +- common/cmd_dcr.c | 2 +- common/cmd_fdc.c | 136 ++++++++++++++++++++++++------------------------ common/cmd_fdt.c | 4 +- common/cmd_i2c.c | 16 +++--- common/cmd_ide.c | 6 +-- common/cmd_mem.c | 60 ++++++++++----------- common/cmd_pci.c | 2 +- common/cmd_reginfo.c | 112 +++++++++++++++++++-------------------- common/cmd_scsi.c | 2 +- common/cmd_usb.c | 2 +- common/cmd_vfd.c | 8 +-- common/command.c | 34 ++++++------ common/console.c | 2 +- common/env_dataflash.c | 2 +- common/env_nand.c | 2 +- common/hush.c | 1 - common/lists.c | 4 +- common/usb.c | 6 +-- common/usb_kbd.c | 4 +- common/virtex2.c | 2 +- 21 files changed, 202 insertions(+), 207 deletions(-) (limited to 'common') diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c index 932f638..13af93e 100644 --- a/common/cmd_autoscript.c +++ b/common/cmd_autoscript.c @@ -52,7 +52,7 @@ int autoscript (ulong addr, const char *fit_uname) { - ulong len; + ulong len; image_header_t *hdr; ulong *data; char *cmd; diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index a053343..439d07a 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -123,7 +123,7 @@ int do_getidcr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if (argc < 3) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; - } + } /* Find out whether ther is '.' (dot) symbol in the first parameter. */ strncpy (buf, argv[1], sizeof(buf)-1); diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index bf28370..0293d18 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -46,24 +46,23 @@ #define FALSE 0 #endif - /*#if defined(CONFIG_CMD_DATE) */ /*#include */ /*#endif */ #if defined(CONFIG_CMD_FDC) || defined(CONFIG_CMD_FDOS) - typedef struct { - int flags; /* connected drives ect */ - unsigned long blnr; /* Logical block nr */ - uchar drive; /* drive no */ - uchar cmdlen; /* cmd length */ - uchar cmd[16]; /* cmd desc */ - uchar dma; /* if > 0 dma enabled */ - uchar result[11];/* status information */ - uchar resultlen; /* lenght of result */ + int flags; /* connected drives ect */ + unsigned long blnr; /* Logical block nr */ + uchar drive; /* drive no */ + uchar cmdlen; /* cmd length */ + uchar cmd[16]; /* cmd desc */ + uchar dma; /* if > 0 dma enabled */ + uchar result[11]; /* status information */ + uchar resultlen; /* lenght of result */ } FDC_COMMAND_STRUCT; + /* flags: only the lower 8bit used: * bit 0 if set drive 0 is present * bit 1 if set drive 1 is present @@ -75,31 +74,30 @@ typedef struct { * bit 7 if set disk in drive 4 is inserted */ - /* cmd indexes */ -#define COMMAND 0 -#define DRIVE 1 +#define COMMAND 0 +#define DRIVE 1 #define CONFIG0 1 -#define SPEC_HUTSRT 1 -#define TRACK 2 +#define SPEC_HUTSRT 1 +#define TRACK 2 #define CONFIG1 2 #define SPEC_HLT 2 -#define HEAD 3 +#define HEAD 3 #define CONFIG2 3 -#define SECTOR 4 -#define SECTOR_SIZE 5 -#define LAST_TRACK 6 -#define GAP 7 -#define DTL 8 +#define SECTOR 4 +#define SECTOR_SIZE 5 +#define LAST_TRACK 6 +#define GAP 7 +#define DTL 8 /* result indexes */ -#define STATUS_0 0 -#define STATUS_PCN 1 -#define STATUS_1 1 -#define STATUS_2 2 -#define STATUS_TRACK 3 -#define STATUS_HEAD 4 -#define STATUS_SECT 5 -#define STATUS_SECT_SIZE 6 +#define STATUS_0 0 +#define STATUS_PCN 1 +#define STATUS_1 1 +#define STATUS_2 2 +#define STATUS_TRACK 3 +#define STATUS_HEAD 4 +#define STATUS_SECT 5 +#define STATUS_SECT_SIZE 6 /* Register addresses */ @@ -114,34 +112,34 @@ typedef struct { #define FDC_DIR FDC_BASE + 6 /* Digital Input Register */ #define FDC_CCR FDC_BASE + 7 /* Configuration Control */ /* Commands */ -#define FDC_CMD_SENSE_INT 0x08 -#define FDC_CMD_CONFIGURE 0x13 -#define FDC_CMD_SPECIFY 0x03 -#define FDC_CMD_RECALIBRATE 0x07 -#define FDC_CMD_READ 0x06 -#define FDC_CMD_READ_TRACK 0x02 -#define FDC_CMD_READ_ID 0x0A -#define FDC_CMD_DUMP_REG 0x0E -#define FDC_CMD_SEEK 0x0F - -#define FDC_CMD_SENSE_INT_LEN 0x01 -#define FDC_CMD_CONFIGURE_LEN 0x04 -#define FDC_CMD_SPECIFY_LEN 0x03 -#define FDC_CMD_RECALIBRATE_LEN 0x02 -#define FDC_CMD_READ_LEN 0x09 -#define FDC_CMD_READ_TRACK_LEN 0x09 -#define FDC_CMD_READ_ID_LEN 0x02 -#define FDC_CMD_DUMP_REG_LEN 0x01 -#define FDC_CMD_SEEK_LEN 0x03 - -#define FDC_FIFO_THR 0x0C -#define FDC_FIFO_DIS 0x00 +#define FDC_CMD_SENSE_INT 0x08 +#define FDC_CMD_CONFIGURE 0x13 +#define FDC_CMD_SPECIFY 0x03 +#define FDC_CMD_RECALIBRATE 0x07 +#define FDC_CMD_READ 0x06 +#define FDC_CMD_READ_TRACK 0x02 +#define FDC_CMD_READ_ID 0x0A +#define FDC_CMD_DUMP_REG 0x0E +#define FDC_CMD_SEEK 0x0F + +#define FDC_CMD_SENSE_INT_LEN 0x01 +#define FDC_CMD_CONFIGURE_LEN 0x04 +#define FDC_CMD_SPECIFY_LEN 0x03 +#define FDC_CMD_RECALIBRATE_LEN 0x02 +#define FDC_CMD_READ_LEN 0x09 +#define FDC_CMD_READ_TRACK_LEN 0x09 +#define FDC_CMD_READ_ID_LEN 0x02 +#define FDC_CMD_DUMP_REG_LEN 0x01 +#define FDC_CMD_SEEK_LEN 0x03 + +#define FDC_FIFO_THR 0x0C +#define FDC_FIFO_DIS 0x00 #define FDC_IMPLIED_SEEK 0x01 -#define FDC_POLL_DIS 0x00 -#define FDC_PRE_TRK 0x00 -#define FDC_CONFIGURE FDC_FIFO_THR | (FDC_POLL_DIS<<4) | (FDC_FIFO_DIS<<5) | (FDC_IMPLIED_SEEK << 6) -#define FDC_MFM_MODE 0x01 /* MFM enable */ -#define FDC_SKIP_MODE 0x00 /* skip enable */ +#define FDC_POLL_DIS 0x00 +#define FDC_PRE_TRK 0x00 +#define FDC_CONFIGURE FDC_FIFO_THR | (FDC_POLL_DIS<<4) | (FDC_FIFO_DIS<<5) | (FDC_IMPLIED_SEEK << 6) +#define FDC_MFM_MODE 0x01 /* MFM enable */ +#define FDC_SKIP_MODE 0x00 /* skip enable */ #define FDC_TIME_OUT 100000 /* time out */ #define FDC_RW_RETRIES 3 /* read write retries */ @@ -150,18 +148,18 @@ typedef struct { /* Disk structure */ typedef struct { - unsigned int size; /* nr of sectors total */ - unsigned int sect; /* sectors per track */ - unsigned int head; /* nr of heads */ - unsigned int track; /* nr of tracks */ - unsigned int stretch; /* !=0 means double track steps */ - unsigned char gap; /* gap1 size */ - unsigned char rate; /* data rate. |= 0x40 for perpendicular */ - unsigned char spec1; /* stepping rate, head unload time */ - unsigned char fmt_gap; /* gap2 size */ - unsigned char hlt; /* head load time */ - unsigned char sect_code; /* Sector Size code */ - const char * name; /* used only for predefined formats */ + unsigned int size; /* nr of sectors total */ + unsigned int sect; /* sectors per track */ + unsigned int head; /* nr of heads */ + unsigned int track; /* nr of tracks */ + unsigned int stretch; /* !=0 means double track steps */ + unsigned char gap; /* gap1 size */ + unsigned char rate; /* data rate. |= 0x40 for perpendicular */ + unsigned char spec1; /* stepping rate, head unload time */ + unsigned char fmt_gap;/* gap2 size */ + unsigned char hlt; /* head load time */ + unsigned char sect_code;/* Sector Size code */ + const char * name; /* used only for predefined formats */ } FD_GEO_STRUCT; @@ -342,7 +340,7 @@ int fdc_issue_cmd(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG) case FDC_CMD_CONFIGURE: pCMD->cmd[CONFIG0]=0; pCMD->cmd[CONFIG1]=FDC_CONFIGURE; /* FIFO Threshold, Poll, Enable FIFO */ - pCMD->cmd[CONFIG2]=FDC_PRE_TRK; /* Precompensation Track */ + pCMD->cmd[CONFIG2]=FDC_PRE_TRK; /* Precompensation Track */ pCMD->cmdlen=FDC_CMD_CONFIGURE_LEN; pCMD->resultlen=0; /* no result */ break; diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 7436a95..ede65ae 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -464,13 +464,13 @@ static int fdt_valid(void) /* * Parse the user's input, partially heuristic. Valid formats: * <0x00112233 4 05> - an array of cells. Numbers follow standard - * C conventions. + * C conventions. * [00 11 22 .. nn] - byte stream * "string" - If the the value doesn't start with "<" or "[", it is * treated as a string. Note that the quotes are * stripped by the parser before we get the string. * newval: An array of strings containing the new property as specified - * on the command line + * on the command line * count: The number of strings in the array * data: A bytestream to be placed in the property * len: The length of the resulting bytestream diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index c60ec99..aac7e9a 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -266,8 +266,8 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } /* - * Chip is always specified. - */ + * Chip is always specified. + */ chip = simple_strtoul(argv[1], NULL, 16); /* @@ -353,8 +353,8 @@ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } /* - * Chip is always specified. - */ + * Chip is always specified. + */ chip = simple_strtoul(argv[1], NULL, 16); /* @@ -444,8 +444,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) size = cmd_get_data_size(argv[0], 1); /* - * Chip is always specified. - */ + * Chip is always specified. + */ chip = simple_strtoul(argv[1], NULL, 16); /* @@ -1256,7 +1256,7 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) #if defined(CONFIG_I2C_CMD_TREE) U_BOOT_CMD( i2c, 6, 1, do_i2c, - "i2c - I2C sub-system\n", + "i2c - I2C sub-system\n", #if defined(CONFIG_I2C_MULTI_BUS) "dev [dev] - show or set current I2C bus\n" #endif /* CONFIG_I2C_MULTI_BUS */ @@ -1280,7 +1280,7 @@ U_BOOT_CMD( ); U_BOOT_CMD( - imm, 3, 1, do_i2c_mm, + imm, 3, 1, do_i2c_mm, "imm - i2c memory modify (auto-incrementing)\n", "chip address[.0, .1, .2]\n" " - memory modify, auto increment address\n" diff --git a/common/cmd_ide.c b/common/cmd_ide.c index cac99d5..6560702 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -1233,7 +1233,7 @@ static void ide_ident (block_dev_desc_t *dev_desc) dev_desc->blksz=ATA_BLOCKSIZE; dev_desc->lun=0; /* just to fill something in... */ -#if 0 /* only used to test the powersaving mode, +#if 0 /* only used to test the powersaving mode, * if enabled, the drive goes after 5 sec * in standby mode */ ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); @@ -1783,7 +1783,7 @@ unsigned char atapi_issue(int device,unsigned char* ccb,int ccblen, unsigned cha } output_data_shorts (device, (unsigned short *)ccb,ccblen/2); /* write command block */ - /* ATAPI Command written wait for completition */ + /* ATAPI Command written wait for completition */ udelay (5000); /* device must set bsy */ mask = ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR; @@ -1852,7 +1852,7 @@ AI_OUT: * returns, an request_sense will be issued */ -#define ATAPI_DRIVE_NOT_READY 100 +#define ATAPI_DRIVE_NOT_READY 100 #define ATAPI_UNIT_ATTN 10 unsigned char atapi_issue_autoreq (int device, diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 51aa71f..2606986 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1201,56 +1201,56 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /**************************************************/ #if defined(CONFIG_CMD_MEMORY) U_BOOT_CMD( - md, 3, 1, do_mem_md, - "md - memory display\n", - "[.b, .w, .l] address [# of objects]\n - memory display\n" + md, 3, 1, do_mem_md, + "md - memory display\n", + "[.b, .w, .l] address [# of objects]\n - memory display\n" ); U_BOOT_CMD( - mm, 2, 1, do_mem_mm, - "mm - memory modify (auto-incrementing)\n", + mm, 2, 1, do_mem_mm, + "mm - memory modify (auto-incrementing)\n", "[.b, .w, .l] address\n" " - memory modify, auto increment address\n" ); U_BOOT_CMD( - nm, 2, 1, do_mem_nm, - "nm - memory modify (constant address)\n", + nm, 2, 1, do_mem_nm, + "nm - memory modify (constant address)\n", "[.b, .w, .l] address\n - memory modify, read and keep address\n" ); U_BOOT_CMD( - mw, 4, 1, do_mem_mw, - "mw - memory write (fill)\n", - "[.b, .w, .l] address value [count]\n - write memory\n" + mw, 4, 1, do_mem_mw, + "mw - memory write (fill)\n", + "[.b, .w, .l] address value [count]\n - write memory\n" ); U_BOOT_CMD( - cp, 4, 1, do_mem_cp, - "cp - memory copy\n", + cp, 4, 1, do_mem_cp, + "cp - memory copy\n", "[.b, .w, .l] source target count\n - copy memory\n" ); U_BOOT_CMD( - cmp, 4, 1, do_mem_cmp, - "cmp - memory compare\n", + cmp, 4, 1, do_mem_cmp, + "cmp - memory compare\n", "[.b, .w, .l] addr1 addr2 count\n - compare memory\n" ); #ifndef CONFIG_CRC32_VERIFY U_BOOT_CMD( - crc32, 4, 1, do_mem_crc, - "crc32 - checksum calculation\n", + crc32, 4, 1, do_mem_crc, + "crc32 - checksum calculation\n", "address count [addr]\n - compute CRC32 checksum [save at addr]\n" ); #else /* CONFIG_CRC32_VERIFY */ U_BOOT_CMD( - crc32, 5, 1, do_mem_crc, - "crc32 - checksum calculation\n", + crc32, 5, 1, do_mem_crc, + "crc32 - checksum calculation\n", "address count [addr]\n - compute CRC32 checksum [save at addr]\n" "-v address count crc\n - verify crc of memory area\n" ); @@ -1258,45 +1258,45 @@ U_BOOT_CMD( #endif /* CONFIG_CRC32_VERIFY */ U_BOOT_CMD( - base, 2, 1, do_mem_base, - "base - print or set address offset\n", + base, 2, 1, do_mem_base, + "base - print or set address offset\n", "\n - print address offset for memory commands\n" "base off\n - set address offset for memory commands to 'off'\n" ); U_BOOT_CMD( - loop, 3, 1, do_mem_loop, - "loop - infinite loop on address range\n", + loop, 3, 1, do_mem_loop, + "loop - infinite loop on address range\n", "[.b, .w, .l] address number_of_objects\n" " - loop on a set of addresses\n" ); #ifdef CONFIG_LOOPW U_BOOT_CMD( - loopw, 4, 1, do_mem_loopw, - "loopw - infinite write loop on address range\n", + loopw, 4, 1, do_mem_loopw, + "loopw - infinite write loop on address range\n", "[.b, .w, .l] address number_of_objects data_to_write\n" " - loop on a set of addresses\n" ); #endif /* CONFIG_LOOPW */ U_BOOT_CMD( - mtest, 4, 1, do_mem_mtest, - "mtest - simple RAM test\n", + mtest, 4, 1, do_mem_mtest, + "mtest - simple RAM test\n", "[start [end [pattern]]]\n" " - simple RAM read/write test\n" ); #ifdef CONFIG_MX_CYCLIC U_BOOT_CMD( - mdc, 4, 1, do_mem_mdc, - "mdc - memory display cyclic\n", + mdc, 4, 1, do_mem_mdc, + "mdc - memory display cyclic\n", "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n" ); U_BOOT_CMD( - mwc, 4, 1, do_mem_mwc, - "mwc - memory write cyclic\n", + mwc, 4, 1, do_mem_mwc, + "mwc - memory write cyclic\n", "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n" ); #endif /* CONFIG_MX_CYCLIC */ diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 82d9717..8968701 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -173,7 +173,7 @@ static char *pci_classes_str(u8 class) * Subroutine: pci_header_show_brief * * Description: Reads and prints the header of the - * specified PCI device in short form. + * specified PCI device in short form. * * Inputs: dev Bus+Device+Function number * diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c index dd808ed..1669d74 100644 --- a/common/cmd_reginfo.c +++ b/common/cmd_reginfo.c @@ -109,24 +109,24 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) puts ("\nMemory (SDRAM) Configuration\n" "besra besrsa besrb besrsb bear mcopt1 rtr pmit\n"); - mtdcr(memcfga,mem_besra); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_besra); printf ("%08x ", mfdcr(memcfgd)); mtdcr(memcfga,mem_besrsa); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_besrb); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_besrsb); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_bear); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_mcopt1); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_rtr); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_pmit); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_besrb); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_besrsb); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_bear); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mcopt1); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_rtr); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_pmit); printf ("%08x ", mfdcr(memcfgd)); puts ("\n" "mb0cf mb1cf mb2cf mb3cf sdtr1 ecccf eccerr\n"); - mtdcr(memcfga,mem_mb0cf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_mb1cf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_mb2cf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_mb3cf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_sdtr1); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_ecccf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_eccerr); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mb0cf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mb1cf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mb2cf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mb3cf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_sdtr1); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_ecccf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_eccerr); printf ("%08x ", mfdcr(memcfgd)); printf ("\n\n" "DMA Channels\n" @@ -149,32 +149,32 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) puts ("\n" "External Bus\n" "pbear pbesr0 pbesr1 epcr\n"); - mtdcr(ebccfga,pbear); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pbesr0); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pbesr1); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,epcr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pbear); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pbesr0); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pbesr1); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,epcr); printf ("%08x ", mfdcr(ebccfgd)); puts ("\n" "pb0cr pb0ap pb1cr pb1ap pb2cr pb2ap pb3cr pb3ap\n"); - mtdcr(ebccfga,pb0cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb0ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb1cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb1ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb2cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb2ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb3cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb3ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb0cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb0ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb1cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb1ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb2cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb2ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb3cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb3ap); printf ("%08x ", mfdcr(ebccfgd)); puts ("\n" "pb4cr pb4ap pb5cr bp5ap pb6cr pb6ap pb7cr pb7ap\n"); - mtdcr(ebccfga,pb4cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb4ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb5cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb5ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb6cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb6ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb7cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb7ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb4cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb4ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb5cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb5ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb6cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb6ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb7cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb7ap); printf ("%08x ", mfdcr(ebccfgd)); puts ("\n\n"); @@ -196,12 +196,12 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) puts ("\nMemory (SDRAM) Configuration\n" "mcopt1 rtr pmit mb0cf mb1cf sdtr1\n"); - mtdcr(memcfga,mem_mcopt1); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_rtr); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_pmit); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_mb0cf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_mb1cf); printf ("%08x ", mfdcr(memcfgd)); - mtdcr(memcfga,mem_sdtr1); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mcopt1); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_rtr); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_pmit); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mb0cf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_mb1cf); printf ("%08x ", mfdcr(memcfgd)); + mtdcr(memcfga,mem_sdtr1); printf ("%08x ", mfdcr(memcfgd)); printf ("\n\n" "DMA Channels\n" @@ -221,31 +221,31 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) puts ("\n" "External Bus\n" "pbear pbesr0 pbesr1 epcr\n"); - mtdcr(ebccfga,pbear); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pbesr0); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pbesr1); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,epcr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pbear); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pbesr0); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pbesr1); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,epcr); printf ("%08x ", mfdcr(ebccfgd)); puts ("\n" "pb0cr pb0ap pb1cr pb1ap pb2cr pb2ap pb3cr pb3ap\n"); - mtdcr(ebccfga,pb0cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb0ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb1cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb1ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb2cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb2ap); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb3cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb3ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb0cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb0ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb1cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb1ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb2cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb2ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb3cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb3ap); printf ("%08x ", mfdcr(ebccfgd)); puts ("\n" "pb4cr pb4ap\n"); - mtdcr(ebccfga,pb4cr); printf ("%08x ", mfdcr(ebccfgd)); - mtdcr(ebccfga,pb4ap); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb4cr); printf ("%08x ", mfdcr(ebccfgd)); + mtdcr(ebccfga,pb4ap); printf ("%08x ", mfdcr(ebccfgd)); puts ("\n\n"); #elif defined(CONFIG_5xx) - volatile immap_t *immap = (immap_t *)CFG_IMMR; + volatile immap_t *immap = (immap_t *)CFG_IMMR; volatile memctl5xx_t *memctl = &immap->im_memctl; volatile sysconf5xx_t *sysconf = &immap->im_siu_conf; volatile sit5xx_t *timers = &immap->im_sit; @@ -382,7 +382,7 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #if defined(CONFIG_CMD_REGINFO) U_BOOT_CMD( - reginfo, 2, 1, do_reginfo, + reginfo, 2, 1, do_reginfo, "reginfo - print register information\n", ); #endif diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index f49531e..69028f3 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -393,7 +393,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } printf ("Usage:\n%s\n", cmdtp->usage); return 1; - case 3: + case 3: if (strncmp(argv[1],"dev",3) == 0) { int dev = (int)simple_strtoul(argv[2], NULL, 10); printf ("\nSCSI device %d: ", dev); diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 23413b5..9be86b8 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -475,7 +475,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #ifdef CONFIG_USB_STORAGE /* try to recognize storage devices immediately */ if (i >= 0) - usb_stor_curr_dev = usb_stor_scan(1); + usb_stor_curr_dev = usb_stor_scan(1); #endif return 0; } diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c index 29c349d..104c310 100644 --- a/common/cmd_vfd.c +++ b/common/cmd_vfd.c @@ -66,10 +66,10 @@ int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } U_BOOT_CMD( - vfd, 2, 0, do_vfd, - "vfd - load a bitmap to the VFDs on TRAB\n", - "/N\n" - " - load bitmap N to the VFDs (N is _decimal_ !!!)\n" + vfd, 2, 0, do_vfd, + "vfd - load a bitmap to the VFDs on TRAB\n", + "/N\n" + " - load bitmap N to the VFDs (N is _decimal_ !!!)\n" "vfd ADDR\n" " - load bitmap at address ADDR\n" ); diff --git a/common/command.c b/common/command.c index af2f8cb..861796d 100644 --- a/common/command.c +++ b/common/command.c @@ -38,7 +38,7 @@ do_version (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( version, 1, 1, do_version, - "version - print monitor version\n", + "version - print monitor version\n", NULL ); @@ -71,8 +71,8 @@ do_echo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( echo, CFG_MAXARGS, 1, do_echo, - "echo - echo args to console\n", - "[args..]\n" + "echo - echo args to console\n", + "[args..]\n" " - echo args to console; \\c suppresses newline\n" ); @@ -196,17 +196,15 @@ do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) expr = !expr; -#if 0 - printf(": returns %d\n", expr); -#endif + debug (": returns %d\n", expr); return expr; } U_BOOT_CMD( test, CFG_MAXARGS, 1, do_test, - "test - minimal test like /bin/sh\n", - "[args..]\n" + "test - minimal test like /bin/sh\n", + "[args..]\n" " - test functionality\n" ); @@ -224,7 +222,7 @@ do_exit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( exit, 2, 1, do_exit, - "exit - exit script\n", + "exit - exit script\n", " - exit functionality\n" ); @@ -317,12 +315,12 @@ int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( help, CFG_MAXARGS, 1, do_help, - "help - print online help\n", - "[command ...]\n" - " - show help information (for 'command')\n" - "'help' prints online help for the monitor commands.\n\n" - "Without arguments, it prints a short usage message for all commands.\n\n" - "To get detailed help information for specific commands you can type\n" + "help - print online help\n", + "[command ...]\n" + " - show help information (for 'command')\n" + "'help' prints online help for the monitor commands.\n\n" + "Without arguments, it prints a short usage message for all commands.\n\n" + "To get detailed help information for specific commands you can type\n" "'help' with one or more command names as arguments.\n" ); @@ -330,13 +328,13 @@ U_BOOT_CMD( #ifdef CFG_LONGHELP cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { "?", CFG_MAXARGS, 1, do_help, - "? - alias for 'help'\n", + "? - alias for 'help'\n", NULL }; #else cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { "?", CFG_MAXARGS, 1, do_help, - "? - alias for 'help'\n" + "? - alias for 'help'\n" }; #endif /* CFG_LONGHELP */ @@ -498,7 +496,7 @@ static int make_argv(char *s, int argvsz, char *argv[]) while ((*s == ' ') || (*s == '\t')) ++s; - if (*s == '\0') /* end of s, no more args */ + if (*s == '\0') /* end of s, no more args */ break; argv[argc++] = s; /* begin of argument string */ diff --git a/common/console.c b/common/console.c index d8a0cb6..1b095b1 100644 --- a/common/console.c +++ b/common/console.c @@ -415,7 +415,7 @@ int console_init_r (void) stdoutname = getenv ("stdout"); stderrname = getenv ("stderr"); - if (OVERWRITE_CONSOLE == 0) { /* if not overwritten by config switch */ + if (OVERWRITE_CONSOLE == 0) { /* if not overwritten by config switch */ inputdev = search_device (DEV_FLAGS_INPUT, stdinname); outputdev = search_device (DEV_FLAGS_OUTPUT, stdoutname); errdev = search_device (DEV_FLAGS_OUTPUT, stderrname); diff --git a/common/env_dataflash.c b/common/env_dataflash.c index 8a94432..2945364 100644 --- a/common/env_dataflash.c +++ b/common/env_dataflash.c @@ -98,7 +98,7 @@ int env_init(void) } } - return (0); + return (0); } #endif /* CFG_ENV_IS_IN_DATAFLASH */ diff --git a/common/env_nand.c b/common/env_nand.c index 49742f5..70d05ad 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -273,7 +273,7 @@ void env_relocate_spec (void) total = CFG_ENV_SIZE; ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr); - if (ret || total != CFG_ENV_SIZE) + if (ret || total != CFG_ENV_SIZE) return use_default(); if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc) diff --git a/common/hush.c b/common/hush.c index 582635c..b43f618 100644 --- a/common/hush.c +++ b/common/hush.c @@ -1,4 +1,3 @@ -/* vi: set sw=4 ts=4: */ /* * sh.c -- a prototype Bourne shell grammar parser * Intended to follow the original Thompson and Ritchie diff --git a/common/lists.c b/common/lists.c index 3f117b5..0dc090a 100644 --- a/common/lists.c +++ b/common/lists.c @@ -2,8 +2,8 @@ #include #include -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) +#define MAX(a,b) (((a)>(b)) ? (a) : (b)) +#define MIN(a,b) (((a)<(b)) ? (a) : (b)) #define CAT4CHARS(a,b,c,d) ((a<<24) | (b<<16) | (c<<8) | d) /* increase list size by 10% every time it is full */ diff --git a/common/usb.c b/common/usb.c index 2fa5254..52e8472 100644 --- a/common/usb.c +++ b/common/usb.c @@ -180,7 +180,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, setup_packet.value = swap_16(value); setup_packet.index = swap_16(index); setup_packet.length = swap_16(size); - USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X\nvalue 0x%X index 0x%X length 0x%X\n", + USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X\nvalue 0x%X index 0x%X length 0x%X\n", request,requesttype,value,index,size); dev->status=USB_ST_NOT_PROC; /*not yet processed */ @@ -387,7 +387,7 @@ int usb_clear_halt(struct usb_device *dev, int pipe) int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size) { int res; - res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, (type << 8) + index, 0, buf, size, USB_CNTL_TIMEOUT); @@ -399,7 +399,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char */ int usb_get_configuration_no(struct usb_device *dev,unsigned char *buffer,int cfgno) { - int result; + int result; unsigned int tmp; struct usb_config_descriptor *config; diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 1703b23..11e861d 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -238,7 +238,7 @@ static void usb_kbd_setled(struct usb_device *dev) leds|=1; usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE, - 0x200, iface->bInterfaceNumber,(void *)&leds, 1, 0); + 0x200, iface->bInterfaceNumber,(void *)&leds, 1, 0); } @@ -251,7 +251,7 @@ static int usb_kbd_translate(unsigned char scancode,unsigned char modifier,int p if(pressed==0) { /* key released */ - repeat_delay=0; + repeat_delay=0; return 0; } if(pressed==2) { diff --git a/common/virtex2.c b/common/virtex2.c index 1283ff6..665a503 100644 --- a/common/virtex2.c +++ b/common/virtex2.c @@ -84,7 +84,7 @@ * an XC2V1000, if anyone can ever get ahold of one. */ #ifndef CFG_FPGA_WAIT_INIT -#define CFG_FPGA_WAIT_INIT CFG_HZ/2 /* 500 ms */ +#define CFG_FPGA_WAIT_INIT CFG_HZ/2 /* 500 ms */ #endif /* -- cgit v1.1 From c918261c6d9f265f88baf70f8a73dfe6f0cb9596 Mon Sep 17 00:00:00 2001 From: Christian Eggers Date: Wed, 21 May 2008 22:12:00 +0200 Subject: USB: replace old swap_ with proper endianess conversion macros Signed-off-by: Christian Eggers Signed-off-by: Markus Klotzbuecher --- common/usb.c | 44 ++++++++++++++++++++++---------------------- common/usb_kbd.c | 11 ++++++----- common/usb_storage.c | 28 ++++++++++------------------ 3 files changed, 38 insertions(+), 45 deletions(-) (limited to 'common') diff --git a/common/usb.c b/common/usb.c index 52e8472..a0107dc 100644 --- a/common/usb.c +++ b/common/usb.c @@ -48,6 +48,7 @@ #include #include #include +#include #if defined(CONFIG_CMD_USB) @@ -177,10 +178,10 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, /* set setup command */ setup_packet.requesttype = requesttype; setup_packet.request = request; - setup_packet.value = swap_16(value); - setup_packet.index = swap_16(index); - setup_packet.length = swap_16(size); - USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X\nvalue 0x%X index 0x%X length 0x%X\n", + setup_packet.value = cpu_to_le16(value); + setup_packet.index = cpu_to_le16(index); + setup_packet.length = cpu_to_le16(size); + USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, value 0x%X index 0x%X length 0x%X\n", request,requesttype,value,index,size); dev->status=USB_ST_NOT_PROC; /*not yet processed */ @@ -300,7 +301,7 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno) return -1; } memcpy(&dev->config, buffer, buffer[0]); - dev->config.wTotalLength = swap_16(dev->config.wTotalLength); + le16_to_cpus(&(dev->config.wTotalLength)); dev->config.no_of_if = 0; index = dev->config.bLength; @@ -329,8 +330,7 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno) dev->config.if_desc[ifno].no_of_ep++; /* found an endpoint */ memcpy(&dev->config.if_desc[ifno].ep_desc[epno], &buffer[index], buffer[index]); - dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize = - swap_16(dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize); + le16_to_cpus(&(dev->config.if_desc[ifno].ep_desc[epno].wMaxPacketSize)); USB_PRINTF("if %d, ep %d\n", ifno, epno); break; default: @@ -413,7 +413,7 @@ int usb_get_configuration_no(struct usb_device *dev,unsigned char *buffer,int cf printf("config descriptor too short (expected %i, got %i)\n",8,result); return -1; } - tmp=swap_16(config->wTotalLength); + tmp = le16_to_cpu(config->wTotalLength); if (tmp > USB_BUFSIZ) { USB_PRINTF("usb_get_configuration_no: failed to get descriptor - too long: %d\n", @@ -816,10 +816,10 @@ int usb_new_device(struct usb_device *dev) return 1; } /* correct le values */ - dev->descriptor.bcdUSB=swap_16(dev->descriptor.bcdUSB); - dev->descriptor.idVendor=swap_16(dev->descriptor.idVendor); - dev->descriptor.idProduct=swap_16(dev->descriptor.idProduct); - dev->descriptor.bcdDevice=swap_16(dev->descriptor.bcdDevice); + le16_to_cpus(&dev->descriptor.bcdUSB); + le16_to_cpus(&dev->descriptor.idVendor); + le16_to_cpus(&dev->descriptor.idProduct); + le16_to_cpus(&dev->descriptor.bcdDevice); /* only support for one config for now */ usb_get_configuration_no(dev,&tmpbuf[0],0); usb_parse_config(dev,&tmpbuf[0],0); @@ -979,8 +979,8 @@ static int hub_port_reset(struct usb_device *dev, int port, USB_HUB_PRINTF("get_port_status failed status %lX\n",dev->status); return -1; } - portstatus = swap_16(portsts.wPortStatus); - portchange = swap_16(portsts.wPortChange); + portstatus = le16_to_cpu(portsts.wPortStatus); + portchange = le16_to_cpu(portsts.wPortChange); USB_HUB_PRINTF("portstatus %x, change %x, %s\n", portstatus ,portchange, portstatus&(1<desc,buffer,descriptor->bLength); /* adjust 16bit values */ - hub->desc.wHubCharacteristics=swap_16(descriptor->wHubCharacteristics); + hub->desc.wHubCharacteristics = le16_to_cpu(descriptor->wHubCharacteristics); /* set the bitmap */ bitmap=(unsigned char *)&hub->desc.DeviceRemovable[0]; memset(bitmap,0xff,(USB_MAXCHILDREN+1+7)/8); /* devices not removable by default */ @@ -1161,11 +1161,11 @@ int usb_hub_configure(struct usb_device *dev) } hubsts = (struct usb_hub_status *)buffer; USB_HUB_PRINTF("get_hub_status returned status %X, change %X\n", - swap_16(hubsts->wHubStatus),swap_16(hubsts->wHubChange)); + le16_to_cpu(hubsts->wHubStatus),le16_to_cpu(hubsts->wHubChange)); USB_HUB_PRINTF("local power source is %s\n", - (swap_16(hubsts->wHubStatus) & HUB_STATUS_LOCAL_POWER) ? "lost (inactive)" : "good"); + (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_LOCAL_POWER) ? "lost (inactive)" : "good"); USB_HUB_PRINTF("%sover-current condition exists\n", - (swap_16(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? "" : "no "); + (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? "" : "no "); usb_hub_power_on(hub); for (i = 0; i < dev->maxchild; i++) { struct usb_port_status portsts; @@ -1175,8 +1175,8 @@ int usb_hub_configure(struct usb_device *dev) USB_HUB_PRINTF("get_port_status failed\n"); continue; } - portstatus = swap_16(portsts.wPortStatus); - portchange = swap_16(portsts.wPortChange); + portstatus = le16_to_cpu(portsts.wPortStatus); + portchange = le16_to_cpu(portsts.wPortChange); USB_HUB_PRINTF("Port %d Status %X Change %X\n",i+1,portstatus,portchange); if (portchange & USB_PORT_STAT_C_CONNECTION) { USB_HUB_PRINTF("port %d connection change\n", i + 1); diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 11e861d..1e79208 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -26,6 +26,7 @@ */ #include #include +#include #ifdef CONFIG_USB_KEYBOARD @@ -475,14 +476,14 @@ static int fetch_item(unsigned char *start,unsigned char *end, struct hid_item * break; case 2: if ((end - start) >= 2) { - item->data.u16 = swap_16((unsigned short *)start); + item->data.u16 = le16_to_cpu((unsigned short *)start); start+=2; return item->size; } case 3: item->size++; if ((end - start) >= 4) { - item->data.u32 = swap_32((unsigned long *)start); + item->data.u32 = le32_to_cpu((unsigned long *)start); start+=4; return item->size; } @@ -705,15 +706,15 @@ static int usb_kbd_get_hid_desc(struct usb_device *dev) } index=head->bLength; config=(struct usb_config_descriptor *)&buffer[0]; - len=swap_16(config->wTotalLength); + len=le16_to_cpu(config->wTotalLength); /* Ok the first entry must be a configuration entry, now process the others */ head=(struct usb_descriptor_header *)&buffer[index]; while(index+1 < len) { if(head->bDescriptorType==USB_DT_HID) { printf("HID desc found\n"); memcpy(&usb_kbd_hid_desc,&buffer[index],buffer[index]); - usb_kbd_hid_desc.bcdHID=swap_16(usb_kbd_hid_desc.bcdHID); - usb_kbd_hid_desc.wDescriptorLength=swap_16(usb_kbd_hid_desc.wDescriptorLength); + le16_to_cpus(&usb_kbd_hid_desc.bcdHID); + le16_to_cpus(&usb_kbd_hid_desc.wDescriptorLength); usb_kbd_display_hid(&usb_kbd_hid_desc); len=0; break; diff --git a/common/usb_storage.c b/common/usb_storage.c index 7c08f95..3e113b4 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -52,6 +52,7 @@ #include #include +#include #include @@ -474,9 +475,9 @@ int usb_stor_BBB_comdat(ccb *srb, struct us_data *us) /* always OUT to the ep */ pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out); - cbw.dCBWSignature = swap_32(CBWSIGNATURE); - cbw.dCBWTag = swap_32(CBWTag++); - cbw.dCBWDataTransferLength = swap_32(srb->datalen); + cbw.dCBWSignature = cpu_to_le32(CBWSIGNATURE); + cbw.dCBWTag = cpu_to_le32(CBWTag++); + cbw.dCBWDataTransferLength = cpu_to_le32(srb->datalen); cbw.bCBWFlags = (dir_in? CBWFLAGS_IN : CBWFLAGS_OUT); cbw.bCBWLUN = srb->lun; cbw.bCDBLength = srb->cmdlen; @@ -692,14 +693,14 @@ int usb_stor_BBB_transport(ccb *srb, struct us_data *us) printf("\n"); #endif /* misuse pipe to get the residue */ - pipe = swap_32(csw.dCSWDataResidue); + pipe = le32_to_cpu(csw.dCSWDataResidue); if (pipe == 0 && srb->datalen != 0 && srb->datalen - data_actlen != 0) pipe = srb->datalen - data_actlen; - if (CSWSIGNATURE != swap_32(csw.dCSWSignature)) { + if (CSWSIGNATURE != le32_to_cpu(csw.dCSWSignature)) { USB_STOR_PRINTF("!CSWSIGNATURE\n"); usb_stor_BBB_reset(us); return USB_STOR_TRANSPORT_FAILED; - } else if ((CBWTag - 1) != swap_32(csw.dCSWTag)) { + } else if ((CBWTag - 1) != le32_to_cpu(csw.dCSWTag)) { USB_STOR_PRINTF("!Tag\n"); usb_stor_BBB_reset(us); return USB_STOR_TRANSPORT_FAILED; @@ -1222,18 +1223,9 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t if(cap[0]>(0x200000 * 10)) /* greater than 10 GByte */ cap[0]>>=16; #endif -#ifdef LITTLEENDIAN - cap[0] = ((unsigned long)( - (((unsigned long)(cap[0]) & (unsigned long)0x000000ffUL) << 24) | - (((unsigned long)(cap[0]) & (unsigned long)0x0000ff00UL) << 8) | - (((unsigned long)(cap[0]) & (unsigned long)0x00ff0000UL) >> 8) | - (((unsigned long)(cap[0]) & (unsigned long)0xff000000UL) >> 24) )); - cap[1] = ((unsigned long)( - (((unsigned long)(cap[1]) & (unsigned long)0x000000ffUL) << 24) | - (((unsigned long)(cap[1]) & (unsigned long)0x0000ff00UL) << 8) | - (((unsigned long)(cap[1]) & (unsigned long)0x00ff0000UL) >> 8) | - (((unsigned long)(cap[1]) & (unsigned long)0xff000000UL) >> 24) )); -#endif + cap[0] = cpu_to_be32(cap[0]); + cap[1] = cpu_to_be32(cap[1]); + /* this assumes bigendian! */ cap[0] += 1; capacity = &cap[0]; -- cgit v1.1