73c5cc60c941e96606564d5d6f8f894d97bd3825
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
5 * Author: Weijie Gao <weijie.gao@mediatek.com>
11 #ifndef PRIVATE_MTK_SNAND_HEADER
24 struct mtk_snand_platdata
{
27 enum mtk_snand_soc soc
;
31 struct mtk_snand_chip_info
{
37 uint32_t spare_per_sector
;
39 uint32_t fdm_ecc_size
;
42 uint32_t ecc_strength
;
47 struct snand_flash_info
;
49 int mtk_snand_init(void *dev
, const struct mtk_snand_platdata
*pdata
,
50 struct mtk_snand
**psnf
);
51 int mtk_snand_cleanup(struct mtk_snand
*snf
);
53 int mtk_snand_chip_reset(struct mtk_snand
*snf
);
54 int mtk_snand_read_page(struct mtk_snand
*snf
, uint64_t addr
, void *buf
,
56 int mtk_snand_write_page(struct mtk_snand
*snf
, uint64_t addr
, const void *buf
,
57 const void *oob
, bool raw
);
58 int mtk_snand_erase_block(struct mtk_snand
*snf
, uint64_t addr
);
59 int mtk_snand_block_isbad(struct mtk_snand
*snf
, uint64_t addr
);
60 int mtk_snand_block_markbad(struct mtk_snand
*snf
, uint64_t addr
);
61 int mtk_snand_fill_oob(struct mtk_snand
*snf
, uint8_t *oobraw
,
62 const uint8_t *oobbuf
, size_t ooblen
);
63 int mtk_snand_transfer_oob(struct mtk_snand
*snf
, uint8_t *oobbuf
,
64 size_t ooblen
, const uint8_t *oobraw
);
65 int mtk_snand_read_page_auto_oob(struct mtk_snand
*snf
, uint64_t addr
,
66 void *buf
, void *oob
, size_t ooblen
,
67 size_t *actualooblen
, bool raw
);
68 int mtk_snand_write_page_auto_oob(struct mtk_snand
*snf
, uint64_t addr
,
69 const void *buf
, const void *oob
,
70 size_t ooblen
, size_t *actualooblen
,
72 int mtk_snand_get_chip_info(struct mtk_snand
*snf
,
73 struct mtk_snand_chip_info
*info
);
74 int mtk_snand_irq_process(struct mtk_snand
*snf
);
76 #endif /* _MTK_SNAND_H_ */