ppi.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Analog Devices PPI header file
  3. *
  4. * Copyright (c) 2011 Analog Devices Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef _PPI_H_
  16. #define _PPI_H_
  17. #include <linux/interrupt.h>
  18. #include <asm/blackfin.h>
  19. #include <asm/bfin_ppi.h>
  20. /* EPPI */
  21. #ifdef EPPI_EN
  22. #define PORT_EN EPPI_EN
  23. #define PORT_DIR EPPI_DIR
  24. #define DMA32 0
  25. #define PACK_EN PACKEN
  26. #endif
  27. /* EPPI3 */
  28. #ifdef EPPI0_CTL2
  29. #define PORT_EN EPPI_CTL_EN
  30. #define PORT_DIR EPPI_CTL_DIR
  31. #define PACK_EN EPPI_CTL_PACKEN
  32. #define DMA32 0
  33. #define DLEN_8 EPPI_CTL_DLEN08
  34. #define DLEN_16 EPPI_CTL_DLEN16
  35. #endif
  36. struct ppi_if;
  37. struct ppi_params {
  38. u32 width; /* width in pixels */
  39. u32 height; /* height in lines */
  40. u32 hdelay; /* delay after the HSYNC in pixels */
  41. u32 vdelay; /* delay after the VSYNC in lines */
  42. u32 line; /* total pixels per line */
  43. u32 frame; /* total lines per frame */
  44. u32 hsync; /* HSYNC length in pixels */
  45. u32 vsync; /* VSYNC length in lines */
  46. int bpp; /* bits per pixel */
  47. int dlen; /* data length for ppi in bits */
  48. u32 ppi_control; /* ppi configuration */
  49. u32 int_mask; /* interrupt mask */
  50. };
  51. struct ppi_ops {
  52. int (*attach_irq)(struct ppi_if *ppi, irq_handler_t handler);
  53. void (*detach_irq)(struct ppi_if *ppi);
  54. int (*start)(struct ppi_if *ppi);
  55. int (*stop)(struct ppi_if *ppi);
  56. int (*set_params)(struct ppi_if *ppi, struct ppi_params *params);
  57. void (*update_addr)(struct ppi_if *ppi, unsigned long addr);
  58. };
  59. enum ppi_type {
  60. PPI_TYPE_PPI,
  61. PPI_TYPE_EPPI,
  62. PPI_TYPE_EPPI3,
  63. };
  64. struct ppi_info {
  65. enum ppi_type type;
  66. int dma_ch;
  67. int irq_err;
  68. void __iomem *base;
  69. const unsigned short *pin_req;
  70. };
  71. struct ppi_if {
  72. struct device *dev;
  73. unsigned long ppi_control;
  74. const struct ppi_ops *ops;
  75. const struct ppi_info *info;
  76. bool err_int; /* if we need request error interrupt */
  77. bool err; /* if ppi has fifo error */
  78. void *priv;
  79. };
  80. struct ppi_if *ppi_create_instance(struct platform_device *pdev,
  81. const struct ppi_info *info);
  82. void ppi_delete_instance(struct ppi_if *ppi);
  83. #endif