1 #ifndef FDL_NAND_OPERATE_H
2 #define FDL_NAND_OPERATE_H
4 #include <asm/arch/cmd_def.h>
7 #define NAND_SYSTEM_ERROR 1
8 #define NAND_UNKNOWN_DEVICE 2
9 #define NAND_INVALID_DEVICE_SIZE 3
10 #define NAND_INCOMPATIBLE_PART 4
11 #define NAND_INVALID_ADDR 5
12 #define NAND_INVALID_SIZE 6
14 static __inline DLSTATUS convert_err (int err)
20 case NAND_INVALID_ADDR:
21 return BSL_REP_DOWN_DEST_ERROR;
22 case NAND_INVALID_SIZE:
23 return BSL_REP_DOWN_SIZE_ERROR;
24 case NAND_UNKNOWN_DEVICE:
25 return BSL_UNKNOWN_DEVICE;
26 case NAND_INVALID_DEVICE_SIZE:
27 return BSL_INVALID_DEVICE_SIZE;
28 case NAND_INCOMPATIBLE_PART:
29 return BSL_INCOMPATIBLE_PARTITION;
31 return BSL_REP_OPERATION_FAILED;
37 * Get download info from download start command which
38 * will used in next step
40 * @param part partition/volume name
41 * @param size total download size
42 * @param nv_checksum NA
46 int fdl2_download_start(char* name, unsigned long size, unsigned long nv_checksum);
51 * Save data to fdl buf and finally write it to nand flash
53 * @param size total download size
54 * @param buf data recvd
58 int fdl2_download_midst(unsigned short size, char *buf);
69 int fdl2_download_end(void);
72 * fdl2_nand_read_start
74 * Get partition/volume info from read start command which
75 * will used in next step
77 * @param part partition/volume name
78 * @param size total size
82 int fdl2_read_start(char* part, unsigned long size);
85 * fdl2_nand_read_midst
87 * Read partition/volume data
89 * @param size size to be read
90 * @param off offset of begin of part/vol
91 * @param buf data saved
95 int fdl2_read_midst(unsigned long size, unsigned long off, unsigned char *buf);
106 int fdl2_read_end(void);
111 * Erase partition/volume
113 * @param part partition/volume name
114 * @param size size to be erased(no use now)
118 int fdl2_erase(char* part, unsigned long size);
123 * Resize/Add/Delete volumes
125 * @param vol_cfg volume cfg
126 * @param total_vol_num
130 int fdl2_repartition(void* vol_cfg, unsigned short total_vol_num);
132 #endif /*FDL_NAND_OPERATE_H*/