cpm_uart.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * linux/drivers/serial/cpm_uart.h
  3. *
  4. * Driver for CPM (SCC/SMC) serial ports
  5. *
  6. * Copyright (C) 2004 Freescale Semiconductor, Inc.
  7. *
  8. */
  9. #ifndef CPM_UART_H
  10. #define CPM_UART_H
  11. #include <linux/config.h>
  12. #if defined(CONFIG_CPM2)
  13. #include "cpm_uart_cpm2.h"
  14. #elif defined(CONFIG_8xx)
  15. #include "cpm_uart_cpm1.h"
  16. #endif
  17. #define SERIAL_CPM_MAJOR 204
  18. #define SERIAL_CPM_MINOR 46
  19. #define IS_SMC(pinfo) (pinfo->flags & FLAG_SMC)
  20. #define IS_DISCARDING(pinfo) (pinfo->flags & FLAG_DISCARDING)
  21. #define FLAG_DISCARDING 0x00000004 /* when set, don't discard */
  22. #define FLAG_SMC 0x00000002
  23. #define FLAG_CONSOLE 0x00000001
  24. #define UART_SMC1 0
  25. #define UART_SMC2 1
  26. #define UART_SCC1 2
  27. #define UART_SCC2 3
  28. #define UART_SCC3 4
  29. #define UART_SCC4 5
  30. #define UART_NR 6
  31. #define RX_NUM_FIFO 4
  32. #define RX_BUF_SIZE 32
  33. #define TX_NUM_FIFO 4
  34. #define TX_BUF_SIZE 32
  35. #define SCC_WAIT_CLOSING 100
  36. struct uart_cpm_port {
  37. struct uart_port port;
  38. u16 rx_nrfifos;
  39. u16 rx_fifosize;
  40. u16 tx_nrfifos;
  41. u16 tx_fifosize;
  42. smc_t *smcp;
  43. smc_uart_t *smcup;
  44. scc_t *sccp;
  45. scc_uart_t *sccup;
  46. volatile cbd_t *rx_bd_base;
  47. volatile cbd_t *rx_cur;
  48. volatile cbd_t *tx_bd_base;
  49. volatile cbd_t *tx_cur;
  50. unsigned char *tx_buf;
  51. unsigned char *rx_buf;
  52. u32 flags;
  53. void (*set_lineif)(struct uart_cpm_port *);
  54. u8 brg;
  55. uint dp_addr;
  56. void *mem_addr;
  57. dma_addr_t dma_addr;
  58. /* helpers */
  59. int baud;
  60. int bits;
  61. /* Keep track of 'odd' SMC2 wirings */
  62. int is_portb;
  63. /* wait on close if needed */
  64. int wait_closing;
  65. };
  66. extern int cpm_uart_port_map[UART_NR];
  67. extern int cpm_uart_nr;
  68. extern struct uart_cpm_port cpm_uart_ports[UART_NR];
  69. /* these are located in their respective files */
  70. void cpm_line_cr_cmd(int line, int cmd);
  71. int cpm_uart_init_portdesc(void);
  72. int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
  73. void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
  74. void smc1_lineif(struct uart_cpm_port *pinfo);
  75. void smc2_lineif(struct uart_cpm_port *pinfo);
  76. void scc1_lineif(struct uart_cpm_port *pinfo);
  77. void scc2_lineif(struct uart_cpm_port *pinfo);
  78. void scc3_lineif(struct uart_cpm_port *pinfo);
  79. void scc4_lineif(struct uart_cpm_port *pinfo);
  80. #endif /* CPM_UART_H */