omap-gpmc.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * OMAP GPMC (General Purpose Memory Controller) defines
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the
  6. * Free Software Foundation; either version 2 of the License, or (at your
  7. * option) any later version.
  8. */
  9. #include <linux/platform_data/gpmc-omap.h>
  10. #define GPMC_CONFIG_WP 0x00000005
  11. /* IRQ numbers in GPMC IRQ domain for legacy boot use */
  12. #define GPMC_IRQ_FIFOEVENTENABLE 0
  13. #define GPMC_IRQ_COUNT_EVENT 1
  14. /**
  15. * gpmc_nand_ops - Interface between NAND and GPMC
  16. * @nand_write_buffer_empty: get the NAND write buffer empty status.
  17. */
  18. struct gpmc_nand_ops {
  19. bool (*nand_writebuffer_empty)(void);
  20. };
  21. struct gpmc_nand_regs;
  22. #if IS_ENABLED(CONFIG_OMAP_GPMC)
  23. struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
  24. int cs);
  25. #else
  26. static inline struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
  27. int cs)
  28. {
  29. return NULL;
  30. }
  31. #endif /* CONFIG_OMAP_GPMC */
  32. /*--------------------------------*/
  33. /* deprecated APIs */
  34. #if IS_ENABLED(CONFIG_OMAP_GPMC)
  35. void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
  36. #else
  37. static inline void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
  38. {
  39. }
  40. #endif /* CONFIG_OMAP_GPMC */
  41. /*--------------------------------*/
  42. extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
  43. struct gpmc_settings *gpmc_s,
  44. struct gpmc_device_timings *dev_t);
  45. struct device_node;
  46. extern int gpmc_get_client_irq(unsigned irq_config);
  47. extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
  48. extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
  49. extern int gpmc_calc_divider(unsigned int sync_clk);
  50. extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
  51. const struct gpmc_settings *s);
  52. extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p);
  53. extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
  54. extern void gpmc_cs_free(int cs);
  55. extern int gpmc_configure(int cmd, int wval);
  56. extern void gpmc_read_settings_dt(struct device_node *np,
  57. struct gpmc_settings *p);
  58. extern void omap3_gpmc_save_context(void);
  59. extern void omap3_gpmc_restore_context(void);
  60. struct gpmc_timings;
  61. struct omap_nand_platform_data;
  62. struct omap_onenand_platform_data;
  63. #if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
  64. extern int gpmc_nand_init(struct omap_nand_platform_data *d,
  65. struct gpmc_timings *gpmc_t);
  66. #else
  67. static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
  68. struct gpmc_timings *gpmc_t)
  69. {
  70. return 0;
  71. }
  72. #endif
  73. #if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
  74. extern int gpmc_onenand_init(struct omap_onenand_platform_data *d);
  75. #else
  76. #define board_onenand_data NULL
  77. static inline int gpmc_onenand_init(struct omap_onenand_platform_data *d)
  78. {
  79. return 0;
  80. }
  81. #endif