blob: ccb3665129186cc193f92b921d5a0b65d0524f5a [file] [log] [blame]
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +00001#ifndef __FLASH_H__
2#define __FLASH_H__ 1
3
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +00004#include <sys/io.h>
5#include <unistd.h>
Ollie Lho184a4042005-11-26 21:55:36 +00006#include <stdint.h>
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +00007
8struct flashchip {
Ollie Lho761bf1b2004-03-20 16:46:10 +00009 char *name;
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000010 int manufacture_id;
11 int model_id;
12
Ollie Lho184a4042005-11-26 21:55:36 +000013 volatile uint8_t *virt_addr;
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000014 int total_size;
15 int page_size;
16
17 int (*probe) (struct flashchip * flash);
18 int (*erase) (struct flashchip * flash);
Ollie Lho184a4042005-11-26 21:55:36 +000019 int (*write) (struct flashchip * flash, uint8_t *buf);
20 int (*read) (struct flashchip * flash, uint8_t *buf);
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000021
Ronald G. Minnich56439422002-09-06 16:58:14 +000022 int fd_mem;
Ollie Lho184a4042005-11-26 21:55:36 +000023 volatile uint8_t *virt_addr_2;
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000024};
25
Ollie Lho184a4042005-11-26 21:55:36 +000026extern struct flashchip flashchips[];
27
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000028#define AMD_ID 0x01
29#define AM_29F040B 0xA4
Stefan Reinauerd918daa2006-03-16 16:44:07 +000030#define AM_29F016D 0xAD
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000031
Ollie Lho761bf1b2004-03-20 16:46:10 +000032#define ATMEL_ID 0x1F /* Winbond Manufacture ID code */
33#define AT_29C040A 0xA4 /* Winbond w29c020c device code */
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000034
35#define MX_ID 0xC2
36#define MX_29F002 0xB0
37
Ronald G. Minnich5b582f22006-02-23 17:16:44 +000038#define SHARP_ID 0xB0
39#define SHARP_LHF00L04 0xCF
40
Stefan Reinauere807d822006-07-31 23:37:17 +000041#define SST_ID 0xBF /* SST Manufacturer ID code */
42#define SST_29EE020A 0x10 /* SST 29EE020 device */
43#define SST_28SF040 0x04 /* SST 29EE040 device */
44#define SST_39SF010 0xB5 /* SST 39SF010A device */
45#define SST_39SF020 0xB6 /* SST 39SF020A device */
46#define SST_39SF040 0xB7 /* SST 39SF040 device */
47#define SST_39VF020 0xD6 /* SST 39VF020 device */
Scott Tsai023af762006-03-31 11:36:06 +000048#define SST_49LF040B 0x50 /* SST 49LF040B device */
David Hendricks3770a112004-03-17 21:47:30 +000049#define SST_49LF040 0x51 /* SST 49LF040 device */
Uwe Hermanne205d982006-10-07 22:59:03 +000050#define SST_49LF020A 0x52 /* SST 49LF020A device */
David Hendricks1f128102004-03-18 21:55:22 +000051#define SST_49LF080A 0x5B /* SST 48LF080A device */
Ollie Lho761bf1b2004-03-20 16:46:10 +000052#define SST_49LF002A 0x57 /* SST 49LF002A device */
53#define SST_49LF003A 0x1B /* SST 49LF003A device */
54#define SST_49LF004A 0x60 /* SST 49LF004A device */
55#define SST_49LF008A 0x5A /* SST 49LF008A device */
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000056
Stefan Reinauere807d822006-07-31 23:37:17 +000057#define PMC_ID 0x9D /* PMC Manufacturer ID code */
Stefan Reinauer6424faf2006-06-25 09:56:45 +000058#define PMC_49FL002 0x6D /* PMC 49FL002 device code */
Ollie Lho761bf1b2004-03-20 16:46:10 +000059#define PMC_49FL004 0x6E /* PMC 49FL004 device code */
Ronald G. Minniche3dad012004-02-10 21:34:18 +000060
Ollie Lho761bf1b2004-03-20 16:46:10 +000061#define WINBOND_ID 0xDA /* Winbond Manufacture ID code */
62#define W_29C011 0xC1 /* Winbond w29c011 device code */
63#define W_29C020C 0x45 /* Winbond w29c020c device code */
Stefan Reinauer86de2832006-03-31 11:26:55 +000064#define W_39V040A 0x3D /* Winbond w39v040a device code */
Stefan Reinauere807d822006-07-31 23:37:17 +000065#define W_39V040B 0x54 /* Winbond w39v040b device code */
Stefan Reinauer86de2832006-03-31 11:26:55 +000066#define W_49F002U 0x0B /* Winbond w49F002u device code */
Stefan Reinauerdb8b13a2006-06-14 15:58:41 +000067#define W_49V002A 0xB0 /* Winbond W49V002A device code */
Stefan Reinauer64f05bb2006-07-19 15:13:21 +000068#define W_49V002FA 0x32 /* Winbond W49V002FA device code */
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000069
Ollie Lho761bf1b2004-03-20 16:46:10 +000070#define ST_ID 0x20
Stefan Reinauer9d3d93e2006-02-24 13:47:26 +000071#define ST_M29F040B 0xE2
Ronald G. Minnich3c910ed2002-05-28 23:29:17 +000072#define ST_M29F400BT 0xD5
73
Stefan Reinaueraf2c2b52006-06-30 20:07:50 +000074#define EMST_ID 0x8c /* EMST - Elite Flash Storage Inc. Manufacturer ID code */
75#define EMST_F49B002UA 0x00 /* EMST F49B002UA device code */
76
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000077#define MSYSTEMS_ID 0x156f
Ollie Lho761bf1b2004-03-20 16:46:10 +000078#define MSYSTEMS_MD2200 0xdb /* ? */
79#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */
80#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */
Ronald G. Minnich5e5f75e2002-01-29 18:21:41 +000081
Giampiero Giancipolia8c80822006-11-20 20:03:07 +000082#define SM_ID 0x40 /* SyncMOS ID */
Uwe Hermann838c7692006-11-21 15:02:27 +000083#define S29C51001T 0x01 /* SyncMOS S29C51001T/B */
84#define S29C51002T 0x02 /* SyncMOS S29C51002T/B */
85#define S29C51004T 0x03 /* SyncMOS S29C51004T/B */
86#define S29C31004T 0x63 /* SyncMOS S29C31004T */
Giampiero Giancipolia8c80822006-11-20 20:03:07 +000087
Ronald G. Minnicheaab50b2003-09-12 22:41:53 +000088extern void myusec_delay(int time);
Ollie Lhocbbf1252004-03-17 22:22:08 +000089extern void myusec_calibrate_delay();
90extern int enable_flash_write(void);
Ollie Lho761bf1b2004-03-20 16:46:10 +000091#endif /* !__FLASH_H__ */