u-boot nand配置选项

CONFIG_FLASH_CFI_LEGACY
CONFIG_FLASH_CFI_DRIVER
CONFIG_FLASH_CFI_MTD

https://blog.csdn.net/novawl/article/details/7875289

https://blog.csdn.net/han_dawei/article/details/43059139

https://www.xuebuyuan.com/1975553.html

http://xilinx.eetrend.com/content/2021/100553647.html

CONFIG_MTD_CONCAT
 
https://www.cnblogs.com/slzuo/p/15031263.html
 
 
nand 操作函数: 来源 rawnand.h头文件
#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
/* return the supported features. */
static inline int onfi_feature(struct nand_chip *chip)
{
    return chip->onfi_version ? le16_to_cpu(chip->onfi_params.features) : 0;
}

/* return the supported asynchronous timing mode. */
static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
{
    if (!chip->onfi_version)
        return ONFI_TIMING_MODE_UNKNOWN;
    return le16_to_cpu(chip->onfi_params.async_timing_mode);
}

/* return the supported synchronous timing mode. */
static inline int onfi_get_sync_timing_mode(struct nand_chip *chip)
{
    if (!chip->onfi_version)
        return ONFI_TIMING_MODE_UNKNOWN;
    return le16_to_cpu(chip->onfi_params.src_sync_timing_mode);
}
#else
static inline int onfi_feature(struct nand_chip *chip)
{
    return 0;
}

static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
{
    return ONFI_TIMING_MODE_UNKNOWN;
}

static inline int onfi_get_sync_timing_mode(struct nand_chip *chip)
{
    return ONFI_TIMING_MODE_UNKNOWN;
}
#endif

int onfi_init_data_interface(struct nand_chip *chip,
                 struct nand_data_interface *iface,
                 enum nand_data_interface_type type,
                 int timing_mode);

/*
 * Check if it is a SLC nand.
 * The !nand_is_slc() can be used to check the MLC/TLC nand chips.
 * We do not distinguish the MLC and TLC now.
 */
static inline bool nand_is_slc(struct nand_chip *chip)
{
    return chip->bits_per_cell == 1;
}

/**
 * Check if the opcode's address should be sent only on the lower 8 bits
 * @command: opcode to check
 */
static inline int nand_opcode_8bits(unsigned int command)
{
    switch (command) {
    case NAND_CMD_READID:
    case NAND_CMD_PARAM:
    case NAND_CMD_GET_FEATURES:
    case NAND_CMD_SET_FEATURES:
        return 1;
    default:
        break;
    }
    return 0;
}

/* return the supported JEDEC features. */
static inline int jedec_feature(struct nand_chip *chip)
{
    return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
        : 0;
}

/* Standard NAND functions from nand_base.c */
void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
uint8_t nand_read_byte(struct mtd_info *mtd);

/* get timing characteristics from ONFI timing mode. */
const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
/* get data interface from ONFI timing mode 0, used after reset. */
const struct nand_data_interface *nand_get_default_data_interface(void);

int nand_check_erased_ecc_chunk(void *data, int datalen,
                void *ecc, int ecclen,
                void *extraoob, int extraooblen,
                int threshold);

int nand_check_ecc_caps(struct nand_chip *chip,
            const struct nand_ecc_caps *caps, int oobavail);

int nand_match_ecc_req(struct nand_chip *chip,
               const struct nand_ecc_caps *caps,  int oobavail);

int nand_maximize_ecc(struct nand_chip *chip,
              const struct nand_ecc_caps *caps, int oobavail);

/* Reset and initialize a NAND device */
int nand_reset(struct nand_chip *chip, int chipnr);

/* NAND operation helpers */
int nand_reset_op(struct nand_chip *chip);
int nand_readid_op(struct nand_chip *chip, u8 addr, void *buf,
           unsigned int len);
int nand_status_op(struct nand_chip *chip, u8 *status);
int nand_exit_status_op(struct nand_chip *chip);
int nand_erase_op(struct nand_chip *chip, unsigned int eraseblock);
int nand_read_page_op(struct nand_chip *chip, unsigned int page,
              unsigned int offset_in_page, void *buf, unsigned int len);
int nand_change_read_column_op(struct nand_chip *chip,
                   unsigned int offset_in_page, void *buf,
                   unsigned int len, bool force_8bit);
int nand_read_oob_op(struct nand_chip *chip, unsigned int page,
             unsigned int offset_in_page, void *buf, unsigned int len);
int nand_prog_page_begin_op(struct nand_chip *chip, unsigned int page,
                unsigned int offset_in_page, const void *buf,
                unsigned int len);
int nand_prog_page_end_op(struct nand_chip *chip);
int nand_prog_page_op(struct nand_chip *chip, unsigned int page,
              unsigned int offset_in_page, const void *buf,
              unsigned int len);
int nand_change_write_column_op(struct nand_chip *chip,
                unsigned int offset_in_page, const void *buf,
                unsigned int len, bool force_8bit);
int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,
              bool force_8bit);
int nand_write_data_op(struct nand_chip *chip, const void *buf,
               unsigned int len, bool force_8bit);

 

posted @ 2022-02-26 22:46  liujunhuasd  阅读(203)  评论(0编辑  收藏  举报