First attempt at adding support for this chip in flash_rom. It's
basically the same as a W49F002U, only different total and page sizes.
Attached are my tla file-diffs for flash.h and flash_rom.c and also .c
and .h files for the chip itself.
--- orig/util/flash_and_burn/flash.h
+++ mod/util/flash_and_burn/flash.h
@@ -49,6 +49,7 @@
 #define WINBOND_ID        0xDA	/* Winbond Manufacture ID code  */
 #define W_29C011          0xC1	/* Winbond w29c011 device code */
 #define W_29C020C         0x45	/* Winbond w29c020c device code */
+#define W_39V040A         0x3D	/* Winbond w29c020c device code */
 #define W_49F002U         0x0B	/* Winbond w29c020c device code */
 
 #define ST_ID       	  0x20
--- orig/util/flash_and_burn/flash_rom.c
+++ mod/util/flash_and_burn/flash_rom.c
@@ -44,6 +44,7 @@
 #include "am29f040b.h"
 #include "sst28sf040.h"
 #include "w49f002u.h"
+#include "w39v040a.h"
 #include "sst39sf020.h"
 #include "sst49lf040.h"
 #include "pm49fl004.h"
@@ -83,6 +84,8 @@
 	 probe_jedec,	erase_chip_jedec, write_jedec,	NULL},
 	{"W29C020C", 	WINBOND_ID, 	W_29C020C,	NULL, 256, 128,
 	 probe_jedec, 	erase_chip_jedec, write_jedec,	NULL},
+	{"W39V040A", 	WINBOND_ID, 	W_39V040A,	NULL, 512, 4096,
+	 probe_jedec,	erase_chip_jedec, write_39v040a, NULL},
 	{"W49F002U", 	WINBOND_ID, 	W_49F002U,	NULL, 256, 128,
 	 probe_jedec,	erase_chip_jedec, write_49f002, NULL},
 	{"M29F400BT",	ST_ID,		ST_M29F400BT,	NULL, 512, 64 * 1024,
/*
 * w39v040a.c: driver for Winbond 39V040A flash models
 *
 *
 * Copyright 2000 Silicon Integrated System Corporation
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * Reference:
 *	W39V040A data sheet
 *
 * ToDo: Consilidated to standard JEDEC code.
 *
 * $Id: w49f002u.c,v 1.6 2004/12/08 20:10:01 ollie Exp $
 */

#include <stdio.h>
#include "flash.h"
#include "jedec.h"
#include "w39v040a.h"

int write_39v040a(struct flashchip *flash, unsigned char *buf)
{
	int i;
	int total_size = flash->total_size * 1024, page_size =
		flash->page_size;
	volatile char *bios = flash->virt_addr;

	erase_chip_jedec(flash);

	printf("Programming Page: ");
	for (i = 0; i < total_size; i++) {
		/* write to the sector */
		printf("%04d at address: 0x%08x ", i, i * page_size);
		write_sector_jedec(bios, buf + i * page_size,
				   bios + i * page_size, page_size);
		printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
		fflush(stdout);
	}
	printf("\n");

	return (0);
}
#ifndef __W39V040A_H__
#define __W39V040A_H__ 1

extern int write_39v040a(struct flashchip *flash, unsigned char *buf);

#endif				/* !__W39V040A_H__ */
_______________________________________________
LinuxBIOS mailing list
[email protected]
http://www.openbios.org/mailman/listinfo/linuxbios

Reply via email to