cpm_uart.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. struct uart_cpm_port {
  36. struct uart_port port;
  37. u16 rx_nrfifos;
  38. u16 rx_fifosize;
  39. u16 tx_nrfifos;
  40. u16 tx_fifosize;
  41. smc_t *smcp;
  42. smc_uart_t *smcup;
  43. scc_t *sccp;
  44. scc_uart_t *sccup;
  45. volatile cbd_t *rx_bd_base;
  46. volatile cbd_t *rx_cur;
  47. volatile cbd_t *tx_bd_base;
  48. volatile cbd_t *tx_cur;
  49. unsigned char *tx_buf;
  50. unsigned char *rx_buf;
  51. u32 flags;
  52. void (*set_lineif)(struct uart_cpm_port *);
  53. u8 brg;
  54. uint dp_addr;
  55. void *mem_addr;
  56. dma_addr_t dma_addr;
  57. /* helpers */
  58. int baud;
  59. int bits;
  60. /* Keep track of 'odd' SMC2 wirings */
  61. int is_portb;
  62. };
  63. extern int cpm_uart_port_map[UART_NR];
  64. extern int cpm_uart_nr;
  65. extern struct uart_cpm_port cpm_uart_ports[UART_NR];
  66. /* these are located in their respective files */
  67. void cpm_line_cr_cmd(int line, int cmd);
  68. int cpm_uart_init_portdesc(void);
  69. int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
  70. void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
  71. void smc1_lineif(struct uart_cpm_port *pinfo);
  72. void smc2_lineif(struct uart_cpm_port *pinfo);
  73. void scc1_lineif(struct uart_cpm_port *pinfo);
  74. void scc2_lineif(struct uart_cpm_port *pinfo);
  75. void scc3_lineif(struct uart_cpm_port *pinfo);
  76. void scc4_lineif(struct uart_cpm_port *pinfo);
  77. #endif /* CPM_UART_H */