Skip to content
Snippets Groups Projects
  1. Nov 11, 2010
    • Sonic Zhang's avatar
      serial: bfin_5xx: grab port lock before making port termios changes · 5bb06b62
      Sonic Zhang authored
      
      The port lock exists to protect these resources, so we need to grab it
      before making changes.
      
      Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5bb06b62
    • Sonic Zhang's avatar
      serial: bfin_5xx: disable CON_PRINTBUFFER for consoles · 6d9e4498
      Sonic Zhang authored
      
      If we are using early serial, don't let the normal console rewind
      the log buffer, since that causes things to be printed multiple times.
      
      Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6d9e4498
    • Sonic Zhang's avatar
      serial: bfin_5xx: remove redundant SSYNC to improve TX speed · 001a05d5
      Sonic Zhang authored
      
      We don't need to force a SSYNC here as the LSR register will already
      be updated by the time we get back to reading it.  This speeds up TX
      throughput and lowers general system overhead (since SSYNC is system
      wide, not peripheral-specific).
      
      Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      001a05d5
    • Sonic Zhang's avatar
      serial: bfin_5xx: always include DMA headers · b6100992
      Sonic Zhang authored
      
      On Blackfin systems, peripherals that have optional DMA support always
      route their interrupts through the corresponding DMA channel -- even
      when DMA is not being used.  So in PIO mode, we still need to request
      the DMA channel (so interrupts are delivered) which means we need to
      always include the DMA header for the DMA defines/functions.
      
      Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b6100992
    • Lawrence Rust's avatar
      8250: Fix tcsetattr to avoid ioctl(TIOCMIWAIT) hang · 47d3904f
      Lawrence Rust authored
      
      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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      47d3904f
  2. Nov 09, 2010
  3. Nov 03, 2010
  4. Oct 28, 2010
  5. Oct 22, 2010
  6. Oct 20, 2010
  7. Oct 19, 2010
  8. Oct 18, 2010
Loading