mn10300-serial.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* MN10300 On-chip serial port driver definitions
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _MN10300_SERIAL_H
  12. #define _MN10300_SERIAL_H
  13. #ifndef __ASSEMBLY__
  14. #include <linux/serial_core.h>
  15. #include <linux/termios.h>
  16. #endif
  17. #include <asm/page.h>
  18. #include <asm/serial-regs.h>
  19. #define NR_PORTS 3 /* should be set 3 or 9 or 16 */
  20. #define MNSC_BUFFER_SIZE +(PAGE_SIZE / 2)
  21. /* intr_flags bits */
  22. #define MNSCx_RX_AVAIL 0x01
  23. #define MNSCx_RX_OVERF 0x02
  24. #define MNSCx_TX_SPACE 0x04
  25. #define MNSCx_TX_EMPTY 0x08
  26. /* tx_flags bits */
  27. #define MNSCx_TX_BREAK 0x01
  28. #define MNSCx_TX_STOP 0x02
  29. #ifndef __ASSEMBLY__
  30. struct mn10300_serial_port {
  31. char *rx_buffer; /* reception buffer base */
  32. unsigned rx_inp; /* pointer to rx input offset */
  33. unsigned rx_outp; /* pointer to rx output offset */
  34. u8 tx_xchar; /* high-priority XON/XOFF buffer */
  35. u8 tx_flags; /* transmit break/stop request */
  36. u8 intr_flags; /* interrupt flags */
  37. volatile u16 *rx_icr; /* Rx interrupt control register */
  38. volatile u16 *tx_icr; /* Tx interrupt control register */
  39. int rx_irq; /* reception IRQ */
  40. int tx_irq; /* transmission IRQ */
  41. int tm_irq; /* timer IRQ */
  42. const char *name; /* name of serial port */
  43. const char *rx_name; /* Rx interrupt handler name of serial port */
  44. const char *tx_name; /* Tx interrupt handler name of serial port */
  45. const char *tm_name; /* Timer interrupt handler name */
  46. unsigned short type; /* type of serial port */
  47. unsigned char isconsole; /* T if it's a console */
  48. volatile void *_iobase; /* pointer to base of I/O control regs */
  49. volatile u16 *_control; /* control register pointer */
  50. volatile u8 *_status; /* status register pointer */
  51. volatile u8 *_intr; /* interrupt register pointer */
  52. volatile u8 *_rxb; /* receive buffer register pointer */
  53. volatile u8 *_txb; /* transmit buffer register pointer */
  54. volatile u16 *_tmicr; /* timer interrupt control register */
  55. volatile u8 *_tmxmd; /* baud rate timer mode register */
  56. volatile u16 *_tmxbr; /* baud rate timer base register */
  57. /* this must come down here so that assembly can use BSET to access the
  58. * above fields */
  59. struct uart_port uart;
  60. unsigned short rx_brk; /* current break reception status */
  61. u16 tx_cts; /* current CTS status */
  62. int gdbstub; /* preemptively stolen by GDB stub */
  63. u8 clock_src; /* clock source */
  64. #define MNSCx_CLOCK_SRC_IOCLK 0
  65. #define MNSCx_CLOCK_SRC_IOBCLK 1
  66. u8 div_timer; /* timer used as divisor */
  67. #define MNSCx_DIV_TIMER_16BIT 0
  68. #define MNSCx_DIV_TIMER_8BIT 1
  69. u16 options; /* options */
  70. #define MNSCx_OPT_CTS 0x0001
  71. unsigned long ioclk; /* base clock rate */
  72. };
  73. #ifdef CONFIG_MN10300_TTYSM0
  74. extern struct mn10300_serial_port mn10300_serial_port_sif0;
  75. #endif
  76. #ifdef CONFIG_MN10300_TTYSM1
  77. extern struct mn10300_serial_port mn10300_serial_port_sif1;
  78. #endif
  79. #ifdef CONFIG_MN10300_TTYSM2
  80. extern struct mn10300_serial_port mn10300_serial_port_sif2;
  81. #endif
  82. extern struct mn10300_serial_port *mn10300_serial_ports[];
  83. struct mn10300_serial_int {
  84. struct mn10300_serial_port *port;
  85. asmlinkage void (*vdma)(void);
  86. };
  87. extern struct mn10300_serial_int mn10300_serial_int_tbl[];
  88. extern asmlinkage void mn10300_serial_vdma_interrupt(void);
  89. extern asmlinkage void mn10300_serial_vdma_rx_handler(void);
  90. extern asmlinkage void mn10300_serial_vdma_tx_handler(void);
  91. #endif /* __ASSEMBLY__ */
  92. #if defined(CONFIG_GDBSTUB_ON_TTYSM0)
  93. #define SCgSTR SC0STR
  94. #define SCgRXB SC0RXB
  95. #define SCgRXIRQ SC0RXIRQ
  96. #elif defined(CONFIG_GDBSTUB_ON_TTYSM1)
  97. #define SCgSTR SC1STR
  98. #define SCgRXB SC1RXB
  99. #define SCgRXIRQ SC1RXIRQ
  100. #elif defined(CONFIG_GDBSTUB_ON_TTYSM2)
  101. #define SCgSTR SC2STR
  102. #define SCgRXB SC2RXB
  103. #define SCgRXIRQ SC2RXIRQ
  104. #endif
  105. #endif /* _MN10300_SERIAL_H */