1. 14 Mar, 2012 1 commit
  2. 13 Mar, 2012 1 commit
  3. 12 Mar, 2012 2 commits
  4. 09 Mar, 2012 12 commits
  5. 08 Mar, 2012 24 commits
    • Frank Benkert's avatar
      mpc5200b/uart: select more tolerant uart prescaler on low baudrates · e0955ace
      Frank Benkert authored
      In addition to the /32 prescaler, the MPC5200B supports a second
      baudrate prescaler /4 to reach higher baudrates.
      
      The current calculation (introduced with commit 0d1f22e4) in the kernel
      preferes this low prescaler as often as possible, but with some
      imprecise counterparts the communication on low baudrates fails.
      
      According a support-mail from freescale the low prescaler (/4) allows
      just 1% tolerance in bittiming in contrast to 4% of the high prescaler
      (/32).  The prescaler not only affects the baudrate-calculation, but
      also the sampling of the bits on the wire.
      
      With this patch, we use the slightly less precise, but higher tolerant
      prescaler calculation on low baudrates up to (and including) 115200 baud
      and the more precise calculation above.
      
      Tested on a custom MPC5200B board with "fsl,mpc5200b-psc-uart".
      
      Calculation Examples with prescaler (PS) 4 and 32 and divisor (DIV) on
      various baudrates. Real stands for the real baudrate generated and Diff
      for the differences between:
           50 Baud PS 32 DIV 0xa122 Real      50 Diff   0.00%
           75 Baud PS 32 DIV 0x6b6c Real      75 Diff   0.00%
          110 Baud PS 32 DIV 0x493e Real     110 Diff   0.00%
          134 Baud PS 32 DIV 0x3c20 Real     133 Diff   0.75%
          150 Baud PS 32 DIV 0x35b6 Real     150 Diff   0.00%
          200 Baud PS 32 DIV 0x2849 Real     199 Diff   0.50%
          300 Baud PS  4 DIV 0xd6d8 Real     300 Diff   0.00%
                   PS 32 DIV 0x1adb Real     300 Diff   0.00%
          600 Baud PS  4 DIV 0x6b6c Real     600 Diff   0.00%
                   PS 32 DIV 0x0d6e Real     599 Diff   0.17%
         1200 Baud PS  4 DIV 0x35b6 Real    1200 Diff   0.00%
                   PS 32 DIV 0x06b7 Real    1199 Diff   0.08%
         1800 Baud PS  4 DIV 0x23cf Real    1799 Diff   0.06%
                   PS 32 DIV 0x047a Real    1799 Diff   0.06%
         2400 Baud PS  4 DIV 0x1adb Real    2400 Diff   0.00%
                   PS 32 DIV 0x035b Real    2401 Diff - 0.04%
         4800 Baud PS  4 DIV 0x0d6e Real    4799 Diff   0.02%
                   PS 32 DIV 0x01ae Real    4796 Diff   0.08%
         9600 Baud PS  4 DIV 0x06b7 Real    9598 Diff   0.02%
                   PS 32 DIV 0x00d7 Real    9593 Diff   0.07%
        19200 Baud PS  4 DIV 0x035b Real   19208 Diff - 0.04%
                   PS 32 DIV 0x006b Real   19275 Diff - 0.39%
        38400 Baud PS  4 DIV 0x01ae Real   38372 Diff   0.07%
                   PS 32 DIV 0x0036 Real   38194 Diff   0.54%
        57600 Baud PS  4 DIV 0x011e Real   57692 Diff - 0.16%
                   PS 32 DIV 0x0024 Real   57291 Diff   0.54%
        76800 Baud PS  4 DIV 0x00d7 Real   76744 Diff   0.07%
                   PS 32 DIV 0x001b Real   76388 Diff   0.54%
       115200 Baud PS  4 DIV 0x008f Real  115384 Diff - 0.16%
                   PS 32 DIV 0x0012 Real  114583 Diff   0.54%
       153600 Baud PS  4 DIV 0x006b Real  154205 Diff - 0.39%
                   PS 32 DIV 0x000d Real  158653 Diff - 3.29%
       230400 Baud PS  4 DIV 0x0048 Real  229166 Diff   0.54%
                   PS 32 DIV 0x0009 Real  229166 Diff   0.54%
       307200 Baud PS  4 DIV 0x0036 Real  305555 Diff   0.54%
                   PS 32 DIV 0x0007 Real  294642 Diff   4.09%
       460800 Baud PS  4 DIV 0x0024 Real  458333 Diff   0.54%
                   PS 32 DIV 0x0005 Real  412500 Diff  10.48%
       500000 Baud PS  4 DIV 0x0021 Real  500000 Diff   0.00%
                   PS 32 DIV 0x0004 Real  515625 Diff - 3.13%
       576000 Baud PS  4 DIV 0x001d Real  568965 Diff   1.22%
                   PS 32 DIV 0x0004 Real  515625 Diff  10.48%
       614400 Baud PS  4 DIV 0x001b Real  611111 Diff   0.54%
                   PS 32 DIV 0x0003 Real  687500 Diff -11.90%
       921600 Baud PS  4 DIV 0x0012 Real  916666 Diff   0.54%
                   PS 32 DIV 0x0002 Real 1031250 Diff -11.90%
      1000000 Baud PS  4 DIV 0x0011 Real  970588 Diff   2.94%
                   PS 32 DIV 0x0002 Real 1031250 Diff - 3.13%
      1152000 Baud PS  4 DIV 0x000e Real 1178571 Diff - 2.31%
                   PS 32 DIV 0x0002 Real 1031250 Diff  10.48%
      1500000 Baud PS  4 DIV 0x000b Real 1500000 Diff   0.00%
                   PS 32 DIV 0x0001 Real 2062500 Diff -37.50%
      2000000 Baud PS  4 DIV 0x0008 Real 2062500 Diff - 3.13%
                   PS 32 DIV 0x0001 Real 2062500 Diff - 3.13%
      2500000 Baud PS  4 DIV 0x0007 Real 2357142 Diff   5.71%
                   PS 32 DIV 0x0001 Real 2062500 Diff  17.50%
      3000000 Baud PS  4 DIV 0x0006 Real 2750000 Diff   8.33%
                   PS 32 DIV 0x0001 Real 2062500 Diff  31.25%
      3500000 Baud PS  4 DIV 0x0005 Real 3300000 Diff   5.71%
                   PS 32 DIV 0x0001 Real 2062500 Diff  41.07%
      4000000 Baud PS  4 DIV 0x0004 Real 4125000 Diff - 3.13%
                   PS 32 DIV 0x0001 Real 2062500 Diff  48.44%
      Signed-off-by: default avatarFrank Benkert <frank.benkert@avat.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0955ace
    • Dan Carpenter's avatar
      tty: moxa: fix bit test in moxa_start() · 58112dfb
      Dan Carpenter authored
      This is supposed to be doing a shift before the comparison instead of
      just doing a bitwise AND directly.  The current code means the start()
      just returns without doing anything.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58112dfb
    • Jiri Slaby's avatar
      TTY: isdn/gigaset, use tty_port · 48a7466f
      Jiri Slaby authored
      Let us port the code to use tty_port. We now use open_count and tty
      from there. This allows us also to use tty_port_tty_set with tty
      refcounting instead of hand-written locking and logic.
      
      Note that tty and open_count are no longer protected by cs->lock. It is
      protected by tty_port->lock. But since all the places where they were
      used are now switched to the helpers, we are fine.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Hansjoerg Lipp <hjlipp@web.de>
      Acked-by: default avatarTilman Schmidt <tilman@imap.cc>
      Cc: <gigaset307x-common@lists.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      48a7466f
    • Jiri Slaby's avatar
      TTY: isdn/gigaset, do not set tty->driver_data to NULL · fc258f89
      Jiri Slaby authored
      Close the window in open where driver_data is reset to NULL on each
      open. It could cause other processes to get invalid retval from the
      tty->ops operations because of the checks all over the code.
      
      With this change we may do other cleanups. Now, the only valid check
      for tty->driver_data != NULL is in close. This can happen only if open
      fails at gigaset_get_cs_by_tty or try_module_get. The rest of checks
      in various tty->ops->* are invalid as driver_data cannot be NULL
      there. The same holds for cs->open_count. So remove them.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Hansjoerg Lipp <hjlipp@web.de>
      Cc: Tilman Schmidt <tilman@imap.cc>
      Cc: gigaset307x-common@lists.sourceforge.net
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc258f89
    • Jiri Slaby's avatar
      TTY: pdc_cons, use tty_port · 5dd5bc40
      Jiri Slaby authored
      Instead of digging a tty out of the tty_driver struct, which is not
      defined to work, use tty_port properly. This includes proper tty
      refcounting even though there is no possible race currently. But we
      will need tty_port for tty buffers in the future anyway.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5dd5bc40
    • Jiri Slaby's avatar
      TTY: pdc_cons, fix open vs pdc_console_tty_driver race · 0b479d54
      Jiri Slaby authored
      Assign the pointer to pdc_console_tty_driver (a tty_driver) earlier.
      Otherwise the timer may dereference NULL.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b479d54
    • Jiri Slaby's avatar
      TTY: pdc_cons, fix open vs timer race · 52b762f7
      Jiri Slaby authored
      The timer is initialized too late. tty->open may fire an invalid
      timer. So initialize the timer earlier using DEFINE_TIMER.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52b762f7
    • Jiri Slaby's avatar
      TTY: pdc_cons, fix racy tty test · e380a81e
      Jiri Slaby authored
      The tty->count test in the timer was racy. Let's remove the test and
      properly delete the timer and wait for the body to finish using _sync
      version of del_timer.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e380a81e
    • Jiri Slaby's avatar
      TTY: amiserial, use tty_port_close_start · 9b937421
      Jiri Slaby authored
      Again, no need to duplicate the code. Let's use the helper.
      
      Amiserial changes are only free of compilation errors. I have no
      access to the hardware.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b937421
    • Jiri Slaby's avatar
      TTY: amiserial, use tty_port_close_end · b8edebe4
      Jiri Slaby authored
      Hmm, the code was sleeping with interrupts disabled. This was not
      good. Fix this by turning interrupts at an appropriate place. (The
      race is protected by CLOSING flag.)
      
      After the move, the code is identical to tty_port_close_end, so use
      it!
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b8edebe4
    • Jiri Slaby's avatar
      TTY: amiserial, use tty_port_block_til_ready · 6e1aeb03
      Jiri Slaby authored
      Hmm, 150 lines of duplicated stuff is gone now.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e1aeb03
    • Jiri Slaby's avatar
      TTY: amiserial, provide carrier helpers · f1166604
      Jiri Slaby authored
      This is a preparation for a switch to tty_port_block_til_ready. We
      need amiga_carrier_raised and amiga_dtr_rts. The implementation is
      taken from startup, shutdown and current block_til_ready.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1166604
    • Jiri Slaby's avatar
      TTY: amiserial no longer needs serialP · 6fe18d26
      Jiri Slaby authored
      amiserial is the last user of serialP.h. Let's move struct
      serial_state directly to amiserial and remove serialP crap from
      includes. Finally, remove the header from the tree completely.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6fe18d26
    • Jiri Slaby's avatar
      TTY: amiserial, stop using serial_state->{irq,type,line} · ff169e5c
      Jiri Slaby authored
      * instead of line, use tty->index or iterator...
      * irq and type are left unset. So get rid of them.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff169e5c
    • Jiri Slaby's avatar
      TTY: amiserial, define local tty_port pointer · 7188dc20
      Jiri Slaby authored
      And use it to make the code more readable.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7188dc20
    • Jiri Slaby's avatar
      TTY: simserial, final cleanup · 6e9ebcfa
      Jiri Slaby authored
      * remove pointless checks (tty cannot be NULL at that points)
      * fix some printks (use __func__, print text directly w/o using global
        strings)
      * remove some empty lines
      
      This is the last patch for simserial. Overall, the driver is 400 lines
      shorter. Being now at 560 lines.
      
      It was tested using ski with a busybox userspace.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e9ebcfa
    • Jiri Slaby's avatar
      TTY: simserial, reindent some code · f66279cd
      Jiri Slaby authored
      Make the code to conform to the standard. Also make it readable.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f66279cd
    • Jiri Slaby's avatar
      TTY: simserial, fix includes · 8b916330
      Jiri Slaby authored
      Use headers from linux/* instead of asm/. Remove declaration of
      console_drivers, it's in linux/console.h already.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b916330
    • Jiri Slaby's avatar
      TTY: simserial, remove useless comments · adb636fe
      Jiri Slaby authored
      Or the obsolete ones like:
         "Let's have a little bit of fun"
      I have never had fun with software. For fun, one needs hard-ware.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      adb636fe
    • Jiri Slaby's avatar
      TTY: simserial, use tty_port_hangup · 458cd31a
      Jiri Slaby authored
      Convert shutdown to be tty_port_operations->shutdown. Then we can use
      tty_port_hangup. (And we have to use tty_port_close.)
      
      This means we no longer touch ASYNC_INITIALIZED, TTY_IO_ERROR. Also we
      do not need to do any peculiar TTY logic in the file now.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      458cd31a
    • Jiri Slaby's avatar
      TTY: simserial, use tty_port_open · 9aead90a
      Jiri Slaby authored
      So now we convert startup to be ->activate of tty_port. This means we
      no longer care about INITIALIZED and TTY_IO_ERROR flags.
      
      After we have ->activate much of the code may go as it duplicates what
      tty_port_open does. In this case tty_port_open adds block_til_ready to
      the path. But we do not define carrier hooks, so it is a noop.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9aead90a
    • Jiri Slaby's avatar
      TTY: simserial, properly refcount tty_port->tty · 3a5c2423
      Jiri Slaby authored
      So that we will not be surprised in the ISR anymore.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a5c2423
    • Jiri Slaby's avatar
      TTY: simserial, use tty_port_close_start · 78e74d77
      Jiri Slaby authored
      I.e. remove more copied bloat.
      
      The only change is that we wait_until_sent now. Which is what we
      really should do.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78e74d77
    • Jiri Slaby's avatar
      TTY: simserial, use tty_port_close_end · 37343030
      Jiri Slaby authored
      The code is identical except locking. But added locks to protect
      counts do not hurt here. Rather the contrary.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37343030