mm: use memalloc_nofs_save in readahead path
[linux-2.6-microblaze.git] / include / linux / mtd / platnand.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
4  *                        Steven J. Hill <sjhill@realitydiluted.com>
5  *                        Thomas Gleixner <tglx@linutronix.de>
6  *
7  * Contains all platform NAND related definitions.
8  */
9
10 #ifndef __LINUX_MTD_PLATNAND_H
11 #define __LINUX_MTD_PLATNAND_H
12
13 #include <linux/mtd/partitions.h>
14 #include <linux/mtd/rawnand.h>
15 #include <linux/platform_device.h>
16
17 /**
18  * struct platform_nand_chip - chip level device structure
19  * @nr_chips: max. number of chips to scan for
20  * @chip_offset: chip number offset
21  * @nr_partitions: number of partitions pointed to by partitions (or zero)
22  * @partitions: mtd partition list
23  * @chip_delay: R/B delay value in us
24  * @options: Option flags, e.g. 16bit buswidth
25  * @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH
26  * @part_probe_types: NULL-terminated array of probe types
27  */
28 struct platform_nand_chip {
29         int nr_chips;
30         int chip_offset;
31         int nr_partitions;
32         struct mtd_partition *partitions;
33         int chip_delay;
34         unsigned int options;
35         unsigned int bbt_options;
36         const char **part_probe_types;
37 };
38
39 /**
40  * struct platform_nand_ctrl - controller level device structure
41  * @probe: platform specific function to probe/setup hardware
42  * @remove: platform specific function to remove/teardown hardware
43  * @dev_ready: platform specific function to read ready/busy pin
44  * @select_chip: platform specific chip select function
45  * @cmd_ctrl: platform specific function for controlling
46  *            ALE/CLE/nCE. Also used to write command and address
47  * @write_buf: platform specific function for write buffer
48  * @read_buf: platform specific function for read buffer
49  * @priv: private data to transport driver specific settings
50  *
51  * All fields are optional and depend on the hardware driver requirements
52  */
53 struct platform_nand_ctrl {
54         int (*probe)(struct platform_device *pdev);
55         void (*remove)(struct platform_device *pdev);
56         int (*dev_ready)(struct nand_chip *chip);
57         void (*select_chip)(struct nand_chip *chip, int cs);
58         void (*cmd_ctrl)(struct nand_chip *chip, int dat, unsigned int ctrl);
59         void (*write_buf)(struct nand_chip *chip, const uint8_t *buf, int len);
60         void (*read_buf)(struct nand_chip *chip, uint8_t *buf, int len);
61         void *priv;
62 };
63
64 /**
65  * struct platform_nand_data - container structure for platform-specific data
66  * @chip: chip level chip structure
67  * @ctrl: controller level device structure
68  */
69 struct platform_nand_data {
70         struct platform_nand_chip chip;
71         struct platform_nand_ctrl ctrl;
72 };
73
74 #endif /* __LINUX_MTD_PLATNAND_H */