Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 1 | #ifndef __FLASH_H__ |
| 2 | #define __FLASH_H__ 1 |
| 3 | |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 4 | #include <sys/io.h> |
| 5 | #include <unistd.h> |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 6 | #include <stdint.h> |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 7 | |
| 8 | struct flashchip { |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 9 | char *name; |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 10 | int manufacture_id; |
| 11 | int model_id; |
| 12 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 13 | volatile uint8_t *virt_addr; |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 14 | int total_size; |
| 15 | int page_size; |
| 16 | |
| 17 | int (*probe) (struct flashchip * flash); |
| 18 | int (*erase) (struct flashchip * flash); |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 19 | int (*write) (struct flashchip * flash, uint8_t *buf); |
| 20 | int (*read) (struct flashchip * flash, uint8_t *buf); |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 21 | |
Ronald G. Minnich | 5643942 | 2002-09-06 16:58:14 +0000 | [diff] [blame] | 22 | int fd_mem; |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 23 | volatile uint8_t *virt_addr_2; |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
Ollie Lho | 184a404 | 2005-11-26 21:55:36 +0000 | [diff] [blame] | 26 | extern struct flashchip flashchips[]; |
| 27 | |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 28 | #define AMD_ID 0x01 |
| 29 | #define AM_29F040B 0xA4 |
Stefan Reinauer | d918daa | 2006-03-16 16:44:07 +0000 | [diff] [blame] | 30 | #define AM_29F016D 0xAD |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 31 | |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 32 | #define ATMEL_ID 0x1F /* Winbond Manufacture ID code */ |
| 33 | #define AT_29C040A 0xA4 /* Winbond w29c020c device code */ |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 34 | |
| 35 | #define MX_ID 0xC2 |
| 36 | #define MX_29F002 0xB0 |
| 37 | |
Ronald G. Minnich | 5b582f2 | 2006-02-23 17:16:44 +0000 | [diff] [blame] | 38 | #define SHARP_ID 0xB0 |
| 39 | #define SHARP_LHF00L04 0xCF |
| 40 | |
Ollie Lho | 8b8897a | 2004-03-27 00:18:15 +0000 | [diff] [blame] | 41 | #define SST_ID 0xBF /* SST Manufacturer ID code */ |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 42 | #define SST_29EE020A 0x10 /* SST 29EE020 device code */ |
| 43 | #define SST_28SF040 0x04 /* SST 29EE040 device code */ |
| 44 | #define SST_39SF020 0xB6 /* SST 39SF020 device */ |
| 45 | #define SST_39VF020 0xD6 /* SST 39VF020 device */ |
Scott Tsai | 023af76 | 2006-03-31 11:36:06 +0000 | [diff] [blame^] | 46 | #define SST_49LF040B 0x50 /* SST 49LF040B device */ |
David Hendricks | 3770a11 | 2004-03-17 21:47:30 +0000 | [diff] [blame] | 47 | #define SST_49LF040 0x51 /* SST 49LF040 device */ |
David Hendricks | 1f12810 | 2004-03-18 21:55:22 +0000 | [diff] [blame] | 48 | #define SST_49LF080A 0x5B /* SST 48LF080A device */ |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 49 | #define SST_49LF002A 0x57 /* SST 49LF002A device */ |
| 50 | #define SST_49LF003A 0x1B /* SST 49LF003A device */ |
| 51 | #define SST_49LF004A 0x60 /* SST 49LF004A device */ |
| 52 | #define SST_49LF008A 0x5A /* SST 49LF008A device */ |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 53 | |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 54 | #define PMC_ID 0x9D /* PMC Manufacturer ID[B code */ |
| 55 | #define PMC_49FL004 0x6E /* PMC 49FL004 device code */ |
Ronald G. Minnich | e3dad01 | 2004-02-10 21:34:18 +0000 | [diff] [blame] | 56 | |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 57 | #define WINBOND_ID 0xDA /* Winbond Manufacture ID code */ |
| 58 | #define W_29C011 0xC1 /* Winbond w29c011 device code */ |
| 59 | #define W_29C020C 0x45 /* Winbond w29c020c device code */ |
Stefan Reinauer | 86de283 | 2006-03-31 11:26:55 +0000 | [diff] [blame] | 60 | #define W_39V040A 0x3D /* Winbond w39v040a device code */ |
| 61 | #define W_49F002U 0x0B /* Winbond w49F002u device code */ |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 62 | |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 63 | #define ST_ID 0x20 |
Stefan Reinauer | 9d3d93e | 2006-02-24 13:47:26 +0000 | [diff] [blame] | 64 | #define ST_M29F040B 0xE2 |
Ronald G. Minnich | 3c910ed | 2002-05-28 23:29:17 +0000 | [diff] [blame] | 65 | #define ST_M29F400BT 0xD5 |
| 66 | |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 67 | #define MSYSTEMS_ID 0x156f |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 68 | #define MSYSTEMS_MD2200 0xdb /* ? */ |
| 69 | #define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */ |
| 70 | #define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */ |
Ronald G. Minnich | 5e5f75e | 2002-01-29 18:21:41 +0000 | [diff] [blame] | 71 | |
Ronald G. Minnich | eaab50b | 2003-09-12 22:41:53 +0000 | [diff] [blame] | 72 | extern void myusec_delay(int time); |
Ollie Lho | cbbf125 | 2004-03-17 22:22:08 +0000 | [diff] [blame] | 73 | extern void myusec_calibrate_delay(); |
| 74 | extern int enable_flash_write(void); |
Ollie Lho | 761bf1b | 2004-03-20 16:46:10 +0000 | [diff] [blame] | 75 | #endif /* !__FLASH_H__ */ |