- update board/emk tree; use common flash driver - Corrected tested bits in machine check exception in cpu/mpc5xxx/traps.c [adapted for other PPC CPUs -- wd] - Added support for the M48T08 on the EVAL5200 board in rtc/mk48t59.c * Patch by Jon Diekema, 13 Feb 2004: Call show_boot_progress() whenever POST "FAILED" is printed. * Patch by Nishant Kamat, 13 Feb 2004: Add support for TI OMAP1610 H2 Board Fixes for cpu/arm926ejs/interrupt.c (based on Richard Woodruff's patch for arm925, 16 Oct 03) Fix for a timer bug in OMAP1610 Innovator Add support for CS0 (ROM)/CS3 (Flash) boot in OMAP1610 Innovator and H2 * Patches by Stephan Linz, 12 Feb 2004: - add support for NIOS timer with variable period preload counter value - prepare POST framework support for NIOS targets * Patch by Denis Peter, 11 Feb 2004: add POST support for the MIP405 boardmaster
parent
cd0a9de68b
commit
63e73c9a8e
@ -1,502 +0,0 @@ |
|||||||
/*
|
|
||||||
* (C) Copyright 2003 |
|
||||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
|
||||||
* |
|
||||||
* (C) Copyright 2003 |
|
||||||
* Reinhard Meyer, EMK Elektronik GmbH, r.meyer@emk-elektronik.de |
|
||||||
* |
|
||||||
* See file CREDITS for list of people who contributed to this |
|
||||||
* project. |
|
||||||
* |
|
||||||
* This program is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU General Public License as |
|
||||||
* published by the Free Software Foundation; either version 2 of |
|
||||||
* the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
|
||||||
* MA 02111-1307 USA |
|
||||||
*/ |
|
||||||
|
|
||||||
#include <common.h> |
|
||||||
|
|
||||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ |
|
||||||
|
|
||||||
typedef unsigned char FLASH_PORT_WIDTH; |
|
||||||
typedef volatile unsigned char FLASH_PORT_WIDTHV; |
|
||||||
#define FLASH_ID_MASK 0xFF |
|
||||||
|
|
||||||
#define FPW FLASH_PORT_WIDTH |
|
||||||
#define FPWV FLASH_PORT_WIDTHV |
|
||||||
|
|
||||||
#define FLASH_CYCLE1 0x0aaa |
|
||||||
#define FLASH_CYCLE2 0x0555 |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
* Functions |
|
||||||
*/ |
|
||||||
static ulong flash_get_size(FPWV *addr, flash_info_t *info); |
|
||||||
static void flash_reset(flash_info_t *info); |
|
||||||
static int write_word_amd(flash_info_t *info, FPWV *dest, FPW data); |
|
||||||
static flash_info_t *flash_get_info(ulong base); |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
* flash_init() |
|
||||||
* |
|
||||||
* sets up flash_info and returns size of FLASH (bytes) |
|
||||||
*/ |
|
||||||
unsigned long flash_init (void) |
|
||||||
{ |
|
||||||
unsigned long size = 0; |
|
||||||
int i = 0; |
|
||||||
extern void flash_preinit(void); |
|
||||||
extern void flash_afterinit(uint, ulong, ulong); |
|
||||||
ulong flashbase = CFG_FLASH_BASE; |
|
||||||
|
|
||||||
flash_preinit(); |
|
||||||
|
|
||||||
/* There is only ONE FLASH device */ |
|
||||||
memset(&flash_info[i], 0, sizeof(flash_info_t)); |
|
||||||
flash_info[i].size = |
|
||||||
flash_get_size((FPW *)flashbase, &flash_info[i]); |
|
||||||
size += flash_info[i].size; |
|
||||||
|
|
||||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE |
|
||||||
/* monitor protection ON by default */ |
|
||||||
flash_protect(FLAG_PROTECT_SET, |
|
||||||
CFG_MONITOR_BASE, |
|
||||||
CFG_MONITOR_BASE+monitor_flash_len-1, |
|
||||||
flash_get_info(CFG_MONITOR_BASE)); |
|
||||||
#endif |
|
||||||
|
|
||||||
#ifdef CFG_ENV_IS_IN_FLASH |
|
||||||
/* ENV protection ON by default */ |
|
||||||
flash_protect(FLAG_PROTECT_SET, |
|
||||||
CFG_ENV_ADDR, |
|
||||||
CFG_ENV_ADDR+CFG_ENV_SIZE-1, |
|
||||||
flash_get_info(CFG_ENV_ADDR)); |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
flash_afterinit(i, flash_info[i].start[0], flash_info[i].size); |
|
||||||
return size ? size : 1; |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
*/ |
|
||||||
static void flash_reset(flash_info_t *info) |
|
||||||
{ |
|
||||||
FPWV *base = (FPWV *)(info->start[0]); |
|
||||||
|
|
||||||
/* Put FLASH back in read mode */ |
|
||||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) |
|
||||||
*base = (FPW)0x00FF00FF; /* Intel Read Mode */ |
|
||||||
else if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD) |
|
||||||
*base = (FPW)0x00F000F0; /* AMD Read Mode */ |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
*/ |
|
||||||
|
|
||||||
static flash_info_t *flash_get_info(ulong base) |
|
||||||
{ |
|
||||||
int i; |
|
||||||
flash_info_t * info; |
|
||||||
|
|
||||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) { |
|
||||||
info = & flash_info[i]; |
|
||||||
if (info->size && |
|
||||||
info->start[0] <= base && base <= info->start[0] + info->size - 1) |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
return i == CFG_MAX_FLASH_BANKS ? 0 : info; |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
*/ |
|
||||||
|
|
||||||
void flash_print_info (flash_info_t *info) |
|
||||||
{ |
|
||||||
int i; |
|
||||||
uchar *boottype; |
|
||||||
uchar *bootletter; |
|
||||||
uchar *fmt; |
|
||||||
uchar botbootletter[] = "B"; |
|
||||||
uchar topbootletter[] = "T"; |
|
||||||
uchar botboottype[] = "bottom boot sector"; |
|
||||||
uchar topboottype[] = "top boot sector"; |
|
||||||
|
|
||||||
if (info->flash_id == FLASH_UNKNOWN) { |
|
||||||
printf ("missing or unknown FLASH type\n"); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
switch (info->flash_id & FLASH_VENDMASK) { |
|
||||||
case FLASH_MAN_AMD: printf ("AMD "); break; |
|
||||||
#if 0 |
|
||||||
case FLASH_MAN_BM: printf ("BRIGHT MICRO "); break; |
|
||||||
case FLASH_MAN_FUJ: printf ("FUJITSU "); break; |
|
||||||
case FLASH_MAN_SST: printf ("SST "); break; |
|
||||||
case FLASH_MAN_STM: printf ("STM "); break; |
|
||||||
case FLASH_MAN_INTEL: printf ("INTEL "); break; |
|
||||||
#endif |
|
||||||
default: printf ("Unknown Vendor "); break; |
|
||||||
} |
|
||||||
|
|
||||||
/* check for top or bottom boot, if it applies */ |
|
||||||
if (info->flash_id & FLASH_BTYPE) { |
|
||||||
boottype = botboottype; |
|
||||||
bootletter = botbootletter; |
|
||||||
} |
|
||||||
else { |
|
||||||
boottype = topboottype; |
|
||||||
bootletter = topbootletter; |
|
||||||
} |
|
||||||
|
|
||||||
switch (info->flash_id & FLASH_TYPEMASK) { |
|
||||||
case FLASH_AM160T: |
|
||||||
case FLASH_AM160B: |
|
||||||
fmt = "29LV160%s (16 Mbit, %s)\n"; |
|
||||||
break; |
|
||||||
case FLASH_AMDLV065D: |
|
||||||
fmt = "29LV065 (64 Mbit, uniform sectors)\n"; |
|
||||||
break; |
|
||||||
default: |
|
||||||
fmt = "Unknown Chip Type\n"; |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
printf (fmt, bootletter, boottype); |
|
||||||
|
|
||||||
printf (" Size: %ld MB in %d Sectors\n", |
|
||||||
info->size >> 20, |
|
||||||
info->sector_count); |
|
||||||
|
|
||||||
printf (" Sector Start Addresses:"); |
|
||||||
|
|
||||||
for (i=0; i<info->sector_count; ++i) { |
|
||||||
if ((i % 5) == 0) { |
|
||||||
printf ("\n "); |
|
||||||
} |
|
||||||
|
|
||||||
printf (" %08lX%s", info->start[i], |
|
||||||
info->protect[i] ? " (RO)" : " "); |
|
||||||
} |
|
||||||
|
|
||||||
printf ("\n"); |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
*/ |
|
||||||
|
|
||||||
/*
|
|
||||||
* The following code cannot be run from FLASH! |
|
||||||
*/ |
|
||||||
|
|
||||||
ulong flash_get_size (FPWV *addr, flash_info_t *info) |
|
||||||
{ |
|
||||||
int i; |
|
||||||
ulong offset; |
|
||||||
|
|
||||||
/* Write auto select command: read Manufacturer ID */ |
|
||||||
/* Write auto select command sequence and test FLASH answer */ |
|
||||||
addr[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* for AMD, Intel ignores this */ |
|
||||||
addr[FLASH_CYCLE2] = (FPW)0x00550055; /* for AMD, Intel ignores this */ |
|
||||||
addr[FLASH_CYCLE1] = (FPW)0x00900090; /* selects Intel or AMD */ |
|
||||||
|
|
||||||
/* The manufacturer codes are only 1 byte, so just use 1 byte.
|
|
||||||
* This works for any bus width and any FLASH device width. |
|
||||||
*/ |
|
||||||
udelay(100); |
|
||||||
switch (addr[0] & 0xff) { |
|
||||||
|
|
||||||
case (uchar)AMD_MANUFACT: |
|
||||||
info->flash_id = FLASH_MAN_AMD; |
|
||||||
break; |
|
||||||
|
|
||||||
#if 0 |
|
||||||
case (uchar)INTEL_MANUFACT: |
|
||||||
info->flash_id = FLASH_MAN_INTEL; |
|
||||||
break; |
|
||||||
#endif |
|
||||||
|
|
||||||
default: |
|
||||||
printf ("unknown vendor=%x ", addr[0] & 0xff); |
|
||||||
info->flash_id = FLASH_UNKNOWN; |
|
||||||
info->sector_count = 0; |
|
||||||
info->size = 0; |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
/* Check 16 bits or 32 bits of ID so work on 32 or 16 bit bus. */ |
|
||||||
if (info->flash_id != FLASH_UNKNOWN) switch ((FPW)addr[2]) { |
|
||||||
|
|
||||||
case (FPW)AMD_ID_LV160B: |
|
||||||
info->flash_id += FLASH_AM160B; |
|
||||||
info->sector_count = 35; |
|
||||||
info->size = 0x00200000; |
|
||||||
#ifdef CFG_LOWBOOT |
|
||||||
offset = 0; |
|
||||||
#else |
|
||||||
offset = 0x00e00000; |
|
||||||
#endif |
|
||||||
info->start[0] = (ulong)addr + offset; |
|
||||||
info->start[1] = (ulong)addr + offset + 0x4000; |
|
||||||
info->start[2] = (ulong)addr + offset + 0x6000; |
|
||||||
info->start[3] = (ulong)addr + offset + 0x8000; |
|
||||||
for (i = 4; i < info->sector_count; i++) |
|
||||||
{ |
|
||||||
info->start[i] = (ulong)addr + offset + 0x10000 * (i-3); |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
case (FPW)AMD_ID_LV065D: |
|
||||||
info->flash_id += FLASH_AMDLV065D; |
|
||||||
info->sector_count = 128; |
|
||||||
info->size = 0x00800000; |
|
||||||
#ifdef CFG_LOWBOOT |
|
||||||
offset = 0; |
|
||||||
#else |
|
||||||
offset = 0x00800000; |
|
||||||
#endif |
|
||||||
for( i = 0; i < info->sector_count; i++ ) |
|
||||||
info->start[i] = (ulong)addr + offset + (i * 0x10000); |
|
||||||
break; /* => 8 or 16 MB */ |
|
||||||
|
|
||||||
default: |
|
||||||
printf ("unknown AMD device=%x ", (FPW)addr[2]); |
|
||||||
info->flash_id = FLASH_UNKNOWN; |
|
||||||
info->sector_count = 0; |
|
||||||
info->size = 0; |
|
||||||
return (0); /* => no or unknown flash */ |
|
||||||
} |
|
||||||
|
|
||||||
/* Put FLASH back in read mode */ |
|
||||||
flash_reset(info); |
|
||||||
|
|
||||||
return (info->size); |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
*/ |
|
||||||
|
|
||||||
int flash_erase (flash_info_t *info, int s_first, int s_last) |
|
||||||
{ |
|
||||||
FPWV *addr; |
|
||||||
int flag, prot, sect; |
|
||||||
int intel = (info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL; |
|
||||||
ulong start, now, last; |
|
||||||
int rcode = 0; |
|
||||||
|
|
||||||
if ((s_first < 0) || (s_first > s_last)) { |
|
||||||
if (info->flash_id == FLASH_UNKNOWN) { |
|
||||||
printf ("- missing\n"); |
|
||||||
} else { |
|
||||||
printf ("- no sectors to erase\n"); |
|
||||||
} |
|
||||||
return 1; |
|
||||||
} |
|
||||||
|
|
||||||
switch (info->flash_id & FLASH_TYPEMASK) { |
|
||||||
case FLASH_AMDLV065D: |
|
||||||
break; |
|
||||||
case FLASH_UNKNOWN: |
|
||||||
default: |
|
||||||
printf ("Can't erase unknown flash type %08lx - aborted\n", |
|
||||||
info->flash_id); |
|
||||||
return 1; |
|
||||||
} |
|
||||||
|
|
||||||
prot = 0; |
|
||||||
for (sect=s_first; sect<=s_last; ++sect) { |
|
||||||
if (info->protect[sect]) { |
|
||||||
prot++; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (prot) { |
|
||||||
printf ("- Warning: %d protected sectors will not be erased!\n", |
|
||||||
prot); |
|
||||||
} else { |
|
||||||
printf ("\n"); |
|
||||||
} |
|
||||||
|
|
||||||
last = get_timer(0); |
|
||||||
|
|
||||||
/* Start erase on unprotected sectors */ |
|
||||||
for (sect = s_first; sect<=s_last && rcode == 0; sect++) { |
|
||||||
|
|
||||||
if (info->protect[sect] != 0) /* protected, skip it */ |
|
||||||
continue; |
|
||||||
|
|
||||||
/* Disable interrupts which might cause a timeout here */ |
|
||||||
flag = disable_interrupts(); |
|
||||||
|
|
||||||
addr = (FPWV *)(info->start[sect]); |
|
||||||
if (intel) { |
|
||||||
*addr = (FPW)0x00500050; /* clear status register */ |
|
||||||
*addr = (FPW)0x00200020; /* erase setup */ |
|
||||||
*addr = (FPW)0x00D000D0; /* erase confirm */ |
|
||||||
} |
|
||||||
else { |
|
||||||
/* must be AMD style if not Intel */ |
|
||||||
FPWV *base; /* first address in bank */ |
|
||||||
|
|
||||||
base = (FPWV *)(info->start[0]); |
|
||||||
base[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* unlock */ |
|
||||||
base[FLASH_CYCLE2] = (FPW)0x00550055; /* unlock */ |
|
||||||
base[FLASH_CYCLE1] = (FPW)0x00800080; /* erase mode */ |
|
||||||
base[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* unlock */ |
|
||||||
base[FLASH_CYCLE2] = (FPW)0x00550055; /* unlock */ |
|
||||||
*addr = (FPW)0x00300030; /* erase sector */ |
|
||||||
} |
|
||||||
|
|
||||||
/* re-enable interrupts if necessary */ |
|
||||||
if (flag) |
|
||||||
enable_interrupts(); |
|
||||||
|
|
||||||
start = get_timer(0); |
|
||||||
|
|
||||||
/* wait at least 50us for AMD, 80us for Intel.
|
|
||||||
* Let's wait 1 ms. |
|
||||||
*/ |
|
||||||
udelay (1000); |
|
||||||
|
|
||||||
while ((*addr & (FPW)0x00800080) != (FPW)0x00800080) { |
|
||||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) { |
|
||||||
printf ("Timeout\n"); |
|
||||||
|
|
||||||
if (intel) { |
|
||||||
/* suspend erase */ |
|
||||||
*addr = (FPW)0x00B000B0; |
|
||||||
} |
|
||||||
|
|
||||||
flash_reset(info); /* reset to read mode */ |
|
||||||
rcode = 1; /* failed */ |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
/* show that we're waiting */ |
|
||||||
if ((get_timer(last)) > CFG_HZ) {/* every second */ |
|
||||||
putc ('.'); |
|
||||||
last = get_timer(0); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/* show that we're waiting */ |
|
||||||
if ((get_timer(last)) > CFG_HZ) { /* every second */ |
|
||||||
putc ('.'); |
|
||||||
last = get_timer(0); |
|
||||||
} |
|
||||||
|
|
||||||
flash_reset(info); /* reset to read mode */ |
|
||||||
} |
|
||||||
|
|
||||||
printf (" done\n"); |
|
||||||
return rcode; |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
* Copy memory to flash, returns: |
|
||||||
* 0 - OK |
|
||||||
* 1 - write timeout |
|
||||||
* 2 - Flash not erased |
|
||||||
*/ |
|
||||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) |
|
||||||
{ |
|
||||||
FPW data = 0; /* 16 or 32 bit word, matches flash bus width on MPC8XX */ |
|
||||||
int bytes; /* number of bytes to program in current word */ |
|
||||||
int left; /* number of bytes left to program */ |
|
||||||
int i, res; |
|
||||||
|
|
||||||
for (left = cnt, res = 0; |
|
||||||
left > 0 && res == 0; |
|
||||||
addr += sizeof(data), left -= sizeof(data) - bytes) { |
|
||||||
|
|
||||||
bytes = addr & (sizeof(data) - 1); |
|
||||||
addr &= ~(sizeof(data) - 1); |
|
||||||
|
|
||||||
/* combine source and destination data so can program
|
|
||||||
* an entire word of 16 or 32 bits |
|
||||||
*/ |
|
||||||
for (i = 0; i < sizeof(data); i++) { |
|
||||||
data <<= 8; |
|
||||||
if (i < bytes || i - bytes >= left ) |
|
||||||
data += *((uchar *)addr + i); |
|
||||||
else |
|
||||||
data += *src++; |
|
||||||
} |
|
||||||
|
|
||||||
/* write one word to the flash */ |
|
||||||
switch (info->flash_id & FLASH_VENDMASK) { |
|
||||||
case FLASH_MAN_AMD: |
|
||||||
res = write_word_amd(info, (FPWV *)addr, data); |
|
||||||
break; |
|
||||||
default: |
|
||||||
/* unknown flash type, error! */ |
|
||||||
printf ("missing or unknown FLASH type\n"); |
|
||||||
res = 1; /* not really a timeout, but gives error */ |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return (res); |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
* Write a word to Flash for AMD FLASH |
|
||||||
* A word is 16 or 32 bits, whichever the bus width of the flash bank |
|
||||||
* (not an individual chip) is. |
|
||||||
* |
|
||||||
* returns: |
|
||||||
* 0 - OK |
|
||||||
* 1 - write timeout |
|
||||||
* 2 - Flash not erased |
|
||||||
*/ |
|
||||||
static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data) |
|
||||||
{ |
|
||||||
ulong start; |
|
||||||
int flag; |
|
||||||
int res = 0; /* result, assume success */ |
|
||||||
FPWV *base; /* first address in flash bank */ |
|
||||||
|
|
||||||
/* Check if Flash is (sufficiently) erased */ |
|
||||||
if ((*dest & data) != data) { |
|
||||||
return (2); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
base = (FPWV *)(info->start[0]); |
|
||||||
|
|
||||||
/* Disable interrupts which might cause a timeout here */ |
|
||||||
flag = disable_interrupts(); |
|
||||||
|
|
||||||
base[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* unlock */ |
|
||||||
base[FLASH_CYCLE2] = (FPW)0x00550055; /* unlock */ |
|
||||||
base[FLASH_CYCLE1] = (FPW)0x00A000A0; /* selects program mode */ |
|
||||||
|
|
||||||
*dest = data; /* start programming the data */ |
|
||||||
|
|
||||||
/* re-enable interrupts if necessary */ |
|
||||||
if (flag) |
|
||||||
enable_interrupts(); |
|
||||||
|
|
||||||
start = get_timer (0); |
|
||||||
|
|
||||||
/* data polling for D7 */ |
|
||||||
while (res == 0 && (*dest & (FPW)0x00800080) != (data & (FPW)0x00800080)) { |
|
||||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) { |
|
||||||
*dest = (FPW)0x00F000F0; /* reset bank */ |
|
||||||
res = 1; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return (res); |
|
||||||
} |
|
@ -1,489 +0,0 @@ |
|||||||
/*
|
|
||||||
* (C) Copyright 2003 |
|
||||||
* EMK Elektronik GmbH <www.emk-elektronik.de> |
|
||||||
* Reinhard Meyer <r.meyer@emk-elektronik.de> |
|
||||||
* |
|
||||||
* copied from the BMW Port - seems that its similiar enough |
|
||||||
* to be easily adaped ;) --- Well, it turned out to become a |
|
||||||
* merger between parts of the EMKstax Flash routines and the |
|
||||||
* BMW funtion frames... |
|
||||||
* |
|
||||||
* (C) Copyright 2000 |
|
||||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
|
||||||
* |
|
||||||
* See file CREDITS for list of people who contributed to this |
|
||||||
* project. |
|
||||||
* |
|
||||||
* This program is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU General Public License as |
|
||||||
* published by the Free Software Foundation; either version 2 of |
|
||||||
* the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
|
||||||
* MA 02111-1307 USA |
|
||||||
*/ |
|
||||||
|
|
||||||
#include <common.h> |
|
||||||
#include <mpc8xx.h> |
|
||||||
|
|
||||||
#define FLASH_WORD_SIZE unsigned short |
|
||||||
#define FLASH_WORD_WIDTH (sizeof (FLASH_WORD_SIZE)) |
|
||||||
|
|
||||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
* Functions |
|
||||||
*/ |
|
||||||
static int write_word (flash_info_t *info, ulong dest, ulong data); |
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* software product ID entry/exit |
|
||||||
*****************************************************************************/ |
|
||||||
static void FlashProductIdMode ( |
|
||||||
volatile FLASH_WORD_SIZE *b, |
|
||||||
int on_off) |
|
||||||
{ |
|
||||||
b[0x5555] = 0xaa; |
|
||||||
b[0x2aaa] = 0x55; |
|
||||||
b[0x5555] = on_off ? 0x90 : 0xf0; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* sector erase start |
|
||||||
*****************************************************************************/ |
|
||||||
static void FlashSectorErase ( |
|
||||||
volatile FLASH_WORD_SIZE *b, |
|
||||||
volatile FLASH_WORD_SIZE *a) |
|
||||||
{ |
|
||||||
b[0x5555] = 0xaa; |
|
||||||
b[0x2aaa] = 0x55; |
|
||||||
b[0x5555] = 0x80; |
|
||||||
b[0x5555] = 0xaa; |
|
||||||
b[0x2aaa] = 0x55; |
|
||||||
a[0] = 0x30; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* program a word |
|
||||||
*****************************************************************************/ |
|
||||||
static void FlashProgWord ( |
|
||||||
volatile FLASH_WORD_SIZE *b, |
|
||||||
volatile FLASH_WORD_SIZE *a, |
|
||||||
FLASH_WORD_SIZE v) |
|
||||||
{ |
|
||||||
b[0x5555] = 0xaa; |
|
||||||
b[0x2aaa] = 0x55; |
|
||||||
b[0x5555] = 0xa0; |
|
||||||
a[0] = v; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* reset bank, back to read mode |
|
||||||
*****************************************************************************/ |
|
||||||
static void FlashReset (volatile FLASH_WORD_SIZE *b) |
|
||||||
{ |
|
||||||
b[0] = 0xf0; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* identify FLASH chip |
|
||||||
* this code is a stripped version of the FlashGetType() function in EMKstax |
|
||||||
*****************************************************************************/ |
|
||||||
unsigned long flash_init (void) |
|
||||||
{ |
|
||||||
volatile FLASH_WORD_SIZE * const flash = (volatile FLASH_WORD_SIZE *) CFG_FLASH_BASE; |
|
||||||
FLASH_WORD_SIZE manu, dev; |
|
||||||
flash_info_t * const pflinfo = &flash_info[0]; |
|
||||||
int j; |
|
||||||
|
|
||||||
/* get Id Bytes */ |
|
||||||
FlashProductIdMode (flash, 1); |
|
||||||
manu = flash[0]; |
|
||||||
dev = flash[1]; |
|
||||||
FlashProductIdMode (flash, 0); |
|
||||||
|
|
||||||
pflinfo->size = 0; |
|
||||||
pflinfo->sector_count = 0; |
|
||||||
pflinfo->flash_id = 0xffffffff; |
|
||||||
pflinfo->portwidth = FLASH_CFI_16BIT; |
|
||||||
pflinfo->chipwidth = FLASH_CFI_BY16; |
|
||||||
|
|
||||||
switch (manu&0xff) |
|
||||||
{ |
|
||||||
case 0x01: /* AMD */ |
|
||||||
pflinfo->flash_id = FLASH_MAN_AMD; |
|
||||||
switch (dev&0xff) |
|
||||||
{ |
|
||||||
case 0x49: |
|
||||||
pflinfo->size = 0x00200000; |
|
||||||
pflinfo->sector_count = 35; |
|
||||||
pflinfo->flash_id |= FLASH_AM160B; |
|
||||||
pflinfo->start[0] = CFG_FLASH_BASE; |
|
||||||
pflinfo->start[1] = CFG_FLASH_BASE + 0x4000; |
|
||||||
pflinfo->start[2] = CFG_FLASH_BASE + 0x6000; |
|
||||||
pflinfo->start[3] = CFG_FLASH_BASE + 0x8000; |
|
||||||
for (j = 4; j < 35; j++) |
|
||||||
{ |
|
||||||
pflinfo->start[j] = CFG_FLASH_BASE + 0x00010000 * (j-3); |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
case 0xf9: |
|
||||||
pflinfo->size = 0x00400000; |
|
||||||
pflinfo->sector_count = 71; |
|
||||||
pflinfo->flash_id |= FLASH_AM320B; |
|
||||||
pflinfo->start[0] = CFG_FLASH_BASE; |
|
||||||
pflinfo->start[1] = CFG_FLASH_BASE + 0x4000; |
|
||||||
pflinfo->start[2] = CFG_FLASH_BASE + 0x6000; |
|
||||||
pflinfo->start[3] = CFG_FLASH_BASE + 0x8000; |
|
||||||
for (j = 0; j < 8; j++) |
|
||||||
{ |
|
||||||
pflinfo->start[j] = CFG_FLASH_BASE + 0x00002000 * (j); |
|
||||||
} |
|
||||||
for (j = 8; j < 71; j++) |
|
||||||
{ |
|
||||||
pflinfo->start[j] = CFG_FLASH_BASE + 0x00010000 * (j-7); |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
default: |
|
||||||
printf ("unknown AMD dev=%x ", dev); |
|
||||||
pflinfo->flash_id |= FLASH_UNKNOWN; |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
default: |
|
||||||
printf ("unknown manu=%x ", manu); |
|
||||||
} |
|
||||||
return pflinfo->size; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* print info about a FLASH |
|
||||||
*****************************************************************************/ |
|
||||||
void flash_print_info (flash_info_t *info) |
|
||||||
{ |
|
||||||
static const char unk[] = "Unknown"; |
|
||||||
unsigned int i; |
|
||||||
const char *mfct=unk, |
|
||||||
*type=unk; |
|
||||||
|
|
||||||
if(info->flash_id != FLASH_UNKNOWN) |
|
||||||
{ |
|
||||||
switch (info->flash_id & FLASH_VENDMASK) |
|
||||||
{ |
|
||||||
case FLASH_MAN_AMD: |
|
||||||
mfct = "AMD"; |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
switch (info->flash_id & FLASH_TYPEMASK) |
|
||||||
{ |
|
||||||
case FLASH_AM160B: |
|
||||||
type = "AM29LV160B (16 Mbit, bottom boot sect)"; |
|
||||||
break; |
|
||||||
case FLASH_AM320B: |
|
||||||
type = "AM29LV320B (32 Mbit, bottom boot sect)"; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
printf ( |
|
||||||
"\n Brand: %s Type: %s\n" |
|
||||||
" Size: %lu KB in %d Sectors\n", |
|
||||||
mfct, |
|
||||||
type, |
|
||||||
info->size >> 10, |
|
||||||
info->sector_count |
|
||||||
); |
|
||||||
|
|
||||||
printf (" Sector Start Addresses:"); |
|
||||||
|
|
||||||
for (i = 0; i < info->sector_count; i++) |
|
||||||
{ |
|
||||||
unsigned long size; |
|
||||||
unsigned int erased; |
|
||||||
unsigned long *flash = (unsigned long *) info->start[i]; |
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if whole sector is erased |
|
||||||
*/ |
|
||||||
size = |
|
||||||
(i != (info->sector_count - 1)) ? |
|
||||||
(info->start[i + 1] - info->start[i]) >> 2 : |
|
||||||
(info->start[0] + info->size - info->start[i]) >> 2; |
|
||||||
|
|
||||||
for ( |
|
||||||
flash = (unsigned long *) info->start[i], erased = 1; |
|
||||||
(flash != (unsigned long *) info->start[i] + size) && erased; |
|
||||||
flash++ |
|
||||||
) |
|
||||||
erased = *flash == ~0x0UL; |
|
||||||
|
|
||||||
printf ( |
|
||||||
"%s %08lX %s %s", |
|
||||||
(i % 5) ? "" : "\n ", |
|
||||||
info->start[i], |
|
||||||
erased ? "E" : " ", |
|
||||||
info->protect[i] ? "RO" : " " |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
puts ("\n"); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* erase one or more sectors |
|
||||||
*****************************************************************************/ |
|
||||||
int flash_erase (flash_info_t *info, int s_first, int s_last) |
|
||||||
{ |
|
||||||
volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *)(info->start[0]); |
|
||||||
int flag, |
|
||||||
prot, |
|
||||||
sect, |
|
||||||
l_sect; |
|
||||||
ulong start, |
|
||||||
now, |
|
||||||
last; |
|
||||||
|
|
||||||
if ((s_first < 0) || (s_first > s_last)) |
|
||||||
{ |
|
||||||
if (info->flash_id == FLASH_UNKNOWN) |
|
||||||
{ |
|
||||||
printf ("- missing\n"); |
|
||||||
} |
|
||||||
else |
|
||||||
{ |
|
||||||
printf ("- no sectors to erase\n"); |
|
||||||
} |
|
||||||
return 1; |
|
||||||
} |
|
||||||
|
|
||||||
if ((info->flash_id == FLASH_UNKNOWN) || |
|
||||||
(info->flash_id > (FLASH_MAN_STM | FLASH_AMD_COMP))) |
|
||||||
{ |
|
||||||
printf ("Can't erase unknown flash type - aborted\n"); |
|
||||||
return 1; |
|
||||||
} |
|
||||||
|
|
||||||
prot = 0; |
|
||||||
for (sect=s_first; sect<=s_last; ++sect) |
|
||||||
{ |
|
||||||
if (info->protect[sect]) |
|
||||||
{ |
|
||||||
prot++; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (prot) |
|
||||||
{ |
|
||||||
printf ("- Warning: %d protected sectors will not be erased!\n", |
|
||||||
prot); |
|
||||||
} |
|
||||||
else |
|
||||||
{ |
|
||||||
printf ("\n"); |
|
||||||
} |
|
||||||
|
|
||||||
l_sect = -1; |
|
||||||
|
|
||||||
/* Disable interrupts which might cause a timeout here */ |
|
||||||
flag = disable_interrupts(); |
|
||||||
|
|
||||||
/* Start erase on unprotected sectors */ |
|
||||||
for (sect = s_first; sect<=s_last; sect++) |
|
||||||
{ |
|
||||||
if (info->protect[sect] == 0) |
|
||||||
{ /* not protected */ |
|
||||||
FlashSectorErase ((FLASH_WORD_SIZE *)info->start[0], (FLASH_WORD_SIZE *)info->start[sect]); |
|
||||||
l_sect = sect; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/* re-enable interrupts if necessary */ |
|
||||||
if (flag) |
|
||||||
enable_interrupts(); |
|
||||||
|
|
||||||
/* wait at least 80us - let's wait 1 ms */ |
|
||||||
udelay (1000); |
|
||||||
|
|
||||||
/*
|
|
||||||
* We wait for the last triggered sector |
|
||||||
*/ |
|
||||||
if (l_sect < 0) |
|
||||||
goto DONE; |
|
||||||
|
|
||||||
start = get_timer (0); |
|
||||||
last = start; |
|
||||||
addr = (FLASH_WORD_SIZE *)info->start[l_sect]; |
|
||||||
while ((addr[0] & 0x0080) != 0x0080) |
|
||||||
{ |
|
||||||
if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT) |
|
||||||
{ |
|
||||||
printf ("Timeout\n"); |
|
||||||
return 1; |
|
||||||
} |
|
||||||
/* show that we're waiting */ |
|
||||||
if ((now - last) > 1000) |
|
||||||
{ /* every second */ |
|
||||||
serial_putc ('.'); |
|
||||||
last = now; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
DONE: |
|
||||||
/* reset to read mode */ |
|
||||||
FlashReset ((FLASH_WORD_SIZE *)info->start[0]); |
|
||||||
|
|
||||||
printf (" done\n"); |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Copy memory to flash, returns: |
|
||||||
* 0 - OK |
|
||||||
* 1 - write timeout |
|
||||||
* 2 - Flash not erased |
|
||||||
*****************************************************************************/ |
|
||||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) |
|
||||||
{ |
|
||||||
ulong cp, |
|
||||||
wp, |
|
||||||
data; |
|
||||||
int i, |
|
||||||
l, |
|
||||||
rc; |
|
||||||
|
|
||||||
wp = (addr & ~(FLASH_WORD_WIDTH-1)); /* get lower word aligned address */ |
|
||||||
|
|
||||||
/*
|
|
||||||
* handle unaligned start bytes, if there are... |
|
||||||
*/ |
|
||||||
if ((l = addr - wp) != 0) |
|
||||||
{ |
|
||||||
data = 0; |
|
||||||
|
|
||||||
/* get the current before the new data into our data word */ |
|
||||||
for (i=0, cp=wp; i<l; ++i, ++cp) |
|
||||||
{ |
|
||||||
data = (data << 8) | (*(uchar *)cp); |
|
||||||
} |
|
||||||
|
|
||||||
/* now merge the to be programmed values */ |
|
||||||
for (; i<4 && cnt>0; ++i, ++cp, --cnt) |
|
||||||
{ |
|
||||||
data = (data << 8) | *src++; |
|
||||||
} |
|
||||||
|
|
||||||
/* get the current after the new data into our data word */ |
|
||||||
for (; cnt==0 && i<FLASH_WORD_WIDTH; ++i, ++cp) |
|
||||||
{ |
|
||||||
data = (data << 8) | (*(uchar *)cp); |
|
||||||
} |
|
||||||
|
|
||||||
/* now write the combined word */ |
|
||||||
if ((rc = write_word (info, wp, data)) != 0) |
|
||||||
{ |
|
||||||
return (rc); |
|
||||||
} |
|
||||||
wp += FLASH_WORD_WIDTH; |
|
||||||
} |
|
||||||
|
|
||||||
/*
|
|
||||||
* handle word aligned part |
|
||||||
*/ |
|
||||||
while (cnt >= FLASH_WORD_WIDTH) |
|
||||||
{ |
|
||||||
data = 0; |
|
||||||
for (i=0; i<FLASH_WORD_WIDTH; ++i) |
|
||||||
{ |
|
||||||
data = (data << 8) | *src++; |
|
||||||
} |
|
||||||
if ((rc = write_word (info, wp, data)) != 0) |
|
||||||
{ |
|
||||||
return (rc); |
|
||||||
} |
|
||||||
wp += FLASH_WORD_WIDTH; |
|
||||||
cnt -= FLASH_WORD_WIDTH; |
|
||||||
} |
|
||||||
|
|
||||||
if (cnt == 0) |
|
||||||
{ |
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/*
|
|
||||||
* handle unaligned tail bytes, if there are... |
|
||||||
*/ |
|
||||||
data = 0; |
|
||||||
|
|
||||||
/* now merge the to be programmed values */ |
|
||||||
for (i=0, cp=wp; i<FLASH_WORD_WIDTH && cnt>0; ++i, ++cp) |
|
||||||
{ |
|
||||||
data = (data << 8) | *src++; |
|
||||||
--cnt; |
|
||||||
} |
|
||||||
|
|
||||||
/* get the current after the new data into our data word */ |
|
||||||
for (; i<FLASH_WORD_WIDTH; ++i, ++cp) |
|
||||||
{ |
|
||||||
data = (data << 8) | (*(uchar *)cp); |
|
||||||
} |
|
||||||
|
|
||||||
/* now write the combined word */ |
|
||||||
return (write_word (info, wp, data)); |
|
||||||
} |
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Write a word to Flash, returns: |
|
||||||
* 0 - OK |
|
||||||
* 1 - write timeout |
|
||||||
* 2 - Flash not erased |
|
||||||
*****************************************************************************/ |
|
||||||
static int write_word (flash_info_t *info, ulong dest, ulong data) |
|
||||||
{ |
|
||||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)info->start[0]; |
|
||||||
volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest; |
|
||||||
FLASH_WORD_SIZE data2 = data; |
|
||||||
ulong start; |
|
||||||
int flag; |
|
||||||
|
|
||||||
/* Check if Flash is (sufficiently) erased */ |
|
||||||
if ((*dest2 & data2) != data2) |
|
||||||
{ |
|
||||||
return (2); |
|
||||||
} |
|
||||||
|
|
||||||
/* Disable interrupts which might cause a timeout here */ |
|
||||||
flag = disable_interrupts (); |
|
||||||
|
|
||||||
FlashProgWord (addr2, dest2, data2); |
|
||||||
|
|
||||||
/* re-enable interrupts if necessary */ |
|
||||||
if (flag) |
|
||||||
enable_interrupts (); |
|
||||||
|
|
||||||
/* data polling for D7 */ |
|
||||||
start = get_timer (0); |
|
||||||
while ((*dest2 & 0x0080) != (data2 & 0x0080)) |
|
||||||
{ |
|
||||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) |
|
||||||
{ |
|
||||||
return (1); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
|
||||||
*/ |
|
@ -0,0 +1,69 @@ |
|||||||
|
/*
|
||||||
|
* (C) Copyright 2000-2004 |
||||||
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||||
|
* |
||||||
|
* See file CREDITS for list of people who contributed to this |
||||||
|
* project. |
||||||
|
* |
||||||
|
* This program is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU General Public License as |
||||||
|
* published by the Free Software Foundation; either version 2 of |
||||||
|
* the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||||
|
* MA 02111-1307 USA |
||||||
|
* |
||||||
|
* |
||||||
|
* Atapted for ppc4XX by Denis Peter |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <common.h> |
||||||
|
#include <commproc.h> |
||||||
|
|
||||||
|
|
||||||
|
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER) |
||||||
|
|
||||||
|
void post_word_store (ulong a) |
||||||
|
{ |
||||||
|
volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR); |
||||||
|
*(volatile ulong *) save_addr = a; |
||||||
|
} |
||||||
|
|
||||||
|
ulong post_word_load (void) |
||||||
|
{ |
||||||
|
volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR); |
||||||
|
return *(volatile ulong *) save_addr; |
||||||
|
} |
||||||
|
|
||||||
|
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/ |
||||||
|
|
||||||
|
#ifdef CONFIG_BOOTCOUNT_LIMIT |
||||||
|
|
||||||
|
void bootcount_store (ulong a) |
||||||
|
{ |
||||||
|
volatile ulong *save_addr = |
||||||
|
(volatile ulong *)(CFG_OCM_DATA_ADDR + CFG_BOOTCOUNT_ADDR); |
||||||
|
|
||||||
|
save_addr[0] = a; |
||||||
|
save_addr[1] = BOOTCOUNT_MAGIC; |
||||||
|
} |
||||||
|
|
||||||
|
ulong bootcount_load (void) |
||||||
|
{ |
||||||
|
volatile ulong *save_addr = |
||||||
|
(volatile ulong *)(CFG_OCM_DATA_ADDR + CFG_BOOTCOUNT_ADDR); |
||||||
|
|
||||||
|
if (save_addr[1] != BOOTCOUNT_MAGIC) |
||||||
|
return 0; |
||||||
|
else |
||||||
|
return save_addr[0]; |
||||||
|
} |
||||||
|
|
||||||
|
#endif /* CONFIG_BOOTCOUNT_LIMIT */ |
@ -0,0 +1 @@ |
|||||||
|
/*FIXME: Implement this! */ |
@ -0,0 +1,178 @@ |
|||||||
|
/*
|
||||||
|
* (C) Copyright 2004 |
||||||
|
* Texas Instruments. |
||||||
|
* Kshitij Gupta <kshitij@ti.com> |
||||||
|
* Configuration settings for the TI OMAP 1610 H2 board. |
||||||
|
* |
||||||
|
* See file CREDITS for list of people who contributed to this |
||||||
|
* project. |
||||||
|
* |
||||||
|
* This program is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU General Public License as |
||||||
|
* published by the Free Software Foundation; either version 2 of |
||||||
|
* the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||||
|
* MA 02111-1307 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef __CONFIG_H |
||||||
|
#define __CONFIG_H |
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are developing, we might want to start armboot from ram |
||||||
|
* so we MUST NOT initialize critical regs like mem-timing ... |
||||||
|
*/ |
||||||
|
#define CONFIG_INIT_CRITICAL /* undef for developing */ |
||||||
|
|
||||||
|
/*
|
||||||
|
* High Level Configuration Options |
||||||
|
* (easy to change) |
||||||
|
*/ |
||||||
|
#define CONFIG_ARM926EJS 1 /* This is an arm926ejs CPU core */ |
||||||
|
#define CONFIG_OMAP 1 /* in a TI OMAP core */ |
||||||
|
#define CONFIG_OMAP1610 1 /* which is in a 1610 */ |
||||||
|
#define CONFIG_H2_OMAP1610 1 /* on an H2 Board */ |
||||||
|
|
||||||
|
/* input clock of PLL */ |
||||||
|
/* the OMAP1610 H2 has 12MHz input clock */ |
||||||
|
#define CONFIG_SYS_CLK_FREQ 12000000 |
||||||
|
|
||||||
|
#undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */ |
||||||
|
|
||||||
|
#define CONFIG_MISC_INIT_R |
||||||
|
|
||||||
|
#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ |
||||||
|
#define CONFIG_SETUP_MEMORY_TAGS 1 |
||||||
|
|
||||||
|
/*
|
||||||
|
* Size of malloc() pool |
||||||
|
*/ |
||||||
|
#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) |
||||||
|
#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ |
||||||
|
|
||||||
|
/*
|
||||||
|
* Hardware drivers |
||||||
|
*/ |
||||||
|
#define CONFIG_DRIVER_LAN91C96 |
||||||
|
#define CONFIG_LAN91C96_BASE 0x04000300 |
||||||
|
#define CONFIG_LAN91C96_EXT_PHY |
||||||
|
|
||||||
|
/*
|
||||||
|
* NS16550 Configuration |
||||||
|
*/ |
||||||
|
#define CFG_NS16550 |
||||||
|
#define CFG_NS16550_SERIAL |
||||||
|
#define CFG_NS16550_REG_SIZE (-4) |
||||||
|
#define CFG_NS16550_CLK (48000000) /* can be 12M/32Khz or 48Mhz */ |
||||||
|
#define CFG_NS16550_COM1 0xfffb0000 /* uart1, bluetooth uart */ |
||||||
|
|
||||||
|
/*
|
||||||
|
* select serial console configuration |
||||||
|
*/ |
||||||
|
#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on OMAP1610 H2 */ |
||||||
|
|
||||||
|
/* allow to overwrite serial and ethaddr */ |
||||||
|
#define CONFIG_ENV_OVERWRITE |
||||||
|
#define CONFIG_CONS_INDEX 1 |
||||||
|
#define CONFIG_BAUDRATE 115200 |
||||||
|
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } |
||||||
|
|
||||||
|
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_DHCP) |
||||||
|
#define CONFIG_BOOTP_MASK CONFIG_BOOTP_DEFAULT |
||||||
|
|
||||||
|
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ |
||||||
|
#include <cmd_confdefs.h> |
||||||
|
#include <configs/omap1510.h> |
||||||
|
|
||||||
|
#define CONFIG_BOOTDELAY 3 |
||||||
|
#define CONFIG_BOOTARGS "mem=32M console=ttyS0,115200n8 noinitrd \ |
||||||
|
root=/dev/nfs rw nfsroot=157.87.82.48:\
|
||||||
|
/home/a0875451/mwd/myfs/target ip=dhcp" |
||||||
|
#define CONFIG_NETMASK 255.255.254.0 /* talk on MY local net */ |
||||||
|
#define CONFIG_IPADDR 156.117.97.156 /* static IP I currently own */ |
||||||
|
#define CONFIG_SERVERIP 156.117.97.139 /* current IP of my dev pc */ |
||||||
|
#define CONFIG_BOOTFILE "uImage" /* file to load */ |
||||||
|
|
||||||
|
#if (CONFIG_COMMANDS & CFG_CMD_KGDB) |
||||||
|
#define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial port */ |
||||||
|
#define CONFIG_KGDB_SER_INDEX 1 /* which serial port to use */ |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Miscellaneous configurable options |
||||||
|
*/ |
||||||
|
#define CFG_LONGHELP /* undef to save memory */ |
||||||
|
#define CFG_PROMPT "OMAP1610 H2 # " /* Monitor Command Prompt */ |
||||||
|
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ |
||||||
|
/* Print Buffer Size */ |
||||||
|
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) |
||||||
|
#define CFG_MAXARGS 16 /* max number of command args */ |
||||||
|
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ |
||||||
|
|
||||||
|
#define CFG_MEMTEST_START 0x10000000 /* memtest works on */ |
||||||
|
#define CFG_MEMTEST_END 0x12000000 /* 32 MB in DRAM */ |
||||||
|
|
||||||
|
#undef CFG_CLKS_IN_HZ /* everything, incl board info, in Hz */ |
||||||
|
|
||||||
|
#define CFG_LOAD_ADDR 0x10000000 /* default load address */ |
||||||
|
|
||||||
|
/* The 1610 has 6 timers, they can be driven by the RefClk (12Mhz) or by
|
||||||
|
* DPLL1. This time is further subdivided by a local divisor. |
||||||
|
*/ |
||||||
|
#define CFG_TIMERBASE 0xFFFEC500 /* use timer 1 */ |
||||||
|
#define CFG_PVT 7 /* 2^(pvt+1), divide by 256 */ |
||||||
|
#define CFG_HZ ((CONFIG_SYS_CLK_FREQ)/(2 << CFG_PVT)) |
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
* Stack sizes |
||||||
|
* |
||||||
|
* The stack sizes are set up in start.S using the settings below |
||||||
|
*/ |
||||||
|
#define CONFIG_STACKSIZE (128*1024) /* regular stack */ |
||||||
|
#ifdef CONFIG_USE_IRQ |
||||||
|
#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ |
||||||
|
#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ |
||||||
|
#endif |
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
* Physical Memory Map |
||||||
|
*/ |
||||||
|
#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ |
||||||
|
#define PHYS_SDRAM_1 0x10000000 /* SDRAM Bank #1 */ |
||||||
|
#define PHYS_SDRAM_1_SIZE 0x02000000 /* 32 MB */ |
||||||
|
|
||||||
|
#ifdef CONFIG_CS0_BOOT |
||||||
|
#define PHYS_FLASH_1 0x0C000000 |
||||||
|
#endif |
||||||
|
#ifdef CONFIG_CS3_BOOT |
||||||
|
#define PHYS_FLASH_1 0x00000000 |
||||||
|
#endif |
||||||
|
|
||||||
|
#define CFG_FLASH_BASE PHYS_FLASH_1 |
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------
|
||||||
|
* FLASH and environment organization |
||||||
|
*/ |
||||||
|
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ |
||||||
|
#define PHYS_FLASH_SIZE 0x02000000 /* 32MB */ |
||||||
|
#define CFG_MAX_FLASH_SECT (259) /* max number of sectors on one chip */ |
||||||
|
/* addr of environment */ |
||||||
|
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x020000) |
||||||
|
|
||||||
|
/* timeout values are in ticks */ |
||||||
|
#define CFG_FLASH_ERASE_TOUT (20*CFG_HZ) /* Timeout for Flash Erase */ |
||||||
|
#define CFG_FLASH_WRITE_TOUT (20*CFG_HZ) /* Timeout for Flash Write */ |
||||||
|
|
||||||
|
#define CFG_ENV_IS_IN_FLASH 1 |
||||||
|
#define CFG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ |
||||||
|
#define CFG_ENV_OFFSET 0x20000 /* environment starts here */ |
||||||
|
|
||||||
|
#endif /* __CONFIG_H */ |
Loading…
Reference in new issue