summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/uboot/u-boot-1.1.6/sarge-uboot.patch3375
-rw-r--r--packages/uboot/u-boot_1.1.6.bb4
2 files changed, 3378 insertions, 1 deletions
diff --git a/packages/uboot/u-boot-1.1.6/sarge-uboot.patch b/packages/uboot/u-boot-1.1.6/sarge-uboot.patch
new file mode 100644
index 0000000000..affc3d38cd
--- /dev/null
+++ b/packages/uboot/u-boot-1.1.6/sarge-uboot.patch
@@ -0,0 +1,3375 @@
+diff -Nurp ../u-boot-1.1.6/arm_config.mk ./arm_config.mk
+--- ../u-boot-1.1.6/arm_config.mk 2006-11-02 15:15:01.000000000 +0100
++++ ./arm_config.mk 2007-04-23 18:07:47.000000000 +0200
+@@ -21,4 +21,6 @@
+ # MA 02111-1307 USA
+ #
+
++#PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float
++PLATFORM_CPPFLAGS += -march=armv4t -mtune=arm920t
+ PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
+diff -Nurp ../u-boot-1.1.6/board/sarge/config.mk ./board/sarge/config.mk
+--- ../u-boot-1.1.6/board/sarge/config.mk 1970-01-01 01:00:00.000000000 +0100
++++ ./board/sarge/config.mk 2007-03-21 00:31:33.000000000 +0100
+@@ -0,0 +1 @@
++TEXT_BASE = 0x21F00000
+diff -Nurp ../u-boot-1.1.6/board/sarge/flash.c ./board/sarge/flash.c
+--- ../u-boot-1.1.6/board/sarge/flash.c 1970-01-01 01:00:00.000000000 +0100
++++ ./board/sarge/flash.c 2007-03-09 01:25:41.000000000 +0100
+@@ -0,0 +1,504 @@
++/*
++ * (C) Copyright 2002
++ * Lineo, Inc. <www.lineo.com>
++ * Bernhard Kuhn <bkuhn@lineo.com>
++ *
++ * (C) Copyright 2002
++ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
++ * Alex Zuepke <azu@sysgo.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>
++
++ulong myflush(void);
++
++
++/* Flash Organization Structure */
++typedef struct OrgDef
++{
++ unsigned int sector_number;
++ unsigned int sector_size;
++} OrgDef;
++
++
++/* Flash Organizations */
++OrgDef OrgAT49BV16x4[] =
++{
++ { 8, 8*1024 }, /* 8 * 8 kBytes sectors */
++ { 2, 32*1024 }, /* 2 * 32 kBytes sectors */
++ { 30, 64*1024 }, /* 30 * 64 kBytes sectors */
++};
++
++OrgDef OrgAT49BV16x4A[] =
++{
++ { 8, 8*1024 }, /* 8 * 8 kBytes sectors */
++ { 31, 64*1024 }, /* 31 * 64 kBytes sectors */
++};
++
++OrgDef OrgAT49BV6416[] =
++{
++ { 8, 8*1024 }, /* 8 * 8 kBytes sectors */
++ { 127, 64*1024 }, /* 127 * 64 kBytes sectors */
++};
++
++flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
++
++/* AT49BV1614A Codes */
++#define FLASH_CODE1 0xAA
++#define FLASH_CODE2 0x55
++#define ID_IN_CODE 0x90
++#define ID_OUT_CODE 0xF0
++
++
++#define CMD_READ_ARRAY 0x00F0
++#define CMD_UNLOCK1 0x00AA
++#define CMD_UNLOCK2 0x0055
++#define CMD_ERASE_SETUP 0x0080
++#define CMD_ERASE_CONFIRM 0x0030
++#define CMD_PROGRAM 0x00A0
++#define CMD_UNLOCK_BYPASS 0x0020
++#define CMD_SECTOR_UNLOCK 0x0070
++
++#define MEM_FLASH_ADDR1 (*(volatile u16 *)(CFG_FLASH_BASE + (0x00005555<<1)))
++#define MEM_FLASH_ADDR2 (*(volatile u16 *)(CFG_FLASH_BASE + (0x00002AAA<<1)))
++
++#define BIT_ERASE_DONE 0x0080
++#define BIT_RDY_MASK 0x0080
++#define BIT_PROGRAM_ERROR 0x0020
++#define BIT_TIMEOUT 0x80000000 /* our flag */
++
++#define READY 1
++#define ERR 2
++#define TMO 4
++
++/*-----------------------------------------------------------------------
++ */
++void flash_identification (flash_info_t * info)
++{
++ volatile u16 manuf_code, device_code, add_device_code;
++
++ MEM_FLASH_ADDR1 = FLASH_CODE1;
++ MEM_FLASH_ADDR2 = FLASH_CODE2;
++ MEM_FLASH_ADDR1 = ID_IN_CODE;
++
++ manuf_code = *(volatile u16 *) CFG_FLASH_BASE;
++ device_code = *(volatile u16 *) (CFG_FLASH_BASE + 2);
++ add_device_code = *(volatile u16 *) (CFG_FLASH_BASE + (3 << 1));
++
++ MEM_FLASH_ADDR1 = FLASH_CODE1;
++ MEM_FLASH_ADDR2 = FLASH_CODE2;
++ MEM_FLASH_ADDR1 = ID_OUT_CODE;
++
++ /* Vendor type */
++ info->flash_id = ATM_MANUFACT & FLASH_VENDMASK;
++ printf ("Atmel: ");
++
++ if ((device_code & FLASH_TYPEMASK) == (ATM_ID_BV1614 & FLASH_TYPEMASK)) {
++
++ if ((add_device_code & FLASH_TYPEMASK) ==
++ (ATM_ID_BV1614A & FLASH_TYPEMASK)) {
++ info->flash_id |= ATM_ID_BV1614A & FLASH_TYPEMASK;
++ printf ("AT49BV1614A (16Mbit)\n");
++ } else { /* AT49BV1614 Flash */
++ info->flash_id |= ATM_ID_BV1614 & FLASH_TYPEMASK;
++ printf ("AT49BV1614 (16Mbit)\n");
++ }
++
++ } else if ((device_code & FLASH_TYPEMASK) == (ATM_ID_BV6416 & FLASH_TYPEMASK)) {
++ info->flash_id |= ATM_ID_BV6416 & FLASH_TYPEMASK;
++ printf ("AT49BV6416 (64Mbit)\n");
++ }
++}
++
++ushort flash_number_sector(OrgDef *pOrgDef, unsigned int nb_blocks)
++{
++ int i, nb_sectors = 0;
++
++ for (i=0; i<nb_blocks; i++){
++ nb_sectors += pOrgDef[i].sector_number;
++ }
++
++ return nb_sectors;
++}
++
++void flash_unlock_sector(flash_info_t * info, unsigned int sector)
++{
++ volatile u16 *addr = (volatile u16 *) (info->start[sector]);
++
++ MEM_FLASH_ADDR1 = CMD_UNLOCK1;
++ *addr = CMD_SECTOR_UNLOCK;
++}
++
++
++ulong flash_init (void)
++{
++ int i, j, k;
++ unsigned int flash_nb_blocks, sector;
++ unsigned int start_address;
++ OrgDef *pOrgDef;
++
++ ulong size = 0;
++
++ for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
++ ulong flashbase = 0;
++
++ flash_identification (&flash_info[i]);
++
++ if ((flash_info[i].flash_id & FLASH_TYPEMASK) ==
++ (ATM_ID_BV1614 & FLASH_TYPEMASK)) {
++
++ pOrgDef = OrgAT49BV16x4;
++ flash_nb_blocks = sizeof (OrgAT49BV16x4) / sizeof (OrgDef);
++ } else if ((flash_info[i].flash_id & FLASH_TYPEMASK) ==
++ (ATM_ID_BV1614A & FLASH_TYPEMASK)){ /* AT49BV1614A Flash */
++
++ pOrgDef = OrgAT49BV16x4A;
++ flash_nb_blocks = sizeof (OrgAT49BV16x4A) / sizeof (OrgDef);
++ } else if ((flash_info[i].flash_id & FLASH_TYPEMASK) ==
++ (ATM_ID_BV6416 & FLASH_TYPEMASK)){ /* AT49BV6416 Flash */
++
++ pOrgDef = OrgAT49BV6416;
++ flash_nb_blocks = sizeof (OrgAT49BV6416) / sizeof (OrgDef);
++ } else {
++ flash_nb_blocks = 0;
++ pOrgDef = OrgAT49BV16x4;
++ }
++
++ flash_info[i].sector_count = flash_number_sector(pOrgDef, flash_nb_blocks);
++ memset (flash_info[i].protect, 0, flash_info[i].sector_count);
++
++ if (i == 0)
++ flashbase = PHYS_FLASH_1;
++ else
++ panic ("configured too many flash banks!\n");
++
++ sector = 0;
++ start_address = flashbase;
++ flash_info[i].size = 0;
++
++ for (j = 0; j < flash_nb_blocks; j++) {
++ for (k = 0; k < pOrgDef[j].sector_number; k++) {
++ flash_info[i].start[sector++] = start_address;
++ start_address += pOrgDef[j].sector_size;
++ flash_info[i].size += pOrgDef[j].sector_size;
++ }
++ }
++
++ size += flash_info[i].size;
++
++ if ((flash_info[i].flash_id & FLASH_TYPEMASK) ==
++ (ATM_ID_BV6416 & FLASH_TYPEMASK)){ /* AT49BV6416 Flash */
++
++ /* Unlock all sectors at reset */
++ for (j=0; j<flash_info[i].sector_count; j++){
++ flash_unlock_sector(&flash_info[i], j);
++ }
++ }
++ }
++
++ /* Protect binary boot image */
++ flash_protect (FLAG_PROTECT_SET,
++ CFG_FLASH_BASE,
++ CFG_FLASH_BASE + CFG_BOOT_SIZE - 1, &flash_info[0]);
++
++ /* Protect environment variables */
++ flash_protect (FLAG_PROTECT_SET,
++ CFG_ENV_ADDR,
++ CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
++
++ /* Protect U-Boot gzipped image */
++ flash_protect (FLAG_PROTECT_SET,
++ CFG_U_BOOT_BASE,
++ CFG_U_BOOT_BASE + CFG_U_BOOT_SIZE - 1, &flash_info[0]);
++
++ return size;
++}
++
++/*-----------------------------------------------------------------------
++ */
++void flash_print_info (flash_info_t * info)
++{
++ int i;
++
++ switch (info->flash_id & FLASH_VENDMASK) {
++ case (ATM_MANUFACT & FLASH_VENDMASK):
++ printf ("Atmel: ");
++ break;
++ default:
++ printf ("Unknown Vendor ");
++ break;
++ }
++
++ switch (info->flash_id & FLASH_TYPEMASK) {
++ case (ATM_ID_BV1614 & FLASH_TYPEMASK):
++ printf ("AT49BV1614 (16Mbit)\n");
++ break;
++ case (ATM_ID_BV1614A & FLASH_TYPEMASK):
++ printf ("AT49BV1614A (16Mbit)\n");
++ break;
++ case (ATM_ID_BV6416 & FLASH_TYPEMASK):
++ printf ("AT49BV6416 (64Mbit)\n");
++ break;
++ default:
++ printf ("Unknown Chip Type\n");
++ return;
++ }
++
++ printf (" Size: %ld MB in %d Sectors\n",
++ info->size >> 20, info->sector_count);
++
++ printf (" Sector Start Addresses:");
++ for (i = 0; i < info->sector_count; i++) {
++ if ((i % 5) == 0) {
++ printf ("\n ");
++ }
++ printf (" %08lX%s", info->start[i],
++ info->protect[i] ? " (RO)" : " ");
++ }
++ printf ("\n");
++}
++
++/*-----------------------------------------------------------------------
++ */
++
++int flash_erase (flash_info_t * info, int s_first, int s_last)
++{
++ ulong result;
++ int iflag, cflag, prot, sect;
++ int rc = ERR_OK;
++ int chip1;
++
++ /* first look for protection bits */
++
++ if (info->flash_id == FLASH_UNKNOWN)
++ return ERR_UNKNOWN_FLASH_TYPE;
++
++ if ((s_first < 0) || (s_first > s_last)) {
++ return ERR_INVAL;
++ }
++
++ if ((info->flash_id & FLASH_VENDMASK) !=
++ (ATM_MANUFACT & FLASH_VENDMASK)) {
++ return ERR_UNKNOWN_FLASH_VENDOR;
++ }
++
++ prot = 0;
++ for (sect = s_first; sect <= s_last; ++sect) {
++ if (info->protect[sect]) {
++ prot++;
++ }
++ }
++ if (prot)
++ return ERR_PROTECTED;
++
++ /*
++ * Disable interrupts which might cause a timeout
++ * here. Remember that our exception vectors are
++ * at address 0 in the flash, and we don't want a
++ * (ticker) exception to happen while the flash
++ * chip is in programming mode.
++ */
++ cflag = icache_status ();
++ icache_disable ();
++ iflag = disable_interrupts ();
++
++ /* Start erase on unprotected sectors */
++ for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {
++ printf ("Erasing sector %2d ... ", sect);
++
++ /* arm simple, non interrupt dependent timer */
++ reset_timer_masked ();
++
++ if (info->protect[sect] == 0) { /* not protected */
++ volatile u16 *addr = (volatile u16 *) (info->start[sect]);
++
++ MEM_FLASH_ADDR1 = CMD_UNLOCK1;
++ MEM_FLASH_ADDR2 = CMD_UNLOCK2;
++ MEM_FLASH_ADDR1 = CMD_ERASE_SETUP;
++
++ MEM_FLASH_ADDR1 = CMD_UNLOCK1;
++ MEM_FLASH_ADDR2 = CMD_UNLOCK2;
++ *addr = CMD_ERASE_CONFIRM;
++
++ /* wait until flash is ready */
++ chip1 = 0;
++
++ do {
++ result = *addr;
++
++ /* check timeout */
++ if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) {
++ MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
++ chip1 = TMO;
++ break;
++ }
++
++ if (!chip1 && (result & 0xFFFF) & BIT_ERASE_DONE)
++ chip1 = READY;
++
++ } while (!chip1);
++
++ MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
++
++ if (chip1 == ERR) {
++ rc = ERR_PROG_ERROR;
++ goto outahere;
++ }
++ if (chip1 == TMO) {
++ rc = ERR_TIMOUT;
++ goto outahere;
++ }
++
++ printf ("ok.\n");
++ } else { /* it was protected */
++ printf ("protected!\n");
++ }
++ }
++
++ if (ctrlc ())
++ printf ("User Interrupt!\n");
++
++outahere:
++ /* allow flash to settle - wait 10 ms */
++ udelay_masked (10000);
++
++ if (iflag)
++ enable_interrupts ();
++
++ if (cflag)
++ icache_enable ();
++
++ return rc;
++}
++
++/*-----------------------------------------------------------------------
++ * Copy memory to flash
++ */
++
++volatile static int write_word (flash_info_t * info, ulong dest,
++ ulong data)
++{
++ volatile u16 *addr = (volatile u16 *) dest;
++ ulong result;
++ int rc = ERR_OK;
++ int cflag, iflag;
++ int chip1;
++
++ /*
++ * Check if Flash is (sufficiently) erased
++ */
++ result = *addr;
++ if ((result & data) != data)
++ return ERR_NOT_ERASED;
++
++
++ /*
++ * Disable interrupts which might cause a timeout
++ * here. Remember that our exception vectors are
++ * at address 0 in the flash, and we don't want a
++ * (ticker) exception to happen while the flash
++ * chip is in programming mode.
++ */
++ cflag = icache_status ();
++ icache_disable ();
++ iflag = disable_interrupts ();
++
++ MEM_FLASH_ADDR1 = CMD_UNLOCK1;
++ MEM_FLASH_ADDR2 = CMD_UNLOCK2;
++ MEM_FLASH_ADDR1 = CMD_PROGRAM;
++ *addr = data;
++
++ /* arm simple, non interrupt dependent timer */
++ reset_timer_masked ();
++
++ /* wait until flash is ready */
++ chip1 = 0;
++ do {
++ result = *addr;
++
++ /* check timeout */
++ if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) {
++ chip1 = ERR | TMO;
++ break;
++ }
++ if (!chip1 && ((result & 0x80) == (data & 0x80)))
++ chip1 = READY;
++
++ } while (!chip1);
++
++ *addr = CMD_READ_ARRAY;
++
++ if (chip1 == ERR || *addr != data)
++ rc = ERR_PROG_ERROR;
++
++ if (iflag)
++ enable_interrupts ();
++
++ if (cflag)
++ icache_enable ();
++
++ return rc;
++}
++
++/*-----------------------------------------------------------------------
++ * Copy memory to flash.
++ */
++
++int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
++{
++ ulong wp, data;
++ int rc;
++
++ if (addr & 1) {
++ printf ("unaligned destination not supported\n");
++ return ERR_ALIGN;
++ };
++
++ if ((int) src & 1) {
++ printf ("unaligned source not supported\n");
++ return ERR_ALIGN;
++ };
++
++ wp = addr;
++
++ while (cnt >= 2) {
++ data = *((volatile u16 *) src);
++ if ((rc = write_word (info, wp, data)) != 0) {
++ return (rc);
++ }
++ src += 2;
++ wp += 2;
++ cnt -= 2;
++ }
++
++ if (cnt == 1) {
++ data = (*((volatile u8 *) src)) | (*((volatile u8 *) (wp + 1)) <<
++ 8);
++ if ((rc = write_word (info, wp, data)) != 0) {
++ return (rc);
++ }
++ src += 1;
++ wp += 1;
++ cnt -= 1;
++ };
++
++ return ERR_OK;
++}
+diff -Nurp ../u-boot-1.1.6/board/sarge/Makefile ./board/sarge/Makefile
+--- ../u-boot-1.1.6/board/sarge/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ ./board/sarge/Makefile 2007-03-14 01:05:48.000000000 +0100
+@@ -0,0 +1,46 @@
++#
++# (C) Copyright 2007
++# Grzegorz Rajtar, mcgregor@blackmesaeast.com.pl.
++#
++# 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 := sarge_board.o at45.o flash.o
++
++$(LIB): $(OBJS) $(SOBJS)
++ $(AR) crv $@ $(OBJS) $(SOBJS)
++
++clean:
++ rm -f $(SOBJS) $(OBJS)
++
++distclean: clean
++ rm -f $(LIB) core *.bak .depend
++
++#########################################################################
++
++.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
++ $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
++
++-include .depend
++
++#########################################################################
+diff -Nurp ../u-boot-1.1.6/board/sarge/sarge_board.c ./board/sarge/sarge_board.c
+--- ../u-boot-1.1.6/board/sarge/sarge_board.c 1970-01-01 01:00:00.000000000 +0100
++++ ./board/sarge/sarge_board.c 2007-05-11 23:45:25.000000000 +0200
+@@ -0,0 +1,363 @@
++/*
++ * (C) Copyright 2007
++ * Grzegorz Rajtar <mcgregor@blackmesaeast.com.pl>
++ *
++ * 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 <asm/arch/AT91RM9200.h>
++#include <at91rm9200_net.h>
++#include <dm9161.h>
++#include <rtl8201bl.h>
++#include <ste100p.h>
++#include <miiphy.h>
++/* ------------------------------------------------------------------------- */
++/*
++ * Miscelaneous platform dependent initialisations
++ */
++
++void lowlevel_init(void)
++{
++}
++/* ------------------------------------------------------------------------- */
++
++void cs_init(int enable)
++{
++ unsigned long flag =
++ AT91C_PIO_PA0 | AT91C_PIO_PA1 | AT91C_PIO_PA2 |
++ AT91C_PIO_PA4 | AT91C_PIO_PA5 | AT91C_PIO_PA6;
++ //MISO, MOSI, SPCK, NPCS1, NPCS2, NPCS3;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_ASR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PER = flag;
++}
++
++void mac_init(int enable)
++{
++ unsigned long flag =
++ // ETXCK, ETXEN, ETX0, ETX1, EXRS,
++ // ERX0, ERX1, ERXER, EMDC, EMDIO
++ AT91C_PIO_PA7 | AT91C_PIO_PA8 | AT91C_PIO_PA9 | AT91C_PIO_PA10 |
++ AT91C_PIO_PA11 | AT91C_PIO_PA12 | AT91C_PIO_PA13 | AT91C_PIO_PA14 |
++ AT91C_PIO_PA13 | AT91C_PIO_PA16;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_ASR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PER = flag;
++
++ //ERXCK, ECOL, ERXDV, ERX3, ERX2, ETXER, ETX3, ETX2
++ flag = AT91C_PIO_PB19 | AT91C_PIO_PB18 | AT91C_PIO_PB17 | AT91C_PIO_PB16 |
++ AT91C_PIO_PB15 | AT91C_PIO_PB14 | AT91C_PIO_PB13 | AT91C_PIO_PB12;
++
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_BSR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++ // EMDINT -
++ flag = AT91C_PIO_PB1;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_IER = flag;
++ }
++ else
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_IDR = flag;
++ }
++}
++
++void peripheral_init(int enable)
++{
++ unsigned long flag =
++ // A - TXD0, RXD0, SCK0, RXD2, TXD2, I2C_SCL. I2C_SDA
++ AT91C_PIO_PA17 | AT91C_PIO_PA18 | AT91C_PIO_PA19 |
++ AT91C_PIO_PA20 | AT91C_PIO_PA21 | AT91C_PIO_PA22 |
++ AT91C_PIO_PA23 | AT91C_PA25_TWD | AT91C_PA26_TWCK;
++
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_ASR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PER = flag;
++
++ //B - PCK1
++ flag = AT91C_PIO_PA24;
++
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_BSR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PER = flag;
++
++
++ // PA20, PA21 - I/O
++ flag = AT91C_PIO_PA20 | AT91C_PIO_PA21;
++ if (enable)
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PER = flag;
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PDR = flag;
++
++ // A - PCK0, RXD1, TXD1,RF1,RK1, RD1, TD1, TK1, TF1
++ flag = AT91C_PIO_PB27 | AT91C_PIO_PB21 | AT91C_PIO_PB20 |
++ AT91C_PIO_PB11 | AT91C_PIO_PB10 | AT91C_PIO_PB9 |
++ AT91C_PIO_PB8 | AT91C_PIO_PB7 | AT91C_PIO_PB6;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_ASR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++ // I/O PB26 - PB22
++ flag = AT91C_PIO_PB22 | AT91C_PIO_PB23 | AT91C_PIO_PB24 |
++ AT91C_PIO_PB25 | AT91C_PIO_PB26;
++ if (enable)
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++}
++
++void mmc_init(int enable)
++{
++ // MCCK, MCCDA, MCDA0
++ unsigned long flag =
++ AT91C_PIO_PA27 | AT91C_PIO_PA28 | AT91C_PIO_PA29;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_ASR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_PER = flag;
++ // MCDA3, MCDA2, MCDA1
++ flag = AT91C_PIO_PB5 | AT91C_PIO_PB4 | AT91C_PIO_PB3;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_BSR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++ //MCWP, MCCD
++ flag = AT91C_PIO_PB2 | AT91C_PIO_PB0;
++
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_IER = AT91C_PIO_PB0;
++ }
++ else
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_IDR = AT91C_PIO_PB0;
++ }
++}
++
++void irq_init(int enable)
++{
++ // IRQ, FIQ
++ unsigned long flag =
++ AT91C_PIO_PB29 | AT91C_PIO_PB28;
++ if (enable)
++ {
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PDR = flag;
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_ASR = flag;
++ }
++ else
++ ((AT91PS_PIO) AT91C_BASE_PIOB)->PIO_PER = flag;
++}
++
++int board_init (void)
++{
++ DECLARE_GLOBAL_DATA_PTR;
++ long flag;
++
++ /* Enable Ctrlc */
++ console_init_f ();
++
++ /* sarge board specific */
++ /*
++ cs_init(1);
++ mac_init(1);
++ peripheral_init(1);
++ mmc_init(1);
++ irq_init(1);
++ */
++
++ /* PIOB and PIOA clock enabling */
++
++ *AT91C_PMC_PCER = 1 << AT91C_ID_PIOA;
++ *AT91C_PMC_PCER = 1 << AT91C_ID_PIOB;
++
++
++ //miiphy_init();
++ /* memory and cpu-speed are setup before relocation */
++ /* so we do _nothing_ here */
++
++ /* Correct IRDA resistor problem */
++ /* Set PA23_TXD in Output */
++ ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_OER = AT91C_PA23_TXD2;
++
++ /* arch number of AT91RM9200-Board */
++ gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200;
++
++ /* adress of boot parameters */
++ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
++
++ return 0;
++}
++
++int dram_init (void)
++{
++ DECLARE_GLOBAL_DATA_PTR;
++
++ gd->bd->bi_dram[0].start = PHYS_SDRAM;
++ gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
++ return 0;
++}
++
++
++int sarge_before_linux(void)
++{
++ DECLARE_GLOBAL_DATA_PTR;
++ AT91PS_EMAC mac = AT91C_BASE_EMAC;
++ char* isolate_str = getenv("phy_isolate");
++ if (strlen(isolate_str) && strcmp(isolate_str, "yes") == 0)
++ {
++ printf("\nisolating PHY\n");
++ eth_init(gd->bd);
++ ste100p_DisableInterrupts(mac);
++ ste100p_Isolate(mac);
++ }
++}
++
++#ifdef CONFIG_DRIVER_ETHER
++#if (CONFIG_COMMANDS & CFG_CMD_NET)
++
++/*
++ * Name:
++ * at91rm9200_GetPhyInterface
++ * Description:
++ * Initialise the interface functions to the PHY
++ * Arguments:
++ * None
++ * Return value:
++ * None
++ */
++void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
++{
++#ifdef DM9161_ETH
++ p_phyops->Init = dm9161_InitPhy;
++ p_phyops->IsPhyConnected = dm9161_IsPhyConnected;
++ p_phyops->GetLinkSpeed = dm9161_GetLinkSpeed;
++ p_phyops->AutoNegotiate = dm9161_AutoNegotiate;
++#endif
++
++#ifdef RTL8201BL_ETH
++ p_phyops->Init = rtl8201bl_InitPhy;
++ p_phyops->IsPhyConnected = rtl8201bl_IsPhyConnected;
++ p_phyops->GetLinkSpeed = rtl8201bl_GetLinkSpeed;
++ p_phyops->AutoNegotiate = rtl8201bl_AutoNegotiate;
++
++#endif
++#ifdef STE100P_ETH
++ p_phyops->Init = ste100p_InitPhy;
++ p_phyops->IsPhyConnected = ste100p_IsPhyConnected;
++ p_phyops->GetLinkSpeed = ste100p_GetLinkSpeed;
++ p_phyops->AutoNegotiate = ste100p_AutoNegotiate;
++ p_phyops->Isolate = ste100p_Isolate;
++
++#endif
++
++}
++
++#endif /* CONFIG_COMMANDS & CFG_CMD_NET */
++#endif /* CONFIG_DRIVER_ETHER */
++
++/*
++ * Disk On Chip (NAND) Millenium initialization.
++ * The NAND lives in the CS2* space
++ */
++#if (CONFIG_COMMANDS & CFG_CMD_NAND)
++extern ulong nand_probe (ulong physadr);
++
++#define AT91_SMARTMEDIA_BASE 0x40000000 /* physical address to access memory on NCS3 */
++void nand_init (void)
++{
++ /* Setup Smart Media, fitst enable the address range of CS3 */
++ *AT91C_EBI_CSA |= AT91C_EBI_CS3A_SMC_SmartMedia;
++ /* set the bus interface characteristics based on
++ tDS Data Set up Time 30 - ns
++ tDH Data Hold Time 20 - ns
++ tALS ALE Set up Time 20 - ns
++ 16ns at 60 MHz ~= 3 */
++/*memory mapping structures */
++#define SM_ID_RWH (5 << 28)
++#define SM_RWH (1 << 28)
++#define SM_RWS (0 << 24)
++#define SM_TDF (1 << 8)
++#define SM_NWS (3)
++ AT91C_BASE_SMC2->SMC2_CSR[3] = (SM_RWH | SM_RWS |
++ AT91C_SMC2_ACSS_STANDARD | AT91C_SMC2_DBW_8 |
++ SM_TDF | AT91C_SMC2_WSEN | SM_NWS);
++
++ /* enable the SMOE line PC0=SMCE, A21=CLE, A22=ALE */
++ *AT91C_PIOC_ASR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE |
++ AT91C_PC3_BFBAA_SMWE;
++ *AT91C_PIOC_PDR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE |
++ AT91C_PC3_BFBAA_SMWE;
++
++ /* Configure PC2 as input (signal READY of the SmartMedia) */
++ *AT91C_PIOC_PER = AT91C_PC2_BFAVD; /* enable direct output enable */
++ *AT91C_PIOC_ODR = AT91C_PC2_BFAVD; /* disable output */
++
++ /* Configure PB1 as input (signal Card Detect of the SmartMedia) */
++ *AT91C_PIOB_PER = AT91C_PIO_PB1; /* enable direct output enable */
++ *AT91C_PIOB_ODR = AT91C_PIO_PB1; /* disable output */
++
++ /* PIOB and PIOC clock enabling */
++ *AT91C_PMC_PCER = 1 << AT91C_ID_PIOB;
++ *AT91C_PMC_PCER = 1 << AT91C_ID_PIOC;
++
++ if (*AT91C_PIOB_PDSR & AT91C_PIO_PB1)
++ printf (" No SmartMedia card inserted\n");
++#ifdef DEBUG
++ printf (" SmartMedia card inserted\n");
++
++ printf ("Probing at 0x%.8x\n", AT91_SMARTMEDIA_BASE);
++#endif
++ printf ("%4lu MB\n", nand_probe(AT91_SMARTMEDIA_BASE) >> 20);
++}
++#endif
+diff -Nurp ../u-boot-1.1.6/board/sarge/u-boot.lds ./board/sarge/u-boot.lds
+--- ../u-boot-1.1.6/board/sarge/u-boot.lds 1970-01-01 01:00:00.000000000 +0100
++++ ./board/sarge/u-boot.lds 2007-03-09 01:25:41.000000000 +0100
+@@ -0,0 +1,57 @@
++/*
++ * (C) Copyright 2002
++ * Gary Jennejohn, DENX Software Engineering, <gj@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_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
++/*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/
++OUTPUT_ARCH(arm)
++ENTRY(_start)
++SECTIONS
++{
++ . = 0x00000000;
++
++ . = ALIGN(4);
++ .text :
++ {
++ cpu/arm920t/start.o (.text)
++ *(.text)
++ }
++
++ . = ALIGN(4);
++ .rodata : { *(.rodata) }
++
++ . = ALIGN(4);
++ .data : { *(.data) }
++
++ . = ALIGN(4);
++ .got : { *(.got) }
++
++ . = .;
++ __u_boot_cmd_start = .;
++ .u_boot_cmd : { *(.u_boot_cmd) }
++ __u_boot_cmd_end = .;
++
++ . = ALIGN(4);
++ __bss_start = .;
++ .bss : { *(.bss) }
++ _end = .;
++}
+diff -Nurp ../u-boot-1.1.6/common/cmd_bootm.c ./common/cmd_bootm.c
+--- ../u-boot-1.1.6/common/cmd_bootm.c 2006-11-02 15:15:01.000000000 +0100
++++ ./common/cmd_bootm.c 2007-03-27 02:55:11.000000000 +0200
+@@ -79,7 +79,10 @@ DECLARE_GLOBAL_DATA_PTR;
+ # define CHUNKSZ (64 * 1024)
+ #endif
+
+-int gunzip (void *, int, unsigned char *, unsigned long *);
++
++//int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
++int gunzip(unsigned char *inbuf, unsigned long *insize, unsigned char *outbuf, unsigned long *outsize);
++
+
+ static void *zalloc(void *, unsigned, unsigned);
+ static void zfree(void *, void *, unsigned);
+@@ -94,6 +97,12 @@ extern flash_info_t flash_info[]; /* inf
+ static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+ #endif
+
++
++#ifdef CONFIG_HAS_DATAFLASH
++extern int AT91F_DataflashInit(void);
++#endif
++
++
+ static void print_type (image_header_t *hdr);
+
+ #ifdef __I386__
+@@ -176,8 +185,9 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
+
+ /* Copy header so we can blank CRC field for re-calculation */
+ #ifdef CONFIG_HAS_DATAFLASH
++ AT91F_DataflashInit();
+ if (addr_dataflash(addr)){
+- read_dataflash(addr, sizeof(image_header_t), (char *)&header);
++ read_dataflash(addr, sizeof(image_header_t), (char *)&header);
+ } else
+ #endif
+ memmove (&header, (char *)addr, sizeof(image_header_t));
+@@ -194,7 +204,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
+ } else
+ #endif /* __I386__ */
+ {
+- puts ("Bad Magic Number\n");
++ printf ("Bad Magic Number, got 0x%x, should be: 0x%x\n", hdr->ih_magic, IH_MAGIC);
+ SHOW_BOOT_PROGRESS (-1);
+ return 1;
+ }
+@@ -216,9 +226,14 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
+
+ #ifdef CONFIG_HAS_DATAFLASH
+ if (addr_dataflash(addr)){
+- len = ntohl(hdr->ih_size) + sizeof(image_header_t);
+- read_dataflash(addr, len, (char *)CFG_LOAD_ADDR);
+- addr = CFG_LOAD_ADDR;
++ len = ntohl(hdr->ih_size) + sizeof(image_header_t);
++ char* env_loadaddr = getenv("loadaddr");
++ unsigned long load_addr = CFG_LOAD_ADDR;
++ if (env_loadaddr)
++ load_addr = simple_strtoul(env_loadaddr, NULL, 16);
++ read_dataflash(addr, len, (char *)load_addr);
++ addr = load_addr;
++
+ }
+ #endif
+
+@@ -227,6 +242,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
+ print_image_hdr ((image_header_t *)addr);
+
+ data = addr + sizeof(image_header_t);
++
+ len = ntohl(hdr->ih_size);
+
+ if (verify) {
+@@ -343,12 +359,24 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
+ break;
+ case IH_COMP_GZIP:
+ printf (" Uncompressing %s ... ", name);
+- if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
+- (uchar *)data, &len) != 0) {
+- puts ("GUNZIP ERROR - must RESET board to recover\n");
++ int res;
++ if ((res = gunzip ((uchar *)data, &len, (void *)ntohl(hdr->ih_load), &unc_len
++ )) != 0) {
++ printf ("GUNZIP ERROR (code %d)- must RESET board to recover\n", res);
+ SHOW_BOOT_PROGRESS (-6);
++
+ do_reset (cmdtp, flag, argc, argv);
+ }
++ //addr = ntohl(hdr->ih_load);
++ //old gunzip switched parameters list
++
++/* if ((res = gunzip ((void *)ntohl(hdr->ih_load), unc_len,
++ (uchar *)data, &len)) != 0) {
++ printf ("GUNZIP ERROR (code %d)- must RESET board to recover\n", res);
++ SHOW_BOOT_PROGRESS (-6);
++ do_reset (cmdtp, flag, argc, argv);
++ } */
++
+ break;
+ #ifdef CONFIG_BZIP2
+ case IH_COMP_BZIP2:
+@@ -413,7 +441,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
+ default: /* handled by (original) Linux case */
+ case IH_OS_LINUX:
+ #ifdef CONFIG_SILENT_CONSOLE
+- fixup_silent_linux();
++// fixup_silent_linux();
+ #endif
+ do_bootm_linux (cmdtp, flag, argc, argv,
+ addr, len_ptr, verify);
+@@ -1429,12 +1457,13 @@ static void zfree(void *x, void *addr, u
+
+ #define DEFLATED 8
+
++/*
+ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
+ {
+ z_stream s;
+ int r, i, flags;
+
+- /* skip header */
++ // skip header
+ i = 10;
+ flags = src[3];
+ if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
+@@ -1462,9 +1491,10 @@ int gunzip(void *dst, int dstlen, unsign
+ s.outcb = (cb_func)WATCHDOG_RESET;
+ #else
+ s.outcb = Z_NULL;
+-#endif /* CONFIG_HW_WATCHDOG */
+-
++#endif // CONFIG_HW_WATCHDOG //
++
+ r = inflateInit2(&s, -MAX_WBITS);
++ // gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
+ if (r != Z_OK) {
+ printf ("Error: inflateInit2() returned %d\n", r);
+ return (-1);
+@@ -1480,9 +1510,8 @@ int gunzip(void *dst, int dstlen, unsign
+ }
+ *lenp = s.next_out - (unsigned char *) dst;
+ inflateEnd(&s);
+-
+ return (0);
+-}
++}*/
+
+ #ifdef CONFIG_BZIP2
+ void bz_internal_error(int errcode)
+diff -Nurp ../u-boot-1.1.6/cpu/arm920t/at91rm9200/Makefile ./cpu/arm920t/at91rm9200/Makefile
+--- ../u-boot-1.1.6/cpu/arm920t/at91rm9200/Makefile 2006-11-02 15:15:01.000000000 +0100
++++ ./cpu/arm920t/at91rm9200/Makefile 2007-05-13 20:19:07.000000000 +0200
+@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
+ LIB = $(obj)lib$(SOC).a
+
+ COBJS = bcm5221.o dm9161.o ether.o i2c.o interrupts.o \
+- lxt972.o serial.o usb_ohci.o
++ lxt972.o serial.o usb_ohci.o ste100p.o
+ SOBJS = lowlevel_init.o
+
+ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+diff -Nurp ../u-boot-1.1.6/cpu/arm920t/at91rm9200/ste100p.c ./cpu/arm920t/at91rm9200/ste100p.c
+--- ../u-boot-1.1.6/cpu/arm920t/