#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-direction.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/resource.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand-ecc-sw-hamming.h>
#include <linux/mtd/rawnand.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/mtd/partitions.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/amba/bus.h>
#include <mtd/mtd-abi.h>
#define CTRL …
#define BANK_ENABLE …
#define MUXED …
#define NOR_DEV …
#define WIDTH_16 …
#define RSTPWRDWN …
#define WPROT …
#define WRT_ENABLE …
#define WAIT_ENB …
#define CTRL_TIM …
#define FSMC_NOR_BANK_SZ …
#define FSMC_NOR_REG_SIZE …
#define FSMC_NOR_REG(base, bank, reg) …
#define FSMC_PC …
#define FSMC_RESET …
#define FSMC_WAITON …
#define FSMC_ENABLE …
#define FSMC_DEVTYPE_NAND …
#define FSMC_DEVWID_16 …
#define FSMC_ECCEN …
#define FSMC_ECCPLEN_256 …
#define FSMC_TCLR_SHIFT …
#define FSMC_TCLR_MASK …
#define FSMC_TAR_SHIFT …
#define FSMC_TAR_MASK …
#define STS …
#define FSMC_CODE_RDY …
#define COMM …
#define FSMC_TSET_SHIFT …
#define FSMC_TSET_MASK …
#define FSMC_TWAIT_SHIFT …
#define FSMC_TWAIT_MASK …
#define FSMC_THOLD_SHIFT …
#define FSMC_THOLD_MASK …
#define FSMC_THIZ_SHIFT …
#define FSMC_THIZ_MASK …
#define ATTRIB …
#define IOATA …
#define ECC1 …
#define ECC2 …
#define ECC3 …
#define FSMC_NAND_BANK_SZ …
#define FSMC_BUSY_WAIT_TIMEOUT …
#define TOUTDEL …
#define TINDEL …
struct fsmc_nand_timings { … };
enum access_mode { … };
struct fsmc_nand_data { … };
static int fsmc_ecc1_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobregion)
{ … }
static int fsmc_ecc1_ooblayout_free(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobregion)
{ … }
static const struct mtd_ooblayout_ops fsmc_ecc1_ooblayout_ops = …;
static int fsmc_ecc4_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobregion)
{ … }
static int fsmc_ecc4_ooblayout_free(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobregion)
{ … }
static const struct mtd_ooblayout_ops fsmc_ecc4_ooblayout_ops = …;
static inline struct fsmc_nand_data *nand_to_fsmc(struct nand_chip *chip)
{ … }
static void fsmc_nand_setup(struct fsmc_nand_data *host,
struct fsmc_nand_timings *tims)
{ … }
static int fsmc_calc_timings(struct fsmc_nand_data *host,
const struct nand_sdr_timings *sdrt,
struct fsmc_nand_timings *tims)
{ … }
static int fsmc_setup_interface(struct nand_chip *nand, int csline,
const struct nand_interface_config *conf)
{ … }
static void fsmc_enable_hwecc(struct nand_chip *chip, int mode)
{ … }
static int fsmc_read_hwecc_ecc4(struct nand_chip *chip, const u8 *data,
u8 *ecc)
{ … }
static int fsmc_read_hwecc_ecc1(struct nand_chip *chip, const u8 *data,
u8 *ecc)
{ … }
static int fsmc_correct_ecc1(struct nand_chip *chip,
unsigned char *buf,
unsigned char *read_ecc,
unsigned char *calc_ecc)
{ … }
static int count_written_bits(u8 *buff, int size, int max_bits)
{ … }
static void dma_complete(void *param)
{ … }
static int dma_xfer(struct fsmc_nand_data *host, void *buffer, int len,
enum dma_data_direction direction)
{ … }
static void fsmc_write_buf(struct fsmc_nand_data *host, const u8 *buf,
int len)
{ … }
static void fsmc_read_buf(struct fsmc_nand_data *host, u8 *buf, int len)
{ … }
static void fsmc_read_buf_dma(struct fsmc_nand_data *host, u8 *buf,
int len)
{ … }
static void fsmc_write_buf_dma(struct fsmc_nand_data *host, const u8 *buf,
int len)
{ … }
static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op,
bool check_only)
{ … }
static int fsmc_read_page_hwecc(struct nand_chip *chip, u8 *buf,
int oob_required, int page)
{ … }
static int fsmc_bch8_correct_data(struct nand_chip *chip, u8 *dat,
u8 *read_ecc, u8 *calc_ecc)
{ … }
static bool filter(struct dma_chan *chan, void *slave)
{ … }
static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
struct fsmc_nand_data *host,
struct nand_chip *nand)
{ … }
static int fsmc_nand_attach_chip(struct nand_chip *nand)
{ … }
static const struct nand_controller_ops fsmc_nand_controller_ops = …;
static void fsmc_nand_disable(struct fsmc_nand_data *host)
{ … }
static int __init fsmc_nand_probe(struct platform_device *pdev)
{ … }
static void fsmc_nand_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int fsmc_nand_suspend(struct device *dev)
{ … }
static int fsmc_nand_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(fsmc_nand_pm_ops, fsmc_nand_suspend, fsmc_nand_resume);
static const struct of_device_id fsmc_nand_id_table[] = …;
MODULE_DEVICE_TABLE(of, fsmc_nand_id_table);
static struct platform_driver fsmc_nand_driver = …;
module_platform_driver_probe(…);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;