6 /* PIO operations max */
7 #define FLASH_PROGRAM_POLLS 100000
9 /* 10 Seconds default */
10 #define FLASH_ERASE_SECTOR_TIMEOUT (10*1000 /*SEC*/ )
12 /* Flash device info structure */
13 typedef struct flash_dev_s
{
14 char name
[24]; /* Bank Name */
15 int bank
; /* Bank 0 or 1 */
16 unsigned int base
; /* Base address */
17 int sectors
; /* Sector count */
18 int lgSectorSize
; /* Log2(usable bytes/sector) */
19 int vendorID
; /* Expected vendor ID */
20 int deviceID
; /* Expected device ID */
21 int found
; /* Set if found by flashLibInit */
22 int swap
; /* Set for bank 1 if byte swap req'd */
25 #define FLASH_MAX_POS(dev) \
26 ((dev)->sectors << (dev)->lgSectorSize)
28 #define FLASH_SECTOR_POS(dev, sector) \
29 ((sector) << (dev)->lgSectorSize)
33 #define FLASH0_VENDOR_ID 0x01
34 #define FLASH0_DEVICE_ID 0x49
38 #define FLASH1_VENDOR_ID 0x0001
39 #define FLASH1_DEVICE_ID 0x2249
41 extern flash_dev_t flashDev
[];
42 extern int flashDevCount
;
47 * These must be kept in sync with the table in flashLib.c.
49 #define FLASH_DEV_BANK0_SA0 (&flashDev[0])
50 #define FLASH_DEV_BANK0_SA1 (&flashDev[1])
51 #define FLASH_DEV_BANK0_SA2 (&flashDev[2])
52 #define FLASH_DEV_BANK0_LOW (&flashDev[3]) /* 960K */
53 #define FLASH_DEV_BANK0_BOOT (&flashDev[4]) /* PLCC */
54 #define FLASH_DEV_BANK0_HIGH (&flashDev[5]) /* 512K PLCC shadow */
56 unsigned long flash_init(void);
57 int flashEraseSector(flash_dev_t
*dev
, int sector
);
58 int flashErase(flash_dev_t
*dev
);
59 int flashRead(flash_dev_t
*dev
, int pos
, char *buf
, int len
);
60 int flashWrite(flash_dev_t
*dev
, int pos
, char *buf
, int len
);
61 int flashWritable(flash_dev_t
*dev
, int pos
, int len
);
62 int flashDiag(flash_dev_t
*dev
);
63 int flashDiagAll(void);
65 ulong
flash_get_size (vu_long
*addr
, flash_info_t
*info
);
66 void flash_print_info (flash_info_t
*info
);
67 int flash_erase (flash_info_t
*info
, int s_first
, int s_last
);
68 int write_buff (flash_info_t
*info
, uchar
*src
, ulong addr
, ulong cnt
);
73 #define FLASH_BANK_KERNEL 0
74 #define FLASH_BANK_BOOT 1
75 #define FLASH_BANK_AUX 2
76 #define FIRST_SECTOR 0
78 #endif /* !FLASH_LIB_H */