1. 08 6月, 2011 1 次提交
  2. 20 5月, 2011 2 次提交
  3. 20 4月, 2011 1 次提交
  4. 31 3月, 2011 1 次提交
  5. 18 2月, 2011 2 次提交
    • Y
      serial: change the divisor latch only when prescalar actually changed · 0d0389e5
      Yin Kangkai 提交于
      In 8250.c original ns16550 autoconfig code, we change the divisor latch when
      we goto to high speed mode, we're assuming the previous speed is legacy. This
      some times is not true.
      
      For example in a system with both CONFIG_SERIAL_8250 and
      CONFIG_SERIAL_8250_PNP set, in this case, the code (autoconfig) will be called
      twice, one in serial8250_init/probe() and the other is from
      serial_pnp_probe. When serial_pnp_probe calls the autoconfig for NS16550A,
      it's already in high speed mode, change the divisor latch (quot << 3) in this
      case will make the UART console garbled.
      
      CC: Greg Kroah-Hartman <greg@kroah.com>
      CC: David Woodhouse <dwmw2@infradead.org>
      CC: linux-kernel@vger.kernel.org
      CC: stable@kernel.org
      Signed-off-by: NYin Kangkai <kangkai.yin@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0d0389e5
    • Y
      serial: also set the uartclk value in resume after goes to highspeed · 95926d2d
      Yin Kangkai 提交于
      For any reason if the NS16550A was not work in high speed mode (e.g. we hold
      NS16550A from going to high speed mode in autoconfig_16550a()), now we are
      resume from suspend, we should also set the uartclk to the correct
      value. Otherwise it is still the old 1843200 and that will bring issues.
      
      CC: Greg Kroah-Hartman <greg@kroah.com>
      CC: David Woodhouse <dwmw2@infradead.org>
      CC: linux-kernel@vger.kernel.org
      CC: stable@kernel.org
      Signed-off-by: NYin Kangkai <kangkai.yin@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      95926d2d
  6. 23 1月, 2011 1 次提交
  7. 14 1月, 2011 1 次提交
    • G
      tty: move drivers/serial/ to drivers/tty/serial/ · ab4382d2
      Greg Kroah-Hartman 提交于
      The serial drivers are really just tty drivers, so move them to
      drivers/tty/ to make things a bit neater overall.
      
      This is part of the tty/serial driver movement proceedure as proposed by
      Arnd Bergmann and approved by everyone involved a number of months ago.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Rogier Wolff <R.E.Wolff@bitwizard.nl>
      Cc: Michael H. Warfield <mhw@wittsend.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ab4382d2
  8. 11 12月, 2010 3 次提交
    • O
      8250: fix uninitialized FIFOs · e4f05af1
      Ondrej Puzman 提交于
      I have found a bug in 8250.c driver which causes that 16550A uart FIFOs
      are not turned on during initialization if they are manually configured
      by setserial. UART is then working only as plain 16450 without FIFOs. On
      systems with higher interrupt latency this causes buffer overruns and
      loss of received data when using higher communication speeds.
      
      I'm working for a company which produces industrial computers. These
      devices typically contain high number (8 or more) of traditional 16550A
      uarts - we use TL16C554A chips, but that is not much relevant. UARTs are
      connected to the CPU by ISA bus (Celeron based devices) or LPC bus (Atom
      based devices).
      
      In the Linux the UARTs are using standard 8250.c driver and are
      initialized using setserial command:
      setserial /dev/ttyS4 uart 16550A port 0x3E0 irq 10 baud_base 115200
      
      This executes the UART initialization through serial8250_startup()
      function. At the beginning of the function up->capabilities is
      initialized from uart_config:
       up->capabilities = uart_config[up->port.type].flags;
      Please note that neither up->port.fifosize nor up->tx_loadsz is
      initialized here!!
      
      Later in the same function serial8250_clear_fifos() is called and
      disables FIFOs. The above comment says that they will be reenabled in
      set_termios (they won't ...)
      
      After serial8250_startup() the serial8250_set_termios() is called. In
      this function the following check fails because up->port.fifosize is
      zero because it is not initialized correctly.
      
              if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) {
                      if (baud < 2400)
                              fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
                      else
                              fcr = uart_config[up->port.type].fcr;
              }
      
      fcr variable remains zero and in the end the FCR register is set to zero
      which results in disabled FIFOs even if the UART type is 16550A. This is
      also true for other types of UARTs with FIFOs.
      
      If the UART is autoconfigured via 'setserial /dev/ttySx autoconfig' then
      port.fifosize and tx_loadsz are initialized correctly in the
      autoconfig() function and the UART is working correctly then.
      
      I checked the source codes and I can say that this bug is present in
      2.6.x series of kernels for a couple of years. Namely I can confirm its
      presence in 2.6.16.57, 2.6.32.24 and 2.6.36.1 (tested all of them on our
      hardware).
      
      I think it was not noticed before because not many people use manually
      configured non PNP UARTs on ISA/LPC bus these days. Also the data loss
      caused by buffer overruns occures only if  IRQ latency is higher then
      time needed to receive one character on given communication speed.
      For example our hardware looses received characters only if the UARTs
      are connected throught LPC bus with SERIRQ (serial IRQ transport) and
      not if they are connected to ISA bus because LPC SERIRQ has higher
      interrupt latency then parallel ISA interupt lines.
      
      Here is the patch to correct the bug created against 2.6.36.1:
      Signed-off-by: NOndrej Puzman <puzman@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e4f05af1
    • J
      8250: add a UPIO_DWAPB32 for 32 bit accesses · a3ae0fc3
      Jamie Iles 提交于
      Some platforms contain a Synopsys DesignWare APB UART that is attached
      to a 32-bit APB bus where sub-word accesses are not allowed. Add a new
      IO type (UPIO_DWAPB32) that performs 32 bit acccesses to the UART.
      
      v2:
      	- don't test for 32 bit in the output fast path, provide a
      	  separate dwabp32_serial_out() function. Refactor
      	  dwabp_serial_out() so that we can reuse the LCR saving
      	  code.
      v3:
      	- rebased on top of "8250: use container_of() instead of
      	  casting"
      Signed-off-by: NJamie Iles <jamie@jamieiles.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a3ae0fc3
    • J
      8250: use container_of() instead of casting · 49d5741b
      Jamie Iles 提交于
      The 8250 driver structure uart_8250_port took advantage of the fact
      that the struct uart_port was the first member of its structure and
      used an explicit cast to convert to the derived class. Replace the
      explicit casts with container_of() for safety and clarity.
      Signed-off-by: NJamie Iles <jamie@jamieiles.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      49d5741b
  9. 01 12月, 2010 1 次提交
  10. 17 11月, 2010 1 次提交
  11. 14 11月, 2010 1 次提交
  12. 12 11月, 2010 1 次提交
    • L
      8250: Fix tcsetattr to avoid ioctl(TIOCMIWAIT) hang · 47d3904f
      Lawrence Rust 提交于
      Calling tcsetattr prevents any thread(s) currently suspended in ioctl
      TIOCMIWAIT for the same device from ever resuming.
      
      If a thread is suspended inside a call to ioctl TIOCMIWAIT, waiting for
      a modem status change, then the 8250 driver enables modem status
      interrupts (MSI).  The device interrupt service routine resumes the
      suspended thread(s) on the next MSI.
      
      If while the thread(s) are suspended, another thread calls tcsetattr
      then the 8250 driver disables MSI (unless CTS/RTS handshaking is
      enabled) thus preventing the suspended thread(s) from ever being
      resumed.
      
      This patch only disables MSI in tcsetattr handling if there are no
      suspended threads.
      
      Program to demonstrate bug & fix:
      
      /* gcc miwait.c -o miwait -l pthread */
      #include <stdio.h>
      #include <errno.h>
      #include <unistd.h>
      #include <fcntl.h>
      #include <pthread.h>
      #include <termios.h>
      #include <sys/ioctl.h>
      #include <linux/serial.h>
      
      static void* monitor( void* pv);
      static int s_fd;
      
      int main( void)
        {
        const char kszDev[] = "/dev/ttyS0";
        pthread_t t;
        struct termios tio;
      
        s_fd = open( kszDev, O_RDWR | O_NONBLOCK);
        if ( s_fd < 0)
          return fprintf( stderr, "Error(%d) opening %s: %s\n", errno, kszDev, strerror( errno)), 1;
      
        pthread_create( &t, NULL, &monitor, NULL);
      
        /* Modem status changes seen here */
        puts( "Main: awaiting status changes");
        sleep( 5);
      
        tcgetattr( s_fd, &tio);
        tio.c_cflag ^= CSTOPB;
      
        /* But not after here */
        puts( "Main: tcsetattr called");
        tcsetattr( s_fd, TCSANOW, &tio);
      
        for (;;)
          sleep( 1);
        }
      
      static void* monitor( void* pv)
        {
        (void)pv;
        for(;;)
          {
          unsigned uModem;
          struct serial_icounter_struct cnt;
      
          if ( ioctl( s_fd, TIOCMGET, &uModem) < 0)
            fprintf( stderr, "Error(%d) in TIOCMGET: %s\n", errno, strerror( errno));
          printf( "Modem status:%s%s%s%s%s%s\n",
            (uModem & TIOCM_RTS) ? " RTS" : "",
            (uModem & TIOCM_DTR) ? " DTR" : "",
            (uModem & TIOCM_CTS) ? " CTS" : "",
            (uModem & TIOCM_DSR) ? " DSR" : "",
            (uModem & TIOCM_CD) ? " CD" : "",
            (uModem & TIOCM_RI) ? " RI" : ""
          );
      
          if ( ioctl( s_fd, TIOCGICOUNT, &cnt) < 0)
            fprintf( stderr, "Error(%d) in TIOCGICOUNT: %s\n", errno, strerror( errno));
          printf( "Irqs: CTS:%d DSR:%d RNG:%d DCD:%d Rx:%d Tx:%d Frame:%d Orun:%d Par:%d Brk:%d Oflow:%d\n",
            cnt.cts, cnt.dsr, cnt.rng, cnt.dcd,
            cnt.rx, cnt.tx, cnt.frame, cnt.overrun, cnt.parity,
            cnt.brk, cnt.buf_overrun
          );
      
          fputs( "Waiting...", stdout), fflush( stdout);
          if ( 0 > ioctl( s_fd, TIOCMIWAIT, (unsigned long)(TIOCM_CAR | TIOCM_RNG | TIOCM_DSR | TIOCM_CTS)))
            fprintf( stderr, "\nError(%d) in TIOCMIWAIT: %s\n", errno, strerror( errno));
          fputs( "\n", stdout);
          }
        return NULL;
        }
      
      Signed-off by Lawrence Rust <lawrence@softsystem.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      47d3904f
  13. 23 10月, 2010 5 次提交
  14. 18 10月, 2010 1 次提交
  15. 11 8月, 2010 3 次提交
    • P
      U6715 16550A serial driver support · 235dae5d
      Philippe Langlais 提交于
      UART Features extract from STEricsson U6715 data-sheet (arm926 SoC for mobile phone):
      * Fully compatible with industry standard 16C550 and 16C450 from various
      manufacturers
      * RX and TX 64 byte FIFO reduces CPU interrupts
      * Full double buffering
      * Modem control signals include CTS, RTS, (and DSR, DTR on UART1 only)
      * Automatic baud rate selection
      * Manual or automatic RTS/CTS smart hardware flow control
      * Programmable serial characteristics:
      – Baud rate generation (50 to 3.25M baud)
      – 5, 6, 7 or 8-bit characters
      – Even, odd or no-parity bit generation and detection
      – 1, 1.5 or 2 stop bit generation
      * Independent control of transmit, receive, line status, data set interrupts and FIFOs
      * Full status-reporting capabilities
      * Separate DMA signaling for RX and TX
      * Timed interrupt to spread receive interrupt on known duration
      * DMA time-out interrupt to allow detection of end of reception
      * Carkit pulse coding and decoding compliant with USB carkit control interface [40]
      
      In 16550A auto-configuration, if the fifo size is 64 then it's an U6 16550A port
      Add set_termios hook & export serial8250_do_set_termios to change uart
      clock following baudrate
      Signed-off-by: NPhilippe Langlais <philippe.langlais@stericsson.com>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      235dae5d
    • A
      8250: fix set_ldisc operation · a0821df6
      Arnd Bergmann 提交于
      The ldisc number now gets passed into ->set_ldisc.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      a0821df6
    • Y
      serial: add UART_CAP_EFR and UART_CAP_SLEEP flags to 16C950 UARTs definition · 7a56aa45
      Yegor Yefremov 提交于
      Adding UART_CAP_EFR and UART_CAP_SLEEP flags will enable sleep mode
      and automatic CTS flow control for 16C950 UARTs. It will also avoid
      capabilities detection warning like this:
      
      "ttyS0: detected caps 00000700 should be 00000100"
      Signed-off-by: NYegor Yefremov <yegorslists@googlemail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7a56aa45
  16. 05 8月, 2010 1 次提交
  17. 21 5月, 2010 1 次提交
    • J
      kgdb,8250,pl011: Return immediately from console poll · f5316b4a
      Jason Wessel 提交于
      The design of the kdb shell requires that every device that can
      provide input to kdb have a polling routine that exits immediately if
      there is no character available.  This is required in order to get the
      page scrolling mechanism working.
      
      Changing the kernel debugger I/O API to require all polling character
      routines to exit immediately if there is no data allows the kernel
      debugger to process multiple input channels.
      
      NO_POLL_CHAR will be the return code to the polling routine when ever
      there is no character available.
      
      CC: linux-serial@vger.kernel.org
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      f5316b4a
  18. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  19. 13 3月, 2010 1 次提交
  20. 03 3月, 2010 1 次提交
  21. 27 2月, 2010 1 次提交
    • M
      SERIAL 8250: Fixes for Alchemy UARTs. · b2b13cdf
      Manuel Lauss 提交于
      Limit the amount of address space claimed for Alchemy serial ports to
      0x1000.  On the Au1300, ports are only 0x1000 apart, and the registers
      only extend to 0x110 at most on all supported alchemy models.
      
      On the Au1300 the autodetect logic no longer works and this makes it
      necessary to specify the port type through platform data.  Because of
      this the MSR quirk needs to be moved outside the autoconfig() function
      which will no longer be called when UPF_FIXED_TYPE is specified.
      Signed-off-by: NManuel Lauss <manuel.lauss@gmail.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>,
      Cc: linux-serial@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b2b13cdf
  22. 17 2月, 2010 1 次提交
    • D
      serial: 8250: add serial transmitter fully empty test · bca47613
      Dick Hollenbeck 提交于
      When controlling an industrial radio modem it can be necessary to
      manipulate the handshake lines in order to control the radio modem's
      transmitter, from userspace.
      
      The transmitter should not be turned off before all characters have been
      transmitted.  serial8250_tx_empty() was reporting that all characters were
      transmitted before they actually were.
      
      ===
      
      Discovered in parallel with more testing and analysis by Kees Schoenmakers
      as follows:
      
      I ran into an NetMos 9835 serial pci board which behaves a little
      different than the standard.  This type of expansion board is very common.
      
      "Standard" 8250 compatible devices clear the 'UART_LST_TEMT" bit together
      with the "UART_LSR_THRE" bit when writing data to the device.
      
      The NetMos device does it slightly different
      
      I believe that the TEMT bit is coupled to the shift register.  The problem
      is that after writing data to the device and very quickly after that one
      does call serial8250_tx_empty, it returns the wrong information.
      
      My patch makes the test more robust (and solves the problem) and it does
      not affect the already correct devices.
      
      Alan:
      
        We may yet need to quirk this but now we know which chips we have a
        way to do that should we find this breaks some other 8250 clone with
        dodgy THRE.
      Signed-off-by: NDick Hollenbeck <dick@softplc.com>
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Cc: Kees Schoenmakers <k.schoenmakers@sigmae.nl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bca47613
  23. 12 12月, 2009 2 次提交
  24. 12 11月, 2009 1 次提交
  25. 02 10月, 2009 1 次提交
  26. 20 9月, 2009 4 次提交
    • A
      serial: move delta_msr_wait into the tty_port · bdc04e31
      Alan Cox 提交于
      This is used by various drivers not just serial and can be extracted
      as commonality
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      bdc04e31
    • A
      serial: kill off uart_info · ebd2c8f6
      Alan Cox 提交于
      We moved this into uart_state, now move the fields out of the separate
      structure and kill it off.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ebd2c8f6
    • A
      8250: Now honours baud rate lower bounds · 24d481ec
      Anton Vorontsov 提交于
      A platform clock drives 8250 ports in most SOC systems, the clock
      might run at high frequencies, and so it's not always possible to
      downscale uart clock to a desired value.
      
      Currently the 8250 uart driver accepts not supported baud rates, and
      what is worse, it is doing this silently, and then passes not accepted
      values to a new termios, so userspace has no chance to catch this kind
      of errors (userspace verifies that settings were accepted by reading
      back and comparing the settings).
      
      This patch fixes the issue by passing minimum baud rate to the
      uart_get_baud_rate() call, the call should take care of all bounds,
      so userspace should now report:
      
        # stty -F /dev/ttyS0 speed 300
        115200
        stty: /dev/ttyS0: unable to perform all requested operations
      
      p.s. uart_get_baud_rate() falls back to 9600, which still might be too
           low for some 10 GHz platforms, but that's a separate issue, and
           we can wait with fixing this till we find such a platform.
      Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      24d481ec
    • V
      serial: 8250: add IRQ trigger support · 1c2f0493
      Vikram Pandita 提交于
      There is currently no provision for passing IRQ trigger flags for
      serial IRQs with triggering requirements (such as GPIO IRQs)
      
      This patch adds irqflags to plat_serial8250_port that can be passed
      from board file to reqest_irq() of 8250 driver
      
      Changes are backward compatible with boards passing UPF_SHARE_IRQ flag
      
      Tested on Zoom2 board that has IRQF_TRIGGER_RISING requirement for 8250 irq
      
      [Moved new flag to end to fix bugs in the original with the old_serial array
      	-- Alan]
      Signed-off-by: NVikram Pandita <vikram.pandita@ti.com>
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1c2f0493