blob: f477da55166ad5fabcd4f88973992cc25d259b18 [file] [log] [blame]
rminnich8d3ff912003-10-25 17:01:29 +00001#ifndef __FLASH_H__
2#define __FLASH_H__ 1
3
4#include <sys/io.h>
5#include <unistd.h>
ollie6a600992005-11-26 21:55:36 +00006#include <stdint.h>
rminnich8d3ff912003-10-25 17:01:29 +00007
8struct flashchip {
ollie5b621572004-03-20 16:46:10 +00009 char *name;
rminnich8d3ff912003-10-25 17:01:29 +000010 int manufacture_id;
11 int model_id;
12
ollie6a600992005-11-26 21:55:36 +000013 volatile uint8_t *virt_addr;
rminnich8d3ff912003-10-25 17:01:29 +000014 int total_size;
15 int page_size;
16
17 int (*probe) (struct flashchip * flash);
18 int (*erase) (struct flashchip * flash);
ollie6a600992005-11-26 21:55:36 +000019 int (*write) (struct flashchip * flash, uint8_t *buf);
20 int (*read) (struct flashchip * flash, uint8_t *buf);
rminnich8d3ff912003-10-25 17:01:29 +000021
22 int fd_mem;
ollie6a600992005-11-26 21:55:36 +000023 volatile uint8_t *virt_addr_2;
rminnich8d3ff912003-10-25 17:01:29 +000024};
25
ollie6a600992005-11-26 21:55:36 +000026extern struct flashchip flashchips[];
27
rminnich8d3ff912003-10-25 17:01:29 +000028#define AMD_ID 0x01
29#define AM_29F040B 0xA4
30
ollie5b621572004-03-20 16:46:10 +000031#define ATMEL_ID 0x1F /* Winbond Manufacture ID code */
32#define AT_29C040A 0xA4 /* Winbond w29c020c device code */
rminnich8d3ff912003-10-25 17:01:29 +000033
34#define MX_ID 0xC2
35#define MX_29F002 0xB0
36
ollief1845bd2004-03-27 00:18:15 +000037#define SST_ID 0xBF /* SST Manufacturer ID code */
ollie5b621572004-03-20 16:46:10 +000038#define SST_29EE020A 0x10 /* SST 29EE020 device code */
39#define SST_28SF040 0x04 /* SST 29EE040 device code */
40#define SST_39SF020 0xB6 /* SST 39SF020 device */
41#define SST_39VF020 0xD6 /* SST 39VF020 device */
dhendricks81524b72004-03-17 21:47:30 +000042#define SST_49LF040 0x51 /* SST 49LF040 device */
dhendricks46ebd8d2004-03-18 21:55:22 +000043#define SST_49LF080A 0x5B /* SST 48LF080A device */
ollie5b621572004-03-20 16:46:10 +000044#define SST_49LF002A 0x57 /* SST 49LF002A device */
45#define SST_49LF003A 0x1B /* SST 49LF003A device */
46#define SST_49LF004A 0x60 /* SST 49LF004A device */
47#define SST_49LF008A 0x5A /* SST 49LF008A device */
rminnich8d3ff912003-10-25 17:01:29 +000048
ollie5b621572004-03-20 16:46:10 +000049#define PMC_ID 0x9D /* PMC Manufacturer ID[B code */
50#define PMC_49FL004 0x6E /* PMC 49FL004 device code */
rminnichbe1ace12004-02-10 21:34:18 +000051
ollie5b621572004-03-20 16:46:10 +000052#define WINBOND_ID 0xDA /* Winbond Manufacture ID code */
53#define W_29C011 0xC1 /* Winbond w29c011 device code */
54#define W_29C020C 0x45 /* Winbond w29c020c device code */
55#define W_49F002U 0x0B /* Winbond w29c020c device code */
rminnich8d3ff912003-10-25 17:01:29 +000056
ollie5b621572004-03-20 16:46:10 +000057#define ST_ID 0x20
rminnich8d3ff912003-10-25 17:01:29 +000058#define ST_M29F400BT 0xD5
59
60#define MSYSTEMS_ID 0x156f
ollie5b621572004-03-20 16:46:10 +000061#define MSYSTEMS_MD2200 0xdb /* ? */
62#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */
63#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */
rminnich8d3ff912003-10-25 17:01:29 +000064
65extern void myusec_delay(int time);
ollie5672ac62004-03-17 22:22:08 +000066extern void myusec_calibrate_delay();
67extern int enable_flash_write(void);
ollie5b621572004-03-20 16:46:10 +000068#endif /* !__FLASH_H__ */