From: wdenk Date: Fri, 18 Jan 2002 11:04:56 +0000 (+0000) Subject: * Patch by Denis Peter, 18 Jan 2002: X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=de4f87041d870160c09e02098ea90db03b13e617;p=users%2Frw%2Fppcboot.git * Patch by Denis Peter, 18 Jan 2002: - Support for QNX images - Cleanup of MPL files * Unified speed.c for all 824x boards Patch by Greg Allen, 17 Jan 2002 --- diff --git a/CHANGELOG b/CHANGELOG index 12d4d81..ddbb2c0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,15 @@ Modifications for 1.1.4: * Support for GESPAC PCIPPC2 board +* Patch by Denis Peter, 18 Jan 2002: + - Support for QNX images + - Cleanup of MPL files + +* Fix Sandpoint8240 port: working now from flash, without need for DINK + +* Unified speed.c for all 824x boards + Patch by Greg Allen, 17 Jan 2002 + * added command to switch LSB on LWMON boards * increased IDE_TIME_OUT as needed on some boards @@ -33,8 +42,6 @@ Modifications for 1.1.4: * Fix bug in interrupt handling in Walnut flash driver Patch by Andrew May, 10 Jan 2002 -* Fix Sandpoint8240 port: boots now from flash, without need for DINK - * "Final" fix for HUSH shell * Fix IDE on BAB750 board diff --git a/board/cu824/Makefile b/board/cu824/Makefile index c5a98bf..e515e6e 100644 --- a/board/cu824/Makefile +++ b/board/cu824/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o flash.o ns16550.o serial.o speed.o dc2114x.o +OBJS = $(BOARD).o flash.o ns16550.o serial.o dc2114x.o $(LIB): .depend $(OBJS) $(AR) crv $@ $^ diff --git a/board/cu824/speed.c b/board/cu824/speed.c deleted file mode 100644 index 313462f..0000000 --- a/board/cu824/speed.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (C) Copyright 2001 - * 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 -#include -#include - -static char pll_to_bus_factor[] = -{ - 3, 0, 0, 0, 0, - 0, 0, 0, 1, 0, - 0, 0, 2, 0, 2, - 0, 3, 0, 0, 0, - 2, 0, 0, 0 -}; - -#define PLL_STATE_REG 0xFE80002F - -ulong get_bus_freq(ulong ignore) -{ - unsigned char pll = *(volatile char *) (PLL_STATE_REG); - - if (pll == 24) - { - return CONFIG_SYS_CLK_FREQ * 5 / 2; - } - else - { - return CONFIG_SYS_CLK_FREQ * pll_to_bus_factor[pll]; - } -} - -/* ------------------------------------------------------------------------- */ - -/* - * Measure CPU clock speed - */ - -/* Table to convert pllratio to actual processor clock scaling factor (*10) - */ -#ifdef CONFIG_MPC824X -short pllratio_to_factor[] = { - 00, 00, 00, 10, 20, 20, 25, 00, 00, 00, 00, 00, 00, 00, 00, 00, - 00, 00, 00, 10, 00, 00, 00, 45, 30, 00, 40, 00, 00, 00, 35, 00, -}; -#endif - -ulong get_gclk_freq(void) -{ - uint hid1 = mfspr(HID1); - -#ifdef CONFIG_MPC824X - - /* 5 bits for PLL ration on 824X - */ - hid1 = (hid1 >> (32-5)) & 0x1f; -#else - - /* 4 bits on everythings else - */ - hid1 = (hid1 >> (32-4)) & 0xf; -#endif - - return (pllratio_to_factor[hid1] * get_bus_freq(0)) / 10; -} - -/* ------------------------------------------------------------------------- */ - diff --git a/board/mousse/Makefile b/board/mousse/Makefile index f24ec6c..3a3f2f3 100644 --- a/board/mousse/Makefile +++ b/board/mousse/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o ns16550.o serial.o speed.o dc2114x.o\ +OBJS = $(BOARD).o ns16550.o serial.o dc2114x.o\ m48t59y.o pci.o flash.o #pci.o diff --git a/board/mousse/speed.c b/board/mousse/speed.c deleted file mode 100644 index 7cbd660..0000000 --- a/board/mousse/speed.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (C) Copyright 2001 - * 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 -#include -#include - - -ulong get_bus_freq(ulong ignore) -{ - return 33000000; /* On Mousse, PCI is at least 33Mhz */ -} - -/* ------------------------------------------------------------------------- */ - -/* - * Measure CPU clock speed - */ - -/* Table to convert pllratio to actual processor clock scaling factor (*10) - */ -#ifdef CONFIG_MPC824X -short pllratio_to_factor[] = { - 00, 00, 00, 10, 20, 20, 25, 00, 00, 00, 00, 00, 00, 00, 00, 00, - 00, 00, 00, 10, 00, 00, 00, 45, 60, 00, 40, 00, 00, 00, 35, 00, -}; -#endif - -ulong get_gclk_freq(void) -{ - uint hid1 = mfspr(HID1); - -#ifdef CONFIG_MPC824X - - /* 5 bits for PLL ration on 824x - */ - hid1 = (hid1 >> (32-5)) & 0x1f; -#else - - /* 4 bits on everythings else - */ - hid1 = (hid1 >> (32-4)) & 0xf; -#endif - return (pllratio_to_factor[hid1] * get_bus_freq(0)) / 10; -} - -/* ------------------------------------------------------------------------- */ - diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c new file mode 100644 index 0000000..39c6f70 --- /dev/null +++ b/board/mpl/common/common_util.c @@ -0,0 +1,384 @@ +/* + * (C) Copyright 2001 + * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch + * + * 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 +#include +#include "common_util.h" +#include + +extern int gunzip (void *, int, unsigned char *, int *); +extern int mem_test(unsigned long start, unsigned long ramsize, int quiet); + +#define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */ +#define IMAGE_SIZE 0x80000 + +extern flash_info_t flash_info[]; /* info for FLASH chips */ + +image_header_t header; + + + +int mpl_prg(unsigned long src,unsigned long size) +{ + unsigned long start; + flash_info_t *info; + int i,rc; + unsigned long *magic = (unsigned long *)src; + + info = &flash_info[0]; + start = 0 - size; + for(i=info->sector_count-1;i>0;i--) + { + info->protect[i] = 0; /* unprotect this sector */ + if(start>=info->start[i]) + break; + } + /* set-up flash location */ + /* now erase flash */ + if(magic[0]!=IH_MAGIC) { + printf("Bad Magic number\n"); + return -1; + } + printf("Erasing at %lx (sector %d) (start %lx)\n", + start,i,info->start[i]); + flash_erase (info, i, info->sector_count-1); + printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",src,size); + switch (rc = flash_write ((uchar *)src, start, size)) + { + case 0: printf ("OK programming done\n"); return 0; + case 1: printf ("ERROR Timeout writing to Flash\n"); return 1; + case 2: printf ("ERROR Flash not Erased\n"); return 1; + case 4: printf ("ERROR Can't write to protected Flash sectors\n"); return 1; + case 8: printf ("ERROR Outside available Flash\n"); return 1; + default: printf ("ERROR %s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); return 1; + } + return 1; +} + + +int mpl_prg_image(unsigned long load_addr) +{ + unsigned long data,len,checksum; + image_header_t *hdr=&header; + /* Copy header so we can blank CRC field for re-calculation */ + memcpy (&header, (char *)load_addr, sizeof(image_header_t)); + if (hdr->ih_magic != IH_MAGIC) { + printf ("Bad Magic Number\n"); + return 1; + } + print_image_hdr(hdr); + if (hdr->ih_os != IH_OS_PPCBOOT) { + printf ("No PPCBOOT Image\n"); + return 1; + } + if (hdr->ih_type != IH_TYPE_FIRMWARE) { + printf ("No Firmware Image\n"); + return 1; + } + data = (ulong)&header; + len = sizeof(image_header_t); + checksum = hdr->ih_hcrc; + hdr->ih_hcrc = 0; + if (crc32 (0, (char *)data, len) != checksum) { + printf ("Bad Header Checksum\n"); + return 1; + } + data = load_addr + sizeof(image_header_t); + len = hdr->ih_size; + printf ("Verifying Checksum ... "); + if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) { + printf ("Bad Data CRC\n"); + return 1; + } + switch (hdr->ih_comp) { + case IH_COMP_NONE: + break; + case IH_COMP_GZIP: + printf (" Uncompressing ... "); + if (gunzip ((void *)(data+0x100000), 0x400000, + (uchar *)data, (int *)&len) != 0) { + printf ("GUNZIP ERROR\n"); + return 1; + } + data+=0x100000; + break; + default: + printf (" Unimplemented compression type %d\n", hdr->ih_comp); + return 1; + } + + printf (" OK\n"); + return(mpl_prg(data,len)); +} + + +void get_backup_values(backup_t *buf) +{ + eeprom_read(CFG_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,(void *)buf,sizeof(backup_t)); +} + +void set_backup_values(int overwrite) +{ + backup_t back; + int i; + + get_backup_values(&back); + if(!overwrite) { + if(strncmp(back.signature,"MPL\0",4)==0) { + printf("Not possible to write Backup\n"); + return; + } + } + memcpy(back.signature,"MPL\0",4); + i=getenv_r("serial#",back.serial_name,16); + if(i==0) { + printf("Not possible to write Backup\n"); + return; + } + back.serial_name[16]=0; + i=getenv_r("ethaddr",back.eth_addr,20); + if(i==0) { + printf("Not possible to write Backup\n"); + return; + } + back.eth_addr[20]=0; + eeprom_write(CFG_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,(void *)&back,sizeof(backup_t)); +} + +void clear_env_values(void) +{ + backup_t back; + unsigned char env_crc[4]; + + memset(&back,0xff,sizeof(backup_t)); + memset(env_crc,0x00,4); + eeprom_write(CFG_DEF_EEPROM_ADDR,I2C_BACKUP_ADDR,(void *)&back,sizeof(backup_t)); + eeprom_write(CFG_DEF_EEPROM_ADDR,CFG_ENV_OFFSET,(void *)env_crc,4); +} + +/* ------------------------------------------------------------------------- */ + + /* switches the cs0 and the cs1 to the locations. + When boot is TRUE, the the mapping is switched + to the boot configuration, If it is FALSE, the + flash will be switched in the boot area */ + +#undef SW_CS_DBG +#ifdef SW_CS_DBG +#define SW_CS_PRINTF(fmt,args...) printf (fmt ,##args) +#else +#define SW_CS_PRINTF(fmt,args...) +#endif + + +int switch_cs(unsigned char boot) +{ + unsigned long pbcr; + mtdcr(ebccfga, pb0cr); /* get cs0 config reg */ + pbcr = mfdcr(ebccfgd); + if((pbcr&0x00002000)==0) { + /* we need only to switch if boot from MPS */ + /*printf(" MPS boot mode detected. ");*/ + /* printf("cs0 cfg: %lx\n",pbcr); */ + if(boot) { + /* switch to boot configuration */ + /* this is a 8bit boot, switch cs0 to flash location */ + SW_CS_PRINTF("switch to boot mode (MPS on High address\n"); + pbcr&=0x000FFFFF; /*mask base address of the cs0 */ + pbcr|=(FLASH_BASE0_PRELIM & 0xFFF00000); + mtdcr(ebccfga, pb0cr); + mtdcr(ebccfgd, pbcr); + SW_CS_PRINTF(" new cs0 cfg: %lx\n",pbcr); + mtdcr(ebccfga, pb1cr); /* get cs1 config reg (flash) */ + pbcr = mfdcr(ebccfgd); + SW_CS_PRINTF(" old cs1 cfg: %lx\n",pbcr); + pbcr&=0x000FFFFF; /*mask base address of the cs1 */ + pbcr|=(MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000); + mtdcr(ebccfga, pb1cr); + mtdcr(ebccfgd, pbcr); + SW_CS_PRINTF(" new cs1 cfg: %lx, MPS is on High Address\n",pbcr); + } + else + { + /* map flash to boot area, */ + SW_CS_PRINTF("map Flash to boot area\n"); + pbcr&=0x000FFFFF; /*mask base address of the cs0 */ + pbcr|=(MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000); + mtdcr(ebccfga, pb0cr); + mtdcr(ebccfgd, pbcr); + SW_CS_PRINTF(" new cs0 cfg: %lx\n",pbcr); + mtdcr(ebccfga, pb1cr); /* get cs1 config reg (flash) */ + pbcr = mfdcr(ebccfgd); + SW_CS_PRINTF(" cs1 cfg: %lx\n",pbcr); + pbcr&=0x000FFFFF; /*mask base address of the cs1 */ + pbcr|=(FLASH_BASE0_PRELIM & 0xFFF00000); + mtdcr(ebccfga, pb1cr); + mtdcr(ebccfgd, pbcr); + SW_CS_PRINTF(" new cs1 cfg: %lx Flash is on High Address\n",pbcr); + } + return 1; + } + else { + SW_CS_PRINTF("Normal boot, no switching necessary\n"); + return 0; + } +} + + +int do_mplcommon(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) +{ + ulong size,src,load_addr; + int result; + backup_t back; + src = MULTI_PURPOSE_SOCKET_ADDR; + size = IMAGE_SIZE; + + if (strcmp(argv[1], "flash") == 0) + { +#if (CONFIG_COMMANDS & CFG_CMD_FDC) + if (strcmp(argv[2], "floppy") == 0) { + char *local_args[3]; + extern int do_fdcboot (cmd_tbl_t *, bd_t *, int, int, char *[]); + printf ("\nupdating bootloader image from floppy\n"); + local_args[0] = argv[0]; + if(argc==4) { + local_args[1] = argv[3]; + local_args[2] = NULL; + load_addr=simple_strtoul(argv[3], NULL, 16); + result=do_fdcboot(cmdtp, bd, 0, 2, local_args); + } + else { + local_args[1] = NULL; + load_addr=CFG_LOAD_ADDR; + result=do_fdcboot(cmdtp, bd, 0, 1, local_args); + } + result=mpl_prg_image(load_addr); + return result; + } +#endif /* (CONFIG_COMMANDS & CFG_CMD_FDC) */ + if (strcmp(argv[2], "mem") == 0) { + if(argc==4) { + load_addr=simple_strtoul(argv[3], NULL, 16); + } + else { + load_addr=CFG_LOAD_ADDR; + } + printf ("\nupdating bootloader image from memory at %lX\n",load_addr); + result=mpl_prg_image(load_addr); + return result; + } + if (strcmp(argv[2], "mps") == 0) { + printf ("\nupdating bootloader image from MSP\n"); + result=mpl_prg(src,size); + return result; + } + + } + if (strcmp(argv[1], "mem") == 0) + { + result=0; + if(argc==3) + { + result = (int)simple_strtol(argv[2], NULL, 16); + } + src=(unsigned long)&result; + src-=CFG_MEMTEST_START; + src-=(100*1024); /* - 100k */ + src&=0xfff00000; + size=0; + do { + size++; + printf("\n\nPass %ld\n",size); + mem_test(CFG_MEMTEST_START,src,1); + if(ctrlc()) + break; + if(result>0) + result--; + + }while(result); + return 0; + } + if (strcmp(argv[1], "clearenvvalues") == 0) + { + if (strcmp(argv[2], "yes") == 0) + { + clear_env_values(); + return 0; + } + } + if (strcmp(argv[1], "getback") == 0) { + get_backup_values(&back); + back.signature[3]=0; + back.serial_name[16]=0; + back.eth_addr[20]=0; + printf("GetBackUp: signature: %s\n",back.signature); + printf(" serial#: %s\n",back.serial_name); + printf(" ethaddr: %s\n",back.eth_addr); + return 0; + } + if (strcmp(argv[1], "setback") == 0) { + set_backup_values(1); + return 0; + } +#if 0 + if (strcmp(argv[1], "test") == 0) { + char *local_args[6]; + int i; + extern int do_doc(cmd_tbl_t *, bd_t *, int, int, char *[]); + local_args[0] = argv[0]; + for(i=1;i<5;i++) { + if(i+1usage); + return 1; +} + + diff --git a/board/mpl/common/common_util.h b/board/mpl/common/common_util.h new file mode 100644 index 0000000..7f8ddef --- /dev/null +++ b/board/mpl/common/common_util.h @@ -0,0 +1,42 @@ +/* + * (C) Copyright 2001 + * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch + * + * 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 + * + */ +#ifndef _COMMON_UTIL_H_ +#define _COMMON_UTIL_H_ + +typedef struct { + char signature[4]; + char serial_name[17]; /* "MIP405_1000xxxxx" */ + char eth_addr[21]; /* "00:60:C2:0a:00:00" */ +} backup_t; + +int mpl_prg(unsigned long src,unsigned long size); +int mpl_prg_image(unsigned long load_addr); +void get_backup_values(backup_t *buf); +void set_backup_values(int overwrite); +void clear_env_values(void); +int switch_cs(unsigned char boot); + + +#endif /* _COMMON_UTIL_H_ */ + diff --git a/board/mpl/common/flash.c b/board/mpl/common/flash.c index 6f2eef6..95c9929 100644 --- a/board/mpl/common/flash.c +++ b/board/mpl/common/flash.c @@ -44,6 +44,7 @@ #ifdef CONFIG_MIP405 #include "../mip405/mip405.h" #endif +#include "common_util.h" flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ /*----------------------------------------------------------------------- diff --git a/board/mpl/common/memtst.c b/board/mpl/common/memtst.c index e573c94..5be183f 100644 --- a/board/mpl/common/memtst.c +++ b/board/mpl/common/memtst.c @@ -450,7 +450,7 @@ int mem_test(unsigned long start, unsigned long ramsize, int quiet) prog++; printf("."); } - sprintf(dispbuf,"\n\nMemory Test: addr = 0x%lx size = 0x%lx\n",startaddr,size); + sprintf(dispbuf,"\nMemory Test: addr = 0x%lx size = 0x%lx\n",startaddr,size); testm_puts(quiet,dispbuf); for(stage=0;stage #include #include "mip405.h" -#include -#include "../common/isa.h" -#include "../common/video.h" -#include - -extern flash_info_t flash_info[]; /* info for FLASH chips */ +#include "../common/common_util.h" -int PCI_Write_CFG_Reg(int BusDevFunc, int Reg, unsigned int Value, int Width); -unsigned int PCI_Read_CFG_Reg(int BusDevFunc, int Reg, int Width); -extern void print_mip405_info(void); - - - - - -#define TRUE 1 -#define FALSE 0 - -#define IMAGE_SIZE 0x80000 - -image_header_t header; - - - -int mip405_prg(unsigned long src,unsigned long size) -{ - unsigned long start; - flash_info_t *info; - int i,rc; - unsigned long *magic = (unsigned long *)src; - - info = &flash_info[0]; - start = 0 - size; - for(i=info->sector_count-1;i>0;i--) - { - info->protect[i] = 0; /* unprotect this sector */ - if(start>=info->start[i]) - break; - } - /* set-up flash location */ - /* now erase flash */ - if(magic[0]!=IH_MAGIC) { - printf("Bad Magic number\n"); - return -1; - } - printf("Start erasing at %lx (sector %d) (start %lx)\n", - start,i,info->start[i]); - flash_erase (info, i, info->sector_count-1); - printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",src,size); - switch (rc = flash_write ((uchar *)src, start, size)) - { - case 0: printf ("programming done\n"); return 0; - case 1: printf ("Timeout writing to Flash\n"); return 1; - case 2: printf ("Flash not Erased\n"); return 1; - case 4: printf ("Can't write to protected Flash sectors\n"); return 1; - case 8: printf ("Outside available Flash\n"); return 1; - default: printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); return 1; - } - return 1; -} - - -int mip405_prg_image(unsigned long load_addr) -{ - unsigned long data,len,checksum; - image_header_t *hdr=&header; - /* Copy header so we can blank CRC field for re-calculation */ - memcpy (&header, (char *)load_addr, sizeof(image_header_t)); - if (hdr->ih_magic != IH_MAGIC) { - printf ("Bad Magic Number\n"); - return 1; - } - if (hdr->ih_os != IH_OS_PPCBOOT) { - printf ("No PPCBOOT Image\n"); - return 1; - } - if (hdr->ih_type != IH_TYPE_FIRMWARE) { - printf ("No Firmware Image\n"); - return 1; - } - data = (ulong)&header; - len = sizeof(image_header_t); - checksum = hdr->ih_hcrc; - hdr->ih_hcrc = 0; - if (crc32 (0, (char *)data, len) != checksum) { - printf ("Bad Header Checksum\n"); - return 1; - } - data = load_addr + sizeof(image_header_t); - len = hdr->ih_size; - printf (" Verifying Checksum ... "); - if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) { - printf ("Bad Data CRC\n"); - return 1; - } - printf ("OK\n"); - return(mip405_prg(data,len)); -} +extern void print_mip405_info(void); +extern int do_mplcommon(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]); /* ------------------------------------------------------------------------- */ @@ -132,83 +38,20 @@ int mip405_prg_image(unsigned long load_addr) int do_mip405(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { - ulong size,src,device,load_addr; - int result; - backup_t back; - src = MULTI_PURPOSE_SOCKET_ADDR; - size = IMAGE_SIZE; + ulong led_on; - if (strcmp(argv[1], "flash") == 0) - { - if (strcmp(argv[2], "mem") == 0) { - if(argc==4) { - load_addr=simple_strtoul(argv[3], NULL, 16); - } - else { - load_addr=CFG_LOAD_ADDR; - } - printf ("\nupdating bootloader image from memory at %lX\n",load_addr); - result=mip405_prg_image(load_addr); - return result; - } - if (strcmp(argv[2], "mps") == 0) { - printf ("\nupdating bootloader image from MSP\n"); - result=mip405_prg(src,size); - return result; - } - - } - if (strcmp(argv[1], "mem") == 0) - { - result=0; - if(argc==3) - { - result = (int)simple_strtol(argv[2], NULL, 16); - } - src=(unsigned long)&result; - src-=CFG_MEMTEST_START; - src-=(100*1024); /* - 100k */ - src&=0xfff00000; - size=0; - do { - size++; - printf("Pass %ld\n",size); - mem_test(CFG_MEMTEST_START,src,1); - if(ctrlc()) - break; - if(result>0) - result--; - - }while(result); - return 0; - } - if (strcmp(argv[1], "info") == 0) + if (strcmp(argv[1], "info") == 0) { print_mip405_info(); return 0; } if (strcmp(argv[1], "led") == 0) { - device = (ulong)simple_strtoul(argv[2], NULL, 10); - user_led0((device==1)); + led_on = (ulong)simple_strtoul(argv[2], NULL, 10); + user_led0(led_on); return 0; } - if (strcmp(argv[1], "getback") == 0) { - get_backup_values(&back); - back.signature[3]=0; - back.serial_name[16]=0; - back.eth_addr[20]=0; - printf("GetBackUp: signature: %s\n",back.signature); - printf(" serial#: %s\n",back.serial_name); - printf(" ethaddr: %s\n",back.eth_addr); - return 0; - } - if (strcmp(argv[1], "setback") == 0) { - set_backup_values(1); - return 0; - } - printf("Usage:\n%s\n", cmdtp->usage); - return 1; + return (do_mplcommon(cmdtp, bd, flag, argc, argv)); } /* ------------------------------------------------------------------------- */ diff --git a/board/mpl/mip405/mip405.c b/board/mpl/mip405/mip405.c index 0e4dcb2..e151809 100644 --- a/board/mpl/mip405/mip405.c +++ b/board/mpl/mip405/mip405.c @@ -68,6 +68,7 @@ #include <405gp_i2c.h> #include #include +#include "../common/common_util.h" extern block_dev_desc_t * scsi_get_dev(int dev); extern block_dev_desc_t * ide_get_dev(int dev); @@ -466,49 +467,6 @@ void ide_set_reset(int idereset) out8(PLD_COM_MODE_REG,(in8(PLD_COM_MODE_REG)&0xfe)); } -#define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */ - -void get_backup_values(backup_t *buf) -{ - eeprom_read (CFG_DEF_EEPROM_ADDR, - I2C_BACKUP_ADDR, - (void *)buf, - sizeof(backup_t)); -} - -void set_backup_values(int overwrite) -{ - backup_t back; - int i; - - get_backup_values(&back); - if(!overwrite) { - if(strncmp(back.signature,"MPL\0",4)==0) { - printf("Not possible to write Backup\n"); - return; - } - } - memcpy(back.signature,"MPL\0",4); - i=getenv_r("serial#",back.serial_name,16); - if(i==0) { - printf("Not possible to write Backup\n"); - return; - } - back.serial_name[16]=0; - i=getenv_r("ethaddr",back.eth_addr,20); - if(i==0) { - printf("Not possible to write Backup\n"); - return; - } - back.eth_addr[20]=0; - eeprom_write (CFG_DEF_EEPROM_ADDR, - CFG_ENV_OFFSET+I2C_BACKUP_ADDR, - (void *)&back, - sizeof(backup_t)); -} - - - /* ------------------------------------------------------------------------- */ @@ -618,74 +576,6 @@ int testdram (unsigned long ramsize) return(1); } -/* ------------------------------------------------------------------------- */ - - /* switches the cs0 and the cs1 to the locations. - When boot is TRUE, the the mapping is switched - to the boot configuration, If it is FALSE, the - flash will be switched in the boot area */ - -#undef SW_CS_DBG -#ifdef SW_CS_DBG -#define SW_CS_PRINTF(fmt,args...) printf (fmt ,##args) -#else -#define SW_CS_PRINTF(fmt,args...) -#endif - - -int switch_cs(unsigned char boot) -{ - unsigned long pbcr; - mtdcr(ebccfga, pb0cr); /* get cs0 config reg */ - pbcr = mfdcr(ebccfgd); - if((pbcr&0x00002000)==0) { - /* we need only to switch if boot from MPS */ - /*printf(" MPS boot mode detected. ");*/ - /* printf("cs0 cfg: %lx\n",pbcr); */ - if(boot==TRUE) { - /* switch to boot configuration */ - /* this is a 8bit boot, switch cs0 to flash location */ - SW_CS_PRINTF("switch to boot mode (MPS on High address\n"); - pbcr&=0x000FFFFF; /*mask base address of the cs0 */ - pbcr|=(FLASH_BASE0_PRELIM & 0xFFF00000); - mtdcr(ebccfga, pb0cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs0 cfg: %lx\n",pbcr); - mtdcr(ebccfga, pb1cr); /* get cs1 config reg (flash) */ - pbcr = mfdcr(ebccfgd); - SW_CS_PRINTF(" old cs1 cfg: %lx\n",pbcr); - pbcr&=0x000FFFFF; /*mask base address of the cs1 */ - pbcr|=(MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000); - mtdcr(ebccfga, pb1cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs1 cfg: %lx, MPS is on High Address\n",pbcr); - } - else - { - /* map flash to boot area, */ - SW_CS_PRINTF("map Flash to boot area\n"); - pbcr&=0x000FFFFF; /*mask base address of the cs0 */ - pbcr|=(MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000); - mtdcr(ebccfga, pb0cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs0 cfg: %lx\n",pbcr); - mtdcr(ebccfga, pb1cr); /* get cs1 config reg (flash) */ - pbcr = mfdcr(ebccfgd); - SW_CS_PRINTF(" cs1 cfg: %lx\n",pbcr); - pbcr&=0x000FFFFF; /*mask base address of the cs1 */ - pbcr|=(FLASH_BASE0_PRELIM & 0xFFF00000); - mtdcr(ebccfga, pb1cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs1 cfg: %lx Flash is on High Address\n",pbcr); - } - return TRUE; - } - else { - SW_CS_PRINTF("Normal boot, no switching necessary\n"); - return FALSE; - } -} - void misc_init_r(bd_t *bd) { #if 0 @@ -809,6 +699,7 @@ void print_mip405_info(void) printf("Population Options %d %d %d %d\n",(cfg)&0x1,(cfg>>1)&0x1,(cfg>>2)&0x1,(cfg>>3)&0x1); printf("User LED %s\n",(com_mode & 0x4) ? "on" : "off"); printf("UART Clocks %d\n",(com_mode>>4)&0x3); + printf("Test ist %x\n",com_mode); printf("User Config Switch %d %d %d %d %d %d %d %d\n", (ext)&0x1,(ext>>1)&0x1,(ext>>2)&0x1,(ext>>3)&0x1,(ext>>4)&0x1,(ext>>5)&0x1,(ext>>6)&0x1,(ext>>7)&0x1); printf("SER1 uses handshakes %s\n",(ext & 0x80) ? "DTR/DSR" : "RTS/CTS"); diff --git a/board/mpl/mip405/mip405.h b/board/mpl/mip405/mip405.h index a4ce243..c284f37 100644 --- a/board/mpl/mip405/mip405.h +++ b/board/mpl/mip405/mip405.h @@ -25,19 +25,12 @@ * Global routines used for MIP405 *****************************************************************************/ #ifndef __ASSEMBLY__ -int switch_cs(unsigned char boot); +/*int switch_cs(unsigned char boot);*/ extern int mem_test(unsigned long start, unsigned long ramsize,int mode); void user_led0(unsigned char on); -typedef struct { - char signature[4]; - char serial_name[17]; /* "MIP405_1000xxxxx" */ - char eth_addr[21]; /* "00:60:C2:0a:00:00" */ -} backup_t; -void get_backup_values(backup_t *buf); -void set_backup_values(int overwrite); #endif diff --git a/board/mpl/pip405/Makefile b/board/mpl/pip405/Makefile index 802ab60..1e6d57a 100644 --- a/board/mpl/pip405/Makefile +++ b/board/mpl/pip405/Makefile @@ -25,7 +25,12 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o ../common/flash.o cmd_pip405.o ../common/pci.o ../common/isa.o ../common/kbd.o ../common/video.o ../common/sym53c8xx.o ../common/usb_uhci.o ../common/memtst.o +OBJS = $(BOARD).o \ + ../common/flash.o cmd_pip405.o ../common/pci.o \ + ../common/isa.o ../common/kbd.o ../common/video.o \ + ../common/sym53c8xx.o ../common/usb_uhci.o \ + ../common/memtst.o ../common/common_util.o + SOBJS = init.o $(LIB): $(OBJS) $(SOBJS) diff --git a/board/mpl/pip405/cmd_pip405.c b/board/mpl/pip405/cmd_pip405.c index e4f5e0b..c3efd98 100644 --- a/board/mpl/pip405/cmd_pip405.c +++ b/board/mpl/pip405/cmd_pip405.c @@ -26,119 +26,38 @@ #include #include #include "pip405.h" -#include -#include "../common/isa.h" -#include "../common/video.h" -#include +#include "../common/common_util.h" -extern flash_info_t flash_info[]; /* info for FLASH chips */ -int PCI_Write_CFG_Reg(int BusDevFunc, int Reg, unsigned int Value, int Width); -unsigned int PCI_Read_CFG_Reg(int BusDevFunc, int Reg, int Width); +extern void print_pip405_info(void); +extern int do_mplcommon(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]); - - -#define TRUE 1 -#define FALSE 0 - -#define IMAGE_SIZE 0x80000 - -image_header_t header; - - - -int pip405_prg(unsigned long src,unsigned long size) -{ - unsigned long start; - flash_info_t *info; - int i,rc; - unsigned long *magic = (unsigned long *)src; - - info = &flash_info[0]; - start = 0 - size; - for(i=info->sector_count-1;i>0;i--) - { - info->protect[i] = 0; /* unprotect this sector */ - if(start>=info->start[i]) - break; - } - /* set-up flash location */ - rc=switch_cs(FALSE); - /* now erase flash */ - if(magic[0]!=IH_MAGIC) { - printf("Bad Magic number\n"); - switch_cs(rc); - return -1; - } - printf("Start erasing at %lx (sector %d) (start %lx)\n", - start,i,info->start[i]); - flash_erase (info, i, info->sector_count-1); - printf("flash erased, programming 0x%lx Bytes\n",size); - switch (rc = flash_write ((uchar *)src, start, size)) - { - case 0: printf ("programming done\n"); return 0; - case 1: printf ("Timeout writing to Flash\n"); return 1; - case 2: printf ("Flash not Erased\n"); return 1; - case 4: printf ("Can't write to protected Flash sectors\n"); return 1; - case 8: printf ("Outside available Flash\n"); return 1; - default: printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); return 1; - } - return 1; -} - -int pip405_prg_image(unsigned long load_addr) -{ - unsigned long data,len,checksum; - image_header_t *hdr=&header; - /* Copy header so we can blank CRC field for re-calculation */ - memcpy (&header, (char *)load_addr, sizeof(image_header_t)); - - if (hdr->ih_magic != IH_MAGIC) { - printf ("Bad Magic Number\n"); - return 1; - } - if (hdr->ih_os != IH_OS_PPCBOOT) { - printf ("No PPCBOOT Image\n"); - return 1; - } - if (hdr->ih_type != IH_TYPE_FIRMWARE) { - printf ("No Firmware Image\n"); - return 1; - } - data = (ulong)&header; - len = sizeof(image_header_t); - checksum = hdr->ih_hcrc; - hdr->ih_hcrc = 0; - if (crc32 (0, (char *)data, len) != checksum) { - printf ("Bad Header Checksum\n"); - return 1; - } - data = load_addr + sizeof(image_header_t); - len = hdr->ih_size; - printf (" Verifying Checksum ... "); - if (crc32 (0, (char *)data, len) != hdr->ih_dcrc) { - printf ("Bad Data CRC\n"); - return 1; - } - printf ("OK\n"); - return(pip405_prg(data,len)); -} - - /* ------------------------------------------------------------------------- */ int do_pip405(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { - ulong size,src,device,function,load_addr; - unsigned char i2c[3]; - int result; - backup_t back; - src = MULTI_PURPOSE_SOCKET_ADDR; - size = IMAGE_SIZE; + ulong led_on,led_nr; + + if (strcmp(argv[1], "info") == 0) + { + print_pip405_info(); + return 0; + } + if (strcmp(argv[1], "led") == 0) + { + led_nr = (ulong)simple_strtoul(argv[2], NULL, 10); + led_on = (ulong)simple_strtoul(argv[3], NULL, 10); + if(!led_nr) + user_led0(led_on); + else + user_led1(led_on); + return 0; + } +#if 0 if (strcmp(argv[1], "flash") == 0) { if (strcmp(argv[2], "floppy") == 0) { @@ -157,7 +76,7 @@ int do_pip405(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) load_addr=CFG_LOAD_ADDR; result=do_fdcboot(cmdtp, bd, 0, 1, local_args); } - result=pip405_prg_image(load_addr); + result=mpl_prg_image(load_addr); return result; } if (strcmp(argv[2], "mem") == 0) { @@ -168,12 +87,12 @@ int do_pip405(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) load_addr=CFG_LOAD_ADDR; } printf ("\nupdating bootloader image from memory at %lX\n",load_addr); - result=pip405_prg_image(load_addr); + result=mpl_prg_image(load_addr); return result; } if (strcmp(argv[2], "mps") == 0) { printf ("\nupdating bootloader image from MSP\n"); - result=pip405_prg(src,size); + result=mpl_prg(src,size); return result; } } @@ -191,6 +110,14 @@ int do_pip405(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) set_backup_values(1); return 0; } + if (strcmp(argv[1], "clearenvvalues") == 0) + { + if (strcmp(argv[2], "yes") == 0) + { + clear_env_values(); + return 0; + } + } if (strcmp(argv[1], "mem") == 0) { result=0; @@ -215,31 +142,8 @@ int do_pip405(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) }while(result); return 0; } - if (strcmp(argv[1], "info") == 0) - { - print_pip405_info(); - return 0; - } - if (strcmp(argv[1], "i2c") == 0) - { - i2c[0]=CFG_I2C_EEPROM_ADDR; - i2c[1]=0; - i2c[2]=0; - i2c_read(&i2c[0],3,(unsigned char *)CFG_LOAD_ADDR,512); - return 0; - } - if (strcmp(argv[1], "led") == 0) - { - device = (ulong)simple_strtoul(argv[2], NULL, 10); - function = (ulong)simple_strtoul(argv[3], NULL, 10); - if(device==0) - user_led0((function==1)); - else - user_led1((function==1)); - return 0; - } - printf("Usage:\n%s\n", cmdtp->usage); - return 1; + #endif + return (do_mplcommon(cmdtp, bd, flag, argc, argv)); } /* ------------------------------------------------------------------------- */ diff --git a/board/mpl/pip405/pip405.c b/board/mpl/pip405/pip405.c index f961eb4..6df8eb2 100644 --- a/board/mpl/pip405/pip405.c +++ b/board/mpl/pip405/pip405.c @@ -31,6 +31,7 @@ #include #include "../common/isa.h" #include "../common/video.h" +#include "../common/common_util.h" extern block_dev_desc_t * scsi_get_dev(int dev); @@ -543,47 +544,6 @@ int board_pre_init (void) /* ------------------------------------------------------------------------- */ -#define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */ - -void get_backup_values(backup_t *buf) -{ - eeprom_read (CFG_DEF_EEPROM_ADDR, - I2C_BACKUP_ADDR, - (void *)buf, - sizeof(backup_t)); -} - -void set_backup_values(int overwrite) -{ - backup_t back; - int i; - - get_backup_values(&back); - if(!overwrite) { - if(strncmp(back.signature,"MPL\0",4)==0) { - printf("Not possible to write Backup\n"); - return; - } - } - memcpy(back.signature,"MPL\0",4); - i=getenv_r("serial#",back.serial_name,16); - if(i==0) { - printf("Not possible to write Backup\n"); - return; - } - back.serial_name[16]=0; - i=getenv_r("ethaddr",back.eth_addr,20); - if(i==0) { - printf("Not possible to write Backup\n"); - return; - } - back.eth_addr[20]=0; - eeprom_write (CFG_DEF_EEPROM_ADDR, - CFG_ENV_OFFSET+I2C_BACKUP_ADDR, - (void *)&back, - sizeof(backup_t)); -} - /* * Check Board Identity: @@ -677,74 +637,6 @@ int testdram (unsigned long ramsize) return(1); } -/* ------------------------------------------------------------------------- */ - - /* switches the cs0 and the cs1 to the locations. - When boot is TRUE, the the mapping is switched - to the boot configuration, If it is FALSE, the - flash will be switched in the boot area */ - - -#undef SW_CS_DBG -#ifdef SW_CS_DBG -#define SW_CS_PRINTF(fmt,args...) printf (fmt ,##args) -#else -#define SW_CS_PRINTF(fmt,args...) -#endif - - -int switch_cs(unsigned char boot) -{ - unsigned long pbcr; - mtdcr(ebccfga, pb0cr); /* get cs0 config reg */ - pbcr = mfdcr(ebccfgd); - if((pbcr&0x00002000)==0) { - /* we need only to switch if boot from MPS */ - SW_CS_PRINTF(" MPS boot mode detected. "); - /* printf("cs0 cfg: %lx\n",pbcr); */ - if(boot==TRUE) { - /* switch to boot configuration */ - /* this is a 8bit boot, switch cs0 to flash location */ - SW_CS_PRINTF("switch to boot mode (MPS on High address\n"); - pbcr&=0x000FFFFF; /*mask base address of the cs0 */ - pbcr|=(FLASH_BASE0_PRELIM & 0xFFF00000); - mtdcr(ebccfga, pb0cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs0 cfg: %lx\n",pbcr); - mtdcr(ebccfga, pb1cr); /* get cs1 config reg (flash) */ - pbcr = mfdcr(ebccfgd); - SW_CS_PRINTF(" old cs1 cfg: %lx\n",pbcr); - pbcr&=0x000FFFFF; /*mask base address of the cs1 */ - pbcr|=(MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000); - mtdcr(ebccfga, pb1cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs1 cfg: %lx, MPS is on High Address\n",pbcr); - } - else - { - /* map flash to boot area, */ - SW_CS_PRINTF("map Flash to boot area\n"); - pbcr&=0x000FFFFF; /*mask base address of the cs0 */ - pbcr|=(MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000); - mtdcr(ebccfga, pb0cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs0 cfg: %lx\n",pbcr); - mtdcr(ebccfga, pb1cr); /* get cs1 config reg (flash) */ - pbcr = mfdcr(ebccfgd); - SW_CS_PRINTF(" cs1 cfg: %lx\n",pbcr); - pbcr&=0x000FFFFF; /*mask base address of the cs1 */ - pbcr|=(FLASH_BASE0_PRELIM & 0xFFF00000); - mtdcr(ebccfga, pb1cr); - mtdcr(ebccfgd, pbcr); - SW_CS_PRINTF(" new cs1 cfg: %lx Flash is on High Address\n",pbcr); - } - return TRUE; - } - else { - SW_CS_PRINTF("Normal boot, no switching necessary\n"); - return FALSE; - } -} void misc_init_r(bd_t *bd) { diff --git a/board/mpl/pip405/pip405.h b/board/mpl/pip405/pip405.h index 7adfcef..ee08035 100644 --- a/board/mpl/pip405/pip405.h +++ b/board/mpl/pip405/pip405.h @@ -25,7 +25,6 @@ * Global routines used for PIP405 *****************************************************************************/ -int switch_cs(unsigned char boot); extern int mem_test(unsigned long start, unsigned long ramsize,int mode); @@ -34,14 +33,6 @@ void print_pip405_info(void); void user_led0(unsigned char on); void user_led1(unsigned char on); -typedef struct { - char signature[4]; - char serial_name[17]; /* "PIP405_1000xxxxx" */ - char eth_addr[21]; /* "00:60:C2:08:00:00" */ -} backup_t; - -void get_backup_values(backup_t *buf); -void set_backup_values(int overwrite); #define PLD_BASE_ADDRESS CFG_ISA_IO_BASE_ADDRESS + 0x800 #define PLD_PART_REG PLD_BASE_ADDRESS + 0 diff --git a/board/mpl/pip405/ppcboot.lds b/board/mpl/pip405/ppcboot.lds index c260b18..06f55dd 100644 --- a/board/mpl/pip405/ppcboot.lds +++ b/board/mpl/pip405/ppcboot.lds @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000, 2001 + * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this diff --git a/board/mpl/pip405/ppcboot.lds.debug b/board/mpl/pip405/ppcboot.lds.debug index b8ec990..83c7f19 100644 --- a/board/mpl/pip405/ppcboot.lds.debug +++ b/board/mpl/pip405/ppcboot.lds.debug @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000, 2001 + * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this diff --git a/board/musenki/Makefile b/board/musenki/Makefile index b87f539..444bc76 100644 --- a/board/musenki/Makefile +++ b/board/musenki/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o flash.o ns16550.o serial.o speed.o dc2114x.o +OBJS = $(BOARD).o flash.o ns16550.o serial.o dc2114x.o SOBJS = early_init.o $(LIB): .depend $(OBJS) $(SOBJS) diff --git a/board/musenki/serial.c b/board/musenki/serial.c index 256146e..acc500f 100644 --- a/board/musenki/serial.c +++ b/board/musenki/serial.c @@ -32,10 +32,12 @@ static struct NS16550 *console = (struct NS16550 *) (CFG_EUMB_ADDR + 0x4500); #error no valid console defined #endif +extern ulong get_bus_freq(ulong); + void serial_init (unsigned long dummy, int baudrate) { - int clock_divisor = CFG_SERIAL_CLOCK / 16 / baudrate; + int clock_divisor = get_bus_freq(0) / 16 / baudrate; NS16550_init(CONFIG_CONS_INDEX - 1, clock_divisor); } @@ -74,7 +76,7 @@ serial_tstc(void) void serial_setbrg (unsigned long dummy, int baudrate) { - int clock_divisor = CFG_SERIAL_CLOCK / 16 / baudrate; + int clock_divisor = get_bus_freq(0) / 16 / baudrate; NS16550_reinit(console, clock_divisor); } diff --git a/board/musenki/speed.c b/board/musenki/speed.c deleted file mode 100644 index 048fca1..0000000 --- a/board/musenki/speed.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (C) Copyright 2001 - * 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 -#include -#include - - -ulong get_bus_freq(ulong ignore) -{ - return 100000000; -} - -/* ------------------------------------------------------------------------- */ - -/* - * Measure CPU clock speed - */ - -/* Table to convert pllratio to actual processor clock scaling factor (*10) - */ -#ifdef CONFIG_MPC8245 /* FIXME */ -short pllratio_to_factor[] = { - 00, 00, 00, 10, 20, 20, 25, 00, 00, 00, 00, 00, 00, 00, 00, 00, - 00, 00, 00, 10, 00, 00, 00, 45, 30, 00, 40, 00, 00, 00, 35, 00, -}; -#endif - -ulong get_gclk_freq(void) -{ - uint hid1 = mfspr(HID1); - - /* 5 bits for PLL ration on 8240/8245 */ - hid1 = (hid1 >> (32-5)) & 0x1f; - - return (pllratio_to_factor[hid1] * get_bus_freq(0)) / 10; -} - -/* ------------------------------------------------------------------------- */ - diff --git a/board/sandpoint/Makefile b/board/sandpoint/Makefile index 76c8a33..8285616 100644 --- a/board/sandpoint/Makefile +++ b/board/sandpoint/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o flash.o ns16550.o ns87308.o serial.o speed.o \ +OBJS = $(BOARD).o flash.o ns16550.o ns87308.o serial.o \ pci.o eepro100.o $(LIB): .depend $(OBJS) diff --git a/board/sandpoint/sandpoint.c b/board/sandpoint/sandpoint.c index ae69f75..e365d13 100644 --- a/board/sandpoint/sandpoint.c +++ b/board/sandpoint/sandpoint.c @@ -40,51 +40,52 @@ int checkflash (void) return (0); } -static long dram_size (void) +long int initdram (int board_type) { - static const unsigned long - addressmask = 0x4ff00000, addressinc = 0x00100000; - long result = 0; + int i, cnt; + volatile uchar * base= CFG_SDRAM_BASE; + volatile ulong * addr; + ulong save[32]; + ulong val, ret = 0; -#if (CFG_BANK_ENABLE & 0x80) - result += (CFG_BANK7_END & addressmask) + addressinc - - (CFG_BANK7_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x40) - result += (CFG_BANK6_END & addressmask) + addressinc - - (CFG_BANK6_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x20) - result += (CFG_BANK5_END & addressmask) + addressinc - - (CFG_BANK5_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x10) - result += (CFG_BANK4_END & addressmask) + addressinc - - (CFG_BANK4_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x08) - result += (CFG_BANK3_END & addressmask) + addressinc - - (CFG_BANK3_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x04) - result += (CFG_BANK2_END & addressmask) + addressinc - - (CFG_BANK2_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x02) - result += (CFG_BANK1_END & addressmask) + addressinc - - (CFG_BANK1_START & addressmask); -#endif -#if (CFG_BANK_ENABLE & 0x01) - result += (CFG_BANK0_END & addressmask) + addressinc - - (CFG_BANK0_START & addressmask); -#endif + for (i=0, cnt=(CFG_MAX_RAM_SIZE / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) { + addr = (volatile ulong *)base + cnt; + save[i++] = *addr; + *addr = ~cnt; + } - return result; -} + addr = (volatile ulong *)base; + save[i] = *addr; + *addr = 0; -long int initdram (int board_type) -{ - return dram_size (); + if (*addr != 0) { + *addr = save[i]; + goto Done; + } + + for (cnt = 1; cnt <= CFG_MAX_RAM_SIZE / sizeof(long); cnt <<= 1) { + addr = (volatile ulong *)base + cnt; + val = *addr; + *addr = save[--i]; + if (val != ~cnt) { + ulong new_bank0_end = cnt * sizeof(long) - 1; + ulong mear1 = mpc824x_mpc107_getreg(MEAR1); + ulong emear1 = mpc824x_mpc107_getreg(EMEAR1); + mear1 = (mear1 & 0xFFFFFF00) | + ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT); + emear1 = (emear1 & 0xFFFFFF00) | + ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT); + mpc824x_mpc107_setreg(MEAR1, mear1); + mpc824x_mpc107_setreg(EMEAR1, emear1); + + ret = cnt * sizeof(long); + goto Done; + } + } + + ret = CFG_MAX_RAM_SIZE; +Done: + return ret; } /* diff --git a/board/sandpoint/speed.c b/board/sandpoint/speed.c deleted file mode 100644 index 3a8aa8f..0000000 --- a/board/sandpoint/speed.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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 -#include -#include -#include "speed.h" - -/*use UART2 to measure bus speed*/ -#include "ns16550.h" - - -/* Access functions for the Machine State Register */ -static __inline__ unsigned long get_msr(void) -{ - unsigned long msr; - - __asm__ ("mfmsr %0" : "=r" (msr) :); - return msr; -} - -static __inline__ void set_msr(unsigned long msr) -{ - __asm__ __volatile__("mtmsr %0" : : "r" (msr)); -} - -/* ------------------------------------------------------------------------- */ - -ulong get_bus_freq (ulong ignore) -{ - return 66666666; -} - -/* ------------------------------------------------------------------------- */ - -/* - * Measure CPU clock speed - */ - -/* - * table to convert pllratio to actual processor clock scaling factor (*2) - * if you are using a a different processor with your sandpoint, - * have a look at pmc.c in the dink source for values, or - * figure it out from the hardware book - */ - -#ifdef CONFIG_MPC824X -const unsigned char pllratio_to_factor[32] = { - 0, 0, 0, 2, 4, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 0, 0, 0, 9, 6, 0, 8, 0, 0, 0, 7, 0 -}; -#else - #error Enter clock divider array here! -#endif - -ulong get_gclk_freq (void) -{ - uint hid1; - hid1 = mfspr(HID1); - #ifdef CONFIG_MPC824X - hid1 = (hid1 >> (32-5)) & 0x1f; /* 5 bits for PLL ration on 824x */ - #else - hid1 = (hid1 >> (32-4)) & 0xf; /* 4 bits on everythings else*/ - #endif - - return pllratio_to_factor[hid1] * get_bus_freq(0)/2; -} - -/* ------------------------------------------------------------------------- */ - diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 067b746..39bbf1a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -74,7 +74,9 @@ static boot_os_Fcn do_bootm_linux; static boot_os_Fcn do_bootm_netbsd; #if (CONFIG_COMMANDS & CFG_CMD_ELF) static boot_os_Fcn do_bootm_vxworks; +static boot_os_Fcn do_bootm_qnxelf; int do_bootvx( cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[] ); +int do_bootelf( cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[] ); #endif /* CFG_CMD_ELF */ image_header_t header; @@ -238,6 +240,10 @@ int do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) do_bootm_vxworks (cmdtp, bd, flag, argc, argv, addr, len_ptr, verify); break; + case IH_OS_QNX: + do_bootm_qnxelf (cmdtp, bd, flag, argc, argv, + addr, len_ptr, verify); + break; #endif /* CFG_CMD_ELF */ } @@ -707,6 +713,7 @@ print_type (image_header_t *hdr) case IH_OS_NETBSD: os = "NetBSD"; break; case IH_OS_LINUX: os = "Linux"; break; case IH_OS_VXWORKS: os = "VxWorks"; break; + case IH_OS_QNX: os = "QNX"; break; case IH_OS_PPCBOOT: os = "PPCBoot"; break; default: os = "Unknown OS"; break; } @@ -841,4 +848,18 @@ do_bootm_vxworks (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[], setenv("loadaddr", str); do_bootvx(cmdtp, bd, 0, 0, NULL); } + +static void +do_bootm_qnxelf (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[], + ulong addr, ulong *len_ptr, int verify) +{ + image_header_t *hdr = &header; + char *local_args[2]; + char str[16]; + + sprintf(str, "%x", hdr->ih_ep); /* write entry-point into string */ + local_args[0] = argv[0]; + local_args[1] = str; /* and provide it via the arguments */ + do_bootelf(cmdtp, bd, 0, 2, local_args); +} #endif /* CFG_CMD_ELF */ diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 267c6d8..1235de9 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -297,7 +297,8 @@ int do_scsiboot (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) cnt /= info.blksz; cnt -= 1; } else { - cnt = info.size - 1; + printf("\n** Bad Magic Number **\n"); + return 1; } if (scsi_read (dev, info.start+1, cnt, diff --git a/common/usb_storage.c b/common/usb_storage.c index 9b84038..fb0f7db 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -152,7 +152,7 @@ int usb_stor_scan(int mode) for(i=0;i +#include +#include + +/* ------------------------------------------------------------------------- */ +/* NOTE: This describes the proper use of this file. */ +/* CONFIG_SYS_CLK_FREQ should be defined as the input frequency on PCI_SYNC_IN */ +/* CONFIG_PLL_PCI_TO_MEM_MULTIPLIER is only required on MPC8240 boards */ +/* it should be defined as the PCI to Memory Multiplier as documented */ +/* in the MPC8240 Hardware Specs */ +/* Other mpc824x boards don't need CONFIG_PLL_PCI_TO_MEM_MULTIPLIER because */ +/* they can determine it from the PCR */ + +/* If the PCR is an undocumented feature on the mpc8240 then we can do away */ +/* with CONFIG_PLL_PCI_TO_MEM_MULTIPLIER altogether */ + +/* ------------------------------------------------------------------------- */ + +/* This gives the PCI to Memory multiplier times 10 */ +/* The index is the value of PLL_CFG[0:4] */ +/* This is documented in the MPC8240/5 Hardware Specs */ + +short pll_pci_to_mem_multiplier[] = { +#if defined(CONFIG_MPC8240) + 30, 30, 10, 10, 20, 10, 00, 10, + 10, 00, 20, 00, 20, 00, 20, 00, + 30, 00, 15, 00, 20, 00, 20, 00, + 25, 00, 10, 00, 15, 15, 00, 00 +#elif defined(CONFIG_MPC8245) + 30, 30, 10, 10, 20, 10, 10, 10, + 10, 20, 20, 15, 20, 15, 20, 00, + 30, 00, 15, 00, 20, 25, 20, 40, + 25, 20, 10, 20, 15, 15, 15, 00 +#else +#error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240) +#endif +}; + +#define CU824_PLL_STATE_REG 0xFE80002F +#define PCR 0x800000E2 + +/* ------------------------------------------------------------------------- */ + +/* compute the memory bus clock frequency */ +ulong get_bus_freq(ulong ignore) +{ + unsigned char pll_cfg; +#if defined(CONFIG_MPC8240) && !defined(CONFIG_CU824) + return (CONFIG_SYS_CLK_FREQ) * (CONFIG_PLL_PCI_TO_MEM_MULTIPLIER); +#elif defined(CONFIG_CU824) + pll_cfg = *(volatile unsigned char *) (CU824_PLL_STATE_REG); + pll_cfg &= 0x1f; +#else + CONFIG_READ_BYTE(PCR, pll_cfg); + pll_cfg = (pll_cfg >> 3) & 0x1f; +#endif + return ((CONFIG_SYS_CLK_FREQ) * pll_pci_to_mem_multiplier[pll_cfg] + 5) / 10; +} + + +/* ------------------------------------------------------------------------- */ + +/* This gives the Memory to CPU Core multiplier times 10 */ +/* The index is the value of PLLRATIO in HID1 */ +/* This is documented in the MPC8240 Hardware Specs */ +/* This is not documented for MPC8245 ? FIXME */ +short pllratio_to_factor[] = { + 00, 00, 00, 10, 20, 20, 25, 45, + 00, 00, 00, 00, 00, 00, 00, 00, + 00, 00, 00, 10, 00, 00, 00, 45, + 30, 00, 40, 00, 00, 00, 35, 00, +}; + +/* compute the memory bus clock frequency */ +ulong get_gclk_freq(void) +{ + uint hid1 = mfspr(HID1); + hid1 = (hid1 >> (32-5)) & 0x1f; + return (pllratio_to_factor[hid1] * get_bus_freq(0) + 5) / 10; +} diff --git a/disk/part.c b/disk/part.c index 59ca1f4..3e6e05f 100644 --- a/disk/part.c +++ b/disk/part.c @@ -178,6 +178,10 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc) break; case IF_TYPE_ATAPI: puts ("ATAPI"); break; + case IF_TYPE_USB: puts ("USB"); + break; + case IF_TYPE_DOC: puts ("DOC"); + break; default: puts ("UNKNOWN"); break; } diff --git a/disk/part_dos.c b/disk/part_dos.c index ff62614..20218e9 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -175,11 +175,18 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part info->size = le32_to_int (pt->size4); switch(dev_desc->if_type) { case IF_TYPE_IDE: + case IF_TYPE_ATAPI: sprintf (info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num); break; case IF_TYPE_SCSI: sprintf (info->name, "sd%c%d\n", 'a' + dev_desc->dev, part_num); break; + case IF_TYPE_USB: + sprintf (info->name, "usbd%c%d\n", 'a' + dev_desc->dev, part_num); + break; + case IF_TYPE_DOC: + sprintf (info->name, "docd%c%d\n", 'a' + dev_desc->dev, part_num); + break; default: sprintf (info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num); break; diff --git a/include/cmd_usb.h b/include/cmd_usb.h index f1917d7..20b830d 100644 --- a/include/cmd_usb.h +++ b/include/cmd_usb.h @@ -39,7 +39,7 @@ "usb tree - show USB device tree\n" \ "usb info [dev] - show available USB devices\n" \ "usb scan - (re-)scan USB bus for storage devices\n" \ - "usb device [dev] - show or set current USB staorage device\n" \ + "usb device [dev] - show or set current USB storage device\n" \ "usb part [dev] - print partition table of one or all USB storage devices\n" \ "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"\ " to memory address `addr'\n" \ @@ -73,5 +73,5 @@ int do_usbboot (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]); #define CMD_TBL_USBBOOT #endif -#endif /* _CMD_SCSI_H */ +#endif /* _CMD_USB_H */ diff --git a/include/config_MIP405.h b/include/config_MIP405.h index 3e155de..771893f 100644 --- a/include/config_MIP405.h +++ b/include/config_MIP405.h @@ -92,7 +92,8 @@ * Environment definitions **************************************************************/ #define CONFIG_BAUDRATE 9600 /* STD Baudrate */ -#define CONFIG_BOOTDELAY -1 /* no autoboot */ +#define CONFIG_BOOTDELAY 5 +/* autoboot (do NOT change this set environment variable "bootdelay" to -1 instead) */ #define CONFIG_BOOTCOMMAND "diskboot 200000 0:1; bootm" /* autoboot command */ #define CONFIG_BOOTARGS "console=ttyS0,9600 root=/dev/hda5" /* boot arguments */ @@ -136,10 +137,11 @@ #define CFG_MAXARGS 16 /* max number of command args */ #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ -#define CFG_MEMTEST_START 0x0400000 /* memtest works on */ -#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */ +#define CFG_MEMTEST_START 0x0100000 /* memtest works on */ +#define CFG_MEMTEST_END 0x0C00000 /* 1 ... 12 MB in DRAM */ #undef CFG_EXT_SERIAL_CLOCK /* no external serial clock used */ +#define CFG_IGNORE_405_UART_ERRATA_59 /* The following table includes the supported baudrates */ #define CFG_BAUDRATE_TABLE \ @@ -332,7 +334,7 @@ /************************************************************ * Ident ************************************************************/ -#define VERSION_TAG "REL_1_1_1" +#define VERSION_TAG "REL_1_1_3" #define CONFIG_IDENT_STRING "\n(c) 2001 by MPL AG Switzerland, MEV-10072-001 " VERSION_TAG diff --git a/include/config_MOUSSE.h b/include/config_MOUSSE.h index 8ffccd8..400e7b4 100644 --- a/include/config_MOUSSE.h +++ b/include/config_MOUSSE.h @@ -138,7 +138,8 @@ * For the detail description refer to the MPC8240 user's manual. */ -#define CONFIG_SYS_CLK_FREQ 200000000 +#define CONFIG_SYS_CLK_FREQ 33000000 /* external frequency to pll */ +#define CONFIG_PLL_PCI_TO_MEM_MULTIPLIER 2 #define CFG_HZ 1000 #define CFG_ETH_DEV_FN 0x00 diff --git a/include/config_MUSENKI.h b/include/config_MUSENKI.h index 981be3c..e52dba6 100644 --- a/include/config_MUSENKI.h +++ b/include/config_MUSENKI.h @@ -142,8 +142,7 @@ * For the detail description refer to the MPC8240 user's manual. */ -#define CONFIG_SYS_CLK_FREQ 100000000 -#define CFG_SERIAL_CLOCK CONFIG_SYS_CLK_FREQ +#define CONFIG_SYS_CLK_FREQ 33000000 /* external frequency to pll */ #define CFG_HZ 1000 #define CFG_ETH_DEV_FN 0x7800 diff --git a/include/config_PIP405.h b/include/config_PIP405.h index e6a1a9b..270b183 100644 --- a/include/config_PIP405.h +++ b/include/config_PIP405.h @@ -93,7 +93,10 @@ * Environment definitions **************************************************************/ #define CONFIG_BAUDRATE 9600 /* STD Baudrate */ -#define CONFIG_BOOTDELAY -1 /* no autoboot */ + + +#define CONFIG_BOOTDELAY 5 +/* autoboot (do NOT change this set environment variable "bootdelay" to -1 instead) */ #define CONFIG_BOOTCOMMAND "diskboot 200000 0:1; bootm" /* autoboot command */ #define CONFIG_BOOTARGS "console=ttyS0,9600 root=/dev/hda5" /* boot arguments */ @@ -137,10 +140,11 @@ #define CFG_MAXARGS 16 /* max number of command args */ #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ -#define CFG_MEMTEST_START 0x0400000 /* memtest works on */ -#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */ +#define CFG_MEMTEST_START 0x0100000 /* memtest works on */ +#define CFG_MEMTEST_END 0x0C00000 /* 1 ... 12 MB in DRAM */ #undef CFG_EXT_SERIAL_CLOCK /* no external serial clock used */ +#define CFG_IGNORE_405_UART_ERRATA_59 /* The following table includes the supported baudrates */ #define CFG_BAUDRATE_TABLE \ @@ -327,7 +331,7 @@ /************************************************************ * Ident ************************************************************/ -#define VERSION_TAG "REL_1_1_1" +#define VERSION_TAG "REL_1_1_3" #define CONFIG_IDENT_STRING "\n(c) 2001 by MPL AG Switzerland, MEV-10066-001 " VERSION_TAG diff --git a/include/config_Sandpoint8240.h b/include/config_Sandpoint8240.h index 45d6dda..9a6fdad 100644 --- a/include/config_Sandpoint8240.h +++ b/include/config_Sandpoint8240.h @@ -82,6 +82,7 @@ * Please note that CFG_SDRAM_BASE _must_ start at 0 */ #define CFG_SDRAM_BASE 0x00000000 +#define CFG_MAX_RAM_SIZE 0x10000000 #if defined (USE_DINK32) #define CFG_MONITOR_LEN 0x00030000 @@ -154,6 +155,8 @@ * You should know what you are doing if you make changes here. */ +#define CONFIG_SYS_CLK_FREQ 33000000 /* external frequency to pll */ +#define CONFIG_PLL_PCI_TO_MEM_MULTIPLIER 2 #define CFG_ROMNAL 7 /*rom/flash next access time */ #define CFG_ROMFAL 11 /*rom/flash access time */ @@ -174,21 +177,23 @@ #define CFG_REGISTERD_TYPE_BUFFER 1 /* memory bank settings*/ -/* only bits 20-29 are actually used from these vales to set the start/end address - the upper two bits will be 0, and the lower 20 bits will be set to - 0x00000 for a start address, or 0xfffff for an end address*/ - +/* + * only bits 20-29 are actually used from these vales to set the + * start/end address the upper two bits will be 0, and the lower 20 + * bits will be set to 0x00000 for a start address, or 0xfffff for an + * end address + */ #define CFG_BANK0_START 0x00000000 -#define CFG_BANK0_END 0x01ffffff +#define CFG_BANK0_END (CFG_MAX_RAM_SIZE - 1) #define CFG_BANK0_ENABLE 1 -#define CFG_BANK1_START 0x04000000 -#define CFG_BANK1_END 0x07ffffff +#define CFG_BANK1_START 0x3ff00000 +#define CFG_BANK1_END 0x3fffffff #define CFG_BANK1_ENABLE 0 -#define CFG_BANK2_START 0x08000000 -#define CFG_BANK2_END 0x0bffffff +#define CFG_BANK2_START 0x3ff00000 +#define CFG_BANK2_END 0x3fffffff #define CFG_BANK2_ENABLE 0 -#define CFG_BANK3_START 0x0c000000 -#define CFG_BANK3_END 0x0fffffff +#define CFG_BANK3_START 0x3ff00000 +#define CFG_BANK3_END 0x3fffffff #define CFG_BANK3_ENABLE 0 #define CFG_BANK4_START 0x00000000 #define CFG_BANK4_END 0x00000000 diff --git a/include/part.h b/include/part.h index 02fefff..10324fe 100644 --- a/include/part.h +++ b/include/part.h @@ -44,6 +44,8 @@ typedef struct block_dev_desc { #define IF_TYPE_IDE 1 #define IF_TYPE_SCSI 2 #define IF_TYPE_ATAPI 3 +#define IF_TYPE_USB 4 +#define IF_TYPE_DOC 5 /* Part types */ #define PART_TYPE_UNKNOWN 0x00 #define PART_TYPE_MAC 0x01