接口描述
3 接口描述
3.1 驱动物理层接口
3.1.1 spi_nor_erase
description:mtd erase interface @mtd: MTD device structure @instr: erase operation descrition structure return:success return 0,fail return fail code**
3.1.2 spi_nor_read
description:mtd read interface @mtd:MTD device structure @from: offset to read from MTD device @len: data len @retlen: had read data len @buf: data buffer return:success return max_bitflips,fail return fail code**
3.1.3 spi_nor_write
static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
description:mtd write data interface @to: offset to MTD device @len: want write data len @retlen:return the writen len @buf: data buffer return: success return 0, fail return code fail
3.1.4 spi_nor_lock
static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
description:check block is badblock or not
@mtd:MTD device structure @ofs: offset the mtd device start (align to simu block size) @len:The length of the operating return: success return 0, fail return code fail
3.1.5 spi_nor_unlock
static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
description:check block is badblock or not
@mtd:MTD device structure @ofs: offset the mtd device start (align to simu block size) @len:The length of the operating return: success return 0, fail return code fail
3.1.6 spi_nor_is_locked
static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
description:check block is badblock or not
@mtd:MTD device structure @ofs: offset the mtd device start (align to simu block size) @len:The length of the operating return: Is lock return 1, else return 0
3.1.7 spi_nor_has_lock_erase
description:mtd has lock erase interface,First unlock to operate space, after the completion of the flash lock up @mtd: MTD device structure @instr: erase operation descrition structure return:success return 0,fail return fail code
3.1.8 spi_nor_has_lock_write
static int spi_nor_has_lock_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
description:mtd has lock write data interface,First unlock to operate space, after the completion of the flash lock up @to: offset to MTD device @len: want write data len @retlen:return the writen len @buf: data buffer return: success return 0, fail return code fail
3.2 Uboot 应用接口
3.2.1 sunxi_flash_spinor_probe
description:SPINOR initialization,Set the storage type。 return:zero on success, else a negative error code.
3.2.2 sunxi_flash_spinor_init
description:SPINOR initialization。 @boot_mode:Working mode @res:The default is 0 return:zero on success, else a negative error code.
3.2.3 sunxi_flash_spinor_exit
description:Release registration is a resource for applications. return:zero on success, else a negative error code.
3.2.4 sunxi_flash_spinor_write
description:mtd write data interface. @start_block:want write start sector @nblock:want write sectorcount @buffer:data buffer
return:zero on success, else a negative error code.
3.2.5 sunxi_flash_spinor_write
description:mtd readdata interface. @start_block:want read start sector @nblock:want read sector count @buffer:data buffer return:zero on success, else a negative error code.
3.2.6 sunxi_flash_spinor_erase
description:erase boot || partition data. @erase:erase flag @buffer:The default is NULL return:zero on success, else a negative error code.
3.2.7 sunxi_flash_spinor_force_erase
description:erase boot & partition data. return:zero on success, else a negative error code.
3.2.8 sunxi_flash_spinor_flush
description:Flush physical cache data to flash.
return:zero on success, else a negative error code.
3.2.9 sunxi_flash_spinor_download_spl
description:write boot0. @buf:boot0 data buffer @len:boot0 data len @ext:storage type return:zero on success, else a negative error code.
3.2.10 sunxi_flash_spinor_download_toc
description:write uboot. @buf:uboot data buffer @len:uboot data len @ext:storage type return:zero on success, else a negative error code.