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>
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) */
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;
}
#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 */
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;
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;
}
{
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
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))))
{
#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;
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);
#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)
{
*(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 */
{
/* 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));
--- /dev/null
+ 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>
#define CFG_RESET_ADDRESS 0xff000000
+/*-----------------------------------------------------------------------
+ * USB stuff
+ *-----------------------------------------------------------------------
+ */
+#define CONFIG_USB_CDMFDC5xxx 0x0001BBBB
+#define CONFIG_USB_GPSCFG5xxx 0x00001000
+
/*-----------------------------------------------------------------------
* IDE/ATA stuff Supports IDE harddisk
*-----------------------------------------------------------------------
#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);
}
#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
#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;
return 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
**************************************************************************/
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 */
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) {
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 ||
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) {
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 ||
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 ||
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 ||
NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout);
NetSetHandler (NfsHandler);
- rpc_init ();
NfsTimeoutCount = 0;
NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ;