projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ppc4xx: Big cleanup of PPC4xx defines
[platform/kernel/u-boot.git]
/
board
/
mpl
/
common
/
flash.c
diff --git
a/board/mpl/common/flash.c
b/board/mpl/common/flash.c
index
a437dab
..
682f0e7
100644
(file)
--- a/
board/mpl/common/flash.c
+++ b/
board/mpl/common/flash.c
@@
-52,7
+52,7
@@
#include <mpc5xx.h>
#endif
#include <mpc5xx.h>
#endif
-flash_info_t flash_info[C
FG_MAX_FLASH_BANKS]; /* info for FLASH chips
*/
+flash_info_t flash_info[C
ONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips
*/
/*-----------------------------------------------------------------------
* Functions
*/
/*-----------------------------------------------------------------------
* Functions
*/
@@
-89,7
+89,7
@@
void unlock_intel_sectors(flash_info_t *info,ulong addr,ulong cnt);
* The board_init_r will fill in wrong values in the board init structure,
* but this will be fixed in the misc_init_r routine:
* bd->bi_flashstart=0-flash_info[0].size
* The board_init_r will fill in wrong values in the board init structure,
* but this will be fixed in the misc_init_r routine:
* bd->bi_flashstart=0-flash_info[0].size
- * bd->bi_flashsize=flash_info[0].size-C
FG
_MONITOR_LEN
+ * bd->bi_flashsize=flash_info[0].size-C
ONFIG_SYS
_MONITOR_LEN
* bd->bi_flashoffset=0
*
*/
* bd->bi_flashoffset=0
*
*/
@@
-97,7
+97,7
@@
int get_boot_mode(void)
{
unsigned long pbcr;
int res = 0;
{
unsigned long pbcr;
int res = 0;
- pbcr = mfdcr (
strap
);
+ pbcr = mfdcr (
CPC0_PSR
);
if ((pbcr & PSR_ROM_WIDTH_MASK) == 0)
/* boot via MPS or MPS mapping */
res = BOOT_MPS;
if ((pbcr & PSR_ROM_WIDTH_MASK) == 0)
/* boot via MPS or MPS mapping */
res = BOOT_MPS;
@@
-123,29
+123,29
@@
void setup_cs_reloc(void)
/* first findout on which cs the flash is */
if(mode & BOOT_MPS) {
/* map flash high on CS1 and MPS on CS0 */
/* first findout on which cs the flash is */
if(mode & BOOT_MPS) {
/* map flash high on CS1 and MPS on CS0 */
- mtdcr (
ebccfga, pb0ap
);
- mtdcr (
ebccfgd
, MPS_AP);
- mtdcr (
ebccfga, pb0cr
);
- mtdcr (
ebccfgd
, MPS_CR);
+ mtdcr (
EBC0_CFGADDR, PB0AP
);
+ mtdcr (
EBC0_CFGDATA
, MPS_AP);
+ mtdcr (
EBC0_CFGADDR, PB0CR
);
+ mtdcr (
EBC0_CFGDATA
, MPS_CR);
/* we use the default values (max values) for the flash
* because its real size is not yet known */
/* we use the default values (max values) for the flash
* because its real size is not yet known */
- mtdcr (
ebccfga, pb1ap
);
- mtdcr (
ebccfgd
, FLASH_AP);
- mtdcr (
ebccfga, pb1cr
);
- mtdcr (
ebccfgd
, FLASH_CR_B);
+ mtdcr (
EBC0_CFGADDR, PB1AP
);
+ mtdcr (
EBC0_CFGDATA
, FLASH_AP);
+ mtdcr (
EBC0_CFGADDR, PB1CR
);
+ mtdcr (
EBC0_CFGDATA
, FLASH_CR_B);
}
else {
/* map flash high on CS0 and MPS on CS1 */
}
else {
/* map flash high on CS0 and MPS on CS1 */
- mtdcr (
ebccfga, pb1ap
);
- mtdcr (
ebccfgd
, MPS_AP);
- mtdcr (
ebccfga, pb1cr
);
- mtdcr (
ebccfgd
, MPS_CR);
+ mtdcr (
EBC0_CFGADDR, PB1AP
);
+ mtdcr (
EBC0_CFGDATA
, MPS_AP);
+ mtdcr (
EBC0_CFGADDR, PB1CR
);
+ mtdcr (
EBC0_CFGDATA
, MPS_CR);
/* we use the default values (max values) for the flash
* because its real size is not yet known */
/* we use the default values (max values) for the flash
* because its real size is not yet known */
- mtdcr (
ebccfga, pb0ap
);
- mtdcr (
ebccfgd
, FLASH_AP);
- mtdcr (
ebccfga, pb0cr
);
- mtdcr (
ebccfgd
, FLASH_CR_B);
+ mtdcr (
EBC0_CFGADDR, PB0AP
);
+ mtdcr (
EBC0_CFGDATA
, FLASH_AP);
+ mtdcr (
EBC0_CFGADDR, PB0CR
);
+ mtdcr (
EBC0_CFGDATA
, FLASH_CR_B);
}
}
}
}
@@
-160,7
+160,7
@@
unsigned long flash_init (void)
unsigned long size_b1,flashcr,size_reg;
int mode;
extern char version_string;
unsigned long size_b1,flashcr,size_reg;
int mode;
extern char version_string;
- char *p
=
&version_string;
+ char *p
=
&version_string;
/* Since we are relocated, we can set-up the CS finally */
setup_cs_reloc();
/* Since we are relocated, we can set-up the CS finally */
setup_cs_reloc();
@@
-174,13
+174,13
@@
unsigned long flash_init (void)
"MPS" : "Flash");
#endif /* #if !defined(CONFIG_PATI) */
/* Init: no FLASHes known */
"MPS" : "Flash");
#endif /* #if !defined(CONFIG_PATI) */
/* Init: no FLASHes known */
- for (i=0; i<C
FG
_MAX_FLASH_BANKS; ++i) {
+ for (i=0; i<C
ONFIG_SYS
_MAX_FLASH_BANKS; ++i) {
flash_info[i].flash_id = FLASH_UNKNOWN;
}
/* Static FLASH Bank configuration here - FIXME XXX */
flash_info[i].flash_id = FLASH_UNKNOWN;
}
/* Static FLASH Bank configuration here - FIXME XXX */
- size_b0 = flash_get_size((vu_long *)C
FG
_MONITOR_BASE, &flash_info[0]);
+ size_b0 = flash_get_size((vu_long *)C
ONFIG_SYS
_MONITOR_BASE, &flash_info[0]);
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
@@
-188,10
+188,10
@@
unsigned long flash_init (void)
}
/* protect the bootloader */
/* Monitor protection ON by default */
}
/* protect the bootloader */
/* Monitor protection ON by default */
-#if C
FG_MONITOR_BASE >= CFG
_FLASH_BASE
+#if C
ONFIG_SYS_MONITOR_BASE >= CONFIG_SYS
_FLASH_BASE
flash_protect(FLAG_PROTECT_SET,
flash_protect(FLAG_PROTECT_SET,
- C
FG
_MONITOR_BASE,
- C
FG
_MONITOR_BASE+monitor_flash_len-1,
+ C
ONFIG_SYS
_MONITOR_BASE,
+ C
ONFIG_SYS
_MONITOR_BASE+monitor_flash_len-1,
&flash_info[0]);
#endif
#if !defined(CONFIG_PATI)
&flash_info[0]);
#endif
#if !defined(CONFIG_PATI)
@@
-217,34
+217,34
@@
unsigned long flash_init (void)
}
if(mode & BOOT_MPS) {
/* flash is on CS1 */
}
if(mode & BOOT_MPS) {
/* flash is on CS1 */
- mtdcr(
ebccfga, pb1cr
);
- flashcr = mfdcr (
ebccfgd
);
+ mtdcr(
EBC0_CFGADDR, PB1CR
);
+ flashcr = mfdcr (
EBC0_CFGDATA
);
/* we map the flash high in every case */
flashcr&=0x0001FFFF; /* mask out address bits */
flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */
flashcr|= (i << 17); /* size addr */
/* we map the flash high in every case */
flashcr&=0x0001FFFF; /* mask out address bits */
flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */
flashcr|= (i << 17); /* size addr */
- mtdcr(
ebccfga, pb1cr
);
- mtdcr(
ebccfgd
, flashcr);
+ mtdcr(
EBC0_CFGADDR, PB1CR
);
+ mtdcr(
EBC0_CFGDATA
, flashcr);
}
else {
/* flash is on CS0 */
}
else {
/* flash is on CS0 */
- mtdcr(
ebccfga, pb0cr
);
- flashcr = mfdcr (
ebccfgd
);
+ mtdcr(
EBC0_CFGADDR, PB0CR
);
+ flashcr = mfdcr (
EBC0_CFGDATA
);
/* we map the flash high in every case */
flashcr&=0x0001FFFF; /* mask out address bits */
flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */
flashcr|= (i << 17); /* size addr */
/* we map the flash high in every case */
flashcr&=0x0001FFFF; /* mask out address bits */
flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */
flashcr|= (i << 17); /* size addr */
- mtdcr(
ebccfga, pb0cr
);
- mtdcr(
ebccfgd
, flashcr);
+ mtdcr(
EBC0_CFGADDR, PB0CR
);
+ mtdcr(
EBC0_CFGDATA
, flashcr);
}
#if 0
/* enable this (PIP405/MIP405 only) if you want to test if
the relocation has be done ok.
This will disable both Chipselects */
}
#if 0
/* enable this (PIP405/MIP405 only) if you want to test if
the relocation has be done ok.
This will disable both Chipselects */
- mtdcr (
ebccfga, pb0cr
);
- mtdcr (
ebccfgd
, 0L);
- mtdcr (
ebccfga, pb1cr
);
- mtdcr (
ebccfgd
, 0L);
+ mtdcr (
EBC0_CFGADDR, PB0CR
);
+ mtdcr (
EBC0_CFGDATA
, 0L);
+ mtdcr (
EBC0_CFGADDR, PB1CR
);
+ mtdcr (
EBC0_CFGDATA
, 0L);
printf("CS0 & CS1 switched off for test\n");
#endif
/* patch version_string */
printf("CS0 & CS1 switched off for test\n");
#endif
/* patch version_string */
@@
-256,11
+256,11
@@
unsigned long flash_init (void)
p++;
}
#else /* #if !defined(CONFIG_PATI) */
p++;
}
#else /* #if !defined(CONFIG_PATI) */
-#ifdef C
F
G_ENV_IS_IN_FLASH
+#ifdef C
ONFI
G_ENV_IS_IN_FLASH
/* ENV protection ON by default */
flash_protect(FLAG_PROTECT_SET,
/* ENV protection ON by default */
flash_protect(FLAG_PROTECT_SET,
- C
F
G_ENV_ADDR,
- C
FG_ENV_ADDR+CF
G_ENV_SECT_SIZE-1,
+ C
ONFI
G_ENV_ADDR,
+ C
ONFIG_ENV_ADDR+CONFI
G_ENV_SECT_SIZE-1,
&flash_info[0]);
#endif
#endif /* #if !defined(CONFIG_PATI) */
&flash_info[0]);
#endif
#endif /* #if !defined(CONFIG_PATI) */
@@
-555,7
+555,7
@@
int wait_for_DQ7(flash_info_t *info, int sect)
start = get_timer (0);
last = start;
while ((addr[0] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080) {
start = get_timer (0);
last = start;
while ((addr[0] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080) {
- if ((now = get_timer(start)) > C
FG
_FLASH_ERASE_TOUT) {
+ if ((now = get_timer(start)) > C
ONFIG_SYS
_FLASH_ERASE_TOUT) {
printf ("Timeout\n");
return ERR_TIMOUT;
}
printf ("Timeout\n");
return ERR_TIMOUT;
}
@@
-576,7
+576,7
@@
int intel_wait_for_DQ7(flash_info_t *info, int sect)
start = get_timer (0);
last = start;
while ((addr[0] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080) {
start = get_timer (0);
last = start;
while ((addr[0] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080) {
- if ((now = get_timer(start)) > C
FG
_FLASH_ERASE_TOUT) {
+ if ((now = get_timer(start)) > C
ONFIG_SYS
_FLASH_ERASE_TOUT) {
printf ("Timeout\n");
return ERR_TIMOUT;
}
printf ("Timeout\n");
return ERR_TIMOUT;
}
@@
-819,13
+819,17
@@
static FLASH_WORD_SIZE *read_val = (FLASH_WORD_SIZE *)0x200000;
static int write_word (flash_info_t *info, ulong dest, ulong data)
{
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;
- volatile FLASH_WORD_SIZE *data2
= (FLASH_WORD_SIZE *)&data
;
+ volatile FLASH_WORD_SIZE *addr2 = (
volatile
FLASH_WORD_SIZE *)(info->start[0]);
+ volatile FLASH_WORD_SIZE *dest2 = (
volatile
FLASH_WORD_SIZE *)dest;
+ volatile FLASH_WORD_SIZE *data2;
ulong start;
ulong start;
+ ulong *data_p;
int flag;
int i;
int flag;
int i;
+ data_p = &data;
+ data2 = (volatile FLASH_WORD_SIZE *)data_p;
+
/* Check if Flash is (sufficiently) erased */
if ((*((volatile FLASH_WORD_SIZE *)dest) &
(FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
/* Check if Flash is (sufficiently) erased */
if ((*((volatile FLASH_WORD_SIZE *)dest) &
(FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
@@
-848,7
+852,7
@@
static int write_word (flash_info_t *info, ulong dest, ulong data)
udelay(10);
while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080)
{
udelay(10);
while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) != (FLASH_WORD_SIZE)0x00800080)
{
- if (get_timer(start) > C
FG
_FLASH_WRITE_TOUT)
+ if (get_timer(start) > C
ONFIG_SYS
_FLASH_WRITE_TOUT)
return (1);
}
dest2[i] = (FLASH_WORD_SIZE)0x00FF00FF; /* return to read mode */
return (1);
}
dest2[i] = (FLASH_WORD_SIZE)0x00FF00FF; /* return to read mode */
@@
-869,7
+873,7
@@
static int write_word (flash_info_t *info, ulong dest, ulong data)
start = get_timer (0);
while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) !=
(data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
start = get_timer (0);
while ((dest2[i] & (FLASH_WORD_SIZE)0x00800080) !=
(data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
- if (get_timer(start) > C
FG
_FLASH_WRITE_TOUT) {
+ if (get_timer(start) > C
ONFIG_SYS
_FLASH_WRITE_TOUT) {
return (1);
}
}
return (1);
}
}