1. 23 9月, 2011 2 次提交
    • N
      serial-core: power up uart port early before we do set_termios when resuming · 94abc56f
      Ning Jiang 提交于
      The following patch removed uart_change_pm() in uart_resume_port():
      
      commit 5933a161
      Author: Yin Kangkai <kangkai.yin@linux.intel.com>
          serial-core: reset the console speed on resume
      
      It will break the pxa serial driver when the system resumes from suspend mode
      as it will try to set baud rate divider register in set_termios but with
      clock off. The register value can not be set correctly on some platform if
      the clock is disabled. The pxa driver will check the value and report the
      following warning:
      
      ------------[ cut here ]------------
      WARNING: at drivers/tty/serial/pxa.c:545 serial_pxa_set_termios+0x1dc/0x250()
      Modules linked in:
      [<c0281f30>] (unwind_backtrace+0x0/0xf0) from [<c029341c>] (warn_slowpath_common+0x4c/0x64)
      [<c029341c>] (warn_slowpath_common+0x4c/0x64) from [<c029344c>] (warn_slowpath_null+0x18/0x1c)
      [<c029344c>] (warn_slowpath_null+0x18/0x1c) from [<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250)
      [<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250) from [<c044a840>] (uart_resume_port+0x128/0x2dc)
      [<c044a840>] (uart_resume_port+0x128/0x2dc) from [<c044bbe0>] (serial_pxa_resume+0x18/0x24)
      [<c044bbe0>] (serial_pxa_resume+0x18/0x24) from [<c0454d34>] (platform_pm_resume+0x40/0x4c)
      [<c0454d34>] (platform_pm_resume+0x40/0x4c) from [<c0457ebc>] (pm_op+0x68/0xb4)
      [<c0457ebc>] (pm_op+0x68/0xb4) from [<c0458368>] (device_resume+0xb0/0xec)
      [<c0458368>] (device_resume+0xb0/0xec) from [<c04584c8>] (dpm_resume+0xe0/0x194)
      [<c04584c8>] (dpm_resume+0xe0/0x194) from [<c0458588>] (dpm_resume_end+0xc/0x18)
      [<c0458588>] (dpm_resume_end+0xc/0x18) from [<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac)
      [<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac) from [<c02c5278>] (enter_state+0xac/0xdc)
      [<c02c5278>] (enter_state+0xac/0xdc) from [<c02c48ec>] (state_store+0xa0/0xbc)
      [<c02c48ec>] (state_store+0xa0/0xbc) from [<c0408f7c>] (kobj_attr_store+0x18/0x1c)
      [<c0408f7c>] (kobj_attr_store+0x18/0x1c) from [<c034a6a4>] (sysfs_write_file+0x108/0x140)
      [<c034a6a4>] (sysfs_write_file+0x108/0x140) from [<c02fb798>] (vfs_write+0xac/0x134)
      [<c02fb798>] (vfs_write+0xac/0x134) from [<c02fb8cc>] (sys_write+0x3c/0x68)
      [<c02fb8cc>] (sys_write+0x3c/0x68) from [<c027c700>] (ret_fast_syscall+0x0/0x2c)
      ---[ end trace 88289eceb4675b04 ]---
      
      This patch fix the problem by adding the power on opertion back for uart
      console when console_suspend_enabled is true.
      Signed-off-by: NNing Jiang <ning.jiang@marvell.com>
      Tested-by: NMayank Rana <mrana@codeaurora.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      94abc56f
    • N
      TTY: serial: Move mutex_unlock in uart_close function · 55956216
      Nobuhiro Iwamatsu 提交于
      When mutex_lock is not called, mutex_unlock is sometimes called.
      This deletes unnecessary goto and makes modifications so that
      mutex_unlock is called.
      
      [    8.304000] WARNING: at kernel/muex-debug.c:78
      [    8.304000] Modules linked in:
      [    8.304000]
      [    8.304000] Pid : 114, Comm:                 modprobe
      [    8.304000] CPU : 0                  Not tainted  (3.1.0-rc3-next-20110826 #810)
      [    8.304000]
      [    8.304000] PC is at debug_mutex_unlock+0xf4/0x120
      [    8.304000] PR is at debug_mutex_unlock+0xe6/0x120
      [    8.304000] PC  : 80051114 SP  : 9f02de58 SR  : 400081f1 TEA : 295cf4f2
      [    8.304000] R0  : 00000001 R1  : 00000000 R2  : 0000000f R3  : 00000000
      [    8.304000] R4  : 9fc63158 R5  : 00000000 R6  : 00000001 R7  : 9fe1de78
      [    8.304000] R8  : 805c6b2c R9  : 80003920 R10 : 00000000 R11 : 805c6b2c
      [    8.304000] R12 : 80425ca0 R13 : 00000000 R14 : 9f02de58
      [    8.304000] MACH: 00000003 MACL: 00000000 GBR : 296e1678 PR  : 80051106
      [    8.304000]
      [    8.304000] Call trace:
      [    8.304000]  [<804236c6>] __mutex_unlock_slowpath+0x46/0x120
      [    8.304000]  [<804237aa>] mutex_unlock+0xa/0x20
      [    8.304000]  [<80240ed6>] uart_close+0x76/0x2c0
      [    8.304000]  [<80223b98>] tty_release+0xf8/0x5c0
      [    8.304000]  [<800a93a6>] lookup_object+0x26/0xa0
      [    8.304000]  [<80063f6a>] call_rcu+0x8a/0xc0
      [    8.304000]  [<800a944a>] put_object+0x2a/0x60
      [    8.304000]  [<80003920>] arch_local_irq_restore+0x0/0x40
      [    8.304000]  [<800af320>] fput+0x180/0x2c0
      [    8.304000]  [<800af248>] fput+0xa8/0x2c0
      [    8.304000]  [<800ab1a8>] filp_close+0x48/0xc0
      [    8.304000]  [<800ab29a>] sys_close+0x7a/0x100
      [    8.304000]  [<8000825a>] syscall_call+0xc/0x10
      [    8.304000]  [<800ab220>] sys_close+0x0/0x100
      [    8.304000]
      [    8.304000] Code:
      [    8.304000]   8005110e:  mov.l     @r1, r1
      [    8.304000]   80051110:  tst       r1, r1
      [    8.304000]   80051112:  bf        80051116
      [    8.304000] ->80051114:  trapa     #62
      [    8.304000]   80051116:  mov.l     @r8, r1
      [    8.304000]   80051118:  tst       r1, r1
      [    8.304000]   8005111a:  bt.s      8005104c
      [    8.304000]   8005111c:  mov       #0, r1
      [    8.304000]   8005111e:  bra       80051056
      [    8.304000]
      [    8.304000] ---[ end trace e8f8e04c313f429b ]---
      Signed-off-by: NNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      55956216
  2. 26 8月, 2011 3 次提交
    • J
      TTY: use tty_wait_until_sent_from_close in other drivers · 0b058353
      Jiri Slaby 提交于
      Let's use the newly added helper to avoid stalls in drivers which are
      not yet ported to tty_port helpers.
      
      Those which are broken (call tty_wait_until_sent with irqs disabled)
      are left untouched. They are in a deeper trouble than we are trying to
      solve here. This includes amiserial, 68328serial, 68360serial and
      crisv10.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0b058353
    • J
      TTY: serial, move locking in uart_close · bafb0bd2
      Jiri Slaby 提交于
      So now, when we handle CLOSING flag, there is no point to hold
      port->mutex over the start of uart_close.
      
      Yes, there are still several things to reason about:
      * port->count etc is and always was protected by a spinlock
      * ->stop_rx is protected by a spinlock. Otherwise it would
        race with interrupts.
      * uart_wait_until_sent -- that one is already called without
        port->mutex from set_termios and tty_set_ldisc. Should anything
        be protected there, it would be tx_empty. And by a spinlock.
        8250 does this internally...
      
      This step is needed to fix system stalls. To not create an AB-BA lock
      dependency (see next patches).
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bafb0bd2
    • J
      TTY: serial, use ASYNCB_CLOSING in uart_close · 426929f8
      Jiri Slaby 提交于
      We need to move port->mutex locking after wait_until_sent in
      uart_close (for rationale see next patches). But if we did it now, we
      would introduce a race between close and open. This is exactly why
      port->mutex is locked at the top of uart_close.
      
      To avoid the race, we add ASYNCB_CLOSING to uart_close. Like every
      other sane TTY driver. Thanks to tty_port_block_til_ready used in
      uart_open we will have this for free. Then we can move the port->mutex
      lock.
      
      Also note that this will make the conversion to tty_port helpers
      easier. They are currently handling ASYNC_CLOSING flag correctly.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      426929f8
  3. 24 8月, 2011 4 次提交
  4. 26 4月, 2011 2 次提交
  5. 20 4月, 2011 6 次提交
  6. 18 2月, 2011 3 次提交
  7. 04 2月, 2011 1 次提交
    • Y
      serial-core: reset the console speed on resume · 5933a161
      Yin Kangkai 提交于
      On some platforms, we need to restore the console speed on resume even
      it was not suspended (no_console_suspend), and on others we don't have
      to do that.
      
      So don't care about the "console_suspend_enabled" and unconditionally
      reset the console speed if it is a console.
      
      This is actually a redo of ba15ab0e (Set proper console speed on resume
      if console suspend is disabled) from Deepak Saxena.  I also tried to
      investigate more to find out if this change will break others, here is
      what I've found out:
      
      commit 891b9dd1
      Author: Jason Wang <jason77.wang@gmail.com>
          serial-core: restore termios settings when resume console ports
      
      commit ca2e71aa
      Author: Jason Wang <jason77.wang@gmail.com>
          serial-core: skip call set_termios/console_start when no_console_suspend
      
      commit 4547be78
      Author: Stanislav Brabec <sbrabec@suse.cz>
          serial-core: resume serial hardware with no_console_suspend
      
      commit ba15ab0e
      Author: Deepak Saxena <dsaxena@laptop.org>
          Set proper console speed on resume if console suspend is disabled
      
      from ba15ab0e, we learned that, even if the console suspend is disabled
      (when no_console_suspend is set), we may still need to "reset the port
      to the state it was in before we suspended."
      
      Then with 4547be78, this piece of code is removed.
      
      And then Jason Wang added that back in ca2e71aa and 891b9dd1, to fix
      some breakage on OMAP3EVM platform. From ca2e71aa we learned that the
      "set_termios" things is actually needed by both console is suspended
      and not suspended.
      
      That's why I removed the console_suspended_enabled condition, and only
      call console_start() when we actually suspeneded it.
      
      I also noticed in this thread:
      http://marc.info/?t=129079257100004&r=1&w=2, which talked about on
      some platforms, UART HW will be cut power whether or not we set
      no_console_suspend, and then on resume it does not work quite well. I
      have a similar HW, and this patch fixed this issue, don't know if this
      patch also works on their platforms.
      
      [Update: Stanislav tested this patch on Zaurus and reported it improves the
      situation. Thanks.]
      
      CC: Greg KH <greg@kroah.com>
      CC: Deepak Saxena <dsaxena@laptop.org>
      CC: Jason Wang <jason77.wang@gmail.com>
      CC: Stanislav Brabec <sbrabec@suse.cz>
      CC: Daniel Drake <dsd@laptop.org>
      Signed-off-by: NYin Kangkai <kangkai.yin@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5933a161
  8. 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
  9. 17 12月, 2010 1 次提交
  10. 11 12月, 2010 1 次提交
    • 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
  11. 18 11月, 2010 1 次提交
  12. 23 10月, 2010 3 次提交
    • A
      tty: Make tiocgicount a handler · d281da7f
      Alan Cox 提交于
      Dan Rosenberg noted that various drivers return the struct with uncleared
      fields. Instead of spending forever trying to stomp all the drivers that
      get it wrong (and every new driver) do the job in one place.
      
      This first patch adds the needed operations and hooks them up, including
      the needed USB midlayer and serial core plumbing.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d281da7f
    • J
      serial-core: restore termios settings when resume console ports · 891b9dd1
      Jason Wang 提交于
      The commit 4547be78 rewrites suspend and resume functions. According
      to this rewrite, when a serial port is a printk console device and
      can suspend(without set no_console_suspend flag), it will definitely
      call set_termios function during its resume, but parameter termios
      isn't initialized, this will pass an unpredictable config to the
      serial port. If this serial port is not a userspace opened tty device
      , a suspend and resume action will make this serial port unusable.
      I.E. ttyS0 is a printk console device, ttyS1 or keyboard+display is
      userspace tty device, a suspend/resume action will make ttyS0
      unusable.
      
      If a serial port is both a printk console device and an opened tty
      device, this issue can be overcome because it will call set_termios
      again with the correct parameter in the uart_change_speed function.
      
      Refer to the deleted content of commit 4547be78, revert parts relate
      to restore settings into parameter termios. It is safe because if
      a serial port is a printk console only device, the only meaningful
      field in termios is c_cflag and its old config is saved in
      uport->cons->cflag, if this port is also an opened tty device,
      it will clear uport->cons->cflag in the uart_open and the old config
      is saved in tty->termios.
      Signed-off-by: NJason Wang <jason77.wang@gmail.com>
      Acked-by: NStanislav Brabec <sbrabec@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      891b9dd1
    • J
      serial-core: skip call set_termios/console_start when no_console_suspend · ca2e71aa
      Jason Wang 提交于
      The commit 4547be78 rewrites suspend and resume functions, this
      introduces a problem on the OMAP3EVM platoform. when the kernel boots
      with no_console_suspend and we suspend the kernel, then resume it,
      the serial console will be not usable. This problem should be common
      for all platforms.
      The cause for this problem is that when enter suspend, if we choose
      no_console_suspend, the console_stop will be skiped. But in resume
      function, the console port will be set to uninitialized state by
      calling set_termios function and the console_start is called without
      checking whether the no_console_suspend is set, Now fix it.
      Signed-off-by: NJason Wang <jason77.wang@gmail.com>
      Acked-by: NStanislav Brabec <sbrabec@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ca2e71aa
  13. 11 8月, 2010 9 次提交
  14. 21 1月, 2010 2 次提交
    • A
      serial: Fix crash if the minimum rate of the device is > 9600 baud · 16ae2a87
      Alan Cox 提交于
      In that situation if the old rate is invalid and the new rate is invalid
      and the chip cannot do 9600 baud we report zero, which makes all the
      drivers explode.
      
      Instead force the rate based on min/max
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      16ae2a87
    • S
      serial-core: resume serial hardware with no_console_suspend · 4547be78
      Stanislav Brabec 提交于
      Perform a tricky suspend/resume even with no_console_suspend.
      
      With no_console_suspend, kernel skips serial port suspend/resume and the
      serial hardware may remain in undefined state after resume. It actually
      happens on devices that don't have BIOS that handle serial
      initialization. It makes impossible to use serial console after resume.
      
      Devices affected by this problem include:
      Sharp Zaurus devices
      Several PXA based ARM embedded boards
      
      The patch does:
      - Save the hardware state
      - Perform buffer flush in time of its suspend call
      - Tell the driver that port is suspended
      - But still accept new data
      - And keep console hardware in state that allows to send them
      
      It allows to capture late console messages without breaking console
      after resume.
      
      This is just a resend of a patch discussed in these threads, as the
      patch was not yet applied.
      
      "Possible suspend/resume regression in .32-rc?" (Nov 1-5, 2009, ARM
      list, later LKML)
      
      "serial-core: resume serial hardware with no_console_suspend" (Sep
      15-Oct 18, 2009, LKML & ARM lists)
      Signed-off-by: NStanislav Brabec <sbrabec@suse.cz>
      Tested-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
      Tested-by: NDaniel Mack <daniel@caiaq.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4547be78
  15. 12 12月, 2009 1 次提交