Commit 4510a7b7 authored by stroese's avatar stroese

PMC405 board update

parent 12537cc5
......@@ -30,7 +30,7 @@ CPLD = ../common/xilinx_jtag/lenval.o \
../common/xilinx_jtag/micro.o \
../common/xilinx_jtag/ports.o
OBJS = $(BOARD).o strataflash.o $(CPLD)
OBJS = $(BOARD).o strataflash.o ../common/misc.o $(CPLD)
$(LIB): $(OBJS) $(SOBJS)
$(AR) crv $@ $(OBJS)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,6 +27,9 @@
#include <malloc.h>
extern void lxt971_no_sleep(void);
/* fpga configuration data - not compressed, generated by bin2c */
const unsigned char fpgadata[] =
{
......@@ -62,6 +65,18 @@ int board_early_init_f (void)
*/
mtebc (epcr, 0xa8400000);
/*
* Setup GPIO pins (CS6+CS7 as GPIO)
*/
mtdcr(cntrl0, mfdcr(cntrl0) | 0x00300000);
/*
* Configure GPIO pins
*/
out32(GPIO0_ODR, 0x00000000); /* no open drain pins */
out32(GPIO0_TCR, CFG_FPGA_PRG | CFG_FPGA_CLK | CFG_FPGA_DATA); /* setup for output */
out32(GPIO0_OR, 0); /* outputs -> low */
return 0;
}
......@@ -76,6 +91,12 @@ int misc_init_f (void)
int misc_init_r (void)
{
DECLARE_GLOBAL_DATA_PTR;
/* adjust flash start and offset */
gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
gd->bd->bi_flashoffset = 0;
return (0);
}
......@@ -99,6 +120,11 @@ int checkboard (void)
putc ('\n');
/*
* Disable sleep mode in LXT971
*/
lxt971_no_sleep();
return 0;
}
......@@ -130,3 +156,42 @@ int testdram (void)
}
/* ------------------------------------------------------------------------- */
int do_cantest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr;
volatile uchar *ptr;
volatile uchar val;
int i;
addr = simple_strtol (argv[1], NULL, 16) + 0x16;
i = 0;
for (;;) {
ptr = (uchar *)addr;
for (i=0; i<8; i++) {
*ptr = i;
val = *ptr;
if (val != i) {
printf("ERROR: addr=%p write=0x%02X, read=0x%02X\n", ptr, i, val);
return 0;
}
/* Abort if ctrl-c was pressed */
if (ctrlc()) {
puts("\nAbort\n");
return 0;
}
ptr++;
}
}
return 0;
}
U_BOOT_CMD(
cantest, 3, 1, do_cantest,
"cantest - Test CAN controller",
NULL
);
......@@ -24,7 +24,7 @@
#include <common.h>
#include <asm/processor.h>
#undef DEBUG_FLASH
#undef DEBUG_FLASH
/*
* This file implements a Common Flash Interface (CFI) driver for ppcboot.
* The width of the port and the width of the chips are determined at initialization.
......@@ -89,6 +89,8 @@
#define FLASH_MAN_CFI 0x01000000
typedef union {
unsigned char c;
unsigned short w;
......@@ -111,6 +113,7 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
*/
static void flash_add_byte(flash_info_t *info, cfiword_t * cword, uchar c);
static void flash_make_cmd(flash_info_t * info, uchar cmd, void * cmdbuf);
static void flash_write_cmd(flash_info_t * info, int sect, uchar offset, uchar cmd);
......@@ -246,7 +249,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
flash_write_cmd(info, sect, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd(info, sect, 0, FLASH_CMD_BLOCK_ERASE);
flash_write_cmd(info, sect, 0, FLASH_CMD_ERASE_CONFIRM);
if(flash_full_status_check(info, sect, info->erase_blk_tout, "erase")) {
rcode = 1;
} else
......@@ -274,7 +277,7 @@ void flash_print_info (flash_info_t *info)
info->size >> 20, info->sector_count);
printf(" Erase timeout %ld ms, write timeout %ld ms, buffer write timeout %ld ms, buffer size %d\n",
info->erase_blk_tout, info->write_tout, info->buffer_write_tout, info->buffer_size);
printf (" Sector Start Addresses:");
for (i=0; i<info->sector_count; ++i) {
#ifdef CFG_FLASH_EMPTY_INFO
......@@ -283,28 +286,28 @@ void flash_print_info (flash_info_t *info)
int erased;
volatile unsigned long *flash;
/*
* Check if whole sector is erased
*/
if (i != (info->sector_count-1))
size = info->start[i+1] - info->start[i];
else
size = info->start[0] + info->size - info->start[i];
erased = 1;
flash = (volatile unsigned long *)info->start[i];
size = size >> 2; /* divide by 4 for longword access */
for (k=0; k<size; k++)
{
if (*flash++ != 0xffffffff)
{
erased = 0;
break;
}
}
/*
* Check if whole sector is erased
*/
if (i != (info->sector_count-1))
size = info->start[i+1] - info->start[i];
else
size = info->start[0] + info->size - info->start[i];
erased = 1;
flash = (volatile unsigned long *)info->start[i];
size = size >> 2; /* divide by 4 for longword access */
for (k=0; k<size; k++)
{
if (*flash++ != 0xffffffff)
{
erased = 0;
break;
}
}
if ((i % 5) == 0)
printf ("\n ");
/* print empty and read-only info */
/* print empty and read-only info */
printf (" %08lX%s%s",
info->start[i],
erased ? " E" : " ",
......@@ -411,7 +414,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
else
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR);
if((retcode = flash_full_status_check(info, sector, info->erase_blk_tout,
if((retcode = flash_full_status_check(info, sector, info->erase_blk_tout,
prot?"protect":"unprotect")) == 0) {
info->protect[sector] = prot;
......@@ -461,7 +464,7 @@ static int flash_full_status_check(flash_info_t * info, ulong sector, ulong tout
printf("Command Sequence Error.\n");
} else if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)){
printf("Block Erase Error.\n");
retcode = ERR_NOT_ERASED;
retcode = ERR_NOT_ERASED;
} else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) {
printf("Locking Error\n");
}
......@@ -730,7 +733,7 @@ static int find_sector(flash_info_t *info, ulong addr)
{
int sector;
for(sector = info->sector_count - 1; sector >= 0; sector--) {
if(addr >= info->start[sector])
if(addr >= info->start[sector])
break;
}
return sector;
......@@ -738,7 +741,7 @@ static int find_sector(flash_info_t *info, ulong addr)
static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, int len)
{
int sector;
int cnt;
int retcode;
......@@ -786,8 +789,8 @@ static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, in
flash_write_cmd(info, sector, 0, FLASH_CMD_WRITE_BUFFER_CONFIRM);
retcode = flash_full_status_check(info, sector, info->buffer_write_tout,
"buffer write");
}
}
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
return retcode;
}
}
#endif /* CFG_USE_FLASH_BUFFER_WRITE */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment