From fa23044564091f05d9695beb7b5b9a931e7f41a4 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Thu, 21 Dec 2006 17:17:02 +0100 Subject: Added support for the TQM8272 board from TQ Signed-off-by: Heiko Schocher --- drivers/nand/nand.c | 17 ++++++++++------- drivers/nand/nand_base.c | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/nand/nand.c b/drivers/nand/nand.c index 3899045a72..9fef71d629 100644 --- a/drivers/nand/nand.c +++ b/drivers/nand/nand.c @@ -39,7 +39,7 @@ static ulong base_address[CFG_MAX_NAND_DEVICE] = CFG_NAND_BASE_LIST; static const char default_nand_name[] = "nand"; -extern void board_nand_init(struct nand_chip *nand); +extern int board_nand_init(struct nand_chip *nand); static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, ulong base_addr) @@ -47,13 +47,16 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr; - board_nand_init(nand); - - if (nand_scan(mtd, 1) == 0) { - if (!mtd->name) - mtd->name = (char *)default_nand_name; - } else + if (board_nand_init(nand) == 0) { + if (nand_scan(mtd, 1) == 0) { + if (!mtd->name) + mtd->name = (char *)default_nand_name; + } else + mtd->name = NULL; + } else { mtd->name = NULL; + mtd->size = 0; + } } diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c index b7a5d32fb3..95d6e4ede6 100644 --- a/drivers/nand/nand_base.c +++ b/drivers/nand/nand_base.c @@ -2407,7 +2407,9 @@ int nand_scan (struct mtd_info *mtd, int maxchips) } if (!nand_flash_ids[i].name) { +#if !defined(CONFIG_TQM8272) printk (KERN_WARNING "No NAND device found!!!\n"); +#endif this->select_chip(mtd, -1); return 1; } -- cgit v1.2.1 From d784fdb05900ada3686d5778783e1fb328e9fb66 Mon Sep 17 00:00:00 2001 From: Stefano Babic Date: Tue, 12 Dec 2006 00:22:42 +0100 Subject: Fix cfi failure with Spansion Flash (Spansion Flash Devices have a different offset to go into CFI mode) --- drivers/cfi_flash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c index 9b10220fc7..68a2c71bb9 100644 --- a/drivers/cfi_flash.c +++ b/drivers/cfi_flash.c @@ -1149,6 +1149,7 @@ static int flash_detect_cfi (flash_info_t * info) && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { info->interface = flash_read_ushort (info, 0, FLASH_OFFSET_INTERFACE); + info->cfi_offset=flash_offset_cfi[cfi_offset]; debug ("device interface is %d\n", info->interface); debug ("found port %d chip %d ", @@ -1193,7 +1194,7 @@ ulong flash_get_size (ulong base, int banknum) info->vendor = flash_read_ushort (info, 0, FLASH_OFFSET_PRIMARY_VENDOR); flash_read_jedec_ids (info); - flash_write_cmd (info, 0, FLASH_OFFSET_CFI, FLASH_CMD_CFI); + flash_write_cmd (info, 0, info->cfi_offset, FLASH_CMD_CFI); num_erase_regions = flash_read_uchar (info, FLASH_OFFSET_NUM_ERASE_REGIONS); info->ext_addr = flash_read_ushort (info, 0, -- cgit v1.2.1 From 92eb729bad876725aeea908d2addba0800620840 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Wed, 27 Dec 2006 01:26:13 +0100 Subject: Fix bug in adaption of Stefano Babic's CFI driver patch. --- drivers/cfi_flash.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'drivers') diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c index 68a2c71bb9..2699cce859 100644 --- a/drivers/cfi_flash.c +++ b/drivers/cfi_flash.c @@ -104,6 +104,7 @@ #define FLASH_OFFSET_DEVICE_ID2 0x0E #define FLASH_OFFSET_DEVICE_ID3 0x0F #define FLASH_OFFSET_CFI 0x55 +#define FLASH_OFFSET_CFI_ALT 0x555 #define FLASH_OFFSET_CFI_RESP 0x10 #define FLASH_OFFSET_PRIMARY_VENDOR 0x13 #define FLASH_OFFSET_EXT_QUERY_T_P_ADDR 0x15 /* extended query table primary addr */ @@ -154,6 +155,8 @@ typedef union { #define NUM_ERASE_REGIONS 4 /* max. number of erase regions */ +static uint flash_offset_cfi[2]={FLASH_OFFSET_CFI,FLASH_OFFSET_CFI_ALT}; + /* use CFG_MAX_FLASH_BANKS_DETECT if defined */ #ifdef CFG_MAX_FLASH_BANKS_DETECT static ulong bank_base[CFG_MAX_FLASH_BANKS_DETECT] = CFG_FLASH_BANKS_LIST; @@ -343,7 +346,7 @@ unsigned long flash_init (void) if (flash_info[i].flash_id == FLASH_UNKNOWN) { #ifndef CFG_FLASH_QUIET_TEST printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n", - i, flash_info[i].size, flash_info[i].size << 20); + i+1, flash_info[i].size, flash_info[i].size << 20); #endif /* CFG_FLASH_QUIET_TEST */ } #ifdef CFG_FLASH_PROTECTION @@ -1136,6 +1139,7 @@ static void flash_read_jedec_ids (flash_info_t * info) */ static int flash_detect_cfi (flash_info_t * info) { + int cfi_offset; debug ("flash detect cfi\n"); for (info->portwidth = CFG_FLASH_CFI_WIDTH; @@ -1144,20 +1148,22 @@ static int flash_detect_cfi (flash_info_t * info) info->chipwidth <= info->portwidth; info->chipwidth <<= 1) { flash_write_cmd (info, 0, 0, info->cmd_reset); - flash_write_cmd (info, 0, FLASH_OFFSET_CFI, FLASH_CMD_CFI); - if (flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP, 'Q') - && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') - && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { - info->interface = flash_read_ushort (info, 0, FLASH_OFFSET_INTERFACE); - info->cfi_offset=flash_offset_cfi[cfi_offset]; - debug ("device interface is %d\n", - info->interface); - debug ("found port %d chip %d ", - info->portwidth, info->chipwidth); - debug ("port %d bits chip %d bits\n", - info->portwidth << CFI_FLASH_SHIFT_WIDTH, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); - return 1; + for (cfi_offset=0; cfi_offset < sizeof(flash_offset_cfi)/sizeof(uint); cfi_offset++) { + flash_write_cmd (info, 0, flash_offset_cfi[cfi_offset], FLASH_CMD_CFI); + if (flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP, 'Q') + && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') + && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { + info->interface = flash_read_ushort (info, 0, FLASH_OFFSET_INTERFACE); + info->cfi_offset=flash_offset_cfi[cfi_offset]; + debug ("device interface is %d\n", + info->interface); + debug ("found port %d chip %d ", + info->portwidth, info->chipwidth); + debug ("port %d bits chip %d bits\n", + info->portwidth << CFI_FLASH_SHIFT_WIDTH, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + return 1; + } } } } -- cgit v1.2.1