serial.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Copyright (C) 1999 by Ralf Baechle
  7.  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  8.  */
  9. #ifndef _ASM_SERIAL_H
  10. #define _ASM_SERIAL_H
  11. #include <linux/config.h>
  12. /*
  13.  * This assumes you have a 1.8432 MHz clock for your UART.
  14.  *
  15.  * It'd be nice if someone built a serial card with a 24.576 MHz
  16.  * clock, since the 16550A is capable of handling a top speed of 1.5
  17.  * megabits/second; but this requires the faster clock.
  18.  */
  19. #define BASE_BAUD (1843200 / 16)
  20. #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
  21. /* Standard COM flags (except for COM4, because of the 8514 problem) */
  22. #ifdef CONFIG_SERIAL_DETECT_IRQ
  23. #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
  24. #define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
  25. #else
  26. #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
  27. #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
  28. #endif
  29. #define STD_SERIAL_PORT_DEFNS
  30. /* UART CLK   PORT IRQ     FLAGS        */
  31. { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */
  32. { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */
  33. { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */
  34. { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
  35. #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  36. #define STD_SERIAL_PORT_DEFNS
  37. #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
  38. #ifdef CONFIG_MIPS_SEAD
  39. #include <asm/mips-boards/sead.h>
  40. #include <asm/mips-boards/seadint.h>
  41. #define SEAD_SERIAL_PORT_DEFNS                  
  42. /* UART CLK   PORT IRQ     FLAGS        */                      
  43. { 0, SEAD_BASE_BAUD, SEAD_UART0_REGS_BASE, SEADINT_UART0, STD_COM_FLAGS },     /* ttyS0 */
  44. #else
  45. #define SEAD_SERIAL_PORT_DEFNS
  46. #endif
  47. #ifdef CONFIG_SGI_IP27
  48. /*
  49.  * Note about serial ports and consoles:
  50.  * For console output, everyone uses the IOC3 UARTA (offset 0x178)
  51.  * connected to the master node (look in ip27_setup_console() and
  52.  * ip27prom_console_write()).
  53.  *
  54.  * For serial (/dev/ttyS0 etc), we can not have hardcoded serial port
  55.  * addresses on a partitioned machine. Since we currently use the ioc3
  56.  * serial ports, we use dynamic serial port discovery that the serial.c
  57.  * driver uses for pci/pnp ports (there is an entry for the SGI ioc3
  58.  * boards in pci_boards[]). Unfortunately, UARTA's pio address is greater
  59.  * than UARTB's, although UARTA on o200s has traditionally been known as
  60.  * port 0. So, we just use one serial port from each ioc3 (since the
  61.  * serial driver adds addresses to get to higher ports).
  62.  *
  63.  * The first one to do a register_console becomes the preferred console
  64.  * (if there is no kernel command line console= directive). /dev/console
  65.  * (ie 5, 1) is then "aliased" into the device number returned by the
  66.  * "device" routine referred to in this console structure
  67.  * (ip27prom_console_dev).
  68.  *
  69.  * Also look in ip27-pci.c:pci_fixuop_ioc3() for some comments on working
  70.  * around ioc3 oddities in this respect.
  71.  *
  72.  * The IOC3 serials use a 22MHz clock rate with an additional divider by 3.
  73.  * (IOC3_BAUD = (22000000 / (3*16)))
  74.  *
  75.  * At the moment this is only a skeleton definition as we register all serials
  76.  * at runtime.
  77.  */
  78. #define IP27_SERIAL_PORT_DEFNS
  79. #else
  80. #define IP27_SERIAL_PORT_DEFNS
  81. #endif /* CONFIG_SGI_IP27 */
  82. #ifdef CONFIG_SGI_IP32
  83. #include <asm/ip32/ip32_ints.h>
  84. /*
  85.  * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
  86.  */
  87. /* Standard COM flags (except for COM4, because of the 8514 problem) */
  88. #ifdef CONFIG_SERIAL_DETECT_IRQ
  89. #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
  90. #define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
  91. #else
  92. #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF/* | ASYNC_SKIP_TEST*/)
  93. #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
  94. #endif
  95. #define IP32_SERIAL_PORT_DEFNS
  96.         { baud_base: BASE_BAUD,
  97.   irq: MACEISA_SERIAL1_IRQ,
  98.           flags: STD_COM_FLAGS,
  99.           iomem_base: (u8*)MACE_BASE+MACEISA_SER1_BASE,
  100.           iomem_reg_shift: 8,
  101.           io_type: SERIAL_IO_MEM},                      
  102.         { baud_base: BASE_BAUD,
  103.   irq: MACEISA_SERIAL2_IRQ,
  104.           flags: STD_COM_FLAGS,
  105.           iomem_base: (u8*)MACE_BASE+MACEISA_SER2_BASE,
  106.           iomem_reg_shift: 8,
  107.           io_type: SERIAL_IO_MEM},
  108. #else
  109. #define IP32_SERIAL_PORT_DEFNS
  110. #endif /* CONFIG_SGI_IP31 */
  111. #define SERIAL_PORT_DFNS
  112. IP27_SERIAL_PORT_DEFNS
  113. IP32_SERIAL_PORT_DEFNS
  114. SEAD_SERIAL_PORT_DEFNS
  115. STD_SERIAL_PORT_DEFNS
  116. #define RS_TABLE_SIZE 64
  117. #endif /* _ASM_SERIAL_H */