Patches by himba, 21 Aug 2004:

- fix some "use of label at end of compound statement" warnings
- Define type of LCD panel on lubbock board if CONFIG_LCD is used
This commit is contained in:
wdenk 2004-10-09 22:32:26 +00:00
parent 1d9f410500
commit 63cfcbb4e2
3 changed files with 257 additions and 258 deletions

View File

@ -2,6 +2,10 @@
Changes since U-Boot 1.1.1: Changes since U-Boot 1.1.1:
====================================================================== ======================================================================
* Patches by himba, 21 Aug 2004:
- fix some "use of label at end of compound statement" warnings
- Define type of LCD panel on lubbock board if CONFIG_LCD is used
* Patch by Steven Scholz, 16 Aug 2004: * Patch by Steven Scholz, 16 Aug 2004:
- Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)" - Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)"
- creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0 - creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0

View File

@ -30,338 +30,330 @@
#define FLASH_BANK_SIZE 0x400000 #define FLASH_BANK_SIZE 0x400000
#define MAIN_SECT_SIZE 0x20000 #define MAIN_SECT_SIZE 0x20000
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
*/ */
ulong flash_init(void) ulong flash_init (void)
{ {
int i, j; int i, j;
ulong size = 0; ulong size = 0;
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
{ ulong flashbase = 0;
ulong flashbase = 0;
flash_info[i].flash_id =
(INTEL_MANUFACT & FLASH_VENDMASK) |
(INTEL_ID_28F128J3 & FLASH_TYPEMASK);
flash_info[i].size = FLASH_BANK_SIZE;
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
switch (i)
{
case 0:
flashbase = PHYS_FLASH_1;
break;
case 1:
flashbase = PHYS_FLASH_2;
break;
default:
panic("configured too many flash banks!\n");
break;
}
for (j = 0; j < flash_info[i].sector_count; j++)
{
flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE;
}
size += flash_info[i].size;
}
/* Protect monitor and environment sectors flash_info[i].flash_id =
*/ (INTEL_MANUFACT & FLASH_VENDMASK) |
flash_protect(FLAG_PROTECT_SET, (INTEL_ID_28F128J3 & FLASH_TYPEMASK);
CFG_FLASH_BASE, flash_info[i].size = FLASH_BANK_SIZE;
CFG_FLASH_BASE + monitor_flash_len - 1, flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
&flash_info[0]); memset (flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
switch (i) {
case 0:
flashbase = PHYS_FLASH_1;
break;
case 1:
flashbase = PHYS_FLASH_2;
break;
default:
panic ("configured too many flash banks!\n");
break;
}
for (j = 0; j < flash_info[i].sector_count; j++) {
flash_info[i].start[j] =
flashbase + j * MAIN_SECT_SIZE;
}
size += flash_info[i].size;
}
flash_protect(FLAG_PROTECT_SET, /* Protect monitor and environment sectors
CFG_ENV_ADDR, */
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, flash_protect (FLAG_PROTECT_SET,
&flash_info[0]); CFG_FLASH_BASE,
CFG_FLASH_BASE + monitor_flash_len - 1,
&flash_info[0]);
return size; flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR,
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
return size;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
*/ */
void flash_print_info (flash_info_t *info) void flash_print_info (flash_info_t * info)
{ {
int i, j; int i, j;
for (j=0; j<CFG_MAX_FLASH_BANKS; j++) for (j = 0; j < CFG_MAX_FLASH_BANKS; j++) {
{ switch (info->flash_id & FLASH_VENDMASK) {
switch (info->flash_id & FLASH_VENDMASK) case (INTEL_MANUFACT & FLASH_VENDMASK):
{ printf ("Intel: ");
case (INTEL_MANUFACT & FLASH_VENDMASK): break;
printf("Intel: "); default:
break; printf ("Unknown Vendor ");
default: break;
printf("Unknown Vendor "); }
break;
}
switch (info->flash_id & FLASH_TYPEMASK) switch (info->flash_id & FLASH_TYPEMASK) {
{ case (INTEL_ID_28F320J3A & FLASH_TYPEMASK):
case (INTEL_ID_28F320J3A & FLASH_TYPEMASK): printf ("28F320J3A (32Mbit)\n");
printf("28F320J3A (32Mbit)\n"); break;
break; case (INTEL_ID_28F128J3 & FLASH_TYPEMASK):
case (INTEL_ID_28F128J3 & FLASH_TYPEMASK): printf ("28F128J3 (128Mbit)\n");
printf("28F128J3 (128Mbit)\n"); break;
break; default:
default: printf ("Unknown Chip Type\n");
printf("Unknown Chip Type\n"); goto Done;
goto Done; break;
break; }
}
printf(" Size: %ld MB in %d Sectors\n", printf (" Size: %ld MB in %d Sectors\n",
info->size >> 20, info->sector_count); info->size >> 20, info->sector_count);
printf(" Sector Start Addresses:"); printf (" Sector Start Addresses:");
for (i = 0; i < info->sector_count; i++) for (i = 0; i < info->sector_count; i++) {
{ if ((i % 5) == 0) {
if ((i % 5) == 0) printf ("\n ");
{ }
printf ("\n "); printf (" %08lX%s", info->start[i],
} info->protect[i] ? " (RO)" : " ");
printf (" %08lX%s", info->start[i], }
info->protect[i] ? " (RO)" : " "); printf ("\n");
} info++;
printf ("\n"); }
info++;
}
Done: Done: ;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
*/ */
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 flag, prot, sect;
int rc = ERR_OK; int rc = ERR_OK;
if (info->flash_id == FLASH_UNKNOWN) if (info->flash_id == FLASH_UNKNOWN)
return ERR_UNKNOWN_FLASH_TYPE; return ERR_UNKNOWN_FLASH_TYPE;
if ((s_first < 0) || (s_first > s_last)) { if ((s_first < 0) || (s_first > s_last)) {
return ERR_INVAL; return ERR_INVAL;
} }
if ((info->flash_id & FLASH_VENDMASK) != if ((info->flash_id & FLASH_VENDMASK) !=
(INTEL_MANUFACT & FLASH_VENDMASK)) { (INTEL_MANUFACT & FLASH_VENDMASK)) {
return ERR_UNKNOWN_FLASH_VENDOR; return ERR_UNKNOWN_FLASH_VENDOR;
} }
prot = 0; prot = 0;
for (sect=s_first; sect<=s_last; ++sect) { for (sect = s_first; sect <= s_last; ++sect) {
if (info->protect[sect]) { if (info->protect[sect]) {
prot++; prot++;
} }
} }
if (prot) if (prot)
return ERR_PROTECTED; return ERR_PROTECTED;
/* /*
* Disable interrupts which might cause a timeout * Disable interrupts which might cause a timeout
* here. Remember that our exception vectors are * here. Remember that our exception vectors are
* at address 0 in the flash, and we don't want a * at address 0 in the flash, and we don't want a
* (ticker) exception to happen while the flash * (ticker) exception to happen while the flash
* chip is in programming mode. * chip is in programming mode.
*/ */
flag = disable_interrupts(); flag = disable_interrupts ();
/* Start erase on unprotected sectors */ /* Start erase on unprotected sectors */
for (sect = s_first; sect<=s_last && !ctrlc(); sect++) { for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {
printf("Erasing sector %2d ... ", sect); printf ("Erasing sector %2d ... ", sect);
/* arm simple, non interrupt dependent timer */ /* arm simple, non interrupt dependent timer */
reset_timer_masked(); reset_timer_masked ();
if (info->protect[sect] == 0) { /* not protected */ if (info->protect[sect] == 0) { /* not protected */
vu_short *addr = (vu_short *)(info->start[sect]); vu_short *addr = (vu_short *) (info->start[sect]);
*addr = 0x20; /* erase setup */ *addr = 0x20; /* erase setup */
*addr = 0xD0; /* erase confirm */ *addr = 0xD0; /* erase confirm */
while ((*addr & 0x80) != 0x80) { while ((*addr & 0x80) != 0x80) {
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) { if (get_timer_masked () >
*addr = 0xB0; /* suspend erase */ CFG_FLASH_ERASE_TOUT) {
*addr = 0xFF; /* reset to read mode */ *addr = 0xB0; /* suspend erase */
rc = ERR_TIMOUT; *addr = 0xFF; /* reset to read mode */
goto outahere; rc = ERR_TIMOUT;
} goto outahere;
} }
}
/* clear status register command */ /* clear status register command */
*addr = 0x50; *addr = 0x50;
/* reset to read mode */ /* reset to read mode */
*addr = 0xFF; *addr = 0xFF;
} }
printf("ok.\n"); printf ("ok.\n");
} }
if (ctrlc()) if (ctrlc ())
printf("User Interrupt!\n"); printf ("User Interrupt!\n");
outahere: outahere:
/* allow flash to settle - wait 10 ms */ /* allow flash to settle - wait 10 ms */
udelay_masked(10000); udelay_masked (10000);
if (flag) if (flag)
enable_interrupts(); enable_interrupts ();
return rc; return rc;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* Copy memory to flash * Copy memory to flash
*/ */
static int write_word (flash_info_t *info, ulong dest, ushort data) static int write_word (flash_info_t * info, ulong dest, ushort data)
{ {
vu_short *addr = (vu_short *)dest, val; vu_short *addr = (vu_short *) dest, val;
int rc = ERR_OK; int rc = ERR_OK;
int flag; int flag;
/* Check if Flash is (sufficiently) erased /* Check if Flash is (sufficiently) erased
*/ */
if ((*addr & data) != data) if ((*addr & data) != data)
return ERR_NOT_ERASED; return ERR_NOT_ERASED;
/* /*
* Disable interrupts which might cause a timeout * Disable interrupts which might cause a timeout
* here. Remember that our exception vectors are * here. Remember that our exception vectors are
* at address 0 in the flash, and we don't want a * at address 0 in the flash, and we don't want a
* (ticker) exception to happen while the flash * (ticker) exception to happen while the flash
* chip is in programming mode. * chip is in programming mode.
*/ */
flag = disable_interrupts(); flag = disable_interrupts ();
/* clear status register command */ /* clear status register command */
*addr = 0x50; *addr = 0x50;
/* program set-up command */ /* program set-up command */
*addr = 0x40; *addr = 0x40;
/* latch address/data */ /* latch address/data */
*addr = data; *addr = data;
/* arm simple, non interrupt dependent timer */ /* arm simple, non interrupt dependent timer */
reset_timer_masked(); reset_timer_masked ();
/* wait while polling the status register */ /* wait while polling the status register */
while(((val = *addr) & 0x80) != 0x80) while (((val = *addr) & 0x80) != 0x80) {
{ if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) { rc = ERR_TIMOUT;
rc = ERR_TIMOUT; /* suspend program command */
/* suspend program command */ *addr = 0xB0;
*addr = 0xB0; goto outahere;
goto outahere; }
} }
}
if(val & 0x1A) { /* check for error */ if (val & 0x1A) { /* check for error */
printf("\nFlash write error %02x at address %08lx\n", printf ("\nFlash write error %02x at address %08lx\n",
(int)val, (unsigned long)dest); (int) val, (unsigned long) dest);
if(val & (1<<3)) { if (val & (1 << 3)) {
printf("Voltage range error.\n"); printf ("Voltage range error.\n");
rc = ERR_PROG_ERROR; rc = ERR_PROG_ERROR;
goto outahere; goto outahere;
} }
if(val & (1<<1)) { if (val & (1 << 1)) {
printf("Device protect error.\n"); printf ("Device protect error.\n");
rc = ERR_PROTECTED; rc = ERR_PROTECTED;
goto outahere; goto outahere;
} }
if(val & (1<<4)) { if (val & (1 << 4)) {
printf("Programming error.\n"); printf ("Programming error.\n");
rc = ERR_PROG_ERROR; rc = ERR_PROG_ERROR;
goto outahere; goto outahere;
} }
rc = ERR_PROG_ERROR; rc = ERR_PROG_ERROR;
goto outahere; goto outahere;
} }
outahere: outahere:
/* read array command */ /* read array command */
*addr = 0xFF; *addr = 0xFF;
if (flag) if (flag)
enable_interrupts(); enable_interrupts ();
return rc; return rc;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* Copy memory to flash. * Copy memory to flash.
*/ */
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
{ {
ulong cp, wp; ulong cp, wp;
ushort data; ushort data;
int l; int l;
int i, rc; int i, rc;
wp = (addr & ~1); /* get lower word aligned address */ wp = (addr & ~1); /* get lower word aligned address */
/* /*
* handle unaligned start bytes * handle unaligned start bytes
*/ */
if ((l = addr - wp) != 0) if ((l = addr - wp) != 0) {
{ data = 0;
data = 0; for (i = 0, cp = wp; i < l; ++i, ++cp) {
for (i=0, cp=wp; i<l; ++i, ++cp) { data = (data >> 8) | (*(uchar *) cp << 8);
data = (data >> 8) | (*(uchar *)cp << 8); }
} for (; i < 2 && cnt > 0; ++i) {
for (; i<2 && cnt>0; ++i) { data = (data >> 8) | (*src++ << 8);
data = (data >> 8) | (*src++ << 8); --cnt;
--cnt; ++cp;
++cp; }
} for (; cnt == 0 && i < 2; ++i, ++cp) {
for (; cnt==0 && i<2; ++i, ++cp) { data = (data >> 8) | (*(uchar *) cp << 8);
data = (data >> 8) | (*(uchar *)cp << 8); }
}
if ((rc = write_word(info, wp, data)) != 0) { if ((rc = write_word (info, wp, data)) != 0) {
return (rc); return (rc);
} }
wp += 2; wp += 2;
} }
/* /*
* handle word aligned part * handle word aligned part
*/ */
while (cnt >= 2) { while (cnt >= 2) {
data = *((vu_short*)src); data = *((vu_short *) src);
if ((rc = write_word(info, wp, data)) != 0) { if ((rc = write_word (info, wp, data)) != 0) {
return (rc); return (rc);
} }
src += 2; src += 2;
wp += 2; wp += 2;
cnt -= 2; cnt -= 2;
} }
if (cnt == 0) { if (cnt == 0) {
return ERR_OK; return ERR_OK;
} }
/* /*
* handle unaligned tail bytes * handle unaligned tail bytes
*/ */
data = 0; data = 0;
for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) { for (i = 0, cp = wp; i < 2 && cnt > 0; ++i, ++cp) {
data = (data >> 8) | (*src++ << 8); data = (data >> 8) | (*src++ << 8);
--cnt; --cnt;
} }
for (; i<2; ++i, ++cp) { for (; i < 2; ++i, ++cp) {
data = (data >> 8) | (*(uchar *)cp << 8); data = (data >> 8) | (*(uchar *) cp << 8);
} }
return write_word(info, wp, data); return write_word (info, wp, data);
} }

View File

@ -43,6 +43,9 @@
#define CONFIG_PXA250 1 /* This is an PXA250 CPU */ #define CONFIG_PXA250 1 /* This is an PXA250 CPU */
#define CONFIG_LUBBOCK 1 /* on an LUBBOCK Board */ #define CONFIG_LUBBOCK 1 /* on an LUBBOCK Board */
#define CONFIG_LCD 1 #define CONFIG_LCD 1
#ifdef CONFIG_LCD
#define CONFIG_SHARP_LM8V31
#endif
#define CONFIG_MMC 1 #define CONFIG_MMC 1
#define BOARD_LATE_INIT 1 #define BOARD_LATE_INIT 1