75 lines · c
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_H11#define __LINUX_MTD_PLATNAND_H12 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 structure19 * @nr_chips: max. number of chips to scan for20 * @chip_offset: chip number offset21 * @nr_partitions: number of partitions pointed to by partitions (or zero)22 * @partitions: mtd partition list23 * @chip_delay: R/B delay value in us24 * @options: Option flags, e.g. 16bit buswidth25 * @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH26 * @part_probe_types: NULL-terminated array of probe types27 */28struct 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 structure41 * @probe: platform specific function to probe/setup hardware42 * @remove: platform specific function to remove/teardown hardware43 * @dev_ready: platform specific function to read ready/busy pin44 * @select_chip: platform specific chip select function45 * @cmd_ctrl: platform specific function for controlling46 * ALE/CLE/nCE. Also used to write command and address47 * @write_buf: platform specific function for write buffer48 * @read_buf: platform specific function for read buffer49 * @priv: private data to transport driver specific settings50 *51 * All fields are optional and depend on the hardware driver requirements52 */53struct 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 data66 * @chip: chip level chip structure67 * @ctrl: controller level device structure68 */69struct platform_nand_data {70 struct platform_nand_chip chip;71 struct platform_nand_ctrl ctrl;72};73 74#endif /* __LINUX_MTD_PLATNAND_H */75