flash.h 4.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * flash.h: flash programming utility - central include file
 *
 * Copyright 2000 Silicon Integrated System Corporation
 * Copyright 2000 Ronald G. Minnich <rminnich@gmail.com>
 * Copyright 2005 coresystems GmbH <stepan@coresystems.de>
 * 
 *	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.
 *
 */


Ronald G. Minnich's avatar
Ronald G. Minnich committed
25 26 27
#ifndef __FLASH_H__
#define __FLASH_H__ 1

28
#if defined(__GLIBC__)
29
#include <sys/io.h>
30 31
#endif

32
#include <unistd.h>
33
#include <stdint.h>
34 35

struct flashchip {
36
	char *name;
37 38 39
	int manufacture_id;
	int model_id;

40
	volatile uint8_t *virt_addr;
41 42 43 44 45
	int total_size;
	int page_size;

	int (*probe) (struct flashchip * flash);
	int (*erase) (struct flashchip * flash);
46 47
	int (*write) (struct flashchip * flash, uint8_t *buf);
	int (*read) (struct flashchip * flash, uint8_t *buf);
Ronald G. Minnich's avatar
Ronald G. Minnich committed
48

Ronald G. Minnich's avatar
Ronald G. Minnich committed
49
	int fd_mem;
50
	volatile uint8_t *virt_addr_2;
51 52
};

53 54
extern struct flashchip flashchips[];

55 56
#define AMD_ID            0x01
#define AM_29F040B        0xA4
Stefan Reinauer's avatar
Stefan Reinauer committed
57
#define AM_29F016D        0xAD
58

59 60 61
#define ASD_ID		  0x25
#define ASD_AE49F2008     0x52

62 63
#define ATMEL_ID          0x1F	/* Winbond Manufacture ID code        */
#define AT_29C040A        0xA4	/* Winbond w29c020c device code */
64 65 66 67

#define MX_ID             0xC2
#define MX_29F002         0xB0

Ronald G. Minnich's avatar
Ronald G. Minnich committed
68 69 70
#define SHARP_ID            0xB0
#define SHARP_LHF00L04      0xCF

71 72 73 74 75 76 77
#define SST_ID            0xBF	/* SST Manufacturer ID code */
#define SST_29EE020A      0x10	/* SST 29EE020 device */
#define SST_28SF040       0x04	/* SST 29EE040 device */
#define SST_39SF010       0xB5	/* SST 39SF010A device */
#define SST_39SF020       0xB6	/* SST 39SF020A device */
#define SST_39SF040       0xB7	/* SST 39SF040 device */
#define SST_39VF020       0xD6	/* SST 39VF020 device */
Scott Tsai's avatar
Scott Tsai committed
78
#define SST_49LF040B	  0x50	/* SST 49LF040B device */
David Hendricks's avatar
David Hendricks committed
79
#define SST_49LF040	  0x51	/* SST 49LF040 device */
80
#define SST_49LF020A	  0x52	/* SST 49LF020A device */
81
#define SST_49LF080A	  0x5B	/* SST 48LF080A device */
82 83 84 85
#define SST_49LF002A	  0x57	/* SST 49LF002A device */
#define SST_49LF003A	  0x1B	/* SST 49LF003A device */
#define SST_49LF004A	  0x60	/* SST 49LF004A device */
#define SST_49LF008A	  0x5A	/* SST 49LF008A device */
86 87 88
#define SST_49LF004C	  0x54	/* SST 49LF004C device */
#define SST_49LF008C	  0x59	/* SST 49LF008C device */
#define SST_49LF016C	  0x5C	/* SST 49LF016C device */
89
#define SST_49LF160C	  0x4C	/* SST 49LF160C device */
90

91
#define PMC_ID            0x9D	/* PMC Manufacturer ID code   */
92
#define PMC_49FL002       0x6D	/* PMC 49FL002 device code      */
93
#define PMC_49FL004       0x6E	/* PMC 49FL004 device code      */
94

95 96 97
#define WINBOND_ID        0xDA	/* Winbond Manufacture ID code  */
#define W_29C011          0xC1	/* Winbond w29c011 device code */
#define W_29C020C         0x45	/* Winbond w29c020c device code */
Stefan Reinauer's avatar
Stefan Reinauer committed
98
#define W_39V040A         0x3D	/* Winbond w39v040a device code */
99
#define W_39V040B         0x54	/* Winbond w39v040b device code */
David Hendricks's avatar
David Hendricks committed
100
#define W_39V080A         0xD0	/* Winbond w39v080a device code */
Stefan Reinauer's avatar
Stefan Reinauer committed
101
#define W_49F002U         0x0B	/* Winbond w49F002u device code */
102
#define W_49V002A         0xB0  /* Winbond W49V002A device code */
103
#define W_49V002FA        0x32  /* Winbond W49V002FA device code */
104

105
#define ST_ID       	  0x20
Stefan Reinauer's avatar
Stefan Reinauer committed
106
#define ST_M29F040B       0xE2
107 108
#define ST_M29F400BT      0xD5

109 110 111
#define EMST_ID           0x8c /* EMST - Elite Flash Storage Inc. Manufacturer ID code */
#define EMST_F49B002UA    0x00 /* EMST F49B002UA device code */

Ronald G. Minnich's avatar
Ronald G. Minnich committed
112
#define MSYSTEMS_ID       0x156f
113 114 115
#define MSYSTEMS_MD2200   0xdb	/* ? */
#define MSYSTEMS_MD2800   0x30	/* hmm -- both 0x30 */
#define MSYSTEMS_MD2802   0x30	/* hmm -- both 0x30 */
116

Uwe Hermann's avatar
Uwe Hermann committed
117
#define SYNCMOS_ID	  0x40  /* SyncMOS ID */
118 119 120 121
#define S29C51001T	  0x01  /* SyncMOS S29C51001T/B */
#define S29C51002T	  0x02  /* SyncMOS S29C51002T/B */
#define S29C51004T	  0x03  /* SyncMOS S29C51004T/B */
#define S29C31004T	  0x63  /* SyncMOS S29C31004T */
122

123 124
/* function prototypes from udelay.h */

Ronald G. Minnich's avatar
Ronald G. Minnich committed
125
extern void myusec_delay(int time);
126 127
extern void myusec_calibrate_delay();
extern int enable_flash_write(void);
128 129 130 131 132 133 134 135 136

/* physical memory mapping device */

#if defined (__sun) && (defined(__i386) || defined(__amd64))
#  define MEM_DEV "/dev/xsvc"
#else
#  define MEM_DEV "/dev/mem"
#endif

137
#endif				/* !__FLASH_H__ */