summaryrefslogtreecommitdiff
path: root/board/emk
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-03-06 00:58:30 +0000
committerwdenk <wdenk>2003-03-06 00:58:30 +0000
commitdb2f721ffcf9693086a7e5c6c7015f2019e7f52e (patch)
tree1d755e28c035c1247f30b570ed239a097a7d13c8 /board/emk
parent43d9616cffb4a130e1620e3e33fc9bc1bcabe399 (diff)
downloadu-boot-imx-db2f721ffcf9693086a7e5c6c7015f2019e7f52e.zip
u-boot-imx-db2f721ffcf9693086a7e5c6c7015f2019e7f52e.tar.gz
u-boot-imx-db2f721ffcf9693086a7e5c6c7015f2019e7f52e.tar.bz2
* Patch by Rune Torgersen, 13 Feb 2003:
Add support for Motorola MPC8266ADS board * Patch by Kyle Harris, 19 Feb 2003: patches for the Intel lubbock board: memsetup.S - general cleanup (based on Robert's csb226 code) flash.c - overhaul, actually works now lubbock.c - fix init funcs to return proper value * Patch by Kenneth Johansson, 26 Feb 2003: - Fixed off by one in RFTA calculation. - No need to abort when LDF is lower than we can program it's only minimum timing so clamp it to what we can do. - Takes function pointer to function for reading the spd_nvram. Usefull for faking data or hardcode a module without the nvram. - fix other user for above change - fix some comments. * Patches by Brian Waite, 26 Feb 2003: - fix port for evb64260 board - fix PCI for evb64260 board - fix PCI scan * Patch by Reinhard Meyer, 1 Mar 2003: Add support for EMK TOP860 Module * Patch by Yuli Barcohen, 02 Mar 2003: Add SPD EEPROM support for MPC8260ADS board
Diffstat (limited to 'board/emk')
-rw-r--r--board/emk/top860/Makefile40
-rw-r--r--board/emk/top860/flash.c490
-rw-r--r--board/emk/top860/top860.c187
-rw-r--r--board/emk/top860/u-boot.lds122
-rw-r--r--board/emk/top860/u-boot.lds.debug132
5 files changed, 971 insertions, 0 deletions
diff --git a/board/emk/top860/Makefile b/board/emk/top860/Makefile
new file mode 100644
index 0000000..ef173d0
--- /dev/null
+++ b/board/emk/top860/Makefile
@@ -0,0 +1,40 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB = lib$(BOARD).a
+
+OBJS = $(BOARD).o flash.o
+
+$(LIB): .depend $(OBJS)
+ $(AR) crv $@ $^
+
+#########################################################################
+
+.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+ $(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+sinclude .depend
+
+#########################################################################
diff --git a/board/emk/top860/flash.c b/board/emk/top860/flash.c
new file mode 100644
index 0000000..a9a9771
--- /dev/null
+++ b/board/emk/top860/flash.c
@@ -0,0 +1,490 @@
+/*
+ * (C) Copyright 2003
+ * EMK Elektronik GmbH <www.emk-elektronik.de>
+ * Reinhard Meyer <r.meyer@emk-elektronik.de>
+ *
+ * copied from the BMW Port - seems that its similiar enough
+ * to be easily adaped ;) --- Well, it turned out to become a
+ * merger between parts of the EMKstax Flash routines and the
+ * BMW funtion frames...
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <mpc8xx.h>
+
+#define FLASH_WORD_SIZE unsigned short
+#define FLASH_WORD_WIDTH (sizeof (FLASH_WORD_SIZE))
+
+flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
+
+/*-----------------------------------------------------------------------
+ * Functions
+ */
+static int write_word (flash_info_t *info, ulong dest, ulong data);
+
+
+/*****************************************************************************
+ * software product ID entry/exit
+ *****************************************************************************/
+static void FlashProductIdMode (
+ volatile FLASH_WORD_SIZE *b,
+ int on_off)
+{
+ b[0x5555] = 0xaa;
+ b[0x2aaa] = 0x55;
+ b[0x5555] = on_off ? 0x90 : 0xf0;
+}
+
+/*****************************************************************************
+ * sector erase start
+ *****************************************************************************/
+static void FlashSectorErase (
+ volatile FLASH_WORD_SIZE *b,
+ volatile FLASH_WORD_SIZE *a)
+{
+ b[0x5555] = 0xaa;
+ b[0x2aaa] = 0x55;
+ b[0x5555] = 0x80;
+ b[0x5555] = 0xaa;
+ b[0x2aaa] = 0x55;
+ a[0] = 0x30;
+}
+
+/*****************************************************************************
+ * program a word
+ *****************************************************************************/
+static void FlashProgWord (
+ volatile FLASH_WORD_SIZE *b,
+ volatile FLASH_WORD_SIZE *a,
+ FLASH_WORD_SIZE v)
+{
+ b[0x5555] = 0xaa;
+ b[0x2aaa] = 0x55;
+ b[0x5555] = 0xa0;
+ a[0] = v;
+}
+
+/*****************************************************************************
+ * reset bank, back to read mode
+ *****************************************************************************/
+static void FlashReset (volatile FLASH_WORD_SIZE *b)
+{
+ b[0] = 0xf0;
+}
+
+/*****************************************************************************
+ * identify FLASH chip
+ * this code is a stripped version of the FlashGetType() function in EMKstax
+ *****************************************************************************/
+unsigned long flash_init (void)
+{
+ volatile FLASH_WORD_SIZE * const flash = (volatile FLASH_WORD_SIZE *) CFG_FLASH_BASE;
+ FLASH_WORD_SIZE manu, dev;
+ flash_info_t * const pflinfo = &flash_info[0];
+ int j;
+
+ /* get Id Bytes */
+ FlashProductIdMode (flash, 1);
+ manu = flash[0];
+ dev = flash[1];
+ FlashProductIdMode (flash, 0);
+
+ pflinfo->size = 0;
+ pflinfo->sector_count = 0;
+ pflinfo->flash_id = 0xffffffff;
+ pflinfo->portwidth = FLASH_CFI_16BIT;
+ pflinfo->chipwidth = FLASH_CFI_BY16;
+
+ switch (manu&0xff)
+ {
+ case 0x01: /* AMD */
+ pflinfo->flash_id = FLASH_MAN_AMD;
+ switch (dev&0xff)
+ {
+ case 0x49:
+ pflinfo->size = 0x00200000;
+ pflinfo->sector_count = 35;
+ pflinfo->flash_id |= FLASH_AM160B;
+ pflinfo->start[0] = CFG_FLASH_BASE;
+ pflinfo->start[1] = CFG_FLASH_BASE + 0x4000;
+ pflinfo->start[2] = CFG_FLASH_BASE + 0x6000;
+ pflinfo->start[3] = CFG_FLASH_BASE + 0x8000;
+ for (j = 4; j < 35; j++)
+ {
+ pflinfo->start[j] = CFG_FLASH_BASE + 0x00010000 * (j-3);
+ }
+ break;
+
+ case 0xf9:
+ pflinfo->size = 0x00400000;
+ pflinfo->sector_count = 71;
+ pflinfo->flash_id |= FLASH_AM320B;
+ pflinfo->start[0] = CFG_FLASH_BASE;
+ pflinfo->start[1] = CFG_FLASH_BASE + 0x4000;
+ pflinfo->start[2] = CFG_FLASH_BASE + 0x6000;
+ pflinfo->start[3] = CFG_FLASH_BASE + 0x8000;
+ for (j = 0; j < 8; j++)
+ {
+ pflinfo->start[j] = CFG_FLASH_BASE + 0x00002000 * (j);
+ }
+ for (j = 8; j < 71; j++)
+ {
+ pflinfo->start[j] = CFG_FLASH_BASE + 0x00010000 * (j-7);
+ }
+ break;
+
+ default:
+ printf ("unknown AMD dev=%x ", dev);
+ pflinfo->flash_id |= FLASH_UNKNOWN;
+ }
+ break;
+
+ default:
+ printf ("unknown manu=%x ", manu);
+ }
+ return pflinfo->size;
+}
+
+/*****************************************************************************
+ * print info about a FLASH
+ *****************************************************************************/
+void flash_print_info (flash_info_t *info)
+{
+ static const char unk[] = "Unknown";
+ unsigned int i;
+ const char *mfct=unk,
+ *type=unk;
+
+ if(info->flash_id != FLASH_UNKNOWN)
+ {
+ switch (info->flash_id & FLASH_VENDMASK)
+ {
+ case FLASH_MAN_AMD:
+ mfct = "AMD";
+ break;
+ }
+
+ switch (info->flash_id & FLASH_TYPEMASK)
+ {
+ case FLASH_AM160B:
+ type = "AM29LV160B (16 Mbit, bottom boot sect)";
+ break;
+ case FLASH_AM320B:
+ type = "AM29LV320B (32 Mbit, bottom boot sect)";
+ break;
+ }
+ }
+
+ printf (
+ "\n Brand: %s Type: %s\n"
+ " Size: %lu KB in %d Sectors\n",
+ mfct,
+ type,
+ info->size >> 10,
+ info->sector_count
+ );
+
+ printf (" Sector Start Addresses:");
+
+ for (i = 0; i < info->sector_count; i++)
+ {
+ unsigned long size;
+ unsigned int erased;
+ unsigned long *flash = (unsigned long *) info->start[i];
+
+ /*
+ * Check if whole sector is erased
+ */
+ size =
+ (i != (info->sector_count - 1)) ?
+ (info->start[i + 1] - info->start[i]) >> 2 :
+ (info->start[0] + info->size - info->start[i]) >> 2;
+
+ for (
+ flash = (unsigned long *) info->start[i], erased = 1;
+ (flash != (unsigned long *) info->start[i] + size) && erased;
+ flash++
+ )
+ erased = *flash == ~0x0UL;
+
+ printf (
+ "%s %08lX %s %s",
+ (i % 5) ? "" : "\n ",
+ info->start[i],
+ erased ? "E" : " ",
+ info->protect[i] ? "RO" : " "
+ );
+ }
+
+ puts ("\n");
+ return;
+}
+
+/*****************************************************************************
+ * erase one or more sectors
+ *****************************************************************************/
+int flash_erase (flash_info_t *info, int s_first, int s_last)
+{
+ volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *)(info->start[0]);
+ int flag,
+ prot,
+ sect,
+ l_sect;
+ ulong start,
+ now,
+ last;
+
+ if ((s_first < 0) || (s_first > s_last))
+ {
+ if (info->flash_id == FLASH_UNKNOWN)
+ {
+ printf ("- missing\n");
+ }
+ else
+ {
+ printf ("- no sectors to erase\n");
+ }
+ return 1;
+ }
+
+ if ((info->flash_id == FLASH_UNKNOWN) ||
+ (info->flash_id > (FLASH_MAN_STM | FLASH_AMD_COMP)))
+ {
+ printf ("Can't erase unknown flash type - aborted\n");
+ return 1;
+ }
+
+ prot = 0;
+ for (sect=s_first; sect<=s_last; ++sect)
+ {
+ if (info->protect[sect])
+ {
+ prot++;
+ }
+ }
+
+ if (prot)
+ {
+ printf ("- Warning: %d protected sectors will not be erased!\n",
+ prot);
+ }
+ else
+ {
+ printf ("\n");
+ }
+
+ l_sect = -1;
+
+ /* Disable interrupts which might cause a timeout here */
+ flag = disable_interrupts();
+
+ /* Start erase on unprotected sectors */
+ for (sect = s_first; sect<=s_last; sect++)
+ {
+ if (info->protect[sect] == 0)
+ { /* not protected */
+ FlashSectorErase ((FLASH_WORD_SIZE *)info->start[0], (FLASH_WORD_SIZE *)info->start[sect]);
+ l_sect = sect;
+ }
+ }
+
+ /* re-enable interrupts if necessary */
+ if (flag)
+ enable_interrupts();
+
+ /* wait at least 80us - let's wait 1 ms */
+ udelay (1000);
+
+ /*
+ * We wait for the last triggered sector
+ */
+ if (l_sect < 0)
+ goto DONE;
+
+ start = get_timer (0);
+ last = start;
+ addr = (FLASH_WORD_SIZE *)info->start[l_sect];
+ while ((addr[0] & 0x0080) != 0x0080)
+ {
+ if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT)
+ {
+ printf ("Timeout\n");
+ return 1;
+ }
+ /* show that we're waiting */
+ if ((now - last) > 1000)
+ { /* every second */
+ serial_putc ('.');
+ last = now;
+ }
+ }
+
+ DONE:
+ /* reset to read mode */
+ FlashReset ((FLASH_WORD_SIZE *)info->start[0]);
+
+ printf (" done\n");
+ return 0;
+}
+
+/*****************************************************************************
+ * Copy memory to flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ *****************************************************************************/
+int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
+{
+ ulong cp,
+ wp,
+ data;
+ int i,
+ l,
+ rc;
+
+ wp = (addr & ~(FLASH_WORD_WIDTH-1)); /* get lower word aligned address */
+
+ /*
+ * handle unaligned start bytes, if there are...
+ */
+ if ((l = addr - wp) != 0)
+ {
+ data = 0;
+
+ /* get the current before the new data into our data word */
+ for (i=0, cp=wp; i<l; ++i, ++cp)
+ {
+ data = (data << 8) | (*(uchar *)cp);
+ }
+
+ /* now merge the to be programmed values */
+ for (; i<4 && cnt>0; ++i, ++cp, --cnt)
+ {
+ data = (data << 8) | *src++;
+ }
+
+ /* get the current after the new data into our data word */
+ for (; cnt==0 && i<FLASH_WORD_WIDTH; ++i, ++cp)
+ {
+ data = (data << 8) | (*(uchar *)cp);
+ }
+
+ /* now write the combined word */
+ if ((rc = write_word (info, wp, data)) != 0)
+ {
+ return (rc);
+ }
+ wp += FLASH_WORD_WIDTH;
+ }
+
+ /*
+ * handle word aligned part
+ */
+ while (cnt >= FLASH_WORD_WIDTH)
+ {
+ data = 0;
+ for (i=0; i<FLASH_WORD_WIDTH; ++i)
+ {
+ data = (data << 8) | *src++;
+ }
+ if ((rc = write_word (info, wp, data)) != 0)
+ {
+ return (rc);
+ }
+ wp += FLASH_WORD_WIDTH;
+ cnt -= FLASH_WORD_WIDTH;
+ }
+
+ if (cnt == 0)
+ {
+ return (0);
+ }
+
+ /*
+ * handle unaligned tail bytes, if there are...
+ */
+ data = 0;
+
+ /* now merge the to be programmed values */
+ for (i=0, cp=wp; i<FLASH_WORD_WIDTH && cnt>0; ++i, ++cp)
+ {
+ data = (data << 8) | *src++;
+ --cnt;
+ }
+
+ /* get the current after the new data into our data word */
+ for (; i<FLASH_WORD_WIDTH; ++i, ++cp)
+ {
+ data = (data << 8) | (*(uchar *)cp);
+ }
+
+ /* now write the combined word */
+ return (write_word (info, wp, data));
+}
+
+/*****************************************************************************
+ * Write a word to Flash, returns:
+ * 0 - OK
+ * 1 - write timeout
+ * 2 - Flash not erased
+ *****************************************************************************/
+static int write_word (flash_info_t *info, ulong dest, ulong data)
+{
+ volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)info->start[0];
+ volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
+ FLASH_WORD_SIZE data2 = data;
+ ulong start;
+ int flag;
+
+ /* Check if Flash is (sufficiently) erased */
+ if ((*dest2 & data2) != data2)
+ {
+ return (2);
+ }
+
+ /* Disable interrupts which might cause a timeout here */
+ flag = disable_interrupts ();
+
+ FlashProgWord (addr2, dest2, data2);
+
+ /* re-enable interrupts if necessary */
+ if (flag)
+ enable_interrupts ();
+
+ /* data polling for D7 */
+ start = get_timer (0);
+ while ((*dest2 & 0x0080) != (data2 & 0x0080))
+ {
+ if (get_timer (start) > CFG_FLASH_WRITE_TOUT)
+ {
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+/*-----------------------------------------------------------------------
+ */
+
diff --git a/board/emk/top860/top860.c b/board/emk/top860/top860.c
new file mode 100644
index 0000000..b99bf0e
--- /dev/null
+++ b/board/emk/top860/top860.c
@@ -0,0 +1,187 @@
+/*
+ * (C) Copyright 2003
+ * EMK Elektronik GmbH <www.emk-elektronik.de>
+ * Reinhard Meyer <r.meyer@emk-elektronik.de>
+ *
+ * Board specific routines for the TOP860
+ *
+ * - initialisation
+ * - interface to VPD data (mac address, clock speeds)
+ * - memory controller
+ * - serial io initialisation
+ * - ethernet io initialisation
+ *
+ * -----------------------------------------------------------------
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <commproc.h>
+#include <mpc8xx.h>
+
+/*****************************************************************************
+ * UPM table for 60ns EDO RAM at 25 MHz bus/external clock
+ *****************************************************************************/
+static const uint edo_60ns_25MHz_tbl[] = {
+
+/* single read (offset 0x00 in upm ram) */
+ 0x0ff3fc04,0x08f3fc04,0x00f3fc04,0x00f3fc00,
+ 0x33f7fc07,0xfffffc05,0xfffffc05,0xfffffc05,
+/* burst read (offset 0x08 in upm ram) */
+ 0x0ff3fc04,0x08f3fc04,0x00f3fc0c,0x0ff3fc40,
+ 0x0cf3fc04,0x03f3fc48,0x0cf3fc04,0x03f3fc48,
+ 0x0cf3fc04,0x03f3fc00,0x3ff7fc07,0xfffffc05,
+ 0xfffffc05,0xfffffc05,0xfffffc05,0xfffffc05,
+/* single write (offset 0x18 in upm ram) */
+ 0x0ffffc04,0x08fffc04,0x30fffc00,0xf1fffc07,
+ 0xfffffc05,0xfffffc05,0xfffffc05,0xfffffc05,
+/* burst write (offset 0x20 in upm ram) */
+ 0x0ffffc04,0x08fffc00,0x00fffc04,0x03fffc4c,
+ 0x00fffc00,0x07fffc4c,0x00fffc00,0x0ffffc4c,
+ 0x00fffc00,0x3ffffc07,0xfffffc05,0xfffffc05,
+ 0xfffffc05,0xfffffc05,0xfffffc05,0xfffffc05,
+/* refresh (offset 0x30 in upm ram) */
+ 0xc0fffc04,0x07fffc04,0x0ffffc04,0x0ffffc04,
+ 0xfffffc05,0xfffffc05,0xfffffc05,0xfffffc05,
+ 0xfffffc05,0xfffffc05,0xfffffc05,0xfffffc05,
+/* exception (offset 0x3C in upm ram) */
+ 0xfffffc07,0xfffffc03,0xfffffc05,0xfffffc05,
+};
+
+/*****************************************************************************
+ * Print Board Identity
+ *****************************************************************************/
+int checkboard (void)
+{
+ puts ("Board:"CONFIG_IDENT_STRING"\n");
+ return (0);
+}
+
+/*****************************************************************************
+ * Initialize DRAM controller
+ *****************************************************************************/
+long int initdram (int board_type)
+{
+ volatile immap_t *immap = (immap_t *) CFG_IMMR;
+ volatile memctl8xx_t *memctl = &immap->im_memctl;
+
+ /*
+ * Only initialize memory controller when running from FLASH.
+ * When running from RAM, don't touch it.
+ */
+ if ((ulong) initdram & 0xff000000)
+ {
+ volatile uint *addr1, *addr2;
+ uint i, j;
+
+ upmconfig (UPMA, (uint *) edo_60ns_25MHz_tbl,
+ sizeof (edo_60ns_25MHz_tbl) / sizeof (uint));
+ memctl->memc_mptpr = 0x0200;
+ memctl->memc_mamr = 0x0ca20330;
+ memctl->memc_or2 = -CFG_DRAM_MAX | OR_CSNT_SAM;
+ memctl->memc_br2 = CFG_DRAM_BASE | BR_MS_UPMA | BR_V;
+ /*
+ * Do 8 read accesses to DRAM
+ */
+ addr1 = (volatile uint*) 0;
+ addr2 = (volatile uint*) 0x00400000;
+ for (i=0, j=0; i<8; i++)
+ j = addr1[0];
+
+ /*
+ * Now check whether we got 4MB or 16MB populated
+ */
+ addr1[0] = 0x12345678;
+ addr1[1] = 0x9abcdef0;
+ addr2[0] = 0xfeedc0de;
+ addr2[1] = 0x47110815;
+ if (addr1[0] == 0xfeedc0de && addr1[1] == 0x47110815)
+ {
+ /* only 4MB populated */
+ memctl->memc_or2 = -(CFG_DRAM_MAX/4) | OR_CSNT_SAM;
+ }
+ }
+
+ return -(memctl->memc_or2 & 0xffff0000);
+}
+
+/*****************************************************************************
+ * otherinits after RAM is there and we are relocated to RAM
+ * note: though this is an int function, nobody cares for the result!
+ *****************************************************************************/
+int misc_init_r (void)
+{
+ /* read 'factory' part of EEPROM */
+ uchar buf[81];
+ uchar *p;
+ uint length;
+ uint addr;
+ uint len;
+
+ /* get length first */
+ addr = CFG_FACT_OFFSET;
+ if (eeprom_read (CFG_I2C_FACT_ADDR, addr, buf, 2))
+ {
+bailout:
+ printf ("cannot read factory configuration\n");
+ printf ("be sure to set ethaddr yourself!\n");
+ return 0;
+ }
+ length = buf[0] + (buf[1]<<8);
+ addr += 2;
+
+ /* sanity check */
+ if (length < 20 || length > CFG_FACT_SIZE-2)
+ goto bailout;
+
+ /* read lines */
+ while (length > 0)
+ {
+ /* read one line */
+ len = length > 80 ? 80 : length;
+ if (eeprom_read (CFG_I2C_FACT_ADDR, addr, buf, len))
+ goto bailout;
+ /* mark end of buffer */
+ buf[len] = 0;
+ /* search end of line */
+ for (p=buf; *p && *p != 0x0a; p++) ;
+ if (!*p)
+ goto bailout;
+ *p++ = 0;
+ /* advance to next line start */
+ length -= p-buf;
+ addr += p-buf;
+ /*printf ("%s\n", buf);*/
+ /* search for our specific entry */
+ if (!strncmp ((char *)buf, "[RLA/lan/Ethernet] ", 19))
+ {
+ setenv ("ethaddr", buf+19);
+ }
+ else if (!strncmp ((char *)buf, "[BOARD/SERIAL] ", 15))
+ {
+ setenv ("serial#", buf+15);
+ }
+ else if (!strncmp ((char *)buf, "[BOARD/TYPE] ", 13))
+ {
+ setenv ("board_id", buf+13);
+ }
+ }
+ return (0);
+}
+
diff --git a/board/emk/top860/u-boot.lds b/board/emk/top860/u-boot.lds
new file mode 100644
index 0000000..d647be3
--- /dev/null
+++ b/board/emk/top860/u-boot.lds
@@ -0,0 +1,122 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; */
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ . = + SIZEOF_HEADERS;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.text : { *(.rel.text) }
+ .rela.text : { *(.rela.text) }
+ .rel.data : { *(.rel.data) }
+ .rela.data : { *(.rela.data) }
+ .rel.rodata : { *(.rel.rodata) }
+ .rela.rodata : { *(.rela.rodata) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init : { *(.init) }
+ .plt : { *(.plt) }
+ .text :
+ {
+ cpu/mpc8xx/start.o (.text)
+
+ *(.text)
+ *(.fixup)
+ *(.got1)
+ }
+ _etext = .;
+ PROVIDE (etext = .);
+ .rodata :
+ {
+ *(.rodata)
+ *(.rodata1)
+ }
+ .fini : { *(.fini) } =0
+ .ctors : { *(.ctors) }
+ .dtors : { *(.dtors) }
+
+ /* Read-write section, merged into data segment: */
+ . = (. + 0x00FF) & 0xFFFFFF00;
+ _erotext = .;
+ PROVIDE (erotext = .);
+ .reloc :
+ {
+ *(.got)
+ _GOT2_TABLE_ = .;
+ *(.got2)
+ _FIXUP_TABLE_ = .;
+ *(.fixup)
+ }
+ __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+ __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+ .data :
+ {
+ *(.data)
+ *(.data1)
+ *(.sdata)
+ *(.sdata2)
+ *(.dynamic)
+ CONSTRUCTORS
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+
+ __start___ex_table = .;
+ __ex_table : { *(__ex_table) }
+ __stop___ex_table = .;
+
+ . = ALIGN(256);
+ __init_begin = .;
+ .text.init : { *(.text.init) }
+ .data.init : { *(.data.init) }
+ . = ALIGN(256);
+ __init_end = .;
+
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss) *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ _end = . ;
+ PROVIDE (end = .);
+}
+
diff --git a/board/emk/top860/u-boot.lds.debug b/board/emk/top860/u-boot.lds.debug
new file mode 100644
index 0000000..bd13b7b
--- /dev/null
+++ b/board/emk/top860/u-boot.lds.debug
@@ -0,0 +1,132 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; */
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ . = + SIZEOF_HEADERS;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.text : { *(.rel.text) }
+ .rela.text : { *(.rela.text) }
+ .rel.data : { *(.rel.data) }
+ .rela.data : { *(.rela.data) }
+ .rel.rodata : { *(.rel.rodata) }
+ .rela.rodata : { *(.rela.rodata) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init : { *(.init) }
+ .plt : { *(.plt) }
+ .text :
+ {
+ /* WARNING - the following is hand-optimized to fit within */
+ /* the sector layout of our flash chips! XXX FIXME XXX */
+
+ cpu/mpc8xx/start.o (.text)
+ common/dlmalloc.o (.text)
+ lib_generic/vsprintf.o (.text)
+ lib_generic/crc32.o (.text)
+ lib_ppc/extable.o (.text)
+
+ . = env_offset;
+ common/environment.o(.text)
+
+ *(.text)
+ *(.fixup)
+ *(.got1)
+ }
+ _etext = .;
+ PROVIDE (etext = .);
+ .rodata :
+ {
+ *(.rodata)
+ *(.rodata1)
+ }
+ .fini : { *(.fini) } =0
+ .ctors : { *(.ctors) }
+ .dtors : { *(.dtors) }
+
+ /* Read-write section, merged into data segment: */
+ . = (. + 0x0FFF) & 0xFFFFF000;
+ _erotext = .;
+ PROVIDE (erotext = .);
+ .reloc :
+ {
+ *(.got)
+ _GOT2_TABLE_ = .;
+ *(.got2)
+ _FIXUP_TABLE_ = .;
+ *(.fixup)
+ }
+ __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+ __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+ .data :
+ {
+ *(.data)
+ *(.data1)
+ *(.sdata)
+ *(.sdata2)
+ *(.dynamic)
+ CONSTRUCTORS
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+
+ __start___ex_table = .;
+ __ex_table : { *(__ex_table) }
+ __stop___ex_table = .;
+
+ . = ALIGN(4096);
+ __init_begin = .;
+ .text.init : { *(.text.init) }
+ .data.init : { *(.data.init) }
+ . = ALIGN(4096);
+ __init_end = .;
+
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss) *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ _end = . ;
+ PROVIDE (end = .);
+}
+