diff options
-rw-r--r-- | CHANGELOG | 18 | ||||
-rw-r--r-- | board/icecube/icecube.c | 25 | ||||
-rw-r--r-- | common/cmd_ide.c | 22 | ||||
-rw-r--r-- | common/env_flash.c | 66 | ||||
-rw-r--r-- | cpu/mpc5xxx/ide.c | 24 | ||||
-rw-r--r-- | cpu/mpc5xxx/usb_ohci.c | 8 | ||||
-rw-r--r-- | doc/README.ocotea | 73 | ||||
-rw-r--r-- | include/configs/IceCube.h | 7 | ||||
-rw-r--r-- | include/linux/string.h | 3 | ||||
-rw-r--r-- | lib_generic/string.c | 27 | ||||
-rw-r--r-- | net/nfs.c | 35 |
11 files changed, 231 insertions, 77 deletions
diff --git a/CHANGELOG b/CHANGELOG index 9e3f9be12c7..d497bd0b71c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,23 @@ Changes for U-Boot 1.0.2: ====================================================================== -* Patch by Travis Sawye, 01 Mar 2004: +* Patch by Yuli Barcohen, 4 Mar 2004: + Fix problems with GCC 3.3.x which changed handling of global + variables explicitly initialized to zero (now in .bss instead of + .data as before). + +* Patch by Leon Kukovec, 02 Mar 2004: + add strswab() to fix IDE LBA capacity, firmware and model numbers + on little endian machines + +* Patch by Masami Komiya, 02 Mar 2004: + - Remove get_ticks() from NFS code + - Add verification of RPC transaction ID + +* Patch by Pierre Aubert, 02 Mar 2004: + cleanup for IDE and USB drivers for MPC5200 + +* Patch by Travis Sawyer, 01 Mar 2004: Ocotea: - Add IBM PPC440GX Ref Platform support (Ocotea) Original code by Paul Reynolds <PaulReynolds@lhsolutions.com> diff --git a/board/icecube/icecube.c b/board/icecube/icecube.c index 59431dbb36b..0a4bed49c92 100644 --- a/board/icecube/icecube.c +++ b/board/icecube/icecube.c @@ -207,3 +207,28 @@ void pci_init_board(void) pci_mpc5xxx_init(&hose); } #endif + +#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) + +#define GPIO_PSC1_4 0x01000000ul + +void init_ide_reset (void) +{ + printf ("init_ide_reset\n"); + + /* Configure PSC1_4 as GPIO output for ATA reset */ + *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4; + *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; + *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; +} + +void ide_set_reset (int idereset) +{ + printf ("ide_reset(%d)\n", idereset); + if (idereset) { + *(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4; + } else { + *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4; + } +} +#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */ diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 1778b33d69b..e96a5f59a7e 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -1094,6 +1094,18 @@ static void ide_ident (block_dev_desc_t *dev_desc) ident_cpy (dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision)); ident_cpy (dev_desc->vendor, iop->model, sizeof(dev_desc->vendor)); ident_cpy (dev_desc->product, iop->serial_no, sizeof(dev_desc->product)); +#ifdef __LITTLE_ENDIAN + /* + * firmware revision and model number have Big Endian Byte + * order in Word. Convert both to little endian. + * + * See CF+ and CompactFlash Specification Revision 2.0: + * 6.2.1.6: Identfy Drive, Table 39 for more details + */ + + strswab (dev_desc->revision); + strswab (dev_desc->vendor); +#endif /* __LITTLE_ENDIAN */ if ((iop->config & 0x0080)==0x0080) dev_desc->removable = 1; @@ -1135,8 +1147,18 @@ static void ide_ident (block_dev_desc_t *dev_desc) } #endif /* CONFIG_ATAPI */ +#ifdef __BIG_ENDIAN /* swap shorts */ dev_desc->lba = (iop->lba_capacity << 16) | (iop->lba_capacity >> 16); +#else /* ! __BIG_ENDIAN */ + /* + * do not swap shorts on little endian + * + * See CF+ and CompactFlash Specification Revision 2.0: + * 6.2.1.6: Identfy Drive, Table 39, Word Address 57-58 for details. + */ + dev_desc->lba = iop->lba_capacity; +#endif /* __BIG_ENDIAN */ #if CONFIG_LBA48 if (iop->command_set_2 & 0x0400) { /* LBA 48 support */ diff --git a/common/env_flash.c b/common/env_flash.c index 079f84d2750..4e42c8fee55 100644 --- a/common/env_flash.c +++ b/common/env_flash.c @@ -79,9 +79,9 @@ static env_t *flash_addr_new = (env_t *)CFG_ENV_ADDR_REDUND; static ulong end_addr = CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1; static ulong end_addr_new = CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1; -static uchar active_flag = 1; -static uchar obsolete_flag = 0; -#endif +#define ACTIVE_FLAG 1 +#define OBSOLETE_FLAG 0 +#endif /* CFG_ENV_ADDR_REDUND */ extern uchar default_environment[]; extern int default_environment_size; @@ -112,43 +112,28 @@ int env_init(void) ulong addr1 = (ulong)&(flash_addr->data); ulong addr2 = (ulong)&(flash_addr_new->data); - if (crc1_ok && ! crc2_ok) - { + if (crc1_ok && ! crc2_ok) { gd->env_addr = addr1; gd->env_valid = 1; - } - else if (! crc1_ok && crc2_ok) - { + } else if (! crc1_ok && crc2_ok) { gd->env_addr = addr2; gd->env_valid = 1; - } - else if (! crc1_ok && ! crc2_ok) - { + } else if (! crc1_ok && ! crc2_ok) { gd->env_addr = addr_default; gd->env_valid = 0; - } - else if (flag1 == active_flag && flag2 == obsolete_flag) - { + } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) { gd->env_addr = addr1; gd->env_valid = 1; - } - else if (flag1 == obsolete_flag && flag2 == active_flag) - { + } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) { gd->env_addr = addr2; gd->env_valid = 1; - } - else if (flag1 == flag2) - { + } else if (flag1 == flag2) { gd->env_addr = addr1; gd->env_valid = 2; - } - else if (flag1 == 0xFF) - { + } else if (flag1 == 0xFF) { gd->env_addr = addr1; gd->env_valid = 2; - } - else if (flag2 == 0xFF) - { + } else if (flag2 == 0xFF) { gd->env_addr = addr2; gd->env_valid = 2; } @@ -161,6 +146,7 @@ int saveenv(void) { char *saved_data = NULL; int rc = 1; + char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG; #if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE ulong up_data = 0; #endif @@ -210,16 +196,13 @@ int saveenv(void) if ((rc = flash_write(env_ptr->data, (ulong)&(flash_addr_new->data), sizeof(env_ptr->data))) || - (rc = flash_write((char *)&(env_ptr->crc), (ulong)&(flash_addr_new->crc), sizeof(env_ptr->crc))) || - - (rc = flash_write((char *)&obsolete_flag, + (rc = flash_write(&flag, (ulong)&(flash_addr->flags), sizeof(flash_addr->flags))) || - - (rc = flash_write((char *)&active_flag, + (rc = flash_write(&new_flag, (ulong)&(flash_addr_new->flags), sizeof(flash_addr_new->flags)))) { @@ -361,8 +344,7 @@ void env_relocate_spec (void) #ifdef CFG_ENV_ADDR_REDUND DECLARE_GLOBAL_DATA_PTR; - if (gd->env_addr != (ulong)&(flash_addr->data)) - { + if (gd->env_addr != (ulong)&(flash_addr->data)) { env_t * etmp = flash_addr; ulong ltmp = end_addr; @@ -373,24 +355,26 @@ void env_relocate_spec (void) end_addr_new = ltmp; } - if (flash_addr_new->flags != obsolete_flag && + if (flash_addr_new->flags != OBSOLETE_FLAG && crc32(0, flash_addr_new->data, ENV_SIZE) == - flash_addr_new->crc) - { + flash_addr_new->crc) { + char flag = OBSOLETE_FLAG; + gd->env_valid = 2; flash_sect_protect (0, (ulong)flash_addr_new, end_addr_new); - flash_write((char *)&obsolete_flag, + flash_write(&flag, (ulong)&(flash_addr_new->flags), sizeof(flash_addr_new->flags)); flash_sect_protect (1, (ulong)flash_addr_new, end_addr_new); } - if (flash_addr->flags != active_flag && - (flash_addr->flags & active_flag) == active_flag) - { + if (flash_addr->flags != ACTIVE_FLAG && + (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) { + char flag = ACTIVE_FLAG; + gd->env_valid = 2; flash_sect_protect (0, (ulong)flash_addr, end_addr); - flash_write((char *)&active_flag, + flash_write(&flag, (ulong)&(flash_addr->flags), sizeof(flash_addr->flags)); flash_sect_protect (1, (ulong)flash_addr, end_addr); diff --git a/cpu/mpc5xxx/ide.c b/cpu/mpc5xxx/ide.c index 05eb8bc718b..47188691df6 100644 --- a/cpu/mpc5xxx/ide.c +++ b/cpu/mpc5xxx/ide.c @@ -29,7 +29,9 @@ #define CALC_TIMING(t) (t + period - 1) / period -#define GPIO_PSC1_4 0x01000000ul +#ifdef CONFIG_IDE_RESET +extern void init_ide_reset (void); +#endif int ide_preinit (void) { @@ -70,24 +72,10 @@ int ide_preinit (void) *(vu_long *) MPC5XXX_ATA_PIO2 = reg; -#if defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET) - /* Configure PSC1_4 as GPIO output for ATA reset */ - *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4; - *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; - *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; -#endif /* defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET) */ +#ifdef CONFIG_IDE_RESET + init_ide_reset (); +#endif /* CONFIG_IDE_RESET */ return (0); } - -#if defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET) -void ide_set_reset (int idereset) -{ - if (idereset) { - *(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4; - } else { - *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4; - } -} -#endif /* defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET) */ #endif /* CFG_CMD_IDE */ diff --git a/cpu/mpc5xxx/usb_ohci.c b/cpu/mpc5xxx/usb_ohci.c index 5fcb376c131..97ecb912133 100644 --- a/cpu/mpc5xxx/usb_ohci.c +++ b/cpu/mpc5xxx/usb_ohci.c @@ -1532,10 +1532,12 @@ int usb_lowlevel_init(void) { /* Set the USB Clock */ - *(vu_long *)MPC5XXX_CDM_48_FDC = 0x0001bbbb; - *(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~0x00800000; + *(vu_long *)MPC5XXX_CDM_48_FDC = CONFIG_USB_CDMFDC5xxx; + + /* remove all USB bits first before ORing in ours */ + *(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~0x00807000; /* Activate USB port */ - *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00001000; + *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= CONFIG_USB_GPSCFG5xxx; memset (&gohci, 0, sizeof (ohci_t)); memset (&urb_priv, 0, sizeof (urb_priv_t)); diff --git a/doc/README.ocotea b/doc/README.ocotea new file mode 100644 index 00000000000..403735d0f32 --- /dev/null +++ b/doc/README.ocotea @@ -0,0 +1,73 @@ + IBM Ocotea Board + + Last Update: March 2, 2004 +======================================================================= + +This file contains some handy info regarding U-Boot and the IBM +Ocotea 440gx evalutation board. See the README.ppc440 for additional +information. + + +SWITCH SETTINGS & JUMPERS +========================== + +Here's what I've been using successfully. If you feel inclined to +change things ... please read the docs! + +DIPSW U46 U80 +------------------------ +SW 1 off off +SW 2 on off +SW 3 off off +SW 4 off off +SW 5 off off +SW 6 on on +SW 7 on off +SW 8 on off + +J41: strapped +J42: open + +All others are factory default. + + +I2C Information +===================== + +See README.ebony for information. + +PCI +=========================== + +Untested at the time of writing. + +PPC440GX Ethernet EMACs +=========================== + +All EMAC ports have been tested and are known to work +with EPS Group 4. + +Special note about the Cicada CIS8201: + The CIS8201 Gigabit PHY comes up in GMII mode by default. + One must hit an extended register to allow use of RGMII mode. + This has been done in the 440gx_enet.c file with a #ifdef/endif + pair. + +IBM does not store the EMAC ethernet addresses within their PIBS bootloader. +The addresses contained in the config header file are from my particular +board and you _*should*_ change them to reflect your board either in the +config file and/or in your environment variables. I found the addresses on +labels on the bottom side of the board. + + +BDI2k or JTAG Debugging +=========================== + +For ease of debugging you can swap the small boot flash and external SRAM +by changing U46:3 to on. You can then use the sram as your boot flash by +loading the sram via the jtag debugger. + + +Regards, +--Travis +<tsawyer@sandburst.com> diff --git a/include/configs/IceCube.h b/include/configs/IceCube.h index 1d4daa7598a..3538e1c2be0 100644 --- a/include/configs/IceCube.h +++ b/include/configs/IceCube.h @@ -302,6 +302,13 @@ #define CFG_RESET_ADDRESS 0xff000000 /*----------------------------------------------------------------------- + * USB stuff + *----------------------------------------------------------------------- + */ +#define CONFIG_USB_CDMFDC5xxx 0x0001BBBB +#define CONFIG_USB_GPSCFG5xxx 0x00001000 + +/*----------------------------------------------------------------------- * IDE/ATA stuff Supports IDE harddisk *----------------------------------------------------------------------- */ diff --git a/include/linux/string.h b/include/linux/string.h index e5d57dcae0d..403ae982beb 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -59,6 +59,9 @@ extern __kernel_size_t strnlen(const char *,__kernel_size_t); #ifndef __HAVE_ARCH_STRDUP extern char * strdup(const char *); #endif +#ifdef __HAVE_ARCH_STRSWAB +extern char * strswab(const char *); +#endif #ifndef __HAVE_ARCH_MEMSET extern void * memset(void *,int,__kernel_size_t); diff --git a/lib_generic/string.c b/lib_generic/string.c index d06a645017d..5ba8d7cb514 100644 --- a/lib_generic/string.c +++ b/lib_generic/string.c @@ -364,6 +364,33 @@ char * strsep(char **s, const char *ct) } #endif +#ifndef __HAVE_ARCH_STRSWAB +/** + * strswab - swap adjacent even and odd bytes in %NUL-terminated string + * s: address of the string + * + * returns the address of the swapped string or NULL on error. If + * string length is odd, last byte is untouched. + */ +char *strswab(const char *s) +{ + char *p; + + if ((NULL == s) || ('\0' == *s)) { + return (NULL); + } + + for (p = ((char *)s + 1); '\0' != *p; p += 2) { + char tmp; + tmp = *(p-1); + *(p-1) = *p; + *p = tmp; + } + + return (char *) s; +} +#endif + #ifndef __HAVE_ARCH_MEMSET /** * memset - Fill a region of memory with the given value diff --git a/net/nfs.c b/net/nfs.c index 2363d61a336..ca2a108bae3 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -37,7 +37,7 @@ #define NFS_TIMEOUT 10 static int fs_mounted = 0; -static unsigned long rpc_id; +static unsigned long rpc_id = 0; static int nfs_offset = -1; static int nfs_len; @@ -123,17 +123,6 @@ dirname (char *path) } /************************************************************************** -RPC_INIT - set up the ID counter to something fairly random -**************************************************************************/ -static void -rpc_init (void) -{ - unsigned long t; - t=get_ticks(); - rpc_id = t ^ (t << 8) ^ (t << 16); -} - -/************************************************************************** RPC_ADD_CREDENTIALS - Add RPC authentication/verifier entries **************************************************************************/ static long *rpc_add_credentials (long *p) @@ -189,7 +178,7 @@ rpc_req (int rpc_prog, int rpc_proc, uint32_t *data, int datalen) int pktlen; int sport; - id = rpc_id++; + id = ++rpc_id; pkt.u.call.id = htonl(id); pkt.u.call.type = htonl(MSG_CALL); pkt.u.call.rpcvers = htonl(2); /* use RPC version 2 */ @@ -410,10 +399,14 @@ rpc_lookup_reply (int prog, uchar *pkt, unsigned len) printf ("%s\n", __FUNCTION__); #endif + if (ntohl(rpc_pkt.u.reply.id) != rpc_id) + return -1; + if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || rpc_pkt.u.reply.astatus || rpc_pkt.u.reply.astatus) { + return -1; } switch (prog) { @@ -439,6 +432,9 @@ nfs_mount_reply (uchar *pkt, unsigned len) memcpy ((unsigned char *)&rpc_pkt, pkt, len); + if (ntohl(rpc_pkt.u.reply.id) != rpc_id) + return -1; + if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || rpc_pkt.u.reply.astatus || @@ -463,6 +459,9 @@ nfs_umountall_reply (uchar *pkt, unsigned len) memcpy ((unsigned char *)&rpc_pkt, pkt, len); + if (ntohl(rpc_pkt.u.reply.id) != rpc_id) + return -1; + if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || rpc_pkt.u.reply.astatus) { @@ -486,6 +485,9 @@ nfs_lookup_reply (uchar *pkt, unsigned len) memcpy ((unsigned char *)&rpc_pkt, pkt, len); + if (ntohl(rpc_pkt.u.reply.id) != rpc_id) + return -1; + if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || rpc_pkt.u.reply.astatus || @@ -510,6 +512,9 @@ nfs_readlink_reply (uchar *pkt, unsigned len) memcpy ((unsigned char *)&rpc_pkt, pkt, len); + if (ntohl(rpc_pkt.u.reply.id) != rpc_id) + return -1; + if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || rpc_pkt.u.reply.astatus || @@ -544,6 +549,9 @@ nfs_read_reply (uchar *pkt, unsigned len) memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply)); + if (ntohl(rpc_pkt.u.reply.id) != rpc_id) + return -1; + if (rpc_pkt.u.reply.rstatus || rpc_pkt.u.reply.verifier || rpc_pkt.u.reply.astatus || @@ -755,7 +763,6 @@ NfsStart (void) NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout); NetSetHandler (NfsHandler); - rpc_init (); NfsTimeoutCount = 0; NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ; |