projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'next' of git://git.denx.de/u-boot-usb into next
[oweals/u-boot.git]
/
board
/
mp2usb
/
flash.c
diff --git
a/board/mp2usb/flash.c
b/board/mp2usb/flash.c
index 070dbf62c49f7ac503afc35f0feafe858fefe8bb..21a8ef9e54e6b87b2139804e388220f29f715c1c 100644
(file)
--- a/
board/mp2usb/flash.c
+++ b/
board/mp2usb/flash.c
@@
-30,10
+30,10
@@
#include <common.h>
#include <linux/byteorder/swab.h>
#include <common.h>
#include <linux/byteorder/swab.h>
-#define C
FG_MAX_FLASH_BANKS
1
+#define C
ONFIG_SYS_MAX_FLASH_BANKS
1
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 128 KB sectors (x1) */
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 128 KB sectors (x1) */
-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 */
#define FLASH_PORT_WIDTH ushort
#define FLASH_PORT_WIDTHV vu_short
#define FLASH_PORT_WIDTH ushort
#define FLASH_PORT_WIDTHV vu_short
@@
-77,7
+77,7
@@
unsigned long flash_init (void)
int i;
ulong size = 0;
int i;
ulong size = 0;
- for (i = 0; i < C
FG
_MAX_FLASH_BANKS; i++) {
+ for (i = 0; i < C
ONFIG_SYS
_MAX_FLASH_BANKS; i++) {
switch (i) {
case 0:
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
switch (i) {
case 0:
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
@@
-93,13
+93,13
@@
unsigned long flash_init (void)
/* Protect monitor and environment sectors
*/
flash_protect ( FLAG_PROTECT_SET,
/* Protect monitor and environment sectors
*/
flash_protect ( FLAG_PROTECT_SET,
- C
FG
_FLASH_BASE,
- C
FG
_FLASH_BASE + monitor_flash_len - 1,
+ C
ONFIG_SYS
_FLASH_BASE,
+ C
ONFIG_SYS
_FLASH_BASE + monitor_flash_len - 1,
&flash_info[0] );
flash_protect ( FLAG_PROTECT_SET,
&flash_info[0] );
flash_protect ( FLAG_PROTECT_SET,
- C
F
G_ENV_ADDR,
- C
FG_ENV_ADDR + CF
G_ENV_SIZE - 1, &flash_info[0] );
+ C
ONFI
G_ENV_ADDR,
+ C
ONFIG_ENV_ADDR + CONFI
G_ENV_SIZE - 1, &flash_info[0] );
return size;
}
return size;
}
@@
-220,10
+220,10
@@
static ulong flash_get_size (FPW *addr, flash_info_t *info)
break;
}
break;
}
- if (info->sector_count > C
FG
_MAX_FLASH_SECT) {
+ if (info->sector_count > C
ONFIG_SYS
_MAX_FLASH_SECT) {
printf ("** ERROR: sector count %d > max (%d) **\n",
printf ("** ERROR: sector count %d > max (%d) **\n",
- info->sector_count, C
FG
_MAX_FLASH_SECT);
- info->sector_count = C
FG
_MAX_FLASH_SECT;
+ info->sector_count, C
ONFIG_SYS
_MAX_FLASH_SECT);
+ info->sector_count = C
ONFIG_SYS
_MAX_FLASH_SECT;
}
addr[0] = (FPW) INTEL_RESET; /* restore read mode */
}
addr[0] = (FPW) INTEL_RESET; /* restore read mode */
@@
-237,7
+237,7
@@
static ulong flash_get_size (FPW *addr, flash_info_t *info)
int flash_erase (flash_info_t *info, int s_first, int s_last)
{
int flash_erase (flash_info_t *info, int s_first, int s_last)
{
- int
flag,
prot, sect;
+ int prot, sect;
ulong type, start, last;
int rcode = 0;
int cflag, iflag;
ulong type, start, last;
int rcode = 0;
int cflag, iflag;
@@
-284,10
+284,8
@@
int flash_erase (flash_info_t *info, int s_first, int s_last)
*/
cflag = icache_status ();
icache_disable ();
*/
cflag = icache_status ();
icache_disable ();
- iflag = disable_interrupts ();
-
/* Disable interrupts which might cause a timeout here */
/* Disable interrupts which might cause a timeout here */
-/* flag = disable_interrupts (); */
+ iflag = disable_interrupts ();
/* Start erase on unprotected sectors */
for (sect = s_first; sect <= s_last; sect++) {
/* Start erase on unprotected sectors */
for (sect = s_first; sect <= s_last; sect++) {
@@
-305,7
+303,7
@@
int flash_erase (flash_info_t *info, int s_first, int s_last)
*addr = (FPW) INTEL_CONFIRM; /* erase confirm */
while (((status = *addr) & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) {
*addr = (FPW) INTEL_CONFIRM; /* erase confirm */
while (((status = *addr) & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) {
- if (get_timer_masked () > C
FG
_FLASH_ERASE_TOUT) {
+ if (get_timer_masked () > C
ONFIG_SYS
_FLASH_ERASE_TOUT) {
printf ("Timeout\n");
*addr = (FPW) INTEL_SUSPEND; /* suspend erase */
*addr = (FPW) INTEL_RESET; /* reset to read mode */
printf ("Timeout\n");
*addr = (FPW) INTEL_SUSPEND; /* suspend erase */
*addr = (FPW) INTEL_RESET; /* reset to read mode */
@@
-314,8
+312,8
@@
int flash_erase (flash_info_t *info, int s_first, int s_last)
}
}
}
}
- *addr =
INTEL_CLEAR;
/* clear status register cmd. */
- *addr =
INTEL_RESET;
/* resest to read mode */
+ *addr =
(FPWV)INTEL_CLEAR;
/* clear status register cmd. */
+ *addr =
(FPWV)INTEL_RESET;
/* resest to read mode */
printf (" done\n");
}
printf (" done\n");
}
@@
-425,11
+423,10
@@
static int write_data (flash_info_t *info, ulong dest, FPW data)
FPWV *addr = (FPWV *) dest;
ulong status;
int cflag, iflag;
FPWV *addr = (FPWV *) dest;
ulong status;
int cflag, iflag;
- int flag;
/* Check if Flash is (sufficiently) erased */
if ((*addr & data) != data) {
/* Check if Flash is (sufficiently) erased */
if ((*addr & data) != data) {
- printf ("not erased at %08lx (%lx)\n", (ulong) addr, *addr);
+ printf ("not erased at %08lx (%lx)\n", (ulong) addr,
(ulong)
*addr);
return (2);
}
/*
return (2);
}
/*
@@
-441,10
+438,8
@@
static int write_data (flash_info_t *info, ulong dest, FPW data)
*/
cflag = icache_status ();
icache_disable ();
*/
cflag = icache_status ();
icache_disable ();
- iflag = disable_interrupts ();
-
/* Disable interrupts which might cause a timeout here */
/* Disable interrupts which might cause a timeout here */
- /*flag = disable_interrupts (); */
+ iflag = disable_interrupts ();
*addr = (FPW) INTEL_PROG; /* write setup */
*addr = data;
*addr = (FPW) INTEL_PROG; /* write setup */
*addr = data;
@@
-454,7
+449,7
@@
static int write_data (flash_info_t *info, ulong dest, FPW data)
/* wait while polling the status register */
while (((status = *addr) & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) {
/* wait while polling the status register */
while (((status = *addr) & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) {
- if (get_timer_masked () > C
FG
_FLASH_WRITE_TOUT) {
+ if (get_timer_masked () > C
ONFIG_SYS
_FLASH_WRITE_TOUT) {
*addr = (FPW) INTEL_RESET; /* restore read mode */
return (1);
}
*addr = (FPW) INTEL_RESET; /* restore read mode */
return (1);
}
@@
-505,7
+500,7
@@
int flash_real_protect(flash_info_t *info, long sector, int prot)
reset_timer_masked ();
while ((*addr & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) {
reset_timer_masked ();
while ((*addr & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) {
- if (get_timer_masked () > C
FG
_FLASH_UNLOCK_TOUT) {
+ if (get_timer_masked () > C
ONFIG_SYS
_FLASH_UNLOCK_TOUT) {
printf("Flash lock bit operation timed out\n");
rc = 1;
break;
printf("Flash lock bit operation timed out\n");
rc = 1;
break;
@@
-537,7
+532,7
@@
int flash_real_protect(flash_info_t *info, long sector, int prot)
*addr = (FPW) INTEL_PROTECT; /* set */
while ((*addr & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED)
{
*addr = (FPW) INTEL_PROTECT; /* set */
while ((*addr & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED)
{
- if (get_timer_masked () > C
FG
_FLASH_UNLOCK_TOUT)
+ if (get_timer_masked () > C
ONFIG_SYS
_FLASH_UNLOCK_TOUT)
{
printf("Flash lock bit operation timed out\n");
rc = 1;
{
printf("Flash lock bit operation timed out\n");
rc = 1;