bfin_sir.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Blackfin Infra-red Driver
  3. *
  4. * Copyright 2006-2009 Analog Devices Inc.
  5. *
  6. * Enter bugs at http://blackfin.uclinux.org/
  7. *
  8. * Licensed under the GPL-2 or later.
  9. *
  10. */
  11. #include <linux/serial.h>
  12. #include <linux/module.h>
  13. #include <linux/netdevice.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/delay.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/dma-mapping.h>
  18. #include <linux/slab.h>
  19. #include <net/irda/irda.h>
  20. #include <net/irda/wrapper.h>
  21. #include <net/irda/irda_device.h>
  22. #include <asm/irq.h>
  23. #include <asm/cacheflush.h>
  24. #include <asm/dma.h>
  25. #include <asm/portmux.h>
  26. #undef DRIVER_NAME
  27. #ifdef CONFIG_SIR_BFIN_DMA
  28. struct dma_rx_buf {
  29. char *buf;
  30. int head;
  31. int tail;
  32. };
  33. #endif
  34. struct bfin_sir_port {
  35. unsigned char __iomem *membase;
  36. unsigned int irq;
  37. unsigned int lsr;
  38. unsigned long clk;
  39. struct net_device *dev;
  40. #ifdef CONFIG_SIR_BFIN_DMA
  41. int tx_done;
  42. struct dma_rx_buf rx_dma_buf;
  43. struct timer_list rx_dma_timer;
  44. int rx_dma_nrows;
  45. #endif
  46. unsigned int tx_dma_channel;
  47. unsigned int rx_dma_channel;
  48. };
  49. struct bfin_sir_port_res {
  50. unsigned long base_addr;
  51. int irq;
  52. unsigned int rx_dma_channel;
  53. unsigned int tx_dma_channel;
  54. };
  55. struct bfin_sir_self {
  56. struct bfin_sir_port *sir_port;
  57. spinlock_t lock;
  58. unsigned int open;
  59. int speed;
  60. int newspeed;
  61. struct sk_buff *txskb;
  62. struct sk_buff *rxskb;
  63. struct net_device_stats stats;
  64. struct device *dev;
  65. struct irlap_cb *irlap;
  66. struct qos_info qos;
  67. iobuff_t tx_buff;
  68. iobuff_t rx_buff;
  69. struct work_struct work;
  70. int mtt;
  71. };
  72. #define DRIVER_NAME "bfin_sir"
  73. #define port_membase(port) (((struct bfin_sir_port *)(port))->membase)
  74. #define get_lsr_cache(port) (((struct bfin_sir_port *)(port))->lsr)
  75. #define put_lsr_cache(port, v) (((struct bfin_sir_port *)(port))->lsr = (v))
  76. #include <asm/bfin_serial.h>
  77. static const unsigned short per[][4] = {
  78. /* rx pin tx pin NULL uart_number */
  79. {P_UART0_RX, P_UART0_TX, 0, 0},
  80. {P_UART1_RX, P_UART1_TX, 0, 1},
  81. {P_UART2_RX, P_UART2_TX, 0, 2},
  82. {P_UART3_RX, P_UART3_TX, 0, 3},
  83. };