platnand.h 2.5 KB

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