Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
0004  *            Steven J. Hill <sjhill@realitydiluted.com>
0005  *            Thomas Gleixner <tglx@linutronix.de>
0006  *
0007  * Contains all platform NAND related definitions.
0008  */
0009 
0010 #ifndef __LINUX_MTD_PLATNAND_H
0011 #define __LINUX_MTD_PLATNAND_H
0012 
0013 #include <linux/mtd/partitions.h>
0014 #include <linux/mtd/rawnand.h>
0015 #include <linux/platform_device.h>
0016 
0017 /**
0018  * struct platform_nand_chip - chip level device structure
0019  * @nr_chips: max. number of chips to scan for
0020  * @chip_offset: chip number offset
0021  * @nr_partitions: number of partitions pointed to by partitions (or zero)
0022  * @partitions: mtd partition list
0023  * @chip_delay: R/B delay value in us
0024  * @options: Option flags, e.g. 16bit buswidth
0025  * @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH
0026  * @part_probe_types: NULL-terminated array of probe types
0027  */
0028 struct platform_nand_chip {
0029     int nr_chips;
0030     int chip_offset;
0031     int nr_partitions;
0032     struct mtd_partition *partitions;
0033     int chip_delay;
0034     unsigned int options;
0035     unsigned int bbt_options;
0036     const char **part_probe_types;
0037 };
0038 
0039 /**
0040  * struct platform_nand_ctrl - controller level device structure
0041  * @probe: platform specific function to probe/setup hardware
0042  * @remove: platform specific function to remove/teardown hardware
0043  * @dev_ready: platform specific function to read ready/busy pin
0044  * @select_chip: platform specific chip select function
0045  * @cmd_ctrl: platform specific function for controlling
0046  *        ALE/CLE/nCE. Also used to write command and address
0047  * @write_buf: platform specific function for write buffer
0048  * @read_buf: platform specific function for read buffer
0049  * @priv: private data to transport driver specific settings
0050  *
0051  * All fields are optional and depend on the hardware driver requirements
0052  */
0053 struct platform_nand_ctrl {
0054     int (*probe)(struct platform_device *pdev);
0055     void (*remove)(struct platform_device *pdev);
0056     int (*dev_ready)(struct nand_chip *chip);
0057     void (*select_chip)(struct nand_chip *chip, int cs);
0058     void (*cmd_ctrl)(struct nand_chip *chip, int dat, unsigned int ctrl);
0059     void (*write_buf)(struct nand_chip *chip, const uint8_t *buf, int len);
0060     void (*read_buf)(struct nand_chip *chip, uint8_t *buf, int len);
0061     void *priv;
0062 };
0063 
0064 /**
0065  * struct platform_nand_data - container structure for platform-specific data
0066  * @chip: chip level chip structure
0067  * @ctrl: controller level device structure
0068  */
0069 struct platform_nand_data {
0070     struct platform_nand_chip chip;
0071     struct platform_nand_ctrl ctrl;
0072 };
0073 
0074 #endif /* __LINUX_MTD_PLATNAND_H */