[PATCH 4/7] cfi_flash: use flash_write_word instead of reimplementing it again

Wolfram Sang w.sang at pengutronix.de
Mon Apr 19 04:28:15 EDT 2010


From: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

While at it remove some unused code and an unbalanced
enable_interrupts().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
---
 drivers/nor/cfi_flash.c |   19 +------------------
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 0f7a483..dbfb004 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -116,11 +116,9 @@ static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
 static int flash_write_cfiword (flash_info_t * info, ulong dest,
 				cfiword_t cword)
 {
-	cfiptr_t ctladdr;
 	cfiptr_t cptr;
 	int flag;
 
-	ctladdr.cp = flash_make_addr (info, 0, 0);
 	cptr.cp = (uchar *) dest;
 
 	/* Check if Flash is (sufficiently) erased */
@@ -138,24 +136,9 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
 	if (!flag)
 		return 2;
 
-	/* Disable interrupts which might cause a timeout here */
-//	flag = disable_interrupts ();
-
 	info->cfi_cmd_set->flash_prepare_write(info);
 
-	if (bankwidth_is_1(info)) {
-		cptr.cp[0] = cword.c;
-	} else if (bankwidth_is_2(info)) {
-		cptr.wp[0] = cword.w;
-	} else if (bankwidth_is_4(info)) {
-		cptr.lp[0] = cword.l;
-	} else if (bankwidth_is_8(info)) {
-		cptr.llp[0] = cword.ll;
-	}
-
-	/* re-enable interrupts if necessary */
-	if (flag)
-		enable_interrupts ();
+	flash_write_word(info, cword, (void *)dest);
 
 	return flash_status_check (info, find_sector (info, dest),
 					info->write_tout, "write");
-- 
1.7.0




More information about the barebox mailing list