// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright 2011 Freescale Semiconductor, Inc * * Freescale Integrated Flash Controller * * Author: Dipen Dudhat <[email protected]> */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/compiler.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/io.h> #include <linux/of.h> #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/fsl_ifc.h> #include <linux/irqdomain.h> #include <linux/of_address.h> #include <linux/of_irq.h> struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev; EXPORT_SYMBOL(…); /* * convert_ifc_address - convert the base address * @addr_base: base address of the memory bank */ unsigned int convert_ifc_address(phys_addr_t addr_base) { … } EXPORT_SYMBOL(…); /* * fsl_ifc_find - find IFC bank * @addr_base: base address of the memory bank * * This function walks IFC banks comparing "Base address" field of the CSPR * registers with the supplied addr_base argument. When bases match this * function returns bank number (starting with 0), otherwise it returns * appropriate errno value. */ int fsl_ifc_find(phys_addr_t addr_base) { … } EXPORT_SYMBOL(…); static int fsl_ifc_ctrl_init(struct fsl_ifc_ctrl *ctrl) { … } static void fsl_ifc_ctrl_remove(struct platform_device *dev) { … } /* * NAND events are split between an operational interrupt which only * receives OPC, and an error interrupt that receives everything else, * including non-NAND errors. Whichever interrupt gets to it first * records the status and wakes the wait queue. */ static DEFINE_SPINLOCK(nand_irq_lock); static u32 check_nand_stat(struct fsl_ifc_ctrl *ctrl) { … } static irqreturn_t fsl_ifc_nand_irq(int irqno, void *data) { … } /* * NOTE: This interrupt is used to report ifc events of various kinds, * such as transaction errors on the chipselects. */ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data) { … } /* * fsl_ifc_ctrl_probe * * called by device layer when it finds a device matching * one our driver can handled. This code allocates all of * the resources needed for the controller only. The * resources for the NAND banks themselves are allocated * in the chip probe function. */ static int fsl_ifc_ctrl_probe(struct platform_device *dev) { … } static const struct of_device_id fsl_ifc_match[] = …; static struct platform_driver fsl_ifc_ctrl_driver = …; static int __init fsl_ifc_init(void) { … } subsys_initcall(fsl_ifc_init); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …;