ColdFire: Use CFI Flash driver for M54455EVB

Remove non-common flash driver in
board/freescale/m54455evb/flash.c. The non-cfi flash will
use CONFIG_FLASH_CFI_LEGACY to configure the flash
attribute.

Signed-off-by: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
This commit is contained in:
TsiChung Liew 2008-07-23 17:37:10 -05:00 committed by John Rigby
parent 6d33c6acfa
commit b2d022d1ac
4 changed files with 58 additions and 1328 deletions

View file

@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).a
COBJS = $(BOARD).o flash.o mii.o
COBJS = $(BOARD).o mii.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
@ -41,4 +41,4 @@ include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################
#########################################################################

File diff suppressed because it is too large Load diff

View file

@ -162,3 +162,53 @@ void pci_init_board(void)
pci_mcf5445x_init(&hose);
}
#endif /* CONFIG_PCI */
#if defined(CFG_FLASH_CFI)
#include <flash.h>
ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info)
{
int sect[] = CFG_ATMEL_SECT;
int sectsz[] = CFG_ATMEL_SECTSZ;
int i, j, k;
if (base != CFG_ATMEL_BASE)
return 0;
info->flash_id = 0x01000000;
info->portwidth = 1;
info->chipwidth = 1;
info->buffer_size = 32;
info->erase_blk_tout = 16384;
info->write_tout = 2;
info->buffer_write_tout = 5;
info->vendor = 2; /* CFI_CMDSET_AMD_STANDARD */
info->cmd_reset = 0x00F0;
info->interface = FLASH_CFI_X8;
info->legacy_unlock = 0;
info->manufacturer_id = (u16) ATM_MANUFACT;
info->device_id = ATM_ID_LV040;
info->device_id2 = 0;
info->ext_addr = 0;
info->cfi_version = 0x3133;
info->cfi_offset = 0x0055;
info->addr_unlock1 = 0x00000555;
info->addr_unlock2 = 0x000002AA;
info->name = "CFI conformant";
info->size = 0;
info->sector_count = CFG_ATMEL_TOTALSECT;
info->start[0] = base;
for (k = 0, i = 0; i < CFG_ATMEL_REGION; i++) {
info->size += sect[i] * sectsz[i];
for (j = 0; j < sect[i]; j++, k++) {
info->start[k + 1] = info->start[k] + sectsz[i];
info->protect[k] = 0;
}
}
return 1;
}
#endif /* CFG_FLASH_CFI */

View file

@ -297,9 +297,7 @@
# define CFG_ENV_SECT_SIZE 0x20000
#endif
/* M54455EVB has one non CFI flash, defined CFG_FLASH_CFI will cause the system
keep reset. */
#undef CFG_FLASH_CFI
#define CFG_FLASH_CFI
#ifdef CFG_FLASH_CFI
# define CONFIG_FLASH_CFI_DRIVER 1
@ -310,49 +308,18 @@
# define CFG_FLASH_PROTECTION /* "Real" (hardware) sectors protection */
# define CFG_FLASH_CHECKSUM
# define CFG_FLASH_BANKS_LIST { CFG_CS0_BASE, CFG_CS1_BASE }
# define CONFIG_FLASH_CFI_LEGACY
#else
# define CFG_MAX_FLASH_BANKS 3 /* max number of memory banks */
#ifdef CONFIG_FLASH_CFI_LEGACY
# define CFG_ATMEL_REGION 4
# define CFG_ATMEL_TOTALSECT 11
# define CFG_ATMEL_SECT {1, 2, 1, 7}
# define CFG_ATMEL_SECTSZ {0x4000, 0x2000, 0x8000, 0x10000}
# define CFG_INTEL_SECT 137
/* max number of sectors on one chip */
# define CFG_MAX_FLASH_SECT (CFG_ATMEL_TOTALSECT + CFG_INTEL_SECT)
# define CFG_FLASH_ERASE_TOUT 2000 /* Atmel needs longer timeout */
# define CFG_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (in ms) */
# define CFG_FLASH_LOCK_TOUT 5 /* Timeout for Flash Set Lock Bit (in ms) */
# define CFG_FLASH_UNLOCK_TOUT 100 /* Timeout for Flash Clear Lock Bits (in ms) */
# define CFG_FLASH_PROTECTION /* "Real" (hardware) sectors protection */
# define CFG_FLASH_CHECKSUM
#ifdef CONFIG_SERIAL_FLASH
# define CFG_FLASH2_BASE 0x01000000
# define CFG_STM_SECT 32
# define CFG_STM_SECTSZ 0x10000
# undef CFG_FLASH_ERASE_TOUT
# define CFG_FLASH_ERASE_TOUT 20000
# define SER_WREN 0x06
# define SER_WRDI 0x04
# define SER_RDID 0x9F
# define SER_RDSR 0x05
# define SER_WRSR 0x01
# define SER_READ 0x03
# define SER_F_READ 0x0B
# define SER_PAGE_PROG 0x02
# define SER_SECT_ERASE 0xD8
# define SER_BULK_ERASE 0xC7
# define SER_DEEP_PWRDN 0xB9
# define SER_RES 0xAB
#endif
#endif
#endif
#define CFG_FLASH_PROTECTION /* "Real" (hardware) sectors protection */
#define CFG_FLASH_CHECKSUM
/*
* This is setting for JFFS2 support in u-boot.