bf6xx-sport.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * bf6xx_sport - Analog Devices BF6XX SPORT driver
  3. *
  4. * Copyright (c) 2012 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. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #ifndef _BF6XX_SPORT_H_
  20. #define _BF6XX_SPORT_H_
  21. #include <linux/platform_device.h>
  22. #include <asm/bfin_sport3.h>
  23. struct sport_device {
  24. struct platform_device *pdev;
  25. const unsigned short *pin_req;
  26. struct sport_register *tx_regs;
  27. struct sport_register *rx_regs;
  28. int tx_dma_chan;
  29. int rx_dma_chan;
  30. int tx_err_irq;
  31. int rx_err_irq;
  32. void (*tx_callback)(void *data);
  33. void *tx_data;
  34. void (*rx_callback)(void *data);
  35. void *rx_data;
  36. struct dmasg *tx_desc;
  37. struct dmasg *rx_desc;
  38. unsigned int tx_desc_size;
  39. unsigned int rx_desc_size;
  40. unsigned char *tx_buf;
  41. unsigned char *rx_buf;
  42. unsigned int tx_fragsize;
  43. unsigned int rx_fragsize;
  44. unsigned int tx_frags;
  45. unsigned int rx_frags;
  46. unsigned int wdsize;
  47. };
  48. struct sport_params {
  49. u32 spctl;
  50. u32 div;
  51. };
  52. struct sport_device *sport_create(struct platform_device *pdev);
  53. void sport_delete(struct sport_device *sport);
  54. int sport_set_tx_params(struct sport_device *sport,
  55. struct sport_params *params);
  56. int sport_set_rx_params(struct sport_device *sport,
  57. struct sport_params *params);
  58. void sport_tx_start(struct sport_device *sport);
  59. void sport_rx_start(struct sport_device *sport);
  60. void sport_tx_stop(struct sport_device *sport);
  61. void sport_rx_stop(struct sport_device *sport);
  62. void sport_set_tx_callback(struct sport_device *sport,
  63. void (*tx_callback)(void *), void *tx_data);
  64. void sport_set_rx_callback(struct sport_device *sport,
  65. void (*rx_callback)(void *), void *rx_data);
  66. int sport_config_tx_dma(struct sport_device *sport, void *buf,
  67. int fragcount, size_t fragsize);
  68. int sport_config_rx_dma(struct sport_device *sport, void *buf,
  69. int fragcount, size_t fragsize);
  70. unsigned long sport_curr_offset_tx(struct sport_device *sport);
  71. unsigned long sport_curr_offset_rx(struct sport_device *sport);
  72. #endif