Commit 90b0cf47 authored by Stefan Roese's avatar Stefan Roese
Browse files

Merge with /home/stefan/git/u-boot/denx-merge-sr

parents 4745acaa eb867a76
......@@ -37,9 +37,10 @@ LIST_5xx=" \
LIST_5xxx=" \
BC3450 cpci5200 EVAL5200 fo300 \
icecube_5100 icecube_5200 lite5200b mcc200 \
mecp5200 o2dnt pf5200 PM520 \
TB5200 Total5100 Total5200 Total5200_Rev2 \
TQM5200 TQM5200_B TQM5200S v38b \
mecp5200 motionpro o2dnt pf5200 \
PM520 TB5200 Total5100 Total5200 \
Total5200_Rev2 TQM5200 TQM5200_B TQM5200S \
v38b \
"
#########################################################################
......
......@@ -607,6 +607,9 @@ TQM5200_STK100_config: unconfig
@$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200
uc101_config: unconfig
@$(MKCONFIG) uc101 ppc mpc5xxx uc101
motionpro_config: unconfig
@$(MKCONFIG) motionpro ppc mpc5xxx motionpro
#########################################################################
## MPC8xx Systems
......
......@@ -33,6 +33,7 @@
#include <asm/byteorder.h>
#include <linux/mtd/nand_legacy.h>
#include <fat.h>
#include <part.h>
#include "auto_update.h"
......@@ -71,8 +72,6 @@ extern int transfer_pic(unsigned char, unsigned char *, int, int);
extern int flash_sect_erase(ulong, ulong);
extern int flash_sect_protect (int, ulong, ulong);
extern int flash_write (char *, ulong, ulong);
/* change char* to void* to shutup the compiler */
extern block_dev_desc_t *get_dev (char*, int);
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
/* references to names in cmd_nand.c */
......
......@@ -46,7 +46,7 @@ int board_init (void)
gd->bd->bi_arch_number = 83;
/* location of boot parameters */
gd->bd->bi_boot_params = 0xc0000100;
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
return 0;
}
......
......@@ -23,6 +23,7 @@
#include <image.h>
#include <asm/byteorder.h>
#include <usb.h>
#include <part.h>
#ifdef CFG_HUSH_PARSER
#include <hush.h>
......@@ -47,25 +48,6 @@
#error "must define CFG_CMD_FAT"
#endif
/*
* Check whether a USB memory stick is plugged in.
* If one is found:
* 1) if prepare.img ist found load it into memory. If it is
* valid then run it.
* 2) if preinst.img is found load it into memory. If it is
* valid then run it. Update the EEPROM.
* 3) if firmw_01.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 4) if kernl_01.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 5) if app.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 6) if disk.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 7) if postinst.img is found load it into memory. If it is
* valid then run it. Update the EEPROM.
*/
#undef AU_DEBUG
#undef debug
......@@ -78,6 +60,7 @@
/* possible names of files on the USB stick. */
#define AU_FIRMWARE "u-boot.img"
#define AU_KERNEL "kernel.img"
#define AU_ROOTFS "rootfs.img"
struct flash_layout {
long start;
......@@ -89,33 +72,45 @@ struct flash_layout {
#define AU_FL_FIRMWARE_ND 0xfC03FFFF
#define AU_FL_KERNEL_ST 0xfC0C0000
#define AU_FL_KERNEL_ND 0xfC1BFFFF
#define AU_FL_ROOTFS_ST 0xFC1C0000
#define AU_FL_ROOTFS_ND 0xFCFBFFFF
static int au_usb_stor_curr_dev; /* current device */
/* index of each file in the following arrays */
#define IDX_FIRMWARE 0
#define IDX_KERNEL 1
#define IDX_ROOTFS 2
/* max. number of files which could interest us */
#define AU_MAXFILES 2
#define AU_MAXFILES 3
/* pointers to file names */
char *aufile[AU_MAXFILES];
char *aufile[AU_MAXFILES] = {
AU_FIRMWARE,
AU_KERNEL,
AU_ROOTFS
};
/* sizes of flash areas for each file */
long ausize[AU_MAXFILES];
long ausize[AU_MAXFILES] = {
(AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST,
(AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST,
(AU_FL_ROOTFS_ND + 1) - AU_FL_ROOTFS_ST
};
/* array of flash areas start and end addresses */
struct flash_layout aufl_layout[AU_MAXFILES] = { \
{AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,}, \
{AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,}, \
struct flash_layout aufl_layout[AU_MAXFILES] = {
{AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,},
{AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,},
{AU_FL_ROOTFS_ST, AU_FL_ROOTFS_ND,}
};
/* where to load files into memory */
#define LOAD_ADDR ((unsigned char *)0x00200000)
/* the app is the largest image */
#define MAX_LOADSZ ausize[IDX_KERNEL]
#define MAX_LOADSZ ausize[IDX_ROOTFS]
/*i2c address of the keypad status*/
#define I2C_PSOC_KEYPAD_ADDR 0x53
......@@ -134,8 +129,6 @@ extern int i2c_read (unsigned char, unsigned int, int , unsigned char* , int);
extern int flash_sect_erase(ulong, ulong);
extern int flash_sect_protect (int, ulong, ulong);
extern int flash_write (char *, ulong, ulong);
/* change char* to void* to shutup the compiler */
extern block_dev_desc_t *get_dev (char*, int);
extern int u_boot_hush_start(void);
int au_check_cksum_valid(int idx, long nbytes)
......@@ -163,7 +156,6 @@ int au_check_header_valid(int idx, long nbytes)
{
image_header_t *hdr;
unsigned long checksum;
unsigned char buf[4];
hdr = (image_header_t *)LOAD_ADDR;
/* check the easy ones first */
......@@ -200,6 +192,10 @@ int au_check_header_valid(int idx, long nbytes)
printf ("Image %s wrong type\n", aufile[idx]);
return -1;
}
if ((idx == IDX_ROOTFS) && (hdr->ih_type != IH_TYPE_RAMDISK)) {
printf ("Image %s wrong type\n", aufile[idx]);
return -1;
}
/* recycle checksum */
checksum = ntohl(hdr->ih_size);
/* for kernel and app the image header must also fit into flash */
......@@ -257,7 +253,7 @@ int au_do_update(int idx, long sz)
flash_sect_erase(start, end);
wait_ms(100);
/* strip the header - except for the kernel and ramdisk */
if (hdr->ih_type == IH_TYPE_KERNEL) {
if (hdr->ih_type == IH_TYPE_KERNEL || hdr->ih_type == IH_TYPE_RAMDISK) {
addr = (char *)hdr;
off = sizeof(*hdr);
nbytes = sizeof(*hdr) + ntohl(hdr->ih_size);
......@@ -305,7 +301,7 @@ int do_auto_update(void)
int i, res, bitmap_first, cnt, old_ctrlc, got_ctrlc;
char *env;
long start, end;
char keypad_status1[2] = {0,0}, keypad_status2[2] = {0,0};
uchar keypad_status1[2] = {0,0}, keypad_status2[2] = {0,0};
/*
* Read keypad status
......@@ -317,10 +313,6 @@ int do_auto_update(void)
/*
* Check keypad
*/
if ( !(keypad_status1[0] & KEYPAD_MASK_HI) ||
(keypad_status1[0] != keypad_status2[0])) {
return 0;
}
if ( !(keypad_status1[1] & KEYPAD_MASK_LO) ||
(keypad_status1[1] != keypad_status2[1])) {
return 0;
......@@ -359,14 +351,6 @@ int do_auto_update(void)
debug ("file_fat_detectfs failed\n");
}
/* initialize the array of file names */
memset(aufile, 0, sizeof(aufile));
aufile[IDX_FIRMWARE] = AU_FIRMWARE;
aufile[IDX_KERNEL] = AU_KERNEL;
/* initialize the array of flash sizes */
memset(ausize, 0, sizeof(ausize));
ausize[IDX_FIRMWARE] = (AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST;
ausize[IDX_KERNEL] = (AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST;
/*
* now check whether start and end are defined using environment
* variables.
......@@ -381,8 +365,8 @@ int do_auto_update(void)
end = simple_strtoul(env, NULL, 16);
if (start >= 0 && end && end > start) {
ausize[IDX_FIRMWARE] = (end + 1) - start;
aufl_layout[0].start = start;
aufl_layout[0].end = end;
aufl_layout[IDX_FIRMWARE].start = start;
aufl_layout[IDX_FIRMWARE].end = end;
}
start = -1;
end = 0;
......@@ -394,9 +378,23 @@ int do_auto_update(void)
end = simple_strtoul(env, NULL, 16);
if (start >= 0 && end && end > start) {
ausize[IDX_KERNEL] = (end + 1) - start;
aufl_layout[1].start = start;
aufl_layout[1].end = end;
aufl_layout[IDX_KERNEL].start = start;
aufl_layout[IDX_KERNEL].end = end;
}
start = -1;
end = 0;
env = getenv("rootfs_st");
if (env != NULL)
start = simple_strtoul(env, NULL, 16);
env = getenv("rootfs_nd");
if (env != NULL)
end = simple_strtoul(env, NULL, 16);
if (start >= 0 && end && end > start) {
ausize[IDX_ROOTFS] = (end + 1) - start;
aufl_layout[IDX_ROOTFS].start = start;
aufl_layout[IDX_ROOTFS].end = end;
}
/* make certain that HUSH is runnable */
u_boot_hush_start();
/* make sure that we see CTRL-C and save the old state */
......@@ -443,8 +441,8 @@ int do_auto_update(void)
}
cnt++;
#ifdef AU_TEST_ONLY
} while (res < 0 && cnt < 3);
if (cnt < 3)
} while (res < 0 && cnt < (AU_MAXFILES + 1));
if (cnt < (AU_MAXFILES + 1))
#else
} while (res < 0);
#endif
......
#
# (C) Copyright 2003-2007
# 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 = $(obj)lib$(BOARD).a
COBJS := $(BOARD).o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))
$(LIB): $(obj).depend $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
clean:
rm -f $(SOBJS) $(OBJS)
distclean: clean
rm -f $(LIB) core *.bak .depend
#########################################################################
# defines $(obj).depend target
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################
#
# (C) Copyright 2006-2007
# 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
#
#
# Promess Motion-PRO
#
TEXT_BASE = 0xfff00000
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
/*
* (C) Copyright 2003-2007
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* modified for Promess PRO - by Andy Joseph, andy@promessdev.com
* modified for Promess PRO-Motion - by Robert McCullough, rob@promessdev.com
* modified by Chris M. Tumas 6/20/06 Change CAS latency to 2 from 3
* Also changed the refresh for 100Mhz operation
*
* 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 <mpc5xxx.h>
/* Kollmorgen DPR initialization data */
struct init_elem {
unsigned long addr;
unsigned len;
char *data;
} init_seq[] = {
{0x500003F2, 2, "\x86\x00"}, /* HW parameter */
{0x500003F0, 2, "\x00\x00"},
{0x500003EC, 4, "\x00\x80\xc1\x52"}, /* Magic word */
};
/*
* Initialize Kollmorgen DPR
*/
static void kollmorgen_init(void)
{
unsigned i, j;
vu_char *p;
for (i = 0; i < sizeof(init_seq) / sizeof(struct init_elem); ++i) {
p = (vu_char *)init_seq[i].addr;
for (j = 0; j < init_seq[i].len; ++j)
*(p + j) = *(init_seq[i].data + j);
}
printf("DPR: Kollmorgen DPR initialized\n");
}
/*
* Early board initalization.
*/
int board_early_init_r(void)
{
/* Now, when we are in RAM, disable Boot Chipselect and enable CS0 */
*(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25);
*(vu_long *)MPC5XXX_ADDECR |= (1 << 16);
/* Initialize Kollmorgen DPR */
kollmorgen_init();
return 0;
}
#ifndef CFG_RAMBOOT
/*
* Helper function to initialize SDRAM controller.
*/
static void sdram_start (int hi_addr)
{
long hi_addr_bit = hi_addr ? 0x01000000 : 0;
/* unlock mode register */
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
hi_addr_bit;
/* precharge all banks */
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
hi_addr_bit;
/* auto refresh */
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
hi_addr_bit;
/* auto refresh, second time */
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
hi_addr_bit;
/* set mode register */
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
/* normal operation */
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
}
#endif /* !CFG_RAMBOOT */
/*
* Initalize SDRAM - configure SDRAM controller, detect memory size.
*/
long int initdram (int board_type)
{
ulong dramsize = 0;
#ifndef CFG_RAMBOOT
ulong test1, test2;
/* configure SDRAM start/end for detection */
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e; /* 2G at 0x0 */
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000; /* disabled */
/* setup config registers */
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
sdram_start(0);
test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
} else {
dramsize = test2;
}
/* memory smaller than 1MB is impossible */
if (dramsize < (1 << 20))
dramsize = 0;
/* set SDRAM CS0 size according to the amount of RAM found */
if (dramsize > 0)
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
__builtin_ffs(dramsize >> 20) - 1;
else
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
/* let SDRAM CS1 start right after CS0 and disable it */
*(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize;
#else /* !CFG_RAMBOOT */
/* retrieve size of memory connected to SDRAM CS0 */
dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
if (dramsize >= 0x13)
dramsize = (1 << (dramsize - 0x13)) << 20;
else
dramsize = 0;
#endif /* CFG_RAMBOOT */
/* return total ram size */
return dramsize;
}
int checkboard (void)
{
puts("Board: Promess Motion-PRO board\n");
return 0;
}
/*
* (C) Copyright 2003-2007
* 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);
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/mpc5xxx/start.o (.text)
*(.text)
*(.fixup)
*(.got1)
. = ALIGN(16);
*(.rodata)
*(.rodata1)
*(.rodata.str1.4)
*(.eh_frame)
}
.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 = .);
. = .;
__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;
. = .;
__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 :