#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/gpio/consumer.h>
#include <linux/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand-gpio.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/delay.h>
struct gpiomtd { … };
static inline struct gpiomtd *gpio_nand_getpriv(struct mtd_info *mtd)
{ … }
#ifdef CONFIG_ARM
static void gpio_nand_dosync(struct gpiomtd *gpiomtd)
{
unsigned long tmp;
if (gpiomtd->io_sync) {
tmp = readl(gpiomtd->io_sync);
asm volatile("mov %1, %0\n" : "=r" (tmp) : "r" (tmp));
}
}
#else
static inline void gpio_nand_dosync(struct gpiomtd *gpiomtd) { … }
#endif
static int gpio_nand_exec_instr(struct nand_chip *chip,
const struct nand_op_instr *instr)
{ … }
static int gpio_nand_exec_op(struct nand_chip *chip,
const struct nand_operation *op,
bool check_only)
{ … }
static int gpio_nand_attach_chip(struct nand_chip *chip)
{ … }
static const struct nand_controller_ops gpio_nand_ops = …;
#ifdef CONFIG_OF
static const struct of_device_id gpio_nand_id_table[] = …;
MODULE_DEVICE_TABLE(of, gpio_nand_id_table);
static int gpio_nand_get_config_of(const struct device *dev,
struct gpio_nand_platdata *plat)
{ … }
static struct resource *gpio_nand_get_io_sync_of(struct platform_device *pdev)
{ … }
#else
static inline int gpio_nand_get_config_of(const struct device *dev,
struct gpio_nand_platdata *plat)
{
return -ENOSYS;
}
static inline struct resource *
gpio_nand_get_io_sync_of(struct platform_device *pdev)
{
return NULL;
}
#endif
static inline int gpio_nand_get_config(const struct device *dev,
struct gpio_nand_platdata *plat)
{ … }
static inline struct resource *
gpio_nand_get_io_sync(struct platform_device *pdev)
{ … }
static void gpio_nand_remove(struct platform_device *pdev)
{ … }
static int gpio_nand_probe(struct platform_device *pdev)
{ … }
static struct platform_driver gpio_nand_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;