Changes for U-Boot 1.1.4:
======================================================================
+* Cleanup for GCC-4.x
+
+* Add documentation for Open Firmware Flat Tree and usage.
+ Patch by Pantelis Antoniou, 13 Oct 2005
+
+* Add missing files for Pantelis Antoniou's patch
+ Patch by Pantelis Antoniou, 04 Sep 2005
+
+* Fix problem in ppc4xx eth-driver without ethaddr (only without
+ CONFIG_NET_MULTI set)
+ Patch by Stefan Roese, 10 Oct 2005
+
+* Fix gzip bmp support (test if malloc fails, warning when truncated).
+ Increase CFG_VIDEO_LOGO_MAX_SIZE on HH405 board.
+ Patch by Stefan Roese, 07 Oct 2005
+
+* Add support for OF flat tree for the STXtc board.
+ Patch by Pantelis Antoniou, 04 Sep 2005
+
+* Support passing of OF flat trees to the kernel.
+ Patch by Pantelis Antoniou, 04 Sep 2005
+
* Cleanup
* Add support for NetSilicon NS7520 processor.
logodl_config : unconfig
@./mkconfig $(@:_config=) arm pxa logodl
+pxa255_idp_config: unconfig
+ @./mkconfig $(@:_config=) arm pxa pxa255_idp
+
wepep250_config : unconfig
@./mkconfig $(@:_config=) arm pxa wepep250
expect it to be in bytes, others in MB.
Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes.
+ CONFIG_OF_FLAT_TREE
+
+ New kernel versions are expecting firmware settings to be
+ passed using flat open firmware trees.
+ The environment variable "disable_of", when set, disables this
+ functionality.
+
+ CONFIG_OF_FLAT_TREE_MAX_SIZE
+
+ The maximum size of the constructed OF tree.
+
+ OF_CPU - The proper name of the cpus node.
+ OF_TBCLK - The timebase frequency.
+
- Serial Ports:
CFG_PL010_SERIAL
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
+ char *s = getenv ("serial#");
if (!s || strncmp (s, "ELPT860", 7))
printf ("### No HW ID - assuming ELPT860\n");
* try 8 column mode
*/
size8 = dram_size (CFG_MAMR_8COL,
- (ulong *) SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
+ SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
udelay (1000);
* try 9 column mode
*/
size9 = dram_size (CFG_MAMR_9COL,
- (ulong *) SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
+ SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
size_b0 = size9;
int flash_erase (flash_info_t * info, int s_first, int s_last)
{
- volatile unsigned char *addr = (char *) (info->start[0]);
+ volatile unsigned char *addr = (uchar *) (info->start[0]);
int flag, prot, sect, l_sect;
ulong start, now, last;
for (sect = s_first; sect <= s_last; sect++) {
int sector_size = info->size / info->sector_count;
- addr = (char *) (info->start[sect]);
+ addr = (uchar *) (info->start[sect]);
memset ((void *) addr, 0, sector_size);
}
return 0;
/* Start erase on unprotected sectors */
for (sect = s_first; sect <= s_last; sect++) {
if (info->protect[sect] == 0) { /* not protected */
- addr = (char *) (info->start[sect]);
+ addr = (uchar *) (info->start[sect]);
flash_cmd (info->portwidth, addr, 0, 0x30);
l_sect = sect;
}
/* broken for 2x16: TODO */
static int write_word (flash_info_t * info, ulong dest, ulong data)
{
- volatile unsigned char *addr = (char *) (info->start[0]);
+ volatile unsigned char *addr = (uchar *) (info->start[0]);
ulong start;
int flag, i;
ulong mask;
CHIP_CMD_RST);
/* 1st cycle of word/byte program */
/* write 0x40 to the location to program */
- flash_cmd (info->portwidth, (char *) dest, 0,
+ flash_cmd (info->portwidth, (uchar *) dest, 0,
CHIP_CMD_PROG);
/* 2nd cycle of word/byte program */
/* write the data to the destination address */
static uchar i2c_get_data (uchar * return_data, int len)
{
- unsigned int data, status;
+ unsigned int data, status = 0;
int count = 0;
DP (puts ("i2c_get_data\n"));
int mem_test_data (void)
{
unsigned long long *pmem = (unsigned long long *) CFG_MEMTEST_START;
- unsigned long long temp64;
+ unsigned long long temp64 = 0;
int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
int i;
unsigned int hi, lo;
unsigned long long wmask, short read, short write)
{
unsigned int i;
- unsigned long long temp;
+ unsigned long long temp = 0;
unsigned int hitemp, lotemp, himask, lomask;
for (i = 0; i < size; i++) {
dev->send = (void *) db64360_eth_transmit;
dev->recv = (void *) db64360_eth_poll;
- dev->priv = (void *) ethernet_private =
- calloc (sizeof (*ethernet_private), 1);
+ ethernet_private = calloc (sizeof (*ethernet_private), 1);
+ dev->priv = (void *) ethernet_private;
+
if (!ethernet_private) {
printf ("%s: %s allocation failure, %s\n",
__FUNCTION__, dev->name,
memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);
/* set pointer to memory for stats data structure etc... */
- ethernet_private->port_private = (void *) port_private =
- calloc (sizeof (*ethernet_private), 1);
+ port_private = calloc (sizeof (*ethernet_private), 1);
+ ethernet_private->port_private = (void *)port_private;
if (!port_private) {
printf ("%s: %s allocation failure, %s\n",
__FUNCTION__, dev->name,
int mem_test_data (void)
{
unsigned long long *pmem = (unsigned long long *) CFG_MEMTEST_START;
- unsigned long long temp64;
+ unsigned long long temp64 = 0;
int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
int i;
unsigned int hi, lo;
unsigned long long wmask, short read, short write)
{
unsigned int i;
- unsigned long long temp;
+ unsigned long long temp = 0;
unsigned int hitemp, lotemp, himask, lomask;
for (i = 0; i < size; i++) {
dev->send = (void *) db64460_eth_transmit;
dev->recv = (void *) db64460_eth_poll;
- dev->priv = (void *) ethernet_private =
- calloc (sizeof (*ethernet_private), 1);
+ ethernet_private = calloc (sizeof (*ethernet_private), 1);
+ dev->priv = (void *)ethernet_private;
if (!ethernet_private) {
printf ("%s: %s allocation failure, %s\n",
__FUNCTION__, dev->name,
memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);
/* set pointer to memory for stats data structure etc... */
- ethernet_private->port_private = (void *) port_private =
- calloc (sizeof (*ethernet_private), 1);
+ port_private = calloc (sizeof (*ethernet_private), 1);
+ ethernet_private->port_private = (void *)port_private;
if (!port_private) {
printf ("%s: %s allocation failure, %s\n",
__FUNCTION__, dev->name,
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
/* Read 256 bytes in EEPROM */
- i2c_read (0x54, 0, 1, buff, 128);
- i2c_read (0x54, 128, 1, buff + 128, 128);
+ i2c_read (0x54, 0, 1, (uchar *)buff, 128);
+ i2c_read (0x54, 128, 1, (uchar *)buff + 128, 128);
/* Retrieve MAC address in buffer (key EA) */
for (cp = buff;;) {
cp += 3;
/* Read MAC address */
for (i = 0; i < 6; i++, cp += 2) {
- enet[i] = aschex_to_byte (cp);
+ enet[i] = aschex_to_byte ((unsigned char *)cp);
}
}
/* Scan to the end of the record */
* try 10 column mode
*/
- size10 = dram_size (CFG_MAMR_10COL, (ulong *) SDRAM_BASE_PRELIM,
+ size10 = dram_size (CFG_MAMR_10COL, SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
return (size10);
* try 10 column mode
*/
- size10 = dram_size (CFG_MAMR_10COL, (ulong *) SDRAM_BASE_PRELIM,
+ size10 = dram_size (CFG_MAMR_10COL, SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
return (size10);
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE);
+ size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE);
/*
* Final mapping:
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
+ char *s = getenv ("serial#");
puts ("Board: RRvision ");
* try 8 column mode
*/
size8 = dram_size (CFG_MAMR_8COL,
- (ulong *)SDRAM_BASE2_PRELIM,
+ SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
* try 9 column mode
*/
size9 = dram_size (CFG_MAMR_9COL,
- (ulong *) SDRAM_BASE2_PRELIM,
+ SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
*/
int checkboard(void)
{
- unsigned char *s = getenv("serial#");
+ char *s = getenv("serial#");
puts("Board: Bubinga - AMCC PPC405EP Evaluation Board");
int checkboard(void)
{
sys_info_t sysinfo;
- unsigned char *s = getenv("serial#");
+ char *s = getenv("serial#");
get_sys_info(&sysinfo);
int checkboard (void)
{
sys_info_t sysinfo;
- unsigned char *s = getenv ("serial#");
+ char *s = getenv ("serial#");
get_sys_info (&sysinfo);
*/
int checkboard(void)
{
- unsigned char *s = getenv("serial#");
+ char *s = getenv("serial#");
uint pvr = get_pvr();
if (pvr == PVR_405GPR_RB) {
int i;
uchar *boottype;
uchar *bootletter;
- uchar *fmt;
+ char *fmt;
uchar botbootletter[] = "B";
uchar topbootletter[] = "T";
uchar botboottype[] = "bottom boot sector";
long mear1;
long emear1;
- size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
+ size = get_ram_size (CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
new_bank0_end = size - 1;
- mear1 = mpc824x_mpc107_getreg(MEAR1);
- emear1 = mpc824x_mpc107_getreg(EMEAR1);
+ mear1 = mpc824x_mpc107_getreg (MEAR1);
+ 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);
+ mpc824x_mpc107_setreg (MEAR1, mear1);
+ mpc824x_mpc107_setreg (EMEAR1, emear1);
return (size);
}
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
PCI_ENET0_MEMADDR,
- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
+ PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
PCI_ENET1_MEMADDR,
- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
+ PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
{ }
};
#endif
#endif
};
-void pci_init_board(void)
+void pci_init_board (void)
{
- pci_mpc824x_init(&hose);
+ pci_mpc824x_init (&hose);
}
-int write_flash(char *addr, char value)
+int write_flash (char *addr, char value)
{
char *adr = (char *)0xFF800000;
int cnt = 0;
char status,oldstatus;
- *(adr+0x55) = 0xAA;
- udelay(1);
- *(adr+0xAA) = 0x55;
- udelay(1);
- *(adr+0x55) = 0xA0;
- udelay(1);
+ *(adr+0x55) = 0xAA; udelay (1);
+ *(adr+0xAA) = 0x55; udelay (1);
+ *(adr+0x55) = 0xA0; udelay (1);
*addr = value;
status = *addr;
- do{
-
+ do {
oldstatus = status;
status = *addr;
- if ((oldstatus & 0x40) == (status & 0x40)){
+ if ((oldstatus & 0x40) == (status & 0x40)) {
return 4;
}
cnt++;
- if (cnt > 10000){
+ if (cnt > 10000) {
return 2;
}
- }while( (status & 0x20) == 0 );
+ } while ( (status & 0x20) == 0 );
oldstatus = *addr;
status = *addr;
- if ((oldstatus & 0x40) == (status & 0x40)) return 0;
- else {
+ if ((oldstatus & 0x40) == (status & 0x40)) {
+ return 0;
+ } else {
*(adr+0x55) = 0xF0;
return 1;
}
}
-unsigned update_flash(unsigned char* buf){
- switch((*buf) & 0x3){
- case TRY_WORKING:
- printf("found 3 and converted it to 2\n");
- write_flash(buf, (*buf) & 0xFE);
- *((unsigned char *)0xFF800000) = 0xF0;
- udelay(100);
- printf("buf [%#010x] %#010x\n",buf,(*buf));
- case BOOT_WORKING :
- return BOOT_WORKING;
+unsigned update_flash (unsigned char *buf)
+{
+ switch ((*buf) & 0x3) {
+ case TRY_WORKING:
+ printf ("found 3 and converted it to 2\n");
+ write_flash ((char *)buf, (*buf) & 0xFE);
+ *((unsigned char *)0xFF800000) = 0xF0;
+ udelay (100);
+ printf ("buf [%#010x] %#010x\n", buf, (*buf));
+ /* XXX - fall through??? */
+ case BOOT_WORKING :
+ return BOOT_WORKING;
}
return BOOT_DEFAULT;
}
-unsigned scan_flash(void)
+unsigned scan_flash (void)
{
char section[] = "kernel";
- ulong sp;
int cfgFileLen = (CFG_FLASH_ERASE_SECTOR_LENGTH >> 1);
int sectionPtr = 0;
int foundItem = 0; /* 0: None, 1: section found, 2: "=" found */
buf = (unsigned char*)(CFG_FLASH_RANGE_BASE + CFG_FLASH_RANGE_SIZE \
- CFG_FLASH_ERASE_SECTOR_LENGTH);
- for(bufPtr = 0; bufPtr < cfgFileLen; ++bufPtr){
+ for (bufPtr = 0; bufPtr < cfgFileLen; ++bufPtr) {
if ((buf[bufPtr]==0xFF) && (*(int*)(buf+bufPtr)==0xFFFFFFFF)) {
return BOOT_DEFAULT;
}
- switch(foundItem)
- {
- /* This is the scanning loop, we try to find a particular
- * quoted value
- */
- case 0:
- if((section[sectionPtr] == 0)){
- ++foundItem;
- }
- else if(buf[bufPtr] == section[sectionPtr]){
- ++sectionPtr;
- }
- else {
- sectionPtr = 0;
- }
- break;
- case 1:
+ /* This is the scanning loop, we try to find a particular
+ * quoted value
+ */
+ switch (foundItem) {
+ case 0:
+ if ((section[sectionPtr] == 0)) {
++foundItem;
- break;
- case 2:
- ++foundItem;
- break;
- case 3:
- default:
- return update_flash(buf[bufPtr - 1]);
+ } else if (buf[bufPtr] == section[sectionPtr]) {
+ ++sectionPtr;
+ } else {
+ sectionPtr = 0;
+ }
+ break;
+ case 1:
+ ++foundItem;
+ break;
+ case 2:
+ ++foundItem;
+ break;
+ case 3:
+ default:
+ return update_flash (&buf[bufPtr - 1]);
}
}
- printf("Failed to read %s\n",section);
+ printf ("Failed to read %s\n",section);
return BOOT_DEFAULT;
}
-TSBootInfo* find_boot_info(void)
+TSBootInfo* find_boot_info (void)
{
- unsigned bootimage = scan_flash();
- TSBootInfo* info = (TSBootInfo*)malloc(sizeof(TSBootInfo));
-
- switch(bootimage){
- case TRY_WORKING:
- info->address = CFG_WORKING_KERNEL_ADDRESS;
- break;
- case BOOT_WORKING :
- info->address = CFG_WORKING_KERNEL_ADDRESS;
- break;
- case BOOT_DEFAULT:
- default:
- info->address= CFG_DEFAULT_KERNEL_ADDRESS;
+ unsigned bootimage = scan_flash ();
+ TSBootInfo* info = (TSBootInfo*)malloc (sizeof(TSBootInfo));
+
+ switch (bootimage) {
+ case TRY_WORKING:
+ info->address = CFG_WORKING_KERNEL_ADDRESS;
+ break;
+ case BOOT_WORKING :
+ info->address = CFG_WORKING_KERNEL_ADDRESS;
+ break;
+ case BOOT_DEFAULT:
+ default:
+ info->address= CFG_DEFAULT_KERNEL_ADDRESS;
}
info->size = *((unsigned int *)(info->address ));
return info;
}
-void barcobcd_boot(void)
+void barcobcd_boot (void)
{
TSBootInfo* start;
char *bootm_args[2];
char *buf;
int cnt;
+ extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
buf = (char *)(0x00800000);
/* make certain there are enough chars to print the command line here!
*/
- bootm_args[0]=(char *)malloc(16*sizeof(char));
- bootm_args[1]=(char *)malloc(16*sizeof(char));
+ bootm_args[0] = (char *)malloc (16*sizeof(char));
+ bootm_args[1] = (char *)malloc (16*sizeof(char));
- start = find_boot_info();
+ start = find_boot_info ();
- printf("Booting kernel at address %#10x with size %#10x\n",
+ printf ("Booting kernel at address %#10x with size %#10x\n",
start->address, start->size);
/* give length of the kernel image to bootm */
- sprintf(bootm_args[0],"%x",start->size);
+ sprintf (bootm_args[0],"%x",start->size);
/* give address of the kernel image to bootm */
- sprintf(bootm_args[1],"%x",buf);
+ sprintf (bootm_args[1],"%x",buf);
- printf("flash address: %#10x\n",start->address+8);
- printf("buf address: %#10x\n",buf);
+ printf ("flash address: %#10x\n",start->address+8);
+ printf ("buf address: %#10x\n",buf);
/* aha, we reserve 8 bytes here... */
- for (cnt = 0; cnt < start->size ; cnt++){
+ for (cnt = 0; cnt < start->size ; cnt++) {
buf[cnt] = ((char *)start->address)[cnt+8];
}
/* initialise RAM memory */
*((unsigned int *)0xFEC00000) = 0x00141A98;
- do_bootm(NULL,0,2,bootm_args);
+ do_bootm (NULL,0,2,bootm_args);
}
-int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int barcobcd_boot_image (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
#if 0
if (argc > 1) {
return 1;
}
#endif
- barcobcd_boot();
+ barcobcd_boot ();
return 0;
}
/* Currently, boot_working and boot_default are the same command. This is
* left in here to see what we'll do in the future */
-U_BOOT_CMD(
+U_BOOT_CMD (
try_working, 1, 1, barcobcd_boot_image,
" try_working - check flash value and boot the appropriate image\n",
"\n"
);
-U_BOOT_CMD(
+U_BOOT_CMD (
boot_working, 1, 1, barcobcd_boot_image,
" boot_working - check flash value and boot the appropriate image\n",
"\n"
);
-U_BOOT_CMD(
+U_BOOT_CMD (
boot_default, 1, 1, barcobcd_boot_image,
" boot_default - check flash value and boot the appropriate image\n",
"\n"
/*
* We are not using serial communication, so just provide empty functions
*/
-int serial_init(void){return 0;}
-void serial_setbrg(void){}
-void serial_putc(const char c){}
-void serial_puts(const char *c){}
-void serial_addr(unsigned int i){}
-int serial_getc(void){return 0;}
-int serial_tstc(void){return 0;}
-
-unsigned long post_word_load(void){return 0l;};
-void post_word_store(unsigned long val){}
+int serial_init (void)
+{
+ return 0;
+}
+void serial_setbrg (void)
+{
+ return;
+}
+void serial_putc (const char c)
+{
+ return;
+}
+void serial_puts (const char *c)
+{
+ return;
+}
+void serial_addr (unsigned int i)
+{
+ return;
+}
+int serial_getc (void)
+{
+ return 0;
+}
+int serial_tstc (void)
+{
+ return 0;
+}
+
+unsigned long post_word_load (void)
+{
+ return 0l;
+}
+void post_word_store (unsigned long val)
+{
+ return;
+}
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
+ unsigned char *s = (unsigned char *)getenv ("serial#");
puts ("Board: TTTech C2MON ");
* try 8 column mode
*/
size8 = dram_size (CFG_MAMR_8COL,
- (ulong *)SDRAM_BASE2_PRELIM,
+ SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
* try 9 column mode
*/
size9 = dram_size (CFG_MAMR_9COL,
- (ulong *) SDRAM_BASE2_PRELIM,
+ SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
/* ------------------------------------------------------------------------- */
int misc_init_r (void)
{
- unsigned char *s, *e;
+ char *s, *e;
image_header_t *hdr;
time_t timestamp;
struct rtc_time tm;
#define FACTORY_SETTINGS 0xFFFC0000
if ((s = getenv ("ethaddr")) == NULL) {
- e = (unsigned char *) (FACTORY_SETTINGS);
+ e = (char *) (FACTORY_SETTINGS);
if (*(e + 0) != '0'
|| *(e + 1) != '0'
|| *(e + 2) != ':'
{
setenv (Things[thing].envname, Things[thing].dhcpvalue);
}
- return (Things[thing].dhcpvalue);
+ return ((u8 *)(Things[thing].dhcpvalue));
}
/* ------------------------------------------------------------------------- */
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
int misc_init_r (void)
{
revinfo eerev;
- u_char *ptr;
+ char *ptr;
u_int i, l, initSrom, copyNv;
char buf[256];
char hex[23] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0,
if (strcmp (eerev.magic, "ELTEC") != 0)
{
/* srom is not initialized -> create a default revision info */
- for (i = 0, ptr = (u_char *)&eerev; i < sizeof(revinfo); i++)
+ for (i = 0, ptr = (char *)&eerev; i < sizeof(revinfo); i++)
*ptr++ = 0x00;
strcpy(eerev.magic, "ELTEC");
eerev.revrev[0] = 1;
/* get onboard network iobase */
pci_read_config_dword(PCI_BDF(0,0x10,0), PCI_BASE_ADDRESS_0,
- &onboard_dev.iobase);
+ (unsigned int *)&onboard_dev.iobase);
onboard_dev.iobase &= ~0xf;
source[63] = eepro100_srom_checksum (source);
int i;
/* check revision data */
- eeprom_read (CFG_I2C_EEPROM_ADDR, 480, (char *) &mhpcRevInfo, 32);
+ eeprom_read (CFG_I2C_EEPROM_ADDR, 480, (uchar *) &mhpcRevInfo, 32);
if (strncmp ((char *) &mhpcRevInfo.board[2], "MHPC", 4) != 0) {
printf ("Enter revision number (0-9): %c ",
}
/* setup new revision data */
- eeprom_write (CFG_I2C_EEPROM_ADDR, 480, (char *) &mhpcRevInfo,
+ eeprom_write (CFG_I2C_EEPROM_ADDR, 480, (uchar *) &mhpcRevInfo,
32);
}
immap_t *immr = (immap_t *) CFG_IMMR;
/* enable video only on CLUT value */
- if ((penv = getenv ("clut")) != NULL)
- clut = (u_int) simple_strtoul (penv, NULL, 10);
+ if ((penv = (uchar *)getenv ("clut")) != NULL)
+ clut = (u_int) simple_strtoul ((char *)penv, NULL, 10);
else
return NULL;
int i;
uchar *boottype;
uchar *bootletter;
- uchar *fmt;
+ char *fmt;
uchar botbootletter[] = "B";
uchar topbootletter[] = "T";
uchar botboottype[] = "bottom boot sector";
/*printf ("%s\n", buf); */
/* search for our specific entry */
if (!strncmp ((char *) buf, "[RLA/lan/Ethernet] ", 19)) {
- setenv ("ethaddr", buf + 19);
+ setenv ("ethaddr", (char *)(buf + 19));
} else if (!strncmp ((char *) buf, "[BOARD/SERIAL] ", 15)) {
- setenv ("serial#", buf + 15);
+ setenv ("serial#", (char *)(buf + 15));
} else if (!strncmp ((char *) buf, "[BOARD/TYPE] ", 13)) {
- setenv ("board_id", buf + 13);
+ setenv ("board_id", (char *)(buf + 13));
}
}
}
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
- unsigned char *e;
+ char *s = getenv ("serial#");
+ char *e;
puts ("Board: ");
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
int index;
int len;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
const unsigned char *fpga;
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
{
int index;
int len;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
/* check the data CRC */
checksum = ntohl(hdr->ih_dcrc);
- if (crc32 (0, (char *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
+ if (crc32 (0, (uchar *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
!= checksum) {
printf ("Image %s bad data checksum\n", au_image[i].name);
return -1;
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)hdr, sizeof(*hdr)) != checksum) {
+ if (crc32 (0, (uchar *)hdr, sizeof(*hdr)) != checksum) {
printf ("Image %s bad header checksum\n", au_image[i].name);
return -1;
}
*/
if (au_image[i].type != AU_NAND) {
debug ("flash_write(%p, %lx %x)\n", addr, start, nbytes);
- rc = flash_write(addr, start, nbytes);
+ rc = flash_write((uchar *)addr, start, nbytes);
} else {
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
debug ("nand_rw(%p, %lx %x)\n", addr, start, nbytes);
rc = nand_rw(nand_dev_desc, NANDRW_WRITE | NANDRW_JFFS2,
- start, nbytes, &total, addr);
+ start, nbytes, (size_t *)&total, (uchar *)addr);
debug ("nand_rw: ret=%x total=%d nbytes=%d\n", rc, total, nbytes);
#endif
}
* check the dcrc of the copy
*/
if (au_image[i].type != AU_NAND) {
- rc = crc32 (0, (char *)(start + off), ntohl(hdr->ih_size));
+ rc = crc32 (0, (uchar *)(start + off), ntohl(hdr->ih_size));
} else {
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
rc = nand_rw(nand_dev_desc, NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP,
- start, nbytes, &total, addr);
- rc = crc32 (0, (char *)(addr + off), ntohl(hdr->ih_size));
+ start, nbytes, (size_t *)&total, (uchar *)addr);
+ rc = crc32 (0, (uchar *)(addr + off), ntohl(hdr->ih_size));
#endif
}
if (rc != ntohl(hdr->ih_dcrc)) {
uchar *ptr;
ushort *ptr2;
ushort val;
- unsigned char *dst;
+ unsigned char *dst = NULL;
int x, y;
int width, height, bpp, colors, line_size;
int header_size;
unsigned char r, g, b;
BITMAPINFOHEADER *bm_info;
ulong len;
- int do_free = 0;
/*
* Check for bmp mark 'BM'
/*
* Decompress bmp image
*/
- len = CFG_LCD_LOGO_MAX_SIZE;
- dst = malloc(CFG_LCD_LOGO_MAX_SIZE);
- do_free = 1;
- if (gunzip(dst, CFG_LCD_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+ len = CFG_VIDEO_LOGO_MAX_SIZE;
+ dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+ if (dst == NULL) {
+ printf("Error: malloc in gunzip failed!\n");
return;
}
+ if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+ return;
+ }
+ if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+ printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+ }
/*
* Check for bmp mark 'BM'
break;
default:
printf("LCD: Unknown bpp (%d) im image!\n", bpp);
- free(dst);
+ if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
+ free(dst);
+ }
return;
}
printf(" (%d*%d, %dbpp)\n", width, height, bpp);
}
}
- if (do_free) {
+ if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
free(dst);
}
}
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
int index;
int len;
#endif
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
unsigned short ver;
#endif
if (ctermm2()) {
- unsigned char str[4];
+ char str[4];
/*
* Read board-id and save in env-variable
int result;
int i;
unsigned char ow_id[6];
- unsigned char str[32];
+ char str[32];
unsigned char ow_crc;
/*
IPaddr_t ipaddr;
buf = malloc(CFG_ENV_SIZE_2);
- if (eeprom_read(CFG_I2C_EEPROM_ADDR_2, 0, buf, CFG_ENV_SIZE_2)) {
+ if (eeprom_read(CFG_I2C_EEPROM_ADDR_2, 0, (uchar *)buf, CFG_ENV_SIZE_2)) {
puts("\nError reading backplane EEPROM!\n");
} else {
- crc = crc32(0, buf+4, CFG_ENV_SIZE_2-4);
+ crc = crc32(0, (uchar *)(buf+4), CFG_ENV_SIZE_2-4);
if (crc != *(ulong *)buf) {
printf("ERROR: crc mismatch %08lx %08lx\n", crc, *(ulong *)buf);
return -1;
int do_set_bpip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *buf;
- unsigned char str[32];
+ char str[32];
ulong crc;
if (argc < 2) {
memset(buf, 0, CFG_ENV_SIZE_2);
sprintf(str, "bp_ip=%s", argv[1]);
strcpy(buf+4, str);
- crc = crc32(0, buf+4, CFG_ENV_SIZE_2-4);
+ crc = crc32(0, (uchar *)(buf+4), CFG_ENV_SIZE_2-4);
*(ulong *)buf = crc;
- if (eeprom_write(CFG_I2C_EEPROM_ADDR_2, 0, buf, CFG_ENV_SIZE_2)) {
+ if (eeprom_write(CFG_I2C_EEPROM_ADDR_2, 0, (uchar *)buf, CFG_ENV_SIZE_2)) {
puts("\nError writing backplane EEPROM!\n");
}
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
- test2 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
int mem_test_data (void)
{
unsigned long long *pmem = (unsigned long long *) CFG_MEMTEST_START;
- unsigned long long temp64;
+ unsigned long long temp64 = 0;
int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
int i;
unsigned int hi, lo;
unsigned long long wmask, short read, short write)
{
unsigned int i;
- unsigned long long temp;
+ unsigned long long temp = 0;
unsigned int hitemp, lotemp, himask, lomask;
for (i = 0; i < size; i++) {
dev->send = (void *) db64360_eth_transmit;
dev->recv = (void *) db64360_eth_poll;
- dev->priv = (void *) ethernet_private =
+ ethernet_private =
calloc (sizeof (*ethernet_private), 1);
+ dev->priv = (void *) ethernet_private;
if (!ethernet_private) {
printf ("%s: %s allocation failure, %s\n",
__FUNCTION__, dev->name,
memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);
/* set pointer to memory for stats data structure etc... */
- ethernet_private->port_private = (void *) port_private =
+ port_private =
calloc (sizeof (*ethernet_private), 1);
+ ethernet_private->port_private = (void *)port_private;
if (!port_private) {
printf ("%s: %s allocation failure, %s\n",
__FUNCTION__, dev->name,
{
int index;
int len;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
for (i = 0; i < 4; i++) {
pci_read_config_dword (CFG_PCI9054_DEV_FN,
l * 16 + i * 4,
- &val);
+ (unsigned int *)&val);
printf ("%08x ", val);
}
printf ("\n");
{
int index;
int len;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
int fpga;
unsigned short val;
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
unsigned char trans[16] = {0x0,0x8,0x4,0xc,0x2,0xa,0x6,0xe,
0x1,0x9,0x5,0xd,0x3,0xb,0x7,0xf};
{
int index;
int len;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
{
DECLARE_GLOBAL_DATA_PTR;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
pci_read_config_dword(PCIDEVID_405GP, i, ptr++);
}
ptr = (unsigned int *)PCI_REGS_ADDR;
- *ptr = crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
+ *ptr = crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
printf("\nStoring PCI Configuration Regs...\n");
} else {
pci_read_config_dword(PCIDEVID_405GP, i, ptr++);
}
ptr = (unsigned int *)PCI_REGS_ADDR;
- *ptr = crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
+ *ptr = crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
printf("\nStoring PCI Configuration Regs...\n");
* Rewrite pci config regs (only after soft-reset with magic set)
*/
ptr = (unsigned int *)PCI_REGS_ADDR;
- if (crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
+ if (crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
puts("Restoring PCI Configurations Regs!\n");
ptr = (unsigned int *)PCI_REGS_ADDR + 1;
for (i=0; i<0x40; i+=4) {
* Rewrite pci config regs (only after soft-reset with magic set)
*/
ptr = (unsigned int *)PCI_REGS_ADDR;
- if (crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
+ if (crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
puts("Restoring PCI Configurations Regs!\n");
ptr = (unsigned int *)PCI_REGS_ADDR + 1;
for (i=0; i<0x40; i+=4) {
{
DECLARE_GLOBAL_DATA_PTR;
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
void flash_print_info(flash_info_t * info) {
int i;
- uchar *fmt;
+ char *fmt;
if (info->flash_id == FLASH_UNKNOWN) {
printf("missing or unknown FLASH type\n");
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
- test2 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
* Check Bank 0 Memory Size for re-configuration
*
*/
- size_b0 = get_ram_size ((ulong *) SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
- size_b1 = get_ram_size ((ulong *) SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+ size_b0 = get_ram_size ( (long *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+ size_b1 = get_ram_size ( (long *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
printf ("\nbank 0 size %lu\nbank 1 size %lu\n", size_b0, size_b1);
{
DECLARE_GLOBAL_DATA_PTR;
- unsigned char *s = getenv ("serial#");
- unsigned char *e;
+ char *s = getenv ("serial#");
+ char *e;
puts ("Board: ");
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
* but then only half the real size will be used.]
*/
size_b1 =
- dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE3_PRELIM,
+ dram_size (memctl->memc_mamr, (long *) SDRAM_BASE3_PRELIM,
SDRAM_MAX_SIZE);
/* debug ("SDRAM Bank 1: %ld MB\n", size8 >> 20); */
} else {
*/
/* let the upper layer handle the packet */
- NetReceive (eth_data, eth_len);
+ NetReceive ((uchar *)eth_data, eth_len);
rx->buff_size_byte_count = GT6426x_ETH_BUF_SIZE<<16;
#endif
memcpy(dev->eth_tx_buffer, (char *) p, s);
- tx->buff_pointer = dev->eth_tx_buffer;
+ tx->buff_pointer = (uchar *)dev->eth_tx_buffer;
tx->bytecount_reserved = ((__u16)s) << 16;
/* 31 - own
/* Initialize Rx Side */
for (temp = 0; temp < NR; temp++) {
- p->eth_rx_desc[temp].buff_pointer = p->eth_rx_buffer[temp];
+ p->eth_rx_desc[temp].buff_pointer = (uchar *)p->eth_rx_buffer[temp];
p->eth_rx_desc[temp].buff_size_byte_count = GT6426x_ETH_BUF_SIZE<<16;
/* GT96100 Owner */
dev->send = (void*)gt6426x_eth_transmit;
dev->recv = (void*)gt6426x_eth_poll;
- dev->priv = (void*)p = calloc( sizeof(*p), 1 );
+ p = calloc( sizeof(*p), 1 );
+ dev->priv = (void*)p;
if (!p)
{
printf( "%s: %s allocation failure, %s\n",
volatile struct eth0_tx_desc_struct * next_desc;
/* Note - the following will not work for 64 bit addressing */
volatile unsigned char * buff_pointer;
-} eth0_tx_desc_single __attribute__ ((packed));
+} __attribute__ ((packed)) eth0_tx_desc_single;
typedef struct eth0_rx_desc_struct {
volatile __u32 buff_size_byte_count;
volatile __u32 command_status;
volatile struct eth0_rx_desc_struct * next_desc;
volatile unsigned char * buff_pointer;
-} eth0_rx_desc_single __attribute__ ((packed));
+} __attribute__ ((packed)) eth0_rx_desc_single;
#define NT 20 /* Number of Transmit buffers */
#define NR 20 /* Number of Receive buffers */
int bytes =
hashLength[hashSizeSelector] * sizeof (addrTblEntry);
- tableBase = (unsigned int) realAddrTableBase[port] =
+ realAddrTableBase[port] =
malloc (bytes + 64);
+ tableBase = (unsigned int)realAddrTableBase;
if (!tableBase) {
printf ("%s: alloc memory failed \n", __FUNCTION__);
int
flash_erase (flash_info_t *info, int s_first, int s_last)
{
- volatile unsigned char *addr = (char *)(info->start[0]);
+ volatile unsigned char *addr = (uchar *)(info->start[0]);
int flag, prot, sect, l_sect;
ulong start, now, last;
if((info->flash_id & FLASH_TYPEMASK) == FLASH_RAM) {
for (sect = s_first; sect<=s_last; sect++) {
int sector_size=info->size/info->sector_count;
- addr = (char *)(info->start[sect]);
+ addr = (uchar *)(info->start[sect]);
memset((void *)addr, 0, sector_size);
}
return 0;
/* Start erase on unprotected sectors */
for (sect = s_first; sect<=s_last; sect++) {
if (info->protect[sect] == 0) { /* not protected */
- addr = (char *)(info->start[sect]);
+ addr = (uchar *)(info->start[sect]);
flash_cmd(info->portwidth,addr,0,0x30);
l_sect = sect;
}
static int
write_word (flash_info_t *info, ulong dest, ulong data)
{
- volatile unsigned char *addr = (char *)(info->start[0]);
+ volatile unsigned char *addr = (uchar *)(info->start[0]);
ulong start;
int flag, i;
static uchar
i2c_get_data(uchar* return_data, int len) {
- unsigned int data, status;
+ unsigned int data, status = 0;
int count = 0;
DP(puts("i2c_get_data\n"));
static void
zuma_mbox_setenv(void)
{
- unsigned char *data, buf[32];
+ char *data, buf[32];
unsigned char save = 0;
data = getenv("baudrate");
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
{
DECLARE_GLOBAL_DATA_PTR;
- unsigned char *s;
- unsigned char buf[64];
+ char *s;
+ char buf[64];
int i;
i = getenv_r ("board_id", buf, sizeof (buf));
int last_stage_init (void)
{
#if !defined(CONFIG_SC)
- unsigned char buf[256];
+ char buf[256];
int i;
/*
#endif
switch (value)
{
- case 0x01:
- case AMD_MANUFACT:
+ case 0x1: /* AMD_MANUFACT */
info->flash_id = FLASH_MAN_AMD;
break;
- case FUJ_MANUFACT:
+ case 0x4: /* FUJ_MANUFACT */
info->flash_id = FLASH_MAN_FUJ;
break;
PrintState ();
#endif
/* printf ("\nChecking bank1..."); */
- size8 = dram_size (CFG_MBMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
+ size8 = dram_size (CFG_MBMR_8COL, (long *) SDRAM_BASE1_PRELIM,
SDRAM_MAX_SIZE);
size_b0 = size8;
/* printf ("\nChecking bank2..."); */
size_b1 =
- dram_size (memctl->memc_mbmr, (ulong *) SDRAM_BASE2_PRELIM,
+ dram_size (memctl->memc_mbmr, (long *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
/*
#if 0
ulong base = (ulong)addr;
#endif
- uchar value;
+ ulong value;
/* Write auto select command: read Manufacturer ID */
#if 0
switch (value)
{
- case AMD_MANUFACT:case 0x01:
+ case AMD_MANUFACT:
info->flash_id = FLASH_MAN_AMD;
break;
(Rx[8] != ':') | (Rx[11] != ':') | (Rx[14] != ':')) {
printf ("*** ethernet addr invalid, using default ***\n");
} else {
- setenv ("ethaddr", Rx);
+ setenv ("ethaddr", (char *)Rx);
}
return (0);
}
int mem_test_data (void)
{
unsigned long long *pmem = (unsigned long long *) CFG_SDRAM_BASE;
- unsigned long long temp64;
+ unsigned long long temp64 = 0;
int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
int i;
unsigned int hi, lo;
unsigned long long wmask, short read, short write)
{
unsigned int i;
- unsigned long long temp;
+ unsigned long long temp = 0;
unsigned int hitemp, lotemp, himask, lomask;
for (i = 0; i < size; i++) {
{
DECLARE_GLOBAL_DATA_PTR;
- unsigned char *s = getenv ("serial#");
- unsigned char *e;
+ char *s = getenv ("serial#");
+ char *e;
puts ("Board: ");
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
eeprom_read (dev_addr, offset, (uchar *)&crc, sizeof (ulong));
offset += sizeof (ulong);
- if (crc32 (crc32 (0, (char *)&hdr, sizeof hdr), data, len) != crc)
+ if (crc32 (crc32 (0, (uchar *)&hdr, sizeof hdr), data, len) != crc)
return (0);
ep->ver = hdr.ver;
char *eval;
ulong lval;
- lval = simple_strtol (val, &eval, 10);
+ lval = simple_strtol ((char *)val, &eval, 10);
if ((uchar *)eval == val || *eval != '\0') {
printf ("%s rec (%s) is not a valid uint\n", rp->name, val);
date_handler (eerec_map_t *rp, uchar *val, uchar *dp, uchar *edp)
{
hymod_date_t date;
- uchar *p = val;
+ char *p = (char *)val;
char *ep;
ulong lval;
lval = simple_strtol (p, &ep, 10);
- if ((uchar *)ep == p || *ep++ != '-') {
+ if (ep == p || *ep++ != '-') {
bad_date:
printf ("%s rec (%s) is not a valid date\n", rp->name, val);
return (NULL);
date.year = lval;
lval = simple_strtol (p = ep, &ep, 10);
- if ((uchar *)ep == p || *ep++ != '-' || lval == 0 || lval > 12)
+ if (ep == p || *ep++ != '-' || lval == 0 || lval > 12)
goto bad_date;
date.month = lval;
lval = simple_strtol (p = ep, &ep, 10);
- if ((uchar *)ep == p || *ep != '\0' || lval == 0 || lval > 31)
+ if (ep == p || *ep != '\0' || lval == 0 || lval > 31)
goto bad_date;
date.day = lval;
{
uint len;
- if ((len = strlen (val)) > rp->maxlen) {
+ if ((len = strlen ((char *)val)) > rp->maxlen) {
printf ("%s rec (%s) string is too long (%d>%d)\n",
rp->name, val, len, rp->maxlen);
return (NULL);
for (nbytes = 0, p = val; *p != '\0'; p = (uchar *)ep) {
ulong lval;
- lval = simple_strtol (p, &ep, 10);
+ lval = simple_strtol ((char *)p, &ep, 10);
if ((uchar *)ep == p || (*ep != '\0' && *ep != ',') || \
lval >= 256) {
printf ("%s rec (%s) byte array has invalid uint\n",
eerec_map_t *rp;
for (rp = eerec_map; rp < &eerec_map[neerecs]; rp++)
- if (strcmp (name, rp->name) == 0)
+ if (strcmp ((char *)name, rp->name) == 0)
break;
if (rp >= &eerec_map[neerecs])
char ov[CFG_CBSIZE], nv[CFG_CBSIZE], *p, *q, *nn, c, *curver, *newver;
int override = 1, append = 0, remove = 0, nnl, ovl, nvl;
- nn = name;
+ nn = (char *)name;
if (*nn == '-') {
override = 0;
return (0);
}
- p = value;
+ p = (char *)value;
q = nv;
while ((c = *p) == ' ' || c == '\t')
int i;
uchar *boottype;
uchar *bootletter;
- uchar *fmt;
+ char *fmt;
uchar botbootletter[] = "B";
uchar topbootletter[] = "T";
uchar botboottype[] = "bottom boot sector";
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
/* find RAM size using SDRAM CS1 only */
if (!dramsize)
sdram_start(0);
- test2 = test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
if (!dramsize) {
sdram_start(1);
- test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
}
if (test1 > test2) {
sdram_start(0);
/* find RAM size */
sdram_start(0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
value = addr[1]; /* device ID */
- switch (value) {
+ switch ((unsigned long)value) {
case AMD_ID_F040B:
info->flash_id += FLASH_AM040;
info->sector_count = 8;
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE1_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE1_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE1_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
puts ("Board: ");
- i = getenv_r ("serial#", buf, sizeof (buf));
+ i = getenv_r ("serial#", (char *)buf, sizeof (buf));
s = (i > 0) ? buf : NULL;
- if (!s || strncmp (s, "IP860", 5)) {
+ if (!s || strncmp ((char *)s, "IP860", 5)) {
puts ("### No HW ID - assuming IP860");
} else {
for (e = s; *e; ++e) {
* Check SDRAM Memory Size
*/
if (ip860_get_dram_size() == 16)
- size = dram_size (refresh_val | 0x00804114, (ulong *)SDRAM_BASE, SDRAM_MAX_SIZE);
+ size = dram_size (refresh_val | 0x00804114, SDRAM_BASE, SDRAM_MAX_SIZE);
else
- size = dram_size (refresh_val | 0x00906114, (ulong *)SDRAM_BASE, SDRAM_MAX_SIZE);
+ size = dram_size (refresh_val | 0x00906114, SDRAM_BASE, SDRAM_MAX_SIZE);
udelay (1000);
{
int sn = -1;
- if (!seeprom_read (0xa0, (char *) &sn, sizeof (sn))) {
+ if (!seeprom_read (0xa0, (uchar *) &sn, sizeof (sn))) {
sn = cpu_to_le32 (sn);
}
return sn;
{
char mac[6];
- if (!seeprom_read (0xb0, mac, sizeof (mac))) {
+ if (!seeprom_read (0xb0, (uchar *)mac, sizeof (mac))) {
sprintf (str, "%02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
} else {
{
int sn = -1;
- if (!seeprom_read (0xa0, (char *) &sn, sizeof (sn))) {
+ if (!seeprom_read (0xa0, (uchar *) &sn, sizeof (sn))) {
sn = cpu_to_le32 (sn);
}
return sn;
{
char mac[6];
- if (!seeprom_read (0xb0, mac, sizeof (mac))) {
+ if (!seeprom_read (0xb0, (uchar *)mac, sizeof (mac))) {
sprintf (str, "%02X:%02X:%02X:%02X:%02X:%02X",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
} else {
* Check Bank 0 Memory Size for re-configuration
*/
size_b0 =
- dram_size (CFG_MBMR_8COL, (ulong *) SDRAM_BASE3_PRELIM,
+ dram_size (CFG_MBMR_8COL, (long *) SDRAM_BASE3_PRELIM,
SDRAM_MAX_SIZE);
memctl->memc_mbmr = CFG_MBMR_8COL | MBMR_PTBE;
void load_sernum_ethaddr (void)
{
unsigned char *hwi;
- unsigned char *var;
+ char *var;
unsigned char hwi_stack[CFG_HWINFO_SIZE];
- unsigned char *p;
+ char *p;
hwi = (unsigned char *) (CFG_FLASH_BASE + CFG_HWINFO_OFFSET);
if (*((unsigned long *) hwi) != (unsigned long) CFG_HWINFO_MAGIC) {
/*
** ethaddr
*/
- var = strstr (hwi_stack, ETHADDR_TOKEN);
+ var = strstr ((char *)hwi_stack, ETHADDR_TOKEN);
if (var) {
var += sizeof (ETHADDR_TOKEN) - 1;
p = strchr (var, '\r');
- if (p < hwi + CFG_HWINFO_SIZE) {
+ if ((unsigned char *)p < hwi + CFG_HWINFO_SIZE) {
*p = '\0';
setenv ("ethaddr", var);
*p = '\r';
/*
** lcd
*/
- var = strstr (hwi_stack, LCD_TOKEN);
+ var = strstr ((char *)hwi_stack, LCD_TOKEN);
if (var) {
var += sizeof (LCD_TOKEN) - 1;
p = strchr (var, '\r');
- if (p < hwi + CFG_HWINFO_SIZE) {
+ if ((unsigned char *)p < hwi + CFG_HWINFO_SIZE) {
*p = '\0';
setenv ("lcd", var);
*p = '\r';
int r = 8, g = 8, b = 4;
int r1, g1, b1;
int n;
- uchar tmp[64]; /* long enough for environment variables */
+ char tmp[64]; /* long enough for environment variables */
int tft = 0;
immr->im_cpm.cp_pbpar &= ~(PB_LCD_PWM);
}
/* copy bitmap */
- fb = (char *) (fb_info.VmemAddr);
+ fb = (uchar *) (fb_info.VmemAddr);
memcpy (fb, (uchar *) CONFIG_KUP4K_LOGO, 320 * 240);
}
#endif /* CONFIG_KUP4K_LOGO */
* Check Bank 0 Memory Size for re-configuration
*/
size_b0 = dram_size (CFG_MAMR_8COL,
- (ulong *) SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+ (long *) SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTAE;
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+ size8 = dram_size (CFG_MAMR_8COL, (long *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+ size9 = dram_size (CFG_MAMR_9COL, (long *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
size_b0 = size9;
DECLARE_GLOBAL_DATA_PTR;
uchar kbd_data[KEYBD_DATALEN];
- uchar keybd_env[2 * KEYBD_DATALEN + 1];
+ char keybd_env[2 * KEYBD_DATALEN + 1];
uchar kbd_init_status = gd->kbd_status >> 8;
uchar kbd_status = gd->kbd_status;
uchar val;
- uchar *str;
+ char *str;
int i;
if (kbd_init_status) {
}
setenv ("keybd", keybd_env);
- str = strdup (key_match (kbd_data)); /* decode keys */
+ str = strdup ((char *)key_match (kbd_data)); /* decode keys */
#ifdef KEYBD_SET_DEBUGMODE
if (kbd_data[0] == KEYBD_SET_DEBUGMODE) { /* set debug mode */
if ((console_assign (stdout, "lcd") < 0) ||
/* Don't include modifier byte */
memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
- for (; str != NULL; str = (*nxt) ? nxt+1 : nxt) {
+ for (; str != NULL; str = (*nxt) ? (uchar *)(nxt+1) : (uchar *)nxt) {
uchar c;
int k;
- c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
+ c = (uchar) simple_strtoul ((char *)str, (char **) (&nxt), 16);
if (str == (uchar *)nxt) { /* invalid character */
break;
***********************************************************************/
static uchar *key_match (uchar *kbd_data)
{
- uchar magic[sizeof (kbd_magic_prefix) + 1];
+ char magic[sizeof (kbd_magic_prefix) + 1];
uchar *suffix;
- uchar *kbd_magic_keys;
+ char *kbd_magic_keys;
/*
* The following string defines the characters that can pe appended
/* loop over all magic keys;
* use '\0' suffix in case of empty string
*/
- for (suffix=kbd_magic_keys; *suffix || suffix==kbd_magic_keys; ++suffix) {
+ for (suffix=(uchar *)kbd_magic_keys; *suffix || suffix==(uchar *)kbd_magic_keys; ++suffix) {
sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
#if 0
printf ("### Check magic \"%s\"\n", magic);
#endif
- if (compare_magic(kbd_data, getenv(magic)) == 0) {
- uchar cmd_name[sizeof (kbd_command_prefix) + 1];
+ if (compare_magic(kbd_data, (uchar *)getenv(magic)) == 0) {
+ char cmd_name[sizeof (kbd_command_prefix) + 1];
char *cmd;
sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix);
cmd_name, cmd ? cmd : "<<NULL>>");
#endif
*kbd_data = *suffix;
- return (cmd);
+ return ((uchar *)cmd);
}
}
#if 0
int do_kbd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
uchar kbd_data[KEYBD_DATALEN];
- uchar keybd_env[2 * KEYBD_DATALEN + 1];
+ char keybd_env[2 * KEYBD_DATALEN + 1];
uchar val;
int i;
i2c_write (kbd_addr, 0, 0, &val, 1);
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
- return (compare_magic(kbd_data, CONFIG_MODEM_KEY_MAGIC) == 0);
+ return (compare_magic(kbd_data, (uchar *)CONFIG_MODEM_KEY_MAGIC) == 0);
}
#endif /* CONFIG_MODEM_SUPPORT */
i2c_write (kbd_addr, 0, 0, &val, 1);
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
- return (compare_magic(kbd_data, CONFIG_POST_KEY_MAGIC) == 0);
+ return (compare_magic(kbd_data, (uchar *)CONFIG_POST_KEY_MAGIC) == 0);
}
#endif
return rc;
}
-volatile static int write_word (flash_info_t *info, ulong dest, unsigned long long data) {
+static int write_word (flash_info_t *info, ulong dest, unsigned long long data) {
volatile unsigned long long *addr=(unsigned long long *)dest;
unsigned long long result;
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
- unsigned char *e;
+ char *s = getenv ("serial#");
+ char *e;
if (!s || strncmp (s, "ML2", 9)) {
printf ("### No HW ID - assuming ML2");
#endif
printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",
(ulong)src, size);
- if ((rc = flash_write (src, start, size)) != 0) {
+ if ((rc = flash_write ((char *)src, start, size)) != 0) {
puts("ERROR ");
flash_perror(rc);
return (1);
len = sizeof(image_header_t);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)data, len) != checksum) {
+ if (crc32 (0, (uchar *)data, len) != checksum) {
puts("Bad Header Checksum\n");
return 1;
}
data = ld_addr + sizeof(image_header_t);
len = ntohl(hdr->ih_size);
puts("Verifying Checksum ... ");
- if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+ if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
puts("Bad Data CRC\n");
return 1;
}
} while(len > off);
name=&name_buf[0];
value=&value_buf[0];
- if(strncmp(name,"baudrate",8)!=0) {
- setenv(name,value);
+ if(strncmp((char *)name,"baudrate",8)!=0) {
+ setenv((char *)name,(char *)value);
}
}
void check_env(void)
{
- unsigned char *s;
+ char *s;
int i=0;
char buf[32];
backup_t back;
char buf[64];
char tmp[16];
char cpustr[16];
- unsigned char *s, *e, bc;
+ char *s, *e, bc;
switch (line_number)
{
case 2:
void isa_sio_loadtable(void)
{
- unsigned char *s = getenv("floppy");
+ char *s = getenv("floppy");
/* setup Floppy device 0*/
isa_write_table((SIO_LOGDEV_TABLE *)&sio_fdc,0);
/* setup parallel port device 3 */
int checkboard (void)
{
- unsigned char s[50];
+ char s[50];
unsigned char bc, var;
int i;
backup_t *b = (backup_t *) s;
puts ("Board: ");
get_pcbrev_var(&bc,&var);
- i = getenv_r ("serial#", s, 32);
- if ((i == 0) || strncmp (s, BOARD_NAME,sizeof(BOARD_NAME))) {
+ i = getenv_r ("serial#", (char *)s, 32);
+ if ((i == 0) || strncmp ((char *)s, BOARD_NAME,sizeof(BOARD_NAME))) {
get_backup_values (b);
if (strncmp (b->signature, "MPL\0", 4) != 0) {
puts ("### No HW ID - assuming " BOARD_NAME);
{
unsigned long stop;
struct rtc_time newtm;
- unsigned char *s;
+ char *s;
mem_test_reloc();
/* write correct LED configuration */
if (miiphy_write (0x1, 0x14, 0x2402) != 0) {
{
unsigned char dataout[1];
unsigned char datain[128];
- unsigned long sdram_size;
+ unsigned long sdram_size = 0;
SDRAM_SETUP *t = (SDRAM_SETUP *) sdram_setup_table;
unsigned long memclk;
unsigned long tmemclk = 0;
int checkboard (void)
{
- unsigned char s[50];
+ char s[50];
unsigned char bc;
int i;
backup_t *b = (backup_t *) s;
puts ("Board: ");
- i = getenv_r ("serial#", s, 32);
- if ((i == 0) || strncmp (s, "PIP405", 6)) {
+ i = getenv_r ("serial#", (char *)s, 32);
+ if ((i == 0) || strncmp ((char *)s, "PIP405", 6)) {
get_backup_values (b);
if (strncmp (b->signature, "MPL\0", 4) != 0) {
puts ("### No HW ID - assuming PIP405");
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE1_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE1_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE1_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
* [9 column SDRAM may also be used in 8 column mode,
* but then only half the real size will be used.]
*/
- size_b1 = dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE2_PRELIM,
+ size_b1 = dram_size (memctl->memc_mamr, (long *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
/* debug ("SDRAM Bank 1: %ld MB\n", size8 >> 20); */
int i;
uchar *boottype;
uchar *bootletter;
- uchar *fmt;
+ char *fmt;
uchar botbootletter[] = "B";
uchar topbootletter[] = "T";
uchar botboottype[] = "bottom boot sector";
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
if (!dramsize)
sdram_start(0);
- test2 = test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
if (!dramsize) {
sdram_start(1);
- test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
}
if (test1 > test2) {
DEBUGF("Device ID @ 0x%08lx: 0x%08x\n", addr+1, value);
- switch (value) {
+ switch ((ulong)value) {
case AMD_ID_F040B:
DEBUGF("Am29F040B\n");
info->flash_id += FLASH_AM040;
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
/* find RAM size using SDRAM CS1 only */
if (!dramsize)
sdram_start(0);
- test2 = test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
if (!dramsize) {
sdram_start(1);
- test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
}
if (test1 > test2) {
sdram_start(0);
if (size < I2155X_VPD_SN_SIZE)
size = I2155X_VPD_SN_SIZE;
for (i = 0; i < (size - 1); i++) {
- i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, &c);
+ i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, (uchar *)&c);
if (c == '\0')
break;
string[i] = c;
int res;
if ((ds != 0) && (ds != 0xff)) {
- res = getenv_r ("ethaddr", tmp, sizeof (tmp));
+ res = getenv_r ("ethaddr", (char *)tmp, sizeof (tmp));
if (res > 0) {
ss = ((ds >> 4) & 0x0f);
ss += ss < 0x0a ? '0' : ('a' - 10);
tmp[16] = ss;
tmp[17] = '\0';
- setenv ("ethaddr", tmp);
+ setenv ("ethaddr", (char *)tmp);
/* set the led to show the address */
*((unsigned char *) (CFG_LED_BASE + 1)) = ds;
}
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
+ char *s = getenv ("serial#");
puts ("Board QUANTUM, Serial No: ");
/* Check Bank 0 Memory Size,
* 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
/*
* Final mapping:
{
volatile immap_t *immap = (immap_t *) CFG_IMMR;
volatile memctl8xx_t *memctl = &immap->im_memctl;
- volatile long int *addr;
+ volatile ulong *addr;
ulong cnt, val, size;
ulong save[32]; /* to make test non-destructive */
unsigned char i = 0;
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
int misc_init_r (void)
{
- uchar kbd_data[KEYBD_DATALEN];
- uchar keybd_env[2 * KEYBD_DATALEN + 1];
- uchar *str;
+ char kbd_data[KEYBD_DATALEN];
+ char keybd_env[2 * KEYBD_DATALEN + 1];
+ char *str;
int i;
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
- i2c_read (CFG_I2C_KEY_ADDR, 0, 0, kbd_data, KEYBD_DATALEN);
+ i2c_read (CFG_I2C_KEY_ADDR, 0, 0, (uchar *)kbd_data, KEYBD_DATALEN);
for (i = 0; i < KEYBD_DATALEN; ++i) {
sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
}
setenv ("keybd", keybd_env);
- str = strdup (key_match (keybd_env)); /* decode keys */
+ str = strdup ((char *)key_match ((uchar *)keybd_env)); /* decode keys */
#ifdef CONFIG_PREBOOT /* automatically configure "preboot" command on key match */
setenv ("preboot", str); /* set or delete definition */
* "key_magic" is checked (old behaviour); the string "125" causes
* checks for "key_magic1", "key_magic2" and "key_magic5", etc.
*/
- if ((kbd_magic_keys = getenv ("magic_keys")) != NULL) {
+ if ((kbd_magic_keys = (uchar *)getenv ("magic_keys")) != NULL) {
/* loop over all magic keys;
* use '\0' suffix in case of empty string
*/
for (suffix = kbd_magic_keys;
*suffix || suffix == kbd_magic_keys;
++suffix) {
- sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
+ sprintf ((char *)magic, "%s%c", kbd_magic_prefix, *suffix);
#if 0
printf ("### Check magic \"%s\"\n", magic);
#endif
- if ((str = getenv (magic)) != 0) {
+ if ((str = (uchar *)getenv ((char *)magic)) != 0) {
#if 0
printf ("### Compare \"%s\" \"%s\"\n",
kbd_str, str);
#endif
- if (strcmp (kbd_str, str) == 0) {
- sprintf (cmd_name, "%s%c",
+ if (strcmp ((char *)kbd_str, (char *)str) == 0) {
+ sprintf ((char *)cmd_name, "%s%c",
kbd_command_prefix,
*suffix);
- if ((cmd = getenv (cmd_name)) != 0) {
+ if ((cmd = getenv ((char *)cmd_name)) != 0) {
#if 0
printf ("### Set PREBOOT to $(%s): \"%s\"\n",
cmd_name, cmd);
#endif
- return (cmd);
+ return ((uchar *)cmd);
}
}
}
puts ("Keys:");
for (i = 0; i < KEYBD_DATALEN; ++i) {
- sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
+ sprintf ((char *)(keybd_env + i + i), "%02X", kbd_data[i]);
printf (" %02x", kbd_data[i]);
}
putc ('\n');
- setenv ("keybd", keybd_env);
+ setenv ("keybd", (char *)keybd_env);
return 0;
}
#endif
switch (value)
{
- case 0x01:
- case AMD_MANUFACT:
+ case 0x01: /*AMD_MANUFACT*/
info->flash_id = FLASH_MAN_AMD;
break;
- case FUJ_MANUFACT:
+ case 0x04: /*FUJ_MANUFACT*/
info->flash_id = FLASH_MAN_FUJ;
break;
int checkboard (void)
{
- unsigned char *s = getenv ("serial#");
+ char *s = getenv ("serial#");
if (!s || strncmp (s, "TQM8", 4)) {
printf ("### No HW ID - assuming RBC823\n");
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE4_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE4_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE4_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE4_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
* 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
/*
*/
uchar i2c_reg_read1(uchar i2c_addr, uchar reg)
{
- char buf;
+ uchar buf;
- i2c_read1(i2c_addr, reg, 1, &buf, 1);
+ i2c_read1(i2c_addr, reg, 1, &buf, (uchar)1);
return(buf);
}
volatile unsigned long brdout_enable_ul; /* Read/Write */
volatile unsigned long brdin_data_ul; /* Read Only */
volatile unsigned long misc_ul; /* Read/Write */
-} KAREF_FPGA_REGS_ST __attribute__((packed)), * KAREF_FPGA_REGS_PST;
+} __attribute__((packed)) KAREF_FPGA_REGS_ST , * KAREF_FPGA_REGS_PST;
/* OFEM FPGA */
typedef struct ofem_fpga_regs_s
volatile unsigned long scrmask_ul; /* Read/Write */
volatile unsigned long control_ul; /* Read/Write */
volatile unsigned long mac_flow_ctrl_ul; /* Read/Write */
-} OFEM_FPGA_REGS_ST __attribute__((packed)), * OFEM_FPGA_REGS_PST;
+} __attribute__((packed)) OFEM_FPGA_REGS_ST , * OFEM_FPGA_REGS_PST;
#endif /* __KAREF_H__ */
volatile unsigned long scrmask_ul; /* Read/Write */
volatile unsigned long control_ul; /* Read/Write */
volatile unsigned long boardinfo_ul; /* Read Only */
-} OPTO_FPGA_REGS_ST __attribute__ ((packed)), *OPTO_FPGA_REGS_PST;
+} __attribute__ ((packed)) OPTO_FPGA_REGS_ST , *OPTO_FPGA_REGS_PST;
#endif /* __METROBOX_H__ */
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
unsigned char *s;
unsigned char buf[64];
- s = (getenv_r ("serial#", buf, sizeof(buf)) > 0) ? buf : NULL;
+ s = (getenv_r ("serial#", (char *)&buf, sizeof(buf)) > 0) ? buf : NULL;
puts ("Board: Siemens CCM");
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+ size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+ size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
size = size9;
* Check Bank 0 Memory Size for re-configuration
*
*/
- size = dram_size (CFG_MAMR, (ulong *) SDRAM_BASE_PRELIM,
+ size = dram_size (CFG_MAMR, (long *) SDRAM_BASE_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
}
}
- if (checkall && fpga_get_version(fpga, hdr.ih_name) < 0)
+ if (checkall && fpga_get_version(fpga, (char *)(hdr.ih_name)) < 0)
return 1;
/* align length */
}
hdr = (image_header_t *)addr;
- if ((new_id = fpga_get_version(fpga, hdr->ih_name)) == -1)
+ if ((new_id = fpga_get_version(fpga, (char *)(hdr->ih_name))) == -1)
return 1;
do_load = 1;
* Check Bank 0 Memory Size for re-configuration
*/
#if PCU_E_WITH_SWAPPED_CS /* XXX */
- size_b0 = dram_size (CFG_MAMR, (ulong *) SDRAM_BASE5_PRELIM, SDRAM_MAX_SIZE);
+ size_b0 = dram_size (CFG_MAMR, (long *) SDRAM_BASE5_PRELIM, SDRAM_MAX_SIZE);
#else /* XXX */
- size_b0 = dram_size (CFG_MAMR, (ulong *) SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+ size_b0 = dram_size (CFG_MAMR, (long *) SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
#endif /* XXX */
memctl->memc_mamr = CFG_MAMR | MAMR_PTAE;
int i;
uchar *boottype;
uchar *bootletter;
- uchar *fmt;
+ char *fmt;
uchar botbootletter[] = "B";
uchar topbootletter[] = "T";
uchar botboottype[] = "bottom boot sector";
static long ram_size(ulong *base, long maxsize)
{
volatile long *test_addr;
- volatile long *base_addr = base;
+ volatile ulong *base_addr = base;
ulong ofs; /* byte offset from base_addr */
ulong save; /* to make test non-destructive */
ulong save2; /* to make test non-destructive */
int checkboard (void)
{
- unsigned char *s, *e;
- unsigned char buf[64];
+ char *s, *e;
+ char buf[64];
int i;
i = getenv_r("serial#", buf, sizeof(buf));
* Check for 32M SDRAM Memory Size
*/
size = dram_size(CFG_32M_MAMR|MAMR_PTAE,
- (ulong *)SDRAM_BASE, SDRAM_32M_MAX_SIZE);
+ (long *)SDRAM_BASE, SDRAM_32M_MAX_SIZE);
udelay (1000);
/*
*/
if (size != SDRAM_32M_MAX_SIZE) {
size = dram_size(CFG_16M_MAMR|MAMR_PTAE,
- (ulong *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
+ (long *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
udelay (1000);
}
int checkboard (void)
{
- unsigned char *s, *e;
- unsigned char buf[64];
+ char *s, *e;
+ char buf[64];
int i;
i = getenv_r("serial#", buf, sizeof(buf));
*/
if (size != SDRAM_64M_MAX_SIZE) {
#endif
- size = dram_size (CFG_16M_MBMR, (ulong *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
+ size = dram_size (CFG_16M_MBMR, (long *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
udelay (1000);
#if 0
}
* Check Bank 0 Memory Size for re-configuration
*/
size_b0 =
- dram_size (CFG_MBMR_8COL, (ulong *) SDRAM_BASE3_PRELIM,
+ dram_size (CFG_MBMR_8COL, SDRAM_BASE3_PRELIM,
SDRAM_MAX_SIZE);
memctl->memc_mbmr = CFG_MBMR_8COL | MBMR_PTBE;
LIB = lib$(BOARD).a
-OBJS = $(BOARD).o
+OBJS = $(BOARD).o oftree.o
$(LIB): .depend $(OBJS)
$(AR) crv $@ $(OBJS)
+%.dtb: %.dts
+ dtc -f -V 0x10 -I dts -O dtb $< >$@
+
+%.c: %.dtb
+ xxd -i $< \
+ | sed -e "s/^unsigned char/const unsigned char/g" \
+ | sed -e "s/^unsigned int/const unsigned int/g" > $@
+
#########################################################################
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
--- /dev/null
+/ {
+ model = "STXXTC V1";
+ compatible = "STXXTC";
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ cpus {
+ linux,phandle = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ PowerPC,MPC870@0 {
+ linux,phandle = <3>;
+ name = "PowerPC,MPC870";
+ device_type = "cpu";
+ reg = <0>;
+ clock-frequency = <0>; /* place-holder for runtime fillup */
+ timebase-frequency = <0>; /* dido */
+ linux,boot-cpu;
+ i-cache-size = <2000>;
+ d-cache-size = <2000>;
+ 32-bit;
+ };
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <00000000 00000000 00000000 20000000>;
+ };
+
+ /* copy of the bd_t information (place-holders) */
+ bd_t {
+ memstart = <0>;
+ memsize = <0>;
+ flashstart = <0>;
+ flashsize = <0>;
+ flashoffset = <0>;
+ sramstart = <0>;
+ sramsize = <0>;
+
+ immr_base = <0>;
+
+ bootflags = <0>;
+ ip_addr = <0>;
+ enetaddr = [ 00 00 00 00 00 00 ];
+ ethspeed = <0>;
+ intfreq = <0>;
+ busfreq = <0>;
+
+ baudrate = <0>;
+ };
+
+};
int checkboard (void)
{
- unsigned char *s = getenv("serial#");
+ char *s = getenv("serial#");
int board_type;
if (!s || strncmp(s, "SVM8", 4)) {
/* find RAM size using SDRAM CS0 only */
mpc5xxx_sdram_start(sdram_conf, 0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
mpc5xxx_sdram_start(sdram_conf, 1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
mpc5xxx_sdram_start(sdram_conf, 0);
dramsize = test1;
/* find RAM size using SDRAM CS1 only */
mpc5xxx_sdram_start(sdram_conf, 0);
- test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
mpc5xxx_sdram_start(sdram_conf, 1);
- test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+ test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
if (test1 > test2) {
mpc5xxx_sdram_start(sdram_conf, 0);
dramsize2 = test1;
/* find RAM size */
mpc5xxx_sdram_start(sdram_conf, 0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
mpc5xxx_sdram_start(sdram_conf, 1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
if (test1 > test2) {
mpc5xxx_sdram_start(sdram_conf, 0);
dramsize = test1;
static int i2s_play_wave(unsigned long addr, unsigned long len)
{
unsigned long i;
- unsigned char *wave_file = (char *)addr + 44; /* quick'n dirty: skip
+ unsigned char *wave_file = (uchar *)addr + 44; /* quick'n dirty: skip
* wav header*/
unsigned char swapped[4];
struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
unsigned long reg, val, duration;
- unsigned char *tmp;
+ char *tmp;
unsigned int freq, channel;
unsigned char volume;
int rcode = 1;
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x20000000);
+ test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x20000000);
+ test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
/* find RAM size using SDRAM CS1 only */
sdram_start(0);
- test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+ test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+ test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
if (test1 > test2) {
sdram_start(0);
dramsize2 = test1;
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof (str));
puts ("Board: ");
/* set serial# and ethaddr if not yet defined */
if (getenv("serial#") == NULL) {
- setenv ("serial#", serial);
+ setenv ((char *)"serial#", (char *)serial);
}
if (getenv("ethaddr") == NULL) {
- setenv ("ethaddr", ethaddr);
+ setenv ((char *)"ethaddr", (char *)ethaddr);
}
}
{
DECLARE_GLOBAL_DATA_PTR;
- unsigned char *s = getenv ("serial#");
+ char *s = getenv ("serial#");
puts ("Board: ");
*
* try 8 column mode
*/
- size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size8 >> 20);
/*
* try 9 column mode
*/
- size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+ size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size9 >> 20);
* [9 column SDRAM may also be used in 8 column mode,
* but then only half the real size will be used.]
*/
- size_b1 = dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE3_PRELIM,
+ size_b1 = dram_size (memctl->memc_mamr, (long int *)SDRAM_BASE3_PRELIM,
SDRAM_MAX_SIZE);
debug ("SDRAM Bank 1: %ld MB\n", size_b1 >> 20);
} else {
*/
int checkboard (void)
{
- unsigned char str[64];
+ char str[64];
int i = getenv_r ("serial#", str, sizeof(str));
puts ("Board: ");
int flag;
ulong status;
int rcode = 0;
- volatile long *addr = (unsigned long *)sector;
+ volatile long *addr = (long *)sector;
switch(info->flash_id & FLASH_TYPEMASK) {
case FLASH_28F320J3A:
int flag;
ulong status;
int rcode = 0;
- volatile long *addr = (unsigned long *)sector;
+ volatile long *addr = (long *)sector;
switch(info->flash_id & FLASH_TYPEMASK) {
case FLASH_28F320J3A:
xcv_len = len - 14 - fn_len; /* fpga image length */
/* Check for uninitialized FLASH */
- if ((strncmp(buf, "w7o", 3)!=0) || (len > 0x0007ffffL) || (len == 0))
+ if ((strncmp((char *)buf, "w7o", 3)!=0) || (len > 0x0007ffffL) || (len == 0))
goto bad_image;
/*
unsigned short stored_crc16, calc_crc16 = 0xffff;
/* Check Eyecatcher */
- if (strncmp(vpd->header.eyecatcher, VPD_EYECATCHER, VPD_EYE_SIZE) != 0) {
+ if (strncmp((char *)(vpd->header.eyecatcher), VPD_EYECATCHER, VPD_EYE_SIZE) != 0) {
unsigned offset = 0;
if (dev_addr == CFG_DEF_EEPROM_ADDR)
offset += SDRAM_SPD_DATA_SIZE;
case VPD_PID_PID:
if (strlen_ok(packet, MAX_PROD_ID)) {
strncpy(vpdInfo->productId,
- packet->data, packet->size);
+ (char *)(packet->data), packet->size);
}
break;
case VPD_PID_REV:
(strncmp (vpd->productId, "CMM", 3) == 0))) {
char buf[30];
char *eth;
- unsigned char *serial = getenv ("serial#");
- unsigned char *ethaddr = getenv ("ethaddr");
+ char *serial = getenv ("serial#");
+ char *ethaddr = getenv ("ethaddr");
/* Set 'serial#' envvar if serial# isn't set */
if (!serial) {
}
/* Set 'ethaddr' envvar if 'ethaddr' envvar is the default */
- eth = vpd->ethAddrs[0];
+ eth = (char *)(vpd->ethAddrs[0]);
if (ethaddr
&& (strcmp (ethaddr, MK_STR (CONFIG_ETHADDR)) == 0)) {
/* Now setup ethaddr */
/* initialize the version of the component
*/
- XVersion_FromString(&InstancePtr->Version, "1.00a");
+ XVersion_FromString(&InstancePtr->Version, (s8 *)"1.00a");
/* reset the DMA channel such that it's in a known state and ready
* and indicate the initialization occured with no errors, note that
int
checkboard(void)
{
- uchar tmp[64]; /* long enough for environment variables */
- uchar *s, *e;
+ char tmp[64]; /* long enough for environment variables */
+ char *s, *e;
int i = getenv_r("L", tmp, sizeof (tmp));
if (i < 0) {
RecvFrameLength = PKTSIZE;
Result = XEmac_PollRecv(&Emac, (u8 *) etherrxbuff, &RecvFrameLength);
if (Result == XST_SUCCESS) {
- NetReceive(etherrxbuff, RecvFrameLength);
+ NetReceive((uchar)etherrxbuff, RecvFrameLength);
return (1);
} else {
return (0);
static void
ip_ml300(uchar * s, uchar * res)
{
- uchar temp[2];
+ char temp[2];
u8 i;
res[0] = 0x00;
for (i = 0; i < 4; i++) {
sprintf(temp, "%02x", atoi(s));
- s = strchr(s, '.') + 1;
- strcat(res, temp);
+ s = (uchar *)strchr((char *)s, '.') + 1;
+ strcat((char *)res, temp);
}
}
change_null(uchar * s)
{
if (s != NULL) {
- change_null(strchr(s + 1, 255));
- *(strchr(s, 255)) = '\0';
+ change_null((uchar *)strchr((char *)s + 1, 255));
+ *(strchr((char *)s, 255)) = '\0';
}
}
void
convert_env(void)
{
- uchar *s; /* pointer to env value */
- uchar temp[20]; /* temp storage for addresses */
+ char *s; /* pointer to env value */
+ char temp[20]; /* temp storage for addresses */
/* E -> ethaddr */
s = getenv("E");
/* I -> ipaddr */
s = getenv("I");
if (s != NULL) {
- sprintf(temp, "%d.%d.%d.%d", axtoi(s), axtoi(s + 2),
- axtoi(s + 4), axtoi(s + 6));
+ sprintf(temp, "%d.%d.%d.%d", axtoi((u8 *)s), axtoi((u8 *)(s + 2)),
+ axtoi((u8 *)(s + 4)), axtoi((u8 *)(s + 6)));
setenv("ipaddr", temp);
setenv("I", NULL);
}
/* S -> serverip */
s = getenv("S");
if (s != NULL) {
- sprintf(temp, "%d.%d.%d.%d", axtoi(s), axtoi(s + 2),
- axtoi(s + 4), axtoi(s + 6));
+ sprintf(temp, "%d.%d.%d.%d", axtoi((u8 *)s), axtoi((u8 *)(s + 2)),
+ axtoi((u8 *)(s + 4)), axtoi((u8 *)(s + 6)));
setenv("serverip", temp);
setenv("S", NULL);
}
static void
save_env(void)
{
- uchar eprom[ENV_SIZE]; /* buffer to be written back to EEPROM */
- uchar *s, temp[20];
- uchar ff[] = { 0xff, 0x00 }; /* dummy null value */
+ char eprom[ENV_SIZE]; /* buffer to be written back to EEPROM */
+ char *s, temp[20];
+ char ff[] = { 0xff, 0x00 }; /* dummy null value */
u32 len; /* length of env to be written to EEPROM */
eprom[0] = 0x00;
s = getenv("ipaddr");
if (s != NULL) {
strcat(eprom, "I=");
- ip_ml300(s, temp);
+ ip_ml300((uchar *)s, (uchar *)temp);
strcat(eprom, temp);
strcat(eprom, ff);
}
s = getenv("serverip");
if (s != NULL) {
strcat(eprom, "S=");
- ip_ml300(s, temp);
+ ip_ml300((uchar *)s, (uchar *)temp);
strcat(eprom, temp);
strcat(eprom, ff);
}
}
len = strlen(eprom); /* find env length without crc */
- change_null(eprom); /* change 0xff to 0x00 */
+ change_null((uchar *)eprom); /* change 0xff to 0x00 */
/* update EEPROM env values if there is enough space */
- if (update_crc(len, eprom) == 0)
- send(CFG_ENV_OFFSET, eprom, len + 6);
+ if (update_crc(len, (uchar *)eprom) == 0)
+ send(CFG_ENV_OFFSET, (uchar *)eprom, len + 6);
}
/************************************************************************
env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
env_nvram.o env_nowhere.o \
exports.o \
- flash.o fpga.o \
+ flash.o fpga.o ft_build.o \
hush.o kgdb.o lcd.o lists.o lynxkdi.o \
memsize.o miiphybb.o miiphyutil.o \
s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
hdr->ih_hcrc = 0;
len = sizeof (image_header_t);
data = (ulong)hdr;
- if (crc32(0, (char *)data, len) != crc) {
+ if (crc32(0, (uchar *)data, len) != crc) {
puts ("Bad header crc\n");
return 1;
}
len = ntohl(hdr->ih_size);
if (verify) {
- if (crc32(0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+ if (crc32(0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
puts ("Bad data crc\n");
return 1;
}
#include <bmp_layout.h>
#include <command.h>
#include <asm/byteorder.h>
+#include <malloc.h>
#if (CONFIG_COMMANDS & CFG_CMD_BMP)
static int bmp_info (ulong addr);
static int bmp_display (ulong addr, int x, int y);
+int gunzip(void *, int, unsigned char *, unsigned long *);
+
/*
* Subroutine: do_bmp
*
static int bmp_info(ulong addr)
{
bmp_image_t *bmp=(bmp_image_t *)addr;
+#ifdef CONFIG_VIDEO_BMP_GZIP
+ unsigned char *dst = NULL;
+ ulong len;
+#endif /* CONFIG_VIDEO_BMP_GZIP */
+
if (!((bmp->header.signature[0]=='B') &&
(bmp->header.signature[1]=='M'))) {
+
+#ifdef CONFIG_VIDEO_BMP_GZIP
+ /*
+ * Decompress bmp image
+ */
+ len = CFG_VIDEO_LOGO_MAX_SIZE;
+ dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+ if (dst == NULL) {
+ printf("Error: malloc in gunzip failed!\n");
+ return(1);
+ }
+ if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
+ printf("There is no valid bmp file at the given address\n");
+ return(1);
+ }
+ if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+ printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+ }
+
+ /*
+ * Set addr to decompressed image
+ */
+ bmp = (bmp_image_t *)dst;
+
+ /*
+ * Check for bmp mark 'BM'
+ */
+ if (!((bmp->header.signature[0] == 'B') &&
+ (bmp->header.signature[1] == 'M'))) {
+ printf("There is no valid bmp file at the given address\n");
+ free(dst);
+ return(1);
+ }
+
+ printf("Gzipped BMP image detected!\n");
+#else /* CONFIG_VIDEO_BMP_GZIP */
printf("There is no valid bmp file at the given address\n");
return(1);
+#endif /* CONFIG_VIDEO_BMP_GZIP */
}
printf("Image size : %d x %d\n", le32_to_cpu(bmp->header.width),
le32_to_cpu(bmp->header.height));
printf("Bits per pixel: %d\n", le16_to_cpu(bmp->header.bit_count));
printf("Compression : %d\n", le32_to_cpu(bmp->header.compression));
+
+#ifdef CONFIG_VIDEO_BMP_GZIP
+ if (dst) {
+ free(dst);
+ }
+#endif /* CONFIG_VIDEO_BMP_GZIP */
+
return(0);
}
#include <environment.h>
#include <asm/byteorder.h>
+#ifdef CONFIG_OF_FLAT_TREE
+#include <ft_build.h>
+#endif
+
/*cmd_boot.c*/
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)data, len) != checksum) {
+ if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n");
SHOW_BOOT_PROGRESS (-2);
return 1;
if (verify) {
puts (" Verifying Checksum ... ");
- if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+ if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
printf ("Bad Data CRC\n");
SHOW_BOOT_PROGRESS (-3);
return 1;
}
#endif /* CONFIG_SILENT_CONSOLE */
+#ifdef CONFIG_OF_FLAT_TREE
+extern const unsigned char oftree_dtb[];
+extern const unsigned int oftree_dtb_len;
+#endif
+
#ifdef CONFIG_PPC
static void
do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
bd_t *kbd;
void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
image_header_t *hdr = &header;
+#ifdef CONFIG_OF_FLAT_TREE
+ char *of_flat_tree;
+#endif
if ((s = getenv ("initrd_high")) != NULL) {
/* a value of "no" or a similar string will act like 0,
checksum = hdr->ih_hcrc;
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)data, len) != checksum) {
+ if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n");
SHOW_BOOT_PROGRESS (-11);
do_reset (cmdtp, flag, argc, argv);
if (chunk > CHUNKSZ)
chunk = CHUNKSZ;
- csum = crc32 (csum, (char *)cdata, chunk);
+ csum = crc32 (csum, (uchar *)cdata, chunk);
cdata += chunk;
WATCHDOG_RESET();
}
#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
- csum = crc32 (0, (char *)data, len);
+ csum = crc32 (0, (uchar *)data, len);
#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
if (csum != hdr->ih_dcrc) {
initrd_end = 0;
}
+#ifdef CONFIG_OF_FLAT_TREE
+ if (initrd_start == 0)
+ of_flat_tree = (char *)(((ulong)kbd - OF_FLAT_TREE_MAX_SIZE -
+ sizeof(bd_t)) & ~0xF);
+ else
+ of_flat_tree = (char *)((initrd_start - OF_FLAT_TREE_MAX_SIZE -
+ sizeof(bd_t)) & ~0xF);
+#endif
debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong)kernel);
SHOW_BOOT_PROGRESS (15);
+#ifndef CONFIG_OF_FLAT_TREE
+
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
unlock_ram_in_cache();
#endif
+
/*
* Linux Kernel Parameters:
* r3: ptr to board info data
* r7: End of command line string
*/
(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
+
+#else
+ ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd);
+ /* ft_dump_blob(of_flat_tree); */
+
+#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
+ unlock_ram_in_cache();
+#endif
+ /*
+ * Linux Kernel Parameters:
+ * r3: ptr to OF flat tree, followed by the board info data
+ * r4: initrd_start or 0 if no initrd
+ * r5: initrd_end - unused if r4 is 0
+ * r6: Start of command line string
+ * r7: End of command line string
+ */
+ (*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end, cmd_start, cmd_end);
+
+#endif
}
#endif /* CONFIG_PPC */
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)data, len) != checksum) {
+ if (crc32 (0, (uchar *)data, len) != checksum) {
puts (" Bad Header Checksum\n");
return 1;
}
len = ntohl(hdr->ih_size);
puts (" Verifying Checksum ... ");
- if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+ if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
puts (" Bad Data CRC\n");
return 1;
}
checksum = ntohl(header.ih_hcrc);
header.ih_hcrc = 0;
- if (crc32 (0, (char *)&header, sizeof(image_header_t))
+ if (crc32 (0, (uchar *)&header, sizeof(image_header_t))
!= checksum)
goto next_sector;
len = ntohl(hdr->ih_size);
puts (" Verifying Checksum ... ");
- if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+ if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
puts (" Bad Data CRC\n");
}
puts ("OK\n");
cmd ? "read" : "write", curr_device, off, size);
ret = doc_rw(doc_dev_desc + curr_device, cmd, off, size,
- &total, (u_char*)addr);
+ (size_t *)&total, (u_char*)addr);
printf ("%d bytes %s: %s\n", total, cmd ? "read" : "write",
ret ? "ERROR" : "OK");
if (cmd)
ret = doc_read_ecc(this, from, len,
- &n, (u_char*)buf,
- noecc ? NULL : eccbuf);
+ (size_t *)&n, (u_char*)buf,
+ noecc ? (uchar *)NULL : (uchar *)eccbuf);
else
ret = doc_write_ecc(this, from, len,
- &n, (u_char*)buf,
- noecc ? NULL : eccbuf);
+ (size_t *)&n, (u_char*)buf,
+ noecc ? (uchar *)NULL : (uchar *)eccbuf);
if (ret)
break;
/* Check for ANAND header first. Then can whinge if it's found but later
checks fail */
if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize, SECTORSIZE,
- &retlen, buf, NULL))) {
+ (size_t *)&retlen, buf, NULL))) {
static int warncount = 5;
if (warncount) {
/* To be safer with BIOS, also use erase mark as discriminant */
if ((ret = doc_read_oob(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8,
- 8, &retlen, (char *)&h1) < 0)) {
+ 8, (size_t *)&retlen, (uchar *)&h1) < 0)) {
#ifdef NFTL_DEBUG
printf("ANAND header found at 0x%x, but OOB data read failed\n",
block * nftl->EraseSize);
/* read one sector for every SECTORSIZE of blocks */
if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize +
i + SECTORSIZE, SECTORSIZE,
- &retlen, buf, (char *)&oob)) < 0) {
+ (size_t *)&retlen, buf, (uchar *)&oob)) < 0) {
puts ("Read of bad sector table failed\n");
return -1;
}
return(1);
}
- if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
+ if (strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
unsigned int i;
int rc;
- dataptr = fpgadata;
+ dataptr = (unsigned char *)fpgadata;
#if CFG_FPGA_XILINX
/* skip the first bytes of the bitsteam, their meaning is unknown */
*/
do {
printf("%08lx:", addr);
- if(i2c_read(chip, addr, alen, (char *)&data, size) != 0) {
+ if(i2c_read(chip, addr, alen, (uchar *)&data, size) != 0) {
puts ("\nError reading the chip,\n");
} else {
data = cpu_to_be32(data);
*/
reset_cmd_timeout();
#endif
- if(i2c_write(chip, addr, alen, (char *)&data, size) != 0) {
+ if(i2c_write(chip, addr, alen, (uchar *)&data, size) != 0) {
puts ("Error writing the chip.\n");
}
#ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS
SHOW_BOOT_PROGRESS (-1);
return 1;
}
- if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
- (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+ if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+ (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+ if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
puts ("\n** Bad Header Checksum **\n");
SHOW_BOOT_PROGRESS (-2);
return 1;
do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
uint rcode = 0;
+ iopin_t iopin;
static uint port = 0;
static uint pin = 0;
static uint value = 0;
- static enum { DIR, PAR, SOR, ODR, DAT, INT } cmd = DAT;
- iopin_t iopin;
+ static enum {
+ DIR,
+ PAR,
+ SOR,
+ ODR,
+ DAT,
+#if defined(CONFIG_8xx)
+ INT
+#endif
+ } cmd = DAT;
if (argc != 5) {
puts ("iopset PORT PIN CMD VALUE\n");
if (rcode == 0) {
iopin.port = port;
iopin.pin = pin;
+ iopin.flag = 0;
switch (cmd) {
case DIR:
if (value)
if (addr2info(store_addr)) {
int rc;
- rc = flash_write((uchar *)binbuf,store_addr,binlen);
+ rc = flash_write((char *)binbuf,store_addr,binlen);
if (rc != 0) {
flash_perror (rc);
return (~0);
case 2:
if (strcmp(argv[1],"show") == 0) {
for (i=0; i < (log_size&LOGBUFF_MASK); i++) {
- s = log_buf+((log_start+i)&LOGBUFF_MASK);
+ s = (char *)log_buf+((log_start+i)&LOGBUFF_MASK);
putc (*s);
}
return 0;
}
#endif
puts (" ");
- cp = linebuf;
+ cp = (u_char *)linebuf;
for (i=0; i<linebytes; i++) {
if ((*cp < 0x20) || (*cp > 0x7e))
putc ('.');
puts ("Copy to Flash... ");
- rc = flash_write ((uchar *)addr, dest, count*size);
+ rc = flash_write ((char *)addr, dest, count*size);
if (rc != 0) {
flash_perror (rc);
return (1);
/* read out-of-band data */
if (cmd & NANDRW_READ) {
ret = nand_read_oob(nand_dev_desc + curr_device,
- off, size, &total,
+ off, size, (size_t *)&total,
(u_char*)addr);
}
else {
ret = nand_write_oob(nand_dev_desc + curr_device,
- off, size, &total,
+ off, size, (size_t *)&total,
(u_char*)addr);
}
return ret;
curr_device, off, size);
ret = nand_rw(nand_dev_desc + curr_device, cmd, off, size,
- &total, (u_char*)addr);
+ (size_t *)&total, (u_char*)addr);
printf (" %d bytes %s: %s\n", total,
(cmd & NANDRW_READ) ? "read" : "written",
*/
int check_block (struct nand_chip *nand, unsigned long pos)
{
- int retlen;
+ size_t retlen;
uint8_t oob_data;
uint16_t oob_data16[6];
int page0 = pos & (-nand->erasesize);
return 1;
} else {
/* Note - bad block marker can be on first or second page */
- if (nand_read_oob(nand, page0 + badpos, 1, &retlen, &oob_data)
+ if (nand_read_oob(nand, page0 + badpos, 1, &retlen, (unsigned char *)&oob_data)
|| oob_data != 0xff
- || nand_read_oob (nand, page1 + badpos, 1, &retlen, &oob_data)
+ || nand_read_oob (nand, page1 + badpos, 1, &retlen, (unsigned char *)&oob_data)
|| oob_data != 0xff)
return 1;
}
if (cmd & NANDRW_READ) {
ret = nand_read_ecc(nand, start,
min(len, eblk + erasesize - start),
- &n, (u_char*)buf, eccbuf);
+ (size_t *)&n, (u_char*)buf, (u_char *)eccbuf);
} else {
ret = nand_write_ecc(nand, start,
min(len, eblk + erasesize - start),
- &n, (u_char*)buf, eccbuf);
+ (size_t *)&n, (u_char*)buf, (u_char *)eccbuf);
}
if (ret)
l = NAND_JFFS2_OOB16_FSDALEN;
}
- ret = nand_write_oob(nand, ofs + p, l, &n,
+ ret = nand_write_oob(nand, ofs + p, l, (size_t *)&n,
(u_char *)&clean_marker);
/* quit here if write failed */
if (ret)
for (nxt=j; env_get_char(nxt) != '\0'; ++nxt)
;
- k = envmatch(name, j);
+ k = envmatch((uchar *)name, j);
if (k < 0) {
continue;
}
int i, len, oldval;
int console = -1;
uchar *env, *nxt = NULL;
- uchar *name;
+ char *name;
bd_t *bd = gd->bd;
uchar *env_data = env_get_addr(0);
for (env=env_data; *env; env=nxt+1) {
for (nxt=env; *nxt; ++nxt)
;
- if ((oldval = envmatch(name, env-env_data)) >= 0)
+ if ((oldval = envmatch((uchar *)name, env-env_data)) >= 0)
break;
}
if ( (strcmp (name, "serial#") == 0) ||
((strcmp (name, "ethaddr") == 0)
#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
- && (strcmp (env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
+ && (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
) ) {
printf ("Can't overwrite \"%s\"\n", name);
* or NULL if not found
*/
-char *getenv (uchar *name)
+char *getenv (char *name)
{
int i, nxt;
return (NULL);
}
}
- if ((val=envmatch(name, i)) < 0)
+ if ((val=envmatch((uchar *)name, i)) < 0)
continue;
- return (env_get_addr(val));
+ return ((char *)env_get_addr(val));
}
return (NULL);
}
-int getenv_r (uchar *name, uchar *buf, unsigned len)
+int getenv_r (char *name, char *buf, unsigned len)
{
int i, nxt;
return (-1);
}
}
- if ((val=envmatch(name, i)) < 0)
+ if ((val=envmatch((uchar *)name, i)) < 0)
continue;
/* found; copy out */
n = 0;
#define MAX_IDENT_FIELDS 4
static uchar *known_cards[] = {
- "ARGOSY PnPIDE D5",
+ (uchar *)"ARGOSY PnPIDE D5",
NULL
};
else
break;
}
- puts (id_str);
+ puts ((char *)id_str);
putc ('\n');
for (card=known_cards; *card; ++card) {
debug ("## Compare against \"%s\"\n", *card);
- if (strcmp(*card, id_str) == 0) { /* found! */
+ if (strcmp((char *)*card, (char *)id_str) == 0) { /* found! */
debug ("## CARD FOUND ##\n");
return (1);
}
printf("error reading partinfo\n");
return 1;
}
- if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
- (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+ if ((strncmp((char *)(info.type), BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+ (strncmp((char *)(info.type), BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+ if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
puts ("\n** Bad Header Checksum **\n");
return 1;
}
printf("Error with the SPI transaction.\n");
rcode = 1;
} else {
- cp = din;
+ cp = (char *)din;
for(j = 0; j < ((bitlen + 7) / 8); j++) {
printf("%02X", *cp++);
}
if (get_partition_info (stor_dev, part, &info)) {
/* try to boot raw .... */
- strncpy(&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
- strncpy(&info.name[0], "Raw", 4);
+ strncpy((char *)&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
+ strncpy((char *)&info.name[0], "Raw", 4);
info.start=0;
info.blksz=0x200;
info.size=2880;
printf("error reading partinfo...try to boot raw\n");
}
- if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
- (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+ if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+ (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+ if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
puts ("\n** Bad Header Checksum **\n");
return 1;
}
for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
;
- lval = env_get_addr(i);
+ lval = (char *)env_get_addr(i);
rval = strchr(lval, '=');
if (rval != NULL) {
vallen = rval - lval;
debug (" %08lX ... %08lX ...",
(ulong)&(flash_addr_new->data),
sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
- if ((rc = flash_write(env_ptr->data,
+ if ((rc = flash_write((char *)env_ptr->data,
(ulong)&(flash_addr_new->data),
sizeof(env_ptr->data))) ||
(rc = flash_write((char *)&(env_ptr->crc),
ulong flash_offset;
uchar env_buffer[CFG_ENV_SECT_SIZE];
#else
- uchar *env_buffer = (char *)env_ptr;
+ uchar *env_buffer = (uchar *)env_ptr;
#endif /* CFG_ENV_SECT_SIZE */
int rcode = 0;
return 1;
puts ("Writing to Flash... ");
- rc = flash_write(env_buffer, flash_sect_addr, len);
+ rc = flash_write((char *)env_buffer, flash_sect_addr, len);
if (rc != 0) {
flash_perror (rc);
rcode = 1;
* (only some targets require alignment)
*/
int
-flash_write (uchar *src, ulong addr, ulong cnt)
+flash_write (char *src, ulong addr, ulong cnt)
{
#ifdef CONFIG_SPD823TS
return (ERR_TIMOUT); /* any other error codes are possible as well */
len = info->start[0] + info->size - addr;
if (len > cnt)
len = cnt;
- if ((i = write_buff(info, src, addr, len)) != 0) {
+ if ((i = write_buff(info, (uchar *)src, addr, len)) != 0) {
return (i);
}
cnt -= len;
static fpga_desc desc_table[CONFIG_MAX_FPGA_DEVICES];
/* Local static functions */
-static const fpga_desc * const fpga_get_desc( int devnum );
-static const fpga_desc * const fpga_validate( int devnum, void *buf,
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum );
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf,
size_t bsize, char *fn );
static int fpga_dev_info( int devnum );
/* fpga_get_desc
* map a device number to a descriptor
*/
-static const fpga_desc * const fpga_get_desc( int devnum )
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum )
{
fpga_desc *desc = (fpga_desc * )NULL;
/* fpga_validate
* generic parameter checking code
*/
-static const fpga_desc * const fpga_validate( int devnum, void *buf,
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf,
size_t bsize, char *fn )
{
- const fpga_desc * const desc = fpga_get_desc( devnum );
+ fpga_desc * desc = fpga_get_desc( devnum );
if ( !desc ) {
printf( "%s: Invalid device number %d\n", fn, devnum );
printf( "Altera Device\nDescriptor @ 0x%p\n", desc );
ret_val = altera_info( desc->devdesc );
#else
- fpga_no_sup( __FUNCTION__, "Altera devices" );
+ fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
#endif
break;
default:
#if CONFIG_FPGA & CFG_FPGA_ALTERA
ret_val = altera_reloc( desc, reloc_off );
#else
- fpga_no_sup( __FUNCTION__, "Altera devices" );
+ fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
#endif
break;
default:
/* fpga_count
* Basic interface function to get the current number of devices available.
*/
-const int fpga_count( void )
+int fpga_count( void )
{
return next_desc;
}
int fpga_load( int devnum, void *buf, size_t bsize )
{
int ret_val = FPGA_FAIL; /* assume failure */
- const fpga_desc * const desc = fpga_validate( devnum, buf, bsize, __FUNCTION__ );
+ fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
if ( desc ) {
switch ( desc->devtype ) {
#if CONFIG_FPGA & CFG_FPGA_ALTERA
ret_val = altera_load( desc->devdesc, buf, bsize );
#else
- fpga_no_sup( __FUNCTION__, "Altera devices" );
+ fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
#endif
break;
default:
int fpga_dump( int devnum, void *buf, size_t bsize )
{
int ret_val = FPGA_FAIL; /* assume failure */
- const fpga_desc * const desc = fpga_validate( devnum, buf, bsize, __FUNCTION__ );
+ fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
if ( desc ) {
switch ( desc->devtype ) {
#if CONFIG_FPGA & CFG_FPGA_ALTERA
ret_val = altera_dump( desc->devdesc, buf, bsize );
#else
- fpga_no_sup( __FUNCTION__, "Altera devices" );
+ fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
#endif
break;
default:
--- /dev/null
+/*
+ * OF flat tree builder
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <environment.h>
+
+#include <asm/errno.h>
+#include <stddef.h>
+
+#include <ft_build.h>
+
+#ifdef CONFIG_OF_FLAT_TREE
+
+/* align addr on a size boundary - adjust address up if needed -- Cort */
+#define _ALIGN(addr,size) (((addr)+(size)-1)&(~((size)-1)))
+
+static void ft_put_word(struct ft_cxt *cxt, u32 v)
+{
+ if (cxt->overflow) /* do nothing */
+ return;
+
+ /* check for overflow */
+ if (cxt->p + 4 > cxt->pstr) {
+ cxt->overflow = 1;
+ return;
+ }
+
+ *(u32 *) cxt->p = cpu_to_be32(v);
+ cxt->p += 4;
+}
+
+static inline void ft_put_bin(struct ft_cxt *cxt, const void *data, int sz)
+{
+ u8 *p;
+
+ if (cxt->overflow) /* do nothing */
+ return;
+
+ /* next pointer pos */
+ p = (u8 *) _ALIGN((unsigned long)cxt->p + sz, 4);
+
+ /* check for overflow */
+ if (p > cxt->pstr) {
+ cxt->overflow = 1;
+ return;
+ }
+
+ memcpy(cxt->p, data, sz);
+ if ((sz & 3) != 0)
+ memset(cxt->p + sz, 0, 4 - (sz & 3));
+ cxt->p = p;
+}
+
+void ft_begin_node(struct ft_cxt *cxt, const char *name)
+{
+ ft_put_word(cxt, OF_DT_BEGIN_NODE);
+ ft_put_bin(cxt, name, strlen(name) + 1);
+}
+
+void ft_end_node(struct ft_cxt *cxt)
+{
+ ft_put_word(cxt, OF_DT_END_NODE);
+}
+
+void ft_nop(struct ft_cxt *cxt)
+{
+ ft_put_word(cxt, OF_DT_NOP);
+}
+
+static int lookup_string(struct ft_cxt *cxt, const char *name)
+{
+ u8 *p;
+
+ p = cxt->pstr;
+ while (p < cxt->pstr_begin) {
+ if (strcmp(p, name) == 0)
+ return p - cxt->p_begin;
+ p += strlen(p) + 1;
+ }
+
+ return -1;
+}
+
+void ft_prop(struct ft_cxt *cxt, const char *name, const void *data, int sz)
+{
+ int len, off;
+
+ if (cxt->overflow)
+ return;
+
+ len = strlen(name) + 1;
+
+ off = lookup_string(cxt, name);
+ if (off == -1) {
+ /* check if we have space */
+ if (cxt->p + 12 + sz + len > cxt->pstr) {
+ cxt->overflow = 1;
+ return;
+ }
+
+ cxt->pstr -= len;
+ memcpy(cxt->pstr, name, len);
+ off = cxt->pstr - cxt->p_begin;
+ }
+
+ /* now put offset from beginning of *STRUCTURE* */
+ /* will be fixed up at the end */
+ ft_put_word(cxt, OF_DT_PROP);
+ ft_put_word(cxt, sz);
+ ft_put_word(cxt, off);
+ ft_put_bin(cxt, data, sz);
+}
+
+void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str)
+{
+ ft_prop(cxt, name, str, strlen(str) + 1);
+}
+
+void ft_prop_int(struct ft_cxt *cxt, const char *name, int val)
+{
+ u32 v = cpu_to_be32((u32) val);
+
+ ft_prop(cxt, name, &v, 4);
+}
+
+/* start construction of the flat OF tree */
+void ft_begin(struct ft_cxt *cxt, void *blob, int max_size)
+{
+ struct boot_param_header *bph = blob;
+ u32 off;
+
+ /* clear the cxt */
+ memset(cxt, 0, sizeof(*cxt));
+
+ cxt->bph = bph;
+ cxt->max_size = max_size;
+
+ /* zero everything in the header area */
+ memset(bph, 0, sizeof(*bph));
+
+ bph->magic = cpu_to_be32(OF_DT_HEADER);
+ bph->version = cpu_to_be32(0x10);
+ bph->last_comp_version = cpu_to_be32(0x10);
+
+ /* start pointers */
+ cxt->pres_begin = (u8 *) _ALIGN((unsigned long)(bph + 1), 8);
+ cxt->pres = cxt->pres_begin;
+
+ off = (unsigned long)cxt->pres_begin - (unsigned long)bph;
+ bph->off_mem_rsvmap = cpu_to_be32(off);
+
+ ((u64 *) cxt->pres)[0] = 0; /* phys = 0, size = 0, terminate */
+ ((u64 *) cxt->pres)[1] = 0;
+
+ cxt->p_anchor = cxt->pres + 16; /* over the terminator */
+}
+
+/* add a reserver physical area to the rsvmap */
+void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size)
+{
+ ((u64 *) cxt->pres)[0] = cpu_to_be64(physaddr); /* phys = 0, size = 0, terminate */
+ ((u64 *) cxt->pres)[1] = cpu_to_be64(size);
+
+ cxt->pres += 18; /* advance */
+
+ ((u64 *) cxt->pres)[0] = 0; /* phys = 0, size = 0, terminate */
+ ((u64 *) cxt->pres)[1] = 0;
+
+ /* keep track of size */
+ cxt->res_size = cxt->pres + 16 - cxt->pres_begin;
+
+ cxt->p_anchor = cxt->pres + 16; /* over the terminator */
+}
+
+void ft_begin_tree(struct ft_cxt *cxt)
+{
+ cxt->p_begin = cxt->p_anchor;
+ cxt->pstr_begin = (char *)cxt->bph + cxt->max_size; /* point at the end */
+
+ cxt->p = cxt->p_begin;
+ cxt->pstr = cxt->pstr_begin;
+}
+
+int ft_end_tree(struct ft_cxt *cxt)
+{
+ struct boot_param_header *bph = cxt->bph;
+ int off, sz, sz1;
+ u32 tag, v;
+ u8 *p;
+
+ ft_put_word(cxt, OF_DT_END);
+
+ if (cxt->overflow)
+ return -ENOMEM;
+
+ /* size of the areas */
+ cxt->struct_size = cxt->p - cxt->p_begin;
+ cxt->strings_size = cxt->pstr_begin - cxt->pstr;
+
+ /* the offset we must move */
+ off = (cxt->pstr_begin - cxt->p_begin) - cxt->strings_size;
+
+ /* the new strings start */
+ cxt->pstr_begin = cxt->p_begin + cxt->struct_size;
+
+ /* move the whole string area */
+ memmove(cxt->pstr_begin, cxt->pstr, cxt->strings_size);
+
+ /* now perform the fixup of the strings */
+ p = cxt->p_begin;
+ while ((tag = be32_to_cpu(*(u32 *) p)) != OF_DT_END) {
+ p += 4;
+
+ if (tag == OF_DT_BEGIN_NODE) {
+ p = (u8 *) _ALIGN((unsigned long)p + strlen(p) + 1, 4);
+ continue;
+ }
+
+ if (tag == OF_DT_END_NODE || tag == OF_DT_NOP)
+ continue;
+
+ if (tag != OF_DT_PROP)
+ return -EINVAL;
+
+ sz = be32_to_cpu(*(u32 *) p);
+ p += 4;
+
+ v = be32_to_cpu(*(u32 *) p);
+ v -= off;
+ *(u32 *) p = cpu_to_be32(v); /* move down */
+ p += 4;
+
+ p = (u8 *) _ALIGN((unsigned long)p + sz, 4);
+ }
+
+ /* fix sizes */
+ p = (char *)cxt->bph;
+ sz = (cxt->pstr_begin + cxt->strings_size) - p;
+ sz1 = _ALIGN(sz, 16); /* align at 16 bytes */
+ if (sz != sz1)
+ memset(p + sz, 0, sz1 - sz);
+ bph->totalsize = cpu_to_be32(sz1);
+ bph->off_dt_struct = cpu_to_be32(cxt->p_begin - p);
+ bph->off_dt_strings = cpu_to_be32(cxt->pstr_begin - p);
+
+ /* the new strings start */
+ cxt->pstr_begin = cxt->p_begin + cxt->struct_size;
+ cxt->pstr = cxt->pstr_begin + cxt->strings_size;
+
+ return 0;
+}
+
+/**********************************************************************/
+
+static inline int isprint(int c)
+{
+ return c >= 0x20 && c <= 0x7e;
+}
+
+static int is_printable_string(const void *data, int len)
+{
+ const char *s = data;
+ const char *ss;
+
+ /* zero length is not */
+ if (len == 0)
+ return 0;
+
+ /* must terminate with zero */
+ if (s[len - 1] != '\0')
+ return 0;
+
+ ss = s;
+ while (*s && isprint(*s))
+ s++;
+
+ /* not zero, or not done yet */
+ if (*s != '\0' || (s + 1 - ss) < len)
+ return 0;
+
+ return 1;
+}
+
+static void print_data(const void *data, int len)
+{
+ int i;
+ const u8 *s;
+
+ /* no data, don't print */
+ if (len == 0)
+ return;
+
+ if (is_printable_string(data, len)) {
+ printf(" = \"%s\"", (char *)data);
+ return;
+ }
+
+ switch (len) {
+ case 1: /* byte */
+ printf(" = <0x%02x>", (*(u8 *) data) & 0xff);
+ break;
+ case 2: /* half-word */
+ printf(" = <0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff);
+ break;
+ case 4: /* word */
+ printf(" = <0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
+ break;
+ case 8: /* double-word */
+ printf(" = <0x%16llx>", be64_to_cpu(*(uint64_t *) data));
+ break;
+ default: /* anything else... hexdump */
+ printf(" = [");
+ for (i = 0, s = data; i < len; i++)
+ printf("%02x%s", s[i], i < len - 1 ? " " : "");
+ printf("]");
+
+ break;
+ }
+}
+
+void ft_dump_blob(const void *bphp)
+{
+ const struct boot_param_header *bph = bphp;
+ const uint64_t *p_rsvmap = (const uint64_t *)
+ ((const char *)bph + be32_to_cpu(bph->off_mem_rsvmap));
+ const u32 *p_struct = (const u32 *)
+ ((const char *)bph + be32_to_cpu(bph->off_dt_struct));
+ const u32 *p_strings = (const u32 *)
+ ((const char *)bph + be32_to_cpu(bph->off_dt_strings));
+ u32 tag;
+ const u32 *p;
+ const char *s, *t;
+ int depth, sz, shift;
+ int i;
+ uint64_t addr, size;
+
+ if (be32_to_cpu(bph->magic) != OF_DT_HEADER) {
+ /* not valid tree */
+ return;
+ }
+
+ depth = 0;
+ shift = 4;
+
+ for (i = 0;; i++) {
+ addr = be64_to_cpu(p_rsvmap[i * 2]);
+ size = be64_to_cpu(p_rsvmap[i * 2 + 1]);
+ if (addr == 0 && size == 0)
+ break;
+
+ printf("/memreserve/ 0x%llx 0x%llx;\n", addr, size);
+ }
+
+ p = p_struct;
+ while ((tag = be32_to_cpu(*p++)) != OF_DT_END) {
+
+ /* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
+
+ if (tag == OF_DT_BEGIN_NODE) {
+ s = (const char *)p;
+ p = (u32 *) _ALIGN((unsigned long)p + strlen(s) + 1, 4);
+
+ printf("%*s%s {\n", depth * shift, "", s);
+
+ depth++;
+ continue;
+ }
+
+ if (tag == OF_DT_END_NODE) {
+ depth--;
+
+ printf("%*s};\n", depth * shift, "");
+ continue;
+ }
+
+ if (tag == OF_DT_NOP) {
+ printf("%*s[NOP]\n", depth * shift, "");
+ continue;
+ }
+
+ if (tag != OF_DT_PROP) {
+ fprintf(stderr, "%*s ** Unknown tag 0x%08x\n",
+ depth * shift, "", tag);
+ break;
+ }
+ sz = be32_to_cpu(*p++);
+ s = (const char *)p_strings + be32_to_cpu(*p++);
+ t = (const char *)p;
+ p = (const u32 *)_ALIGN((unsigned long)p + sz, 4);
+ printf("%*s%s", depth * shift, "", s);
+ print_data(t, sz);
+ printf(";\n");
+ }
+}
+
+void ft_backtrack_node(struct ft_cxt *cxt)
+{
+ if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE)
+ return; /* XXX only for node */
+
+ cxt->p -= 4;
+}
+
+/* note that the root node of the blob is "peeled" off */
+void ft_merge_blob(struct ft_cxt *cxt, void *blob)
+{
+ struct boot_param_header *bph = (struct boot_param_header *)blob;
+ u32 *p_struct = (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_struct));
+ u32 *p_strings =
+ (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_strings));
+ u32 tag, *p;
+ char *s, *t;
+ int depth, sz;
+
+ if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE)
+ return; /* XXX only for node */
+
+ cxt->p -= 4;
+
+ depth = 0;
+ p = p_struct;
+ while ((tag = be32_to_cpu(*p++)) != OF_DT_END) {
+
+ /* printf("tag: 0x%08x (%d) - %d\n", tag, p - p_struct, depth); */
+
+ if (tag == OF_DT_BEGIN_NODE) {
+ s = (char *)p;
+ p = (u32 *) _ALIGN((unsigned long)p + strlen(s) + 1, 4);
+
+ if (depth++ > 0)
+ ft_begin_node(cxt, s);
+
+ continue;
+ }
+
+ if (tag == OF_DT_END_NODE) {
+ ft_end_node(cxt);
+ if (--depth == 0)
+ break;
+ continue;
+ }
+
+ if (tag == OF_DT_NOP)
+ continue;
+
+ if (tag != OF_DT_PROP)
+ break;
+
+ sz = be32_to_cpu(*p++);
+ s = (char *)p_strings + be32_to_cpu(*p++);
+ t = (char *)p;
+ p = (u32 *) _ALIGN((unsigned long)p + sz, 4);
+
+ ft_prop(cxt, s, t, sz);
+ }
+}
+
+void *ft_get_prop(void *bphp, const char *propname, int *szp)
+{
+ struct boot_param_header *bph = bphp;
+ uint32_t *p_struct =
+ (uint32_t *) ((char *)bph + be32_to_cpu(bph->off_dt_struct));
+ uint32_t *p_strings =
+ (uint32_t *) ((char *)bph + be32_to_cpu(bph->off_dt_strings));
+ uint32_t version = be32_to_cpu(bph->version);
+ uint32_t tag;
+ uint32_t *p;
+ char *s, *t;
+ char *ss;
+ int sz;
+ static char path[256], prop[256];
+
+ path[0] = '\0';
+
+ p = p_struct;
+ while ((tag = be32_to_cpu(*p++)) != OF_DT_END) {
+
+ if (tag == OF_DT_BEGIN_NODE) {
+ s = (char *)p;
+ p = (uint32_t *) _ALIGN((unsigned long)p + strlen(s) +
+ 1, 4);
+ strcat(path, s);
+ strcat(path, "/");
+ continue;
+ }
+
+ if (tag == OF_DT_END_NODE) {
+ path[strlen(path) - 1] = '\0';
+ ss = strrchr(path, '/');
+ if (ss != NULL)
+ ss[1] = '\0';
+ continue;
+ }
+
+ if (tag == OF_DT_NOP)
+ continue;
+
+ if (tag != OF_DT_PROP)
+ break;
+
+ sz = be32_to_cpu(*p++);
+ s = (char *)p_strings + be32_to_cpu(*p++);
+ if (version < 0x10 && sz >= 8)
+ p = (uint32_t *) _ALIGN((unsigned long)p, 8);
+ t = (char *)p;
+ p = (uint32_t *) _ALIGN((unsigned long)p + sz, 4);
+
+ strcpy(prop, path);
+ strcat(prop, s);
+
+ if (strcmp(prop, propname) == 0) {
+ *szp = sz;
+ return t;
+ }
+ }
+
+ return NULL;
+}
+
+/********************************************************************/
+
+extern unsigned char oftree_dtb[];
+extern unsigned int oftree_dtb_len;
+
+/* Function that returns a character from the environment */
+extern uchar(*env_get_char) (int);
+
+#define BDM(x) { .name = #x, .offset = offsetof(bd_t, bi_ ##x ) }
+
+static const struct {
+ const char *name;
+ int offset;
+} bd_map[] = {
+ BDM(memstart),
+ BDM(memsize),
+ BDM(flashstart),
+ BDM(flashsize),
+ BDM(flashoffset),
+ BDM(sramstart),
+ BDM(sramsize),
+#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260) \
+ || defined(CONFIG_E500)
+ BDM(immr_base),
+#endif
+#if defined(CONFIG_MPC5xxx)
+ BDM(mbar_base),
+#endif
+#if defined(CONFIG_MPC83XX)
+ BDM(immrbar),
+#endif
+#if defined(CONFIG_MPC8220)
+ BDM(mbar_base),
+ BDM(inpfreq),
+ BDM(pcifreq),
+ BDM(pevfreq),
+ BDM(flbfreq),
+ BDM(vcofreq),
+#endif
+ BDM(bootflags),
+ BDM(ip_addr),
+ BDM(intfreq),
+ BDM(busfreq),
+#ifdef CONFIG_CPM2
+ BDM(cpmfreq),
+ BDM(brgfreq),
+ BDM(sccfreq),
+ BDM(vco),
+#endif
+#if defined(CONFIG_MPC5xxx)
+ BDM(ipbfreq),
+ BDM(pcifreq),
+#endif
+ BDM(baudrate),
+};
+
+void ft_setup(void *blob, int size, bd_t * bd)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ u8 *end;
+ u32 *p;
+ int len;
+ struct ft_cxt cxt;
+ int i, k, nxt;
+ static char tmpenv[256];
+ char *s, *lval, *rval;
+ ulong clock;
+ uint32_t v;
+
+ /* disable OF tree; booting old kernel */
+ if (getenv("disable_of") != NULL) {
+ memcpy(blob, bd, sizeof(*bd));
+ return;
+ }
+
+ ft_begin(&cxt, blob, size);
+
+ /* fs_add_rsvmap not used */
+
+ ft_begin_tree(&cxt);
+
+ ft_begin_node(&cxt, "");
+
+ ft_end_node(&cxt);
+
+ /* copy RO tree */
+ ft_merge_blob(&cxt, oftree_dtb);
+
+ /* back into root */
+ ft_backtrack_node(&cxt);
+
+ ft_begin_node(&cxt, "u-boot-env");
+
+ for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
+ for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) ;
+ s = tmpenv;
+ for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k)
+ *s++ = env_get_char(k);
+ *s++ = '\0';
+ lval = tmpenv;
+ s = strchr(tmpenv, '=');
+ if (s != NULL) {
+ *s++ = '\0';
+ rval = s;
+ } else
+ continue;
+ ft_prop_str(&cxt, lval, rval);
+ }
+
+ ft_end_node(&cxt);
+
+ ft_begin_node(&cxt, "chosen");
+
+ ft_prop_str(&cxt, "name", "chosen");
+ ft_prop_str(&cxt, "bootargs", getenv("bootargs"));
+ ft_prop_int(&cxt, "linux,platform", 0x600); /* what is this? */
+
+ ft_end_node(&cxt);
+
+ ft_end_node(&cxt); /* end root */
+
+ ft_end_tree(&cxt);
+
+ /*
+ printf("merged OF-tree\n");
+ ft_dump_blob(blob);
+ */
+
+ /* paste the bd_t at the end of the flat tree */
+ end = (char *)blob +
+ be32_to_cpu(((struct boot_param_header *)blob)->totalsize);
+ memcpy(end, bd, sizeof(*bd));
+
+#ifdef CONFIG_PPC
+
+ for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) {
+ sprintf(tmpenv, "/bd_t/%s", bd_map[i].name);
+ v = *(uint32_t *)((char *)bd + bd_map[i].offset);
+
+ p = ft_get_prop(blob, tmpenv, &len);
+ if (p != NULL)
+ *p = cpu_to_be32(v);
+ }
+
+ p = ft_get_prop(blob, "/bd_t/enetaddr", &len);
+ if (p != NULL)
+ memcpy(p, bd->bi_enetaddr, 6);
+
+ p = ft_get_prop(blob, "/bd_t/ethspeed", &len);
+ if (p != NULL)
+ *p = cpu_to_be32((uint32_t) bd->bi_ethspeed);
+
+ clock = bd->bi_intfreq;
+ p = ft_get_prop(blob, "/cpus/" OF_CPU "/clock-frequency", &len);
+ if (p != NULL)
+ *p = cpu_to_be32(clock);
+
+#ifdef OF_TBCLK
+ clock = OF_TBCLK;
+ p = ft_get_prop(blob, "/cpus/" OF_CPU "/timebase-frequency", &len);
+ if (p != NULL)
+ *p = cpu_to_be32(OF_TBCLK);
+#endif
+
+#endif /* __powerpc__ */
+
+ /*
+ printf("final OF-tree\n");
+ ft_dump_blob(blob);
+ */
+
+}
+
+#endif
#endif
/* "globals" within this file */
-static char *ifs;
+static uchar *ifs;
static char map[256];
#ifndef __U_BOOT__
static int fake_mode;
void update_ifs_map(void)
{
/* char *ifs and char map[256] are both globals. */
- ifs = getenv("IFS");
- if (ifs == NULL) ifs=" \t\n";
+ ifs = (uchar *)getenv("IFS");
+ if (ifs == NULL) ifs=(uchar *)" \t\n";
/* Precompute a list of 'flow through' behavior so it can be treated
* quickly up front. Computation is necessary because of IFS.
* Special case handling of IFS == " \t\n" is not implemented.
*/
memset(map,0,sizeof(map)); /* most characters flow through always */
#ifndef __U_BOOT__
- mapset("\\$'\"`", 3); /* never flow through */
- mapset("<>;&|(){}#", 1); /* flow through if quoted */
+ mapset((uchar *)"\\$'\"`", 3); /* never flow through */
+ mapset((uchar *)"<>;&|(){}#", 1); /* flow through if quoted */
#else
- mapset("\\$'\"", 3); /* never flow through */
- mapset(";&|#", 1); /* flow through if quoted */
+ mapset((uchar *)"\\$'\"", 3); /* never flow through */
+ mapset((uchar *)";&|#", 1); /* flow through if quoted */
#endif
mapset(ifs, 2); /* also flow through if quoted */
}
ctx.type = flag;
initialize_context(&ctx);
update_ifs_map();
- if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset(";$&|", 0);
+ if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0);
inp->promptmode=1;
rcode = parse_stream(&temp, &ctx, inp, '\n');
#ifdef __U_BOOT__
}
*buf = 0;
longjmp_on_fault = 0;
- return buf;
+ return (unsigned char *)buf;
}
/* convert the hex array pointed to by buf into binary to be placed in mem
*ptr++ = hexchars[rp->num >> 4];
*ptr++ = hexchars[rp->num & 0xf];
*ptr++ = ':';
- ptr = mem2hex((char *)&rp->val, ptr, 4);
+ ptr = (char *)mem2hex((char *)&rp->val, ptr, 4);
*ptr++ = ';';
}
printf("kgdb: remcomOutBuffer: %s\n", remcomOutBuffer);
#endif
- putpacket(remcomOutBuffer);
+ putpacket((unsigned char *)&remcomOutBuffer);
while (1) {
volatile int errnum;
#endif
/* reply to the request */
- putpacket(remcomOutBuffer);
+ putpacket((unsigned char *)&remcomOutBuffer);
} /* while(1) */
}
buffer[0] = 'O';
mem2hex ((char *)s, &buffer[1], count);
- putpacket(buffer);
+ putpacket((unsigned char *)&buffer);
return 1;
}
static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
{
#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
- lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen (s));
+ lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
#else
- lcd_drawchars (x, y, s, strlen (s));
+ lcd_drawchars (x, y, s, strlen ((char *)s));
#endif
}
sizeof(bmp_logo_palette)/(sizeof(ushort)));
bmap = &bmp_logo_bitmap[0];
- fb = (char *)(lcd_base + y * lcd_line_length + x);
+ fb = (uchar *)(lcd_base + y * lcd_line_length + x);
if (NBITS(panel_info.vl_bpix) < 12) {
/* Leave room for default color map */
#ifdef CONFIG_MPC823
# ifdef CONFIG_LCD_INFO
sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
- lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, info, strlen(info));
+ lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
sprintf (info, "(C) 2004 DENX Software Engineering");
lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
- info, strlen(info));
+ (uchar *)info, strlen(info));
sprintf (info, " Wolfgang DENK, wd@denx.de");
lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
- info, strlen(info));
+ (uchar *)info, strlen(info));
# ifdef CONFIG_LCD_INFO_BELOW_LOGO
sprintf (info, "MPC823 CPU at %s MHz",
strmhz(temp, gd->cpu_clk));
gd->ram_size >> 20,
gd->bd->bi_flashsize >> 20 );
lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
- info, strlen(info));
+ (uchar *)info, strlen(info));
# endif /* CONFIG_LCD_INFO_BELOW_LOGO */
# endif /* CONFIG_LCD_INFO */
#ifdef CONFIG_MODEM_SUPPORT
debug ("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init);
if (do_mdm_init) {
- uchar *str = strdup(getenv("mdm_cmd"));
+ char *str = strdup(getenv("mdm_cmd"));
setenv ("preboot", str); /* set or delete definition */
if (str != NULL)
free (str);
*/
uchar i2c_reg_read(uchar i2c_addr, uchar reg)
{
- char buf;
+ uchar buf;
i2c_read(i2c_addr, reg, 1, &buf, 1);
*/
int usb_stor_CB_comdat(ccb *srb, struct us_data *us)
{
- int result;
+ int result = 0;
int dir_in,retry;
unsigned int pipe;
unsigned long status;
USB_STOR_PRINTF("CB_transport: control msg returned %d, direction is %s to go 0x%lx\n",result,dir_in ? "IN" : "OUT",srb->datalen);
if (srb->datalen) {
- result = us_one_transfer(us, pipe, srb->pdata,srb->datalen);
+ result = us_one_transfer(us, pipe, (char *)srb->pdata,srb->datalen);
USB_STOR_PRINTF("CBI attempted to transfer data, result is %d status %lX, len %d\n", result,us->pusb_dev->status,us->pusb_dev->act_len);
if(!(us->pusb_dev->status & USB_ST_NAK_REC))
break;
{
char *ptr;
- ptr=srb->pdata;
+ ptr=(char *)srb->pdata;
memset(&srb->cmd[0],0,12);
srb->cmd[0]=SCSI_REQ_SENSE;
srb->cmd[1]=srb->lun<<5;
srb->cmdlen=12;
ss->transport(srb,ss);
USB_STOR_PRINTF("Request Sense returned %02X %02X %02X\n",srb->sense_buf[2],srb->sense_buf[12],srb->sense_buf[13]);
- srb->pdata=ptr;
+ srb->pdata=(uchar *)ptr;
return 0;
}
{
int ret_val = FPGA_FAIL; /* assume a failure */
- if (!xilinx_validate (desc, __FUNCTION__)) {
+ if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
} else
switch (desc->family) {
{
int ret_val = FPGA_FAIL; /* assume a failure */
- if (!xilinx_validate (desc, __FUNCTION__)) {
+ if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
} else
switch (desc->family) {
{
int ret_val = FPGA_FAIL;
- if (xilinx_validate (desc, __FUNCTION__)) {
+ if (xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("Family: \t");
switch (desc->family) {
case Xilinx_Spartan2:
{
int ret_val = FPGA_FAIL; /* assume a failure */
- if (!xilinx_validate (desc, __FUNCTION__)) {
+ if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
} else
switch (desc->family) {
/* Init Ehternet buffers */
for (i = 0; i < RBF_FRAMEMAX; i++) {
- rbfdt[i].addr = rbf_framebuf[i];
+ rbfdt[i].addr = (unsigned long)rbf_framebuf[i];
rbfdt[i].size = 0;
}
rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
* Set individual address filter for unicast address
* and set physical address registers.
*/
- mpc5xxx_fec_set_hwaddr(fec, dev->enetaddr);
+ mpc5xxx_fec_set_hwaddr(fec, (char *)dev->enetaddr);
/*
* Set multicast address filter
unsigned long ievent;
int frame_length, len = 0;
NBUF *frame;
- char buff[FEC_MAX_PKT_SIZE];
+ uchar buff[FEC_MAX_PKT_SIZE];
#if (DEBUG & 0x1)
printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex);
static int mpc_reg_in(volatile u32 *reg)
{
- return *reg >> 24;
+ int ret = *reg >> 24;
__asm__ __volatile__ ("eieio");
+ return ret;
}
static void mpc_reg_out(volatile u32 *reg, int val, int mask)
int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len)
{
- uchar xaddr[4];
+ char xaddr[4];
struct mpc5xxx_i2c * regs = (struct mpc5xxx_i2c *)I2C_BASE;
int ret = -1;
goto Done;
}
- if (receive_bytes(chip, buf, len)) {
+ if (receive_bytes(chip, (char *)buf, len)) {
printf("i2c_read: receive_bytes failed\n");
goto Done;
}
int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
{
- uchar xaddr[4];
+ char xaddr[4];
struct mpc5xxx_i2c *regs = (struct mpc5xxx_i2c *)I2C_BASE;
int ret = -1;
goto Done;
}
- if (send_bytes(chip, buf, len)) {
+ if (send_bytes(chip, (char *)buf, len)) {
printf("i2c_write: send_bytes failed\n");
goto Done;
}
uchar i2c_reg_read(uchar chip, uchar reg)
{
- char buf;
+ uchar buf;
i2c_read(chip, reg, 1, &buf, 1);
* Set individual address filter for unicast address
* and set physical address registers.
*/
- mpc8220_fec_set_hwaddr (fec, dev->enetaddr);
+ mpc8220_fec_set_hwaddr (fec, (char *)(dev->enetaddr));
/*
* Set multicast address filter
static int mpc_reg_in (volatile u32 * reg)
{
- return *reg >> 24;
+ int ret;
+ ret = *reg >> 24;
__asm__ __volatile__ ("eieio");
+ return ret;
}
static void mpc_reg_out (volatile u32 * reg, int val, int mask)
goto Done;
}
- if (send_bytes (chip, &xaddr[4 - alen], alen)) {
+ if (send_bytes (chip, (char *)&xaddr[4 - alen], alen)) {
printf ("i2c_read: send_bytes failed\n");
goto Done;
}
goto Done;
}
- if (receive_bytes (chip, buf, len)) {
+ if (receive_bytes (chip, (char *)buf, len)) {
printf ("i2c_read: receive_bytes failed\n");
goto Done;
}
goto Done;
}
- if (send_bytes (chip, &xaddr[4 - alen], alen)) {
+ if (send_bytes (chip, (char *)&xaddr[4 - alen], alen)) {
printf ("i2c_write: send_bytes failed\n");
goto Done;
}
- if (send_bytes (chip, buf, len)) {
+ if (send_bytes (chip, (char *)buf, len)) {
printf ("i2c_write: send_bytes failed\n");
goto Done;
}
uchar i2c_reg_read (uchar chip, uchar reg)
{
- char buf;
+ uchar buf;
i2c_read (chip, reg, 1, &buf, 1);
* and looking for an <ACK> back.
*/
udelay (10000);
- return i2c_read (chip, 0, 1, (char *) &tmp, 1);
+ return i2c_read (chip, 0, 1, (uchar *) &tmp, 1);
}
uchar i2c_reg_read (uchar i2c_addr, uchar reg)
{
- char buf[1];
+ uchar buf[1];
i2c_read (i2c_addr, reg, 1, buf, 1);
uchar
i2c_reg_read(uchar chip, uchar reg)
{
- char buf;
+ uchar buf;
i2c_read(chip, reg, 1, &buf, 1);
* and looking for an <ACK> back.
*/
udelay(10000);
- return i2c_read (chip, 0, 1, (char *)&tmp, 1);
+ return i2c_read (chip, 0, 1, (uchar *)&tmp, 1);
}
uchar i2c_reg_read (uchar i2c_addr, uchar reg)
{
- char buf[1];
+ uchar buf[1];
i2c_read (i2c_addr, reg, 1, buf, 1);
* and looking for an <ACK> back.
*/
udelay(10000);
- return i2c_read (chip, 0, 1, (char *)&tmp, 1);
+ return i2c_read (chip, 0, 1, (uchar *)&tmp, 1);
}
uchar i2c_reg_read (uchar i2c_addr, uchar reg)
{
- char buf[1];
+ uchar buf[1];
i2c_read (i2c_addr, reg, 1, buf, 1);
# MA 02111-1307 USA
#
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
+PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float
uchar
i2c_reg_read(uchar i2c_addr, uchar reg)
{
- char buf;
+ uchar buf;
i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
for (i = 0; i < TEST_NUM; i++) {
for (l = TEST_MIN_LENGTH; l <= TEST_MAX_LENGTH; l += 8) {
- packet_fill (txbuf, l);
+ packet_fill ((char *)txbuf, l);
spi_xfer (l);
- if (packet_check (rxbuf, l) < 0) {
+ if (packet_check ((char *)rxbuf, l) < 0) {
goto Done;
}
}
}
}
-static inline void video_drawstring (int xx, int yy, unsigned char *s)
+static inline void video_drawstring (int xx, int yy, char *s)
{
- video_drawchars (xx, yy, s, strlen (s));
+ video_drawchars (xx, yy, (unsigned char *)s, strlen (s));
}
/* Relative to console plotting functions */
static inline void video_putstring (int xx, int yy, unsigned char *s)
{
- video_putchars (xx, yy, s, strlen (s));
+ video_putchars (xx, yy, (unsigned char *)s, strlen ((char *)s));
}
/************************************************************************/
static uint32_t mal_ier;
#if !defined(CONFIG_NET_MULTI)
-struct eth_device *emac0_dev;
+struct eth_device *emac0_dev = NULL;
#endif
/* before doing anything, figure out if we have a MAC address */
/* if not, bail */
- if (memcmp (dev->enetaddr, "\0\0\0\0\0\0", 6) == 0)
+ if (memcmp (dev->enetaddr, "\0\0\0\0\0\0", 6) == 0) {
+ printf("ERROR: ethaddr not set!\n");
return -1;
+ }
#if defined(CONFIG_440GX)
/* Need to get the OPB frequency so we can access the PHY */
int eth_init (bd_t *bis)
{
ppc_4xx_eth_initialize(bis);
- return(ppc_4xx_eth_init(emac0_dev, bis));
+ if (emac0_dev) {
+ return ppc_4xx_eth_init(emac0_dev, bis);
+ } else {
+ printf("ERROR: ethaddr not set!\n");
+ return -1;
+ }
}
int eth_send(volatile void *packet, int length)
{
-
return (ppc_4xx_eth_send(emac0_dev, packet, length));
}
*/
uchar i2c_reg_read(uchar i2c_addr, uchar reg)
{
- char buf;
+ uchar buf;
i2c_read(i2c_addr, reg, 1, &buf, 1);
int spd_read(uint addr)
{
- char data[2];
+ uchar data[2];
if (i2c_read(SPD_EEPROM_ADDRESS, addr, 1, data, 1) == 0)
return (int)data[0];
(buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
return (-1);
} /* no DOS Signature at all */
- if(strncmp(&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0)
+ if(strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0)
return DOS_PBR; /* is PBR */
return DOS_MBR; /* Is MBR */
}
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);
+ sprintf ((char *)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);
+ sprintf ((char *)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);
+ sprintf ((char *)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);
+ sprintf ((char *)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);
+ sprintf ((char *)info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num);
break;
}
/* sprintf(info->type, "%d, pt->sys_ind); */
- sprintf (info->type, "U-Boot");
+ sprintf ((char *)info->type, "U-Boot");
return 0;
}
dev_desc->dev, part_num);
return (-1);
}
- if(strncmp(ppr->stand_ident,"CD001",5)!=0) {
+ if(strncmp((char *)ppr->stand_ident,"CD001",5)!=0) {
if(verb)
printf ("** Wrong ISO Ident: %s on %d:%d **\n",
ppr->stand_ident,dev_desc->dev, part_num);
/* the validation entry seems to be ok, now search the "partition" */
entry_num=0;
offset=0x20;
- sprintf (info->type, "U-Boot");
+ sprintf ((char *)info->type, "U-Boot");
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);
+ sprintf ((char *)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);
+ sprintf ((char *)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);
+ sprintf ((char *)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);
+ sprintf ((char *)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);
+ sprintf ((char *)info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num);
break;
}
/* the bootcatalog (including validation Entry) is limited to 2048Bytes
--- /dev/null
+Open Firmware Flat Tree and usage.
+----------------------------------
+
+As part of the ongoing cleanup of the Linux PPC trees, the preferred
+way to pass bootloader and board setup information is the open
+firmware flat tree.
+
+Please take a look at the following email discussion for some
+background.
+
+ http://ozlabs.org/pipermail/linuxppc-dev/2005-August/019408.html
+ http://ozlabs.org/pipermail/linuxppc-dev/2005-August/019362.html
+
+The generated tree is part static and part dynamic.
+
+There is a static part which is compiled in with DTC and a dynamic
+part which is programmatically appended.
+
+You'll need a fairly recent DTC tool, which is available by git at
+
+ rsync://ozlabs.org/dtc/dtc.git
+
+The xxd binary dumper is needed too which I got from
+
+ ftp://ftp.uni-erlangen.de/pub/utilities/etc/xxd-1.10.tar.gz
+
+
+Pantelis Antoniou, 13 Oct 2005
static inline void video_drawstring (int xx, int yy, unsigned char *s)
{
- video_drawchars (xx, yy, s, strlen (s));
+ video_drawchars (xx, yy, s, strlen ((char *)s));
}
/*****************************************************************************/
sprintf (info, " %02d:%02d:%02d ", tm.tm_hour, tm.tm_min,
tm.tm_sec);
video_drawstring (VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
- VIDEO_INFO_Y, info);
+ VIDEO_INFO_Y, (uchar *)info);
sprintf (info, "%02d.%02d.%04d", tm.tm_mday, tm.tm_mon,
tm.tm_year);
video_drawstring (VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
- VIDEO_INFO_Y + 1 * VIDEO_FONT_HEIGHT, info);
+ VIDEO_INFO_Y + 1 * VIDEO_FONT_HEIGHT, (uchar *)info);
}
#endif
*/
len = CFG_VIDEO_LOGO_MAX_SIZE;
dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+ if (dst == NULL) {
+ printf("Error: malloc in gunzip failed!\n");
+ return(1);
+ }
if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)bmp_image, &len) != 0) {
printf ("Error: no valid bmp or bmp.gz image at %lx\n", bmp_image);
free(dst);
return 1;
}
+ if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+ printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+ }
/*
* Set addr to decompressed image
logo_plot (video_fb_address, VIDEO_COLS, 0, 0);
sprintf (info, " %s", &version_string);
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);
+ video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *)info);
#ifdef CONFIG_CONSOLE_EXTRA_INFO
{
if (*info)
video_drawstring (VIDEO_INFO_X,
VIDEO_INFO_Y + i * VIDEO_FONT_HEIGHT,
- info);
+ (uchar *)info);
}
}
#endif
{
int idx=0;
int card_number = 0;
- int cfrv;
+ unsigned int cfrv;
unsigned char timer;
pci_dev_t devbusfn;
unsigned int iobase;
#ifndef CONFIG_TULIP_FIX_DAVICOM
static void read_hw_addr(struct eth_device *dev, bd_t *bis)
{
- u_short tmp, *p = (short *)(&dev->enetaddr[0]);
+ u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
int i, j = 0;
for (i = 0; i < (ETH_ALEN >> 1); i++) {
if (!(le32_to_cpu(rd->status)) & E1000_RXD_STAT_DD)
return 0;
/*DEBUGOUT("recv: packet len=%d \n", rd->length); */
- NetReceive(packet, le32_to_cpu(rd->length));
+ NetReceive((uchar *)packet, le32_to_cpu(rd->length));
fill_rx(hw);
return 1;
}
{
u32 i, status = 0;
u32 tx_status = 0;
+ vu_long *res = (vu_long *)&tx_status;
/* Stop the transmitter */
OUTL(dev, TxOff, ChipCmd);
OUTL(dev, TxOn, ChipCmd);
for (i = 0;
- ((vu_long)tx_status = le32_to_cpu(txd.cmdsts)) & DescOwn;
+ (*res = le32_to_cpu(txd.cmdsts)) & DescOwn;
i++) {
if (i >= TOUT_LOOP) {
printf
/* get MAC address */
for (i = 0; i < 3; i++) {
u32 data;
- char *mac = &dev->enetaddr[i * 2];
+ char *mac = (char *)&dev->enetaddr[i * 2];
OUTL(dev, i * 2, RxFilterAddr);
data = INL(dev, RxFilterData);
/*
* Setup the PCI device.
*/
- pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &dev->iobase);
+ pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, (unsigned int *)&dev->iobase);
dev->iobase &= ~0xf;
PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%x: ",
/*****************************************************************************/
static void smiLoadCcr (struct ctfb_res_modes *var, unsigned short device_id)
{
- unsigned int p, q;
+ unsigned int p = 0;
+ unsigned int q = 0;
long long freq;
register GraphicDevice *pGD = (GraphicDevice *)&smi;
for(i=0;i<MAC_ADDR_LEN;i++) {
tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
}
- (uint)(regs->macstnaddr1) = *((uint *)(tmpbuf));
+ regs->macstnaddr1 = *((uint *)(tmpbuf));
tempval = *((uint *)(tmpbuf +4));
- (uint)(regs->macstnaddr2) = tempval;
+ regs->macstnaddr2 = tempval;
/* reset the indices to zero */
rxIdx = 0;
static inline void *memcpy(void *dst, const void *src, unsigned int len)
{
- void * ret = dst;
- while (len-- > 0) *((char *)dst)++ = *((char *)src)++;
- return ret;
+ char *ret = dst;
+ while (len-- > 0) *(ret)++ = *((char *)src)++;
+ return (void *)ret;
}
/* The EEPROM commands include the alway-set leading bit. */
current_tid = id;
PDEBUG ("thread_start: to be stack=0%08x",
(unsigned)lthreads[id].stack);
- setctxsp (<hreads[id].stack[STK_SIZE]);
+ setctxsp ((vu_char *)<hreads[id].stack[STK_SIZE]);
thread_launcher ();
}
/* no signature found */
return -1;
}
- if(!strncmp(&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
+ if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
/* ok, we assume we are on a PBR only */
cur_part = 1;
part_offset=0;
void rubin_do_decompress(unsigned char *bits, unsigned char *in,
unsigned char *page_out, __u32 destlen)
{
- register char *curr = page_out;
- char *end = page_out + destlen;
+ register char *curr = (char *)page_out;
+ char *end = (char *)(page_out + destlen);
register unsigned long temp;
register unsigned long result;
register unsigned long p;
rec_q <<= 1;
rec_q |= (temp >> (bit++ ^ 7)) & 1;
if (bit > 31) {
+ u32 *p = (u32 *)in;
bit = 0;
- temp = *(++((u32 *) in));
+ temp = *(++p);
+ in = (unsigned char *)p;
}
}
i0 = (bits[i] * p) >> 8;
/* length is also the same, so use ascending sort by name
*/
- cmp = strncmp(jNew->name, jOld->name, jNew->nsize);
+ cmp = strncmp((char *)jNew->name, (char *)jOld->name, jNew->nsize);
if (cmp != 0)
return cmp > 0;
struct jffs2_raw_inode *jNode;
u32 totalSize = 0;
u32 latestVersion = 0;
- char *lDest;
- char *src;
+ uchar *lDest;
+ uchar *src;
long ret;
int i;
u32 counter = 0;
#endif
if(dest) {
- src = ((char *) jNode) + sizeof(struct jffs2_raw_inode);
+ src = ((uchar *) jNode) + sizeof(struct jffs2_raw_inode);
/* ignore data behind latest known EOF */
if (jNode->offset > totalSize) {
put_fl_mem(jNode);
continue;
}
- lDest = (char *) (dest + jNode->offset);
+ lDest = (uchar *) (dest + jNode->offset);
#if 0
putLabeledWord("read_inode: src = ", src);
putLabeledWord("read_inode: dest = ", lDest);
jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
if ((pino == jDir->pino) && (len == jDir->nsize) &&
(jDir->ino) && /* 0 for unlink */
- (!strncmp(jDir->name, name, len))) { /* a match */
+ (!strncmp((char *)jDir->name, name, len))) { /* a match */
if (jDir->version < version) {
put_fl_mem(jDir);
continue;
if (st->st_mtime == (time_t)(-1)) /* some ctimes really hate -1 */
st->st_mtime = 1;
- ctime_r(&st->st_mtime, s/*,64*/); /* newlib ctime doesn't have buflen */
+ ctime_r((time_t *)&st->st_mtime, s/*,64*/); /* newlib ctime doesn't have buflen */
if ((p = strchr(s,'\n')) != NULL) *p = '\0';
if ((p = strchr(s,'\r')) != NULL) *p = '\0';
if(!d || !i) return -1;
- strncpy(fname, d->name, d->nsize);
+ strncpy(fname, (char *)d->name, d->nsize);
fname[d->nsize] = '\0';
memset(&st,0,sizeof(st));
putnstr(src, jNode->dsize);
putstr("\r\n");
#endif
- strncpy(tmp, src, jNode->dsize);
+ strncpy(tmp, (char *)src, jNode->dsize);
tmp[jNode->dsize] = '\0';
put_fl_mem(jNode);
break;
# define __arch_swab16(x) ld_le16(&x)
# define __arch_swab32(x) ld_le32(&x)
#else
-static __inline__ __const__ __u16 ___arch__swab16(__u16 value)
+static __inline__ __attribute__((const)) __u16 ___arch__swab16(__u16 value)
{
__u16 result;
return result;
}
-static __inline__ __const__ __u32 ___arch__swab32(__u32 value)
+static __inline__ __attribute__((const)) __u32 ___arch__swab32(__u32 value)
{
__u32 result;
/* crc, base, loop, mtest */
#define CFG_CMD_NET 0x00000080ULL /* bootp, tftpboot, rarpboot */
#define CFG_CMD_ENV 0x00000100ULL /* saveenv */
-#define CFG_CMD_KGDB 0x00000200ULL /* kgdb */
+#define CFG_CMD_KGDB 0x0000000000000200ULL /* kgdb */
#define CFG_CMD_PCMCIA 0x00000400ULL /* PCMCIA support */
#define CFG_CMD_IDE 0x00000800ULL /* IDE harddisk support */
#define CFG_CMD_PCI 0x00001000ULL /* pciinfo */
/* common/cmd_nvedit.c */
int env_init (void);
void env_relocate (void);
-char *getenv (uchar *);
-int getenv_r (uchar *name, uchar *buf, unsigned len);
+char *getenv (char *);
+int getenv_r (char *name, char *buf, unsigned len);
int saveenv (void);
#ifdef CONFIG_PPC /* ARM version to be fixed! */
void inline setenv (char *, char *);
#undef DEBUG
-#define CONFIG_405 1 /* This is a PPC405 CPU */
-#define CONFIG_4xx 1 /* ...member of PPC4xx family */
+#define CONFIG_405 1 /* This is a PPC405 CPU */
+#define CONFIG_4xx 1 /* ...member of PPC4xx family */
-#define CONFIG_AP1000 1 /* ...on an AP1000 board */
+#define CONFIG_AP1000 1 /* ...on an AP1000 board */
-#define CONFIG_PCI 1
+#define CONFIG_PCI 1
-#define CFG_HUSH_PARSER 1 /* use "hush" command parser */
-#define CFG_PROMPT "0> "
+#define CFG_HUSH_PARSER 1 /* use "hush" command parser */
+#define CFG_PROMPT "0> "
#define CFG_PROMPT_HUSH_PS2 "> "
-#define CONFIG_COMMAND_EDIT 1
-#define CONFIG_COMMAND_HISTORY 1
+#define CONFIG_COMMAND_EDIT 1
+#define CONFIG_COMMAND_HISTORY 1
#define CONFIG_COMPLETE_ADDRESSES 1
#define CFG_ENV_IS_IN_FLASH 1
#endif
#endif
-#define CONFIG_BAUDRATE 57600
-#define CONFIG_BOOTDELAY 3 /* autoboot after 3 seconds */
+#define CONFIG_BAUDRATE 57600
+#define CONFIG_BOOTDELAY 3 /* autoboot after 3 seconds */
-#define CONFIG_BOOTCOMMAND "" /* autoboot command */
+#define CONFIG_BOOTCOMMAND "" /* autoboot command */
/* Size (bytes) of interrupt driven serial port buffer.
* Set to 0 to use polling instead of interrupts.
*/
#undef CONFIG_SERIAL_SOFTWARE_FIFO
-#define CONFIG_BOOTARGS "console=ttyS0,57600"
+#define CONFIG_BOOTARGS "console=ttyS0,57600"
-#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
-#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
+#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
+#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
-#define CONFIG_COMMANDS ( (CONFIG_CMD_DFL & \
- (~CFG_CMD_RTC) & ~(CFG_CMD_I2C)) | \
- CFG_CMD_IRQ | \
- CFG_CMD_PCI | \
- CFG_CMD_DHCP | \
- CFG_CMD_ASKENV | \
- CFG_CMD_ELF | \
- CFG_CMD_PING | \
- CFG_CMD_MVENV \
+#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
+ CFG_CMD_ASKENV | \
+ CFG_CMD_DHCP | \
+ CFG_CMD_ELF | \
+ CFG_CMD_IRQ | \
+ CFG_CMD_MVENV | \
+ CFG_CMD_PCI | \
+ CFG_CMD_PING \
)
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>
-#undef CONFIG_WATCHDOG /* watchdog disabled */
+#undef CONFIG_WATCHDOG /* watchdog disabled */
-#define CONFIG_SYS_CLK_FREQ 30000000
+#define CONFIG_SYS_CLK_FREQ 30000000
-#define CONFIG_SPD_EEPROM 1 /* use SPD EEPROM for setup */
+#define CONFIG_SPD_EEPROM 1 /* use SPD EEPROM for setup */
/*
* Miscellaneous configurable options
*/
-#define CFG_LONGHELP /* undef to save memory */
+#define CFG_LONGHELP /* undef to save memory */
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
+#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
#else
-#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
+#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
#endif
/* usually: (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) */
-#define CFG_PBSIZE (CFG_CBSIZE+4+16) /* Print Buffer Size */
-#define CFG_MAXARGS 16 /* max number of command args */
-#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
+#define CFG_PBSIZE (CFG_CBSIZE+4+16) /* Print Buffer Size */
+#define CFG_MAXARGS 16 /* max number of command args */
+#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
-#define CFG_ALT_MEMTEST 1
-#define CFG_MEMTEST_START 0x00400000 /* memtest works on */
-#define CFG_MEMTEST_END 0x01000000 /* 4 ... 16 MB in DRAM */
+#define CFG_ALT_MEMTEST 1
+#define CFG_MEMTEST_START 0x00400000 /* memtest works on */
+#define CFG_MEMTEST_END 0x01000000 /* 4 ... 16 MB in DRAM */
/*
* If CFG_EXT_SERIAL_CLOCK, then the UART divisor is 1.
* If CFG_405_UART_ERRATA_59 and 200MHz CPU clock,
* set Linux BASE_BAUD to 403200.
*/
-#undef CFG_EXT_SERIAL_CLOCK /* external serial clock */
-#undef CFG_405_UART_ERRATA_59 /* 405GP/CR Rev. D silicon */
-
-#define CFG_NS16550_CLK 40000000
-#define CFG_DUART_CHAN 0
-#define CFG_NS16550_COM1 (0x4C000000 + 0x1000)
-#define CFG_NS16550_COM2 (0x4C800000 + 0x1000)
-#define CFG_NS16550_REG_SIZE 4
-#define CFG_NS16550 1
-#define CFG_INIT_CHAN1 1
-#define CFG_INIT_CHAN2 0
+#undef CFG_EXT_SERIAL_CLOCK /* external serial clock */
+#undef CFG_405_UART_ERRATA_59 /* 405GP/CR Rev. D silicon */
+
+#define CFG_NS16550_CLK 40000000
+#define CFG_DUART_CHAN 0
+#define CFG_NS16550_COM1 (0x4C000000 + 0x1000)
+#define CFG_NS16550_COM2 (0x4C800000 + 0x1000)
+#define CFG_NS16550_REG_SIZE 4
+#define CFG_NS16550 1
+#define CFG_INIT_CHAN1 1
+#define CFG_INIT_CHAN2 0
/* The following table includes the supported baudrates */
#define CFG_BAUDRATE_TABLE \
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-#define CFG_LOAD_ADDR 0x00100000 /* default load address */
-#define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
+#define CFG_LOAD_ADDR 0x00200000 /* default load address */
+#define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
-#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
+#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
/*-----------------------------------------------------------------------
* Start addresses for the final memory configuration
* (Set up by the startup code)
* Please note that CFG_SDRAM_BASE _must_ start at 0
*/
-#define CFG_SDRAM_BASE 0x00000000
-#define CFG_FLASH_BASE 0x20000000
-#define CFG_MONITOR_BASE TEXT_BASE
-#define CFG_MONITOR_LEN (192 * 1024) /* Reserve 196 kB for Monitor */
-#define CFG_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */
+#define CFG_SDRAM_BASE 0x00000000
+#define CFG_FLASH_BASE 0x20000000
+#define CFG_MONITOR_BASE TEXT_BASE
+#define CFG_MONITOR_LEN (192 * 1024) /* Reserve 196 kB for Monitor */
+#define CFG_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */
/*
* For booting Linux, the board info and command line data
* have to be in the first 8 MB of memory, since this is
* the maximum mapped by the Linux kernel during initialization.
*/
-#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
+#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
/*-----------------------------------------------------------------------
* FLASH organization
*/
-#define CFG_FLASH_CFI 1
-#define CFG_PROGFLASH_BASE CFG_FLASH_BASE
-#define CFG_CONFFLASH_BASE 0x24000000
+#define CFG_FLASH_CFI 1
+#define CFG_PROGFLASH_BASE CFG_FLASH_BASE
+#define CFG_CONFFLASH_BASE 0x24000000
-#define CFG_MAX_FLASH_BANKS 2 /* max number of memory banks */
-#define CFG_MAX_FLASH_SECT 256 /* max number of sectors on one chip */
+#define CFG_MAX_FLASH_BANKS 2 /* max number of memory banks */
+#define CFG_MAX_FLASH_SECT 256 /* max number of sectors on one chip */
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
-#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
+#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
-#define CFG_FLASH_PROTECTION 1 /* use hardware protection */
+#define CFG_FLASH_PROTECTION 1 /* use hardware protection */
/* BEG ENVIRONNEMENT FLASH */
#ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_OFFSET 0x00040000 /* Offset of Environment Sector */
-#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
-#define CFG_ENV_SECT_SIZE 0x20000 /* see README - env sector total size */
+#define CFG_ENV_OFFSET 0x00040000 /* Offset of Environment Sector */
+#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
+#define CFG_ENV_SECT_SIZE 0x20000 /* see README - env sector total size */
#endif
/* END ENVIRONNEMENT FLASH */
/*-----------------------------------------------------------------------
* NVRAM organization
*/
-#define CFG_NVRAM_BASE_ADDR 0xf0000000 /* NVRAM base address */
-#define CFG_NVRAM_SIZE 0x1ff8 /* NVRAM size */
+#define CFG_NVRAM_BASE_ADDR 0xf0000000 /* NVRAM base address */
+#define CFG_NVRAM_SIZE 0x1ff8 /* NVRAM size */
#ifdef CFG_ENV_IS_IN_NVRAM
-#define CFG_ENV_SIZE 0x1000 /* Size of Environment vars */
+#define CFG_ENV_SIZE 0x1000 /* Size of Environment vars */
#define CFG_ENV_ADDR \
(CFG_NVRAM_BASE_ADDR+CFG_NVRAM_SIZE-CFG_ENV_SIZE) /* Env */
#endif
/*-----------------------------------------------------------------------
* Cache Configuration
*/
-#define CFG_DCACHE_SIZE 16384
-#define CFG_CACHELINE_SIZE 32
+#define CFG_DCACHE_SIZE 16384
+#define CFG_CACHELINE_SIZE 32
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-#define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */
+#define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */
#endif
/*
* BR0/1 and OR0/1 (FLASH)
*/
-#define FLASH_BASE0_PRELIM CFG_FLASH_BASE /* FLASH bank #0 */
-#define FLASH_BASE1_PRELIM 0 /* FLASH bank #1 */
+#define FLASH_BASE0_PRELIM CFG_FLASH_BASE /* FLASH bank #0 */
+#define FLASH_BASE1_PRELIM 0 /* FLASH bank #1 */
/* Configuration Port location */
-#define CONFIG_PORT_ADDR 0xF0000500
+#define CONFIG_PORT_ADDR 0xF0000500
/*-----------------------------------------------------------------------
* Definitions for initial stack pointer and data area (in DPRAM)
#define CFG_INIT_RAM_ADDR 0x400000 /* inside of SDRAM */
#define CFG_INIT_RAM_END 0x2000 /* End of used area in RAM */
-#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
-#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
/*-----------------------------------------------------------------------
*
* Boot Flags
*/
-#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM 0x02 /* Software reboot */
+#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
+#define BOOTFLAG_WARM 0x02 /* Software reboot */
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
+#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
#endif
/* JFFS2 stuff */
-#define CFG_JFFS2_FIRST_BANK 0
-#define CFG_JFFS2_NUM_BANKS 1
-#define CFG_JFFS2_FIRST_SECTOR 1
+#define CFG_JFFS2_FIRST_BANK 0
+#define CFG_JFFS2_NUM_BANKS 1
+#define CFG_JFFS2_FIRST_SECTOR 1
#define CONFIG_NET_MULTI
#define CONFIG_E1000
-#define CFG_ETH_DEV_FN 0x0800
-#define CFG_ETH_IOBASE 0x31000000
-#define CFG_ETH_MEMBASE 0x32000000
+#define CFG_ETH_DEV_FN 0x0800
+#define CFG_ETH_IOBASE 0x31000000
+#define CFG_ETH_MEMBASE 0x32000000
#endif /* __CONFIG_H */
#define CFG_LCD_MEM CFG_LCD_BIG_MEM
#define CFG_LCD_REG CFG_LCD_BIG_REG
-#define CFG_LCD_LOGO_MAX_SIZE (1024*1024)
+#define CFG_VIDEO_LOGO_MAX_SIZE (1 << 20)
/*-----------------------------------------------------------------------
* Definitions for initial stack pointer and data area (in data cache)
#define CFG_CONSOLE_IS_IN_ENV
#define CONFIG_SPLASH_SCREEN
#define CONFIG_VIDEO_BMP_GZIP /* gzip compressed bmp images */
-#define CFG_VIDEO_LOGO_MAX_SIZE (1024*1024) /* for decompressed img */
+#define CFG_VIDEO_LOGO_MAX_SIZE (2 << 20) /* for decompressed img */
#define ADD_BMP_CMD CFG_CMD_BMP
#else
#define CFG_FLASH_BASE 0xFFF80000
#define CFG_MONITOR_BASE TEXT_BASE
#define CFG_MONITOR_LEN (512 * 1024) /* Reserve 512 kB for Monitor */
-#define CFG_MALLOC_LEN (2 * 1024*1024) /* Reserve 2 MB for malloc() */
+#define CFG_MALLOC_LEN (4 << 20) /* Reserve 4 MB for malloc() */
#if (CFG_MONITOR_BASE < FLASH_BASE0_PRELIM)
# define CFG_RAMBOOT 1
#define CFG_LCD_SMALL_MEM 0xF1400000 /* Epson S1D13704 Mem Base Address */
#define CFG_LCD_SMALL_REG 0xF140FFE0 /* Epson S1D13704 Reg Base Address */
-#define CFG_LCD_LOGO_MAX_SIZE (1024*1024)
-
/*-----------------------------------------------------------------------
* Universal Interrupt Controller (UIC) Setup
*/
#define SCL 0x1000 /* PA 3 */
#define SDA 0x2000 /* PA 2 */
-#define PAR immr->im_ioport.iop_papar
-#define DIR immr->im_ioport.iop_padir
-#define DAT immr->im_ioport.iop_padat
-
-#define I2C_INIT {PAR &= ~(SCL | SDA); DIR |= SCL;}
-#define I2C_ACTIVE (DIR |= SDA)
-#define I2C_TRISTATE (DIR &= ~SDA)
-#define I2C_READ ((DAT & SDA) != 0)
-#define I2C_SDA(bit) if (bit) DAT |= SDA; \
- else DAT &= ~SDA
-#define I2C_SCL(bit) if (bit) DAT |= SCL; \
- else DAT &= ~SCL
-#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
+#define __I2C_DIR immr->im_ioport.iop_padir
+#define __I2C_DAT immr->im_ioport.iop_padat
+#define __I2C_PAR immr->im_ioport.iop_papar
+#define I2C_INIT { __I2C_PAR &= ~(SDA|SCL); \
+ __I2C_DIR |= (SDA|SCL); }
+#define I2C_READ ((__I2C_DAT & SDA) ? 1 : 0)
+#define I2C_SDA(x) { if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
+#define I2C_SCL(x) { if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
+#define I2C_DELAY { udelay(5); }
+#define I2C_ACTIVE { __I2C_DIR |= SDA; }
+#define I2C_TRISTATE { __I2C_DIR &= ~SDA; }
#define CONFIG_RTC_PCF8563
#define CFG_I2C_RTC_ADDR 0x51
#define CONFIG_NET_MULTI
#define CONFIG_PCI_PNP /* do pci plug-and-play */
-#define CONFIG_EEPRO100
+/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
#define CONFIG_E1000
#undef CONFIG_TULIP
#if defined (CONFIG_SOFT_I2C)
#define SDA 0x00010
#define SCL 0x00020
-#define DIR immr->im_cpm.cp_pbdir
-#define DAT immr->im_cpm.cp_pbdat
-#define PAR immr->im_cpm.cp_pbpar
-#define ODR immr->im_cpm.cp_pbodr
-#define I2C_INIT {PAR&=~(SDA|SCL);ODR&=~(SDA|SCL);DAT|=(SDA|SCL);DIR|=(SDA|SCL);}
-#define I2C_READ ((DAT&SDA)?1:0)
-#define I2C_SDA(x) {if(x)DAT|=SDA;else DAT&=~SDA;}
-#define I2C_SCL(x) {if(x)DAT|=SCL;else DAT&=~SCL;}
-#define I2C_DELAY {udelay(5);}
-#define I2C_ACTIVE {DIR|=SDA;}
-#define I2C_TRISTATE {DIR&=~SDA;}
+#define __I2C_DIR immr->im_cpm.cp_pbdir
+#define __I2C_DAT immr->im_cpm.cp_pbdat
+#define __I2C_PAR immr->im_cpm.cp_pbpar
+#define __I2C_ODR immr->im_cpm.cp_pbodr
+#define I2C_INIT { __I2C_PAR &= ~(SDA|SCL); \
+ __I2C_ODR &= ~(SDA|SCL); \
+ __I2C_DAT |= (SDA|SCL); \
+ __I2C_DIR|=(SDA|SCL); }
+#define I2C_READ ((__I2C_DAT & SDA) ? 1 : 0)
+#define I2C_SDA(x) { if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
+#define I2C_SCL(x) { if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
+#define I2C_DELAY { udelay(5); }
+#define I2C_ACTIVE { __I2C_DIR |= SDA; }
+#define I2C_TRISTATE { __I2C_DIR &= ~SDA; }
#endif
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
#define CONFIG_PCI_IO_SIZE 0x01000000
#define CONFIG_NET_MULTI 1
-#define CONFIG_EEPRO100 1
+/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
#define CFG_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */
#define CONFIG_NS8382X 1
#endif /* CONFIG_STK52XX */
#define CONFIG_NET_MULTI
#define CONFIG_PCI_PNP /* do pci plug-and-play */
-#define CONFIG_EEPRO100
+/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
#undef CONFIG_TULIP
#if !defined(CONFIG_PCI_PNP)
#define CFG_LCD_SMALL_MEM 0xF1400000 /* Epson S1D13704 Mem Base Address */
#define CFG_LCD_SMALL_REG 0xF140FFE0 /* Epson S1D13704 Reg Base Address */
-#define CFG_LCD_LOGO_MAX_SIZE (1024*1024)
+#define CFG_VIDEO_LOGO_MAX_SIZE (1 << 20)
/*-----------------------------------------------------------------------
* FPGA stuff
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_ENV_OFFSET 0x000047A4 /* Offset of Environment Sector */
#define CFG_ENV_SIZE 0x00002000 /* Total Size of Environment Sector */
-#define ENV_CRC 0x8BF6F24B
+/* #define ENV_CRC 0x8BF6F24B XXX - FIXME: gets defined automatically */
#define CFG_MALLOC_LEN (512 << 10) /* Reserve 512 kB for malloc() */
#define CFG_XLB_PIPELINING 1
#define CONFIG_NET_MULTI 1
-#define CONFIG_EEPRO100 1
+/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
#define CFG_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */
#define CONFIG_NS8382X 1
#define CONFIG_CRC32_VERIFY 1
#define CONFIG_HUSH_OLD_PARSER_COMPATIBLE 1
-/* Note: change below for your network setting!!!
- * This was done just to facilitate manufacturing test and configuration.
- */
-#define CONFIG_ETHADDR 00:e0:0c:07:9b:8a
+/*****************************************************************************/
+
+/* pass open firmware flat tree */
+#define CONFIG_OF_FLAT_TREE 1
-#define CONFIG_SERVERIP 192.168.08.1
-#define CONFIG_IPADDR 192.168.08.85
-#define CONFIG_GATEWAYIP 192.168.08.1
-#define CONFIG_NETMASK 255.255.255.0
-#define CONFIG_HOSTNAME stx_xtc
-#define CONFIG_ROOTPATH /xtcroot
-#define CONFIG_BOOTFILE uImage
-#define CONFIG_LOADADDR 0x1000000
+/* maximum size of the flat tree (8K) */
+#define OF_FLAT_TREE_MAX_SIZE 8192
+#define OF_CPU "PowerPC,MPC870@0"
+#define OF_TBCLK (MPC8XX_HZ / 16)
#endif /* __CONFIG_H */
/* common/flash.c */
extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
-extern int flash_write (uchar *, ulong, ulong);
+extern int flash_write (char *, ulong, ulong);
extern flash_info_t *addr2info (ulong);
extern int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
/* root function definitions */
extern void fpga_init( ulong reloc_off );
extern int fpga_add( fpga_type devtype, void *desc );
-extern const int fpga_count( void );
+extern int fpga_count( void );
extern int fpga_load( int devnum, void *buf, size_t bsize );
extern int fpga_dump( int devnum, void *buf, size_t bsize );
extern int fpga_info( int devnum );
--- /dev/null
+/*
+ * OF Flat tree builder
+ *
+ */
+
+#ifndef FT_BUILD_H
+#define FT_BUILD_H
+
+#include <linux/types.h>
+#include <asm/u-boot.h>
+
+/* Definitions used by the flattened device tree */
+#define OF_DT_HEADER 0xd00dfeed /* marker */
+#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
+#define OF_DT_END_NODE 0x2 /* End node */
+#define OF_DT_PROP 0x3 /* Property: name off, size,
+ * content */
+#define OF_DT_NOP 0x4 /* nop */
+#define OF_DT_END 0x9
+
+#define OF_DT_VERSION 0x10
+
+struct boot_param_header {
+ u32 magic; /* magic word OF_DT_HEADER */
+ u32 totalsize; /* total size of DT block */
+ u32 off_dt_struct; /* offset to structure */
+ u32 off_dt_strings; /* offset to strings */
+ u32 off_mem_rsvmap; /* offset to memory reserve map */
+ u32 version; /* format version */
+ u32 last_comp_version; /* last compatible version */
+ /* version 2 fields below */
+ u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
+ /* version 3 fields below */
+ u32 dt_strings_size; /* size of the DT strings block */
+};
+
+struct ft_cxt {
+ struct boot_param_header *bph;
+ int max_size; /* maximum size of tree */
+ int overflow; /* set when this happens */
+ u8 *p, *pstr, *pres; /* running pointers */
+ u8 *p_begin, *pstr_begin, *pres_begin; /* starting pointers */
+ u8 *p_anchor; /* start of constructed area */
+ int struct_size, strings_size, res_size;
+};
+
+void ft_begin_node(struct ft_cxt *cxt, const char *name);
+void ft_end_node(struct ft_cxt *cxt);
+
+void ft_begin_tree(struct ft_cxt *cxt);
+int ft_end_tree(struct ft_cxt *cxt);
+
+void ft_nop(struct ft_cxt *cxt);
+void ft_prop(struct ft_cxt *cxt, const char *name, const void *data, int sz);
+void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str);
+void ft_prop_int(struct ft_cxt *cxt, const char *name, int val);
+void ft_begin(struct ft_cxt *cxt, void *blob, int max_size);
+void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size);
+
+void ft_setup(void *blob, int size, bd_t * bd);
+
+void ft_dump_blob(const void *bphp);
+void ft_merge_blob(struct ft_cxt *cxt, void *blob);
+void *ft_get_prop(void *bphp, const char *propname, int *szp);
+
+#endif
#endif /* OPTIMIZE */
-static __inline__ __const__ __u16 __fswab16(__u16 x)
+static __inline__ __attribute__((const)) __u16 __fswab16(__u16 x)
{
return __arch__swab16(x);
}
__arch__swab16s(addr);
}
-static __inline__ __const__ __u32 __fswab32(__u32 x)
+static __inline__ __attribute__((const)) __u32 __fswab32(__u32 x)
{
return __arch__swab32(x);
}
}
#ifdef __BYTEORDER_HAS_U64__
-static __inline__ __const__ __u64 __fswab64(__u64 x)
+static __inline__ __attribute__((const)) __u64 __fswab64(__u64 x)
{
# ifdef __SWAB_64_THRU_32__
__u32 h = x >> 32;
extern ushort getenv_VLAN(char *);
/* copy a filename (allow for "..." notation, limit length) */
-extern void copy_filename (uchar *dst, uchar *src, int size);
+extern void copy_filename (char *dst, char *src, int size);
/**********************************************************************/
static int init_baudrate (void)
{
- uchar tmp[64]; /* long enough for environment variables */
+ char tmp[64]; /* long enough for environment variables */
int i = getenv_r ("baudrate", tmp, sizeof (tmp));
gd->baudrate = (i > 0)
/*
* reserve protected RAM
*/
- i = getenv_r ("pram", tmp, sizeof (tmp));
- reg = (i > 0) ? simple_strtoul (tmp, NULL, 10) : CONFIG_PRAM;
+ i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
+ reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
addr -= (reg << 10); /* size is in kB */
debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
#endif /* CONFIG_PRAM */
bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
#ifdef CFG_EXTBDINFO
- strncpy (bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
- strncpy (bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
+ strncpy ((char *)bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
+ strncpy ((char *)bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
bd->bi_plb_busfreq = gd->bus_clk;
/* Also take the logbuffer into account (pram is in kB) */
pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
#endif
- sprintf (memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
- setenv ("mem", memsz);
+ sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+ setenv ("mem", (char *)memsz);
}
#endif
#ifdef CONFIG_MODEM_SUPPORT
/* called from main loop (common/main.c) */
+/* 'inline' - We have to do it fast */
+static inline void mdm_readline(char *buf, int bufsiz)
+{
+ char c;
+ char *p;
+ int n;
+
+ n = 0;
+ p = buf;
+ for(;;) {
+ c = serial_getc();
+
+ /* dbg("(%c)", c); */
+
+ switch(c) {
+ case '\r':
+ break;
+ case '\n':
+ *p = '\0';
+ return;
+
+ default:
+ if(n++ > bufsiz) {
+ *p = '\0';
+ return; /* sanity check */
+ }
+ *p = c;
+ p++;
+ break;
+ }
+ }
+}
+
+
+
extern void dbg(const char *fmt, ...);
int mdm_init (void)
{
char *init_str;
int i;
extern char console_buffer[];
- static inline void mdm_readline(char *buf, int bufsiz);
extern void enable_putc(void);
extern int hwflow_onoff(int);
return 0;
}
-/* 'inline' - We have to do it fast */
-static inline void mdm_readline(char *buf, int bufsiz)
-{
- char c;
- char *p;
- int n;
-
- n = 0;
- p = buf;
- for(;;) {
- c = serial_getc();
-
- /* dbg("(%c)", c); */
-
- switch(c) {
- case '\r':
- break;
- case '\n':
- *p = '\0';
- return;
-
- default:
- if(n++ > bufsiz) {
- *p = '\0';
- return; /* sanity check */
- }
- *p = c;
- p++;
- break;
- }
- }
-}
#endif
#if 0 /* We could use plain global data, but the resulting code is bigger */
/* Retrieve extended information (we must parse the vendor area) */
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
- BootpVendorProcess(&bp->bp_vend[4], len);
+ BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
NetSetTimeout(0, (thand_f *)0);
u8 *x;
#endif
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
- uchar *hostname;
+ char *hostname;
#endif
*e++ = 99; /* RFC1048 Magic Cookie */
unsigned char bi_enetaddr[6];
int reg;
char *e,*s;
- uchar tmp[64];
+ char tmp[64];
ulong tst1, tst2, sum, m_mask, m_value = 0;
if (BootpTry ==0) {
/* Request additional information from the BOOTP/DHCP server */
#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
- ext_len = DhcpExtended(bp->bp_vend, DHCP_DISCOVER, 0, 0);
+ ext_len = DhcpExtended((u8 *)bp->bp_vend, DHCP_DISCOVER, 0, 0);
#else
- ext_len = BootpExtended(bp->bp_vend);
+ ext_len = BootpExtended((u8 *)bp->bp_vend);
#endif /* CFG_CMD_DHCP */
/*
* Copy options from OFFER packet if present
*/
NetCopyIP(&OfferedIP, &bp->bp_yiaddr);
- extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
+ extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
dhcp_state = REQUESTING;
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
- DhcpOptionsProcess(&bp->bp_vend[4]);
+ DhcpOptionsProcess((u8 *)&bp->bp_vend[4]);
BootpCopyNetParams(bp); /* Store net params from reply */
case REQUESTING:
debug ("DHCP State: REQUESTING\n");
- if ( DhcpMessageType(bp->bp_vend) == DHCP_ACK ) {
+ if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) {
char *s;
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
- DhcpOptionsProcess(&bp->bp_vend[4]);
+ DhcpOptionsProcess((u8 *)&bp->bp_vend[4]);
BootpCopyNetParams(bp); /* Store net params from reply */
dhcp_state = BOUND;
puts ("DHCP client bound to address ");
int eth_initialize(bd_t *bis)
{
- unsigned char enetvar[32], env_enetaddr[6];
+ char enetvar[32], env_enetaddr[6];
int i, eth_number = 0;
char *tmp, *end;
int odd;
ulong result = 0;
ushort leftover;
+ ushort *p;
if (len > 0) {
odd = 1 & (ulong)buff;
buff++;
}
while (len > 1) {
- result += *((const ushort *)buff)++;
+ p = (ushort *)buff;
+ result += *p++;
+ buff = (uchar *)p;
if (result & 0x80000000)
result = (result & 0xFFFF) + (result >> 16);
len -= 2;
ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2);
}
-void copy_filename (uchar *dst, uchar *src, int size)
+void copy_filename (char *dst, char *src, int size)
{
if (*src && (*src == '"')) {
++src;
}
if (rc) { /* Flash is destination for this packet */
- rc = flash_write ((uchar *)src, (ulong)(load_addr+offset), len);
+ rc = flash_write ((char *)src, (ulong)(load_addr+offset), len);
if (rc) {
flash_perror (rc);
NetState = NETLOOP_FAIL;
static int memory_post_dataline(unsigned long long * pmem)
{
- unsigned long long temp64;
+ unsigned long long temp64 = 0;
int num_patterns = sizeof(pattern)/ sizeof(pattern[0]);
int i;
unsigned int hi, lo, pathi, patlo;
int ret = 0;
if (ret == 0)
- ret = memory_post_dataline ((long long *)start);
+ ret = memory_post_dataline ((unsigned long long *)start);
WATCHDOG_RESET ();
if (ret == 0)
- ret = memory_post_addrline ((long *)start, (long *)start, size);
+ ret = memory_post_addrline ((ulong *)start, (ulong *)start, size);
WATCHDOG_RESET ();
if (ret == 0)
- ret = memory_post_addrline ((long *)(start + size - 8),
- (long *)start, size);
+ ret = memory_post_addrline ((ulong *)(start + size - 8),
+ (ulong *)start, size);
WATCHDOG_RESET ();
if (ret == 0)
ret = memory_post_test1 (start, size, 0x00000000);