mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-11 13:08:31 -04:00
PMC405 board update
This commit is contained in:
parent
12537cc5a9
commit
4510a7b736
@ -30,7 +30,7 @@ CPLD = ../common/xilinx_jtag/lenval.o \
|
|||||||
../common/xilinx_jtag/micro.o \
|
../common/xilinx_jtag/micro.o \
|
||||||
../common/xilinx_jtag/ports.o
|
../common/xilinx_jtag/ports.o
|
||||||
|
|
||||||
OBJS = $(BOARD).o strataflash.o $(CPLD)
|
OBJS = $(BOARD).o strataflash.o ../common/misc.o $(CPLD)
|
||||||
|
|
||||||
$(LIB): $(OBJS) $(SOBJS)
|
$(LIB): $(OBJS) $(SOBJS)
|
||||||
$(AR) crv $@ $(OBJS)
|
$(AR) crv $@ $(OBJS)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,9 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern void lxt971_no_sleep(void);
|
||||||
|
|
||||||
|
|
||||||
/* fpga configuration data - not compressed, generated by bin2c */
|
/* fpga configuration data - not compressed, generated by bin2c */
|
||||||
const unsigned char fpgadata[] =
|
const unsigned char fpgadata[] =
|
||||||
{
|
{
|
||||||
@ -62,6 +65,18 @@ int board_early_init_f (void)
|
|||||||
*/
|
*/
|
||||||
mtebc (epcr, 0xa8400000);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +91,12 @@ int misc_init_f (void)
|
|||||||
|
|
||||||
int misc_init_r (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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +120,11 @@ int checkboard (void)
|
|||||||
|
|
||||||
putc ('\n');
|
putc ('\n');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable sleep mode in LXT971
|
||||||
|
*/
|
||||||
|
lxt971_no_sleep();
|
||||||
|
|
||||||
return 0;
|
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 <common.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
|
||||||
#undef DEBUG_FLASH
|
#undef DEBUG_FLASH
|
||||||
/*
|
/*
|
||||||
* This file implements a Common Flash Interface (CFI) driver for ppcboot.
|
* 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.
|
* The width of the port and the width of the chips are determined at initialization.
|
||||||
@ -89,6 +89,8 @@
|
|||||||
#define FLASH_MAN_CFI 0x01000000
|
#define FLASH_MAN_CFI 0x01000000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
unsigned short w;
|
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_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_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);
|
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_CLEAR_STATUS);
|
||||||
flash_write_cmd(info, sect, 0, FLASH_CMD_BLOCK_ERASE);
|
flash_write_cmd(info, sect, 0, FLASH_CMD_BLOCK_ERASE);
|
||||||
flash_write_cmd(info, sect, 0, FLASH_CMD_ERASE_CONFIRM);
|
flash_write_cmd(info, sect, 0, FLASH_CMD_ERASE_CONFIRM);
|
||||||
|
|
||||||
if(flash_full_status_check(info, sect, info->erase_blk_tout, "erase")) {
|
if(flash_full_status_check(info, sect, info->erase_blk_tout, "erase")) {
|
||||||
rcode = 1;
|
rcode = 1;
|
||||||
} else
|
} else
|
||||||
@ -274,7 +277,7 @@ void flash_print_info (flash_info_t *info)
|
|||||||
info->size >> 20, info->sector_count);
|
info->size >> 20, info->sector_count);
|
||||||
printf(" Erase timeout %ld ms, write timeout %ld ms, buffer write timeout %ld ms, buffer size %d\n",
|
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);
|
info->erase_blk_tout, info->write_tout, info->buffer_write_tout, info->buffer_size);
|
||||||
|
|
||||||
printf (" Sector Start Addresses:");
|
printf (" Sector Start Addresses:");
|
||||||
for (i=0; i<info->sector_count; ++i) {
|
for (i=0; i<info->sector_count; ++i) {
|
||||||
#ifdef CFG_FLASH_EMPTY_INFO
|
#ifdef CFG_FLASH_EMPTY_INFO
|
||||||
@ -283,28 +286,28 @@ void flash_print_info (flash_info_t *info)
|
|||||||
int erased;
|
int erased;
|
||||||
volatile unsigned long *flash;
|
volatile unsigned long *flash;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if whole sector is erased
|
* Check if whole sector is erased
|
||||||
*/
|
*/
|
||||||
if (i != (info->sector_count-1))
|
if (i != (info->sector_count-1))
|
||||||
size = info->start[i+1] - info->start[i];
|
size = info->start[i+1] - info->start[i];
|
||||||
else
|
else
|
||||||
size = info->start[0] + info->size - info->start[i];
|
size = info->start[0] + info->size - info->start[i];
|
||||||
erased = 1;
|
erased = 1;
|
||||||
flash = (volatile unsigned long *)info->start[i];
|
flash = (volatile unsigned long *)info->start[i];
|
||||||
size = size >> 2; /* divide by 4 for longword access */
|
size = size >> 2; /* divide by 4 for longword access */
|
||||||
for (k=0; k<size; k++)
|
for (k=0; k<size; k++)
|
||||||
{
|
{
|
||||||
if (*flash++ != 0xffffffff)
|
if (*flash++ != 0xffffffff)
|
||||||
{
|
{
|
||||||
erased = 0;
|
erased = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i % 5) == 0)
|
if ((i % 5) == 0)
|
||||||
printf ("\n ");
|
printf ("\n ");
|
||||||
/* print empty and read-only info */
|
/* print empty and read-only info */
|
||||||
printf (" %08lX%s%s",
|
printf (" %08lX%s%s",
|
||||||
info->start[i],
|
info->start[i],
|
||||||
erased ? " E" : " ",
|
erased ? " E" : " ",
|
||||||
@ -411,7 +414,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
|
|||||||
else
|
else
|
||||||
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR);
|
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) {
|
prot?"protect":"unprotect")) == 0) {
|
||||||
|
|
||||||
info->protect[sector] = prot;
|
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");
|
printf("Command Sequence Error.\n");
|
||||||
} else if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)){
|
} else if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)){
|
||||||
printf("Block Erase Error.\n");
|
printf("Block Erase Error.\n");
|
||||||
retcode = ERR_NOT_ERASED;
|
retcode = ERR_NOT_ERASED;
|
||||||
} else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) {
|
} else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) {
|
||||||
printf("Locking Error\n");
|
printf("Locking Error\n");
|
||||||
}
|
}
|
||||||
@ -730,7 +733,7 @@ static int find_sector(flash_info_t *info, ulong addr)
|
|||||||
{
|
{
|
||||||
int sector;
|
int sector;
|
||||||
for(sector = info->sector_count - 1; sector >= 0; sector--) {
|
for(sector = info->sector_count - 1; sector >= 0; sector--) {
|
||||||
if(addr >= info->start[sector])
|
if(addr >= info->start[sector])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return sector;
|
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)
|
static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
int sector;
|
int sector;
|
||||||
int cnt;
|
int cnt;
|
||||||
int retcode;
|
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);
|
flash_write_cmd(info, sector, 0, FLASH_CMD_WRITE_BUFFER_CONFIRM);
|
||||||
retcode = flash_full_status_check(info, sector, info->buffer_write_tout,
|
retcode = flash_full_status_check(info, sector, info->buffer_write_tout,
|
||||||
"buffer write");
|
"buffer write");
|
||||||
}
|
}
|
||||||
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
|
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
#endif /* CFG_USE_FLASH_BUFFER_WRITE */
|
#endif /* CFG_USE_FLASH_BUFFER_WRITE */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user