1. 06 11月, 2014 20 次提交
    • S
      tty: serial: 8250_dma: keep own book keeping about RX transfers · 0fcb7901
      Sebastian Andrzej Siewior 提交于
      After dmaengine_terminate_all() has been invoked then both DMA drivers
      (edma and omap-dma) do not invoke dma_cookie_complete() to mark the
      transfer as complete. This dma_cookie_complete() is performed by the
      Synopsys DesignWare driver which is probably the only one that is used
      by omap8250-dma and hence don't see following problem…
      …which is that once a RX transfer has been terminated then following
      query of channel status reports DMA_IN_PROGRESS (again: the actual
      transfer has been canceled, there is nothing going on anymore).
      
      This means that serial8250_rx_dma() never enqueues another DMA transfer
      because it (wrongly) assumes that there is a transer already pending.
      
      Vinod Koul refuses to accept a patch which adds this
      dma_cookie_complete() to both drivers and so dmaengine_tx_status() would
      report DMA_COMPLETE instead (and behave like the Synopsys DesignWare
      driver already does). He argues that I am not allowed to use the cookie
      to query the status and that the driver already cleaned everything up after
      the invokation of dmaengine_terminate_all().
      
      To end this I add a bookkeeping whether or not a RX-transfer has been
      started to the 8250-dma code. It has already been done for the TX side.
      *Now* we learn about the RX status based on our bookkeeping and don't
      need dmaengine_tx_status() for this anymore.
      
      Cc: vinod.koul@intel.com
      Reviewed-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0fcb7901
    • S
      tty: serial: 8250_dma: handle error on TX submit · b2202821
      Sebastian Andrzej Siewior 提交于
      Right now it is possible that serial8250_tx_dma() fails and returns
      -EBUSY. The caller (serial8250_start_tx()) will then enable
      UART_IER_THRI which will generate an interrupt once the TX FIFO is
      empty.
      In serial8250_handle_irq() nothing will happen because up->dma is set
      and so serial8250_tx_chars() won't be invoked. We end up with plenty of
      interrupts and some "too much work for irq" output.
      
      This patch introduces dma_tx_err in struct uart_8250_port to signal that
      the last invocation of serial8250_tx_dma() failed so we can fill the TX
      FIFO manually. Should the next invocation of serial8250_start_tx()
      succeed then the dma_tx_err flag along with the THRI bit is removed and
      DMA only usage may continue.
      Reviewed-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2202821
    • S
      tty: serial: Add 8250-core based omap driver · 61929cf0
      Sebastian Andrzej Siewior 提交于
      This patch provides a 8250-core based UART driver for the internal OMAP
      UART. The long term goal is to provide the same functionality as the
      current OMAP uart driver and DMA support.
      I tried to merge omap-serial code together with the 8250-core code.
      There should should be hardly a noticable difference. The trigger levels
      are different compared to omap-serial:
      - omap serial
        TX: Interrupt comes after TX FIFO has room for 16 bytes.
            TX of 4096 bytes in one go results in 256 interrupts
      
        RX: Interrupt comes after there is on byte in the FIFO.
            RX of 4096 bytes results in 4096 interrupts.
      
      - this driver
        TX: Interrupt comes once the TX FIFO is empty.
            TX of 4096 bytes results in 65 interrupts. That means there will
            be gaps on the line while the driver reloads the FIFO.
      
        RX: Interrupt comes once there are 48 bytes in the FIFO or less over
            "longer" time frame. We have
                1 / 11520 * 10^3 * 16 => 1.38… ms
            1.38ms to react and purge the FIFO on 115200,8N1. Since the other
            driver fired after each byte it had ~5.47ms time to react. This
            _may_ cause problems if one relies on no missing bytes and has no
            flow control. On the other hand we get only 85 interrupts for the
            same amount of data.
      
      It has been only tested as console UART on am335x-evm, dra7-evm and
      beagle bone. I also did some longer raw-transfers to meassure the load.
      
      The device name is ttyS based instead of ttyO. If a ttyO based node name
      is required please ask udev for it. If both driver are activated (this
      and omap-serial) then this serial driver will take control over the
      device due to the link order
      
      v9…v10:
      	- Tony noticed that omap3 won't show anything after waking up
      	  from core off. In v9 I reworked the register restore and set
      	  IER to 0 by accident. This went unnoticed because start_tx
      	  usually sets ier (either due to DMA bug or due to TX-complete
      	  IRQ).
      	- dropped EFR and SLEEP from capabilities. We do have both but
      	  nobody should touch it. We already handle SLEEP ourself.
      	- make the private copy of the registers (like EFR) u8 instead
      	  u32
      	- drop MDR1 & DL[ML] reset in restore registers. Does not look
      	  required it is set to the required value later.
      	- update MDR1 & SCR only if changed.
      	- set MDR1 as the last thing. The errata says that we should
      	  setup everything before MDR1 set.
      	- avoid div by 0 in omap_8250_get_divisor() if baud rate gets
      	  very large (Frans Klaver fixed the same thing omap-serial)
      	- drop "is in early stage" from Kconfig.
      v8…v9:
      	- less on a file seems to hang the am335x after a while. I
      	  believe I introduce this bug a while ago since I can reproduce
      	  this prior to v8. Fixed by redoing the omap8250_restore_regs()
      v7…v8:
      	- redo the register write. There is now one function for that
      	  which is used from set_termios() and runtime-resume.
      	- drop PORT_OMAP_16750 and move the setup to the omap file. We
      	  have our own set termios function anyway (Heikki Krogerus)
      	- use MEM instead of MEM32. TRM of AM/DM37x says that 32bit
      	  access on THR might result in data abort. We only need 32bit
      	  access in the errata function which is before we use 8250's
      	  read function so it doesn't matter.
      v4…v7:
      	- change trigger levels after some tests with raw transfers.
      v3…v4:
      	- drop RS485 support
      	- wire up ->throttle / ->unthrottle
      v2…v3:
      	- wire up startup & shutdown for wakeup-irq handling.
      	- RS485 handling (well the core does).
      
      v1…v2:
      	- added runtime PM. Could somebody could please double check
      	  this?
      	- added omap_8250_set_termios()
      Reviewed-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NFrans Klaver <frans.klaver@xsens.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61929cf0
    • S
      tty: serial: 8250: make serial8250_console_setup() non _init · f31b5d27
      Sebastian Andrzej Siewior 提交于
      if I boot with console=ttyS0 and the omap driver is module I end up with
      
      | console [ttyS0] disabled
      | omap8250 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 88, base_baud = 3000000) is a 8250
      | Unable to handle kernel paging request at virtual address c07a9de0
      | Modules linked in: 8250_omap(+)
      | CPU: 0 PID: 908 Comm: modprobe Not tainted 3.17.0-rc5+ #1593
      | PC is at serial8250_console_setup+0x0/0xc8
      | LR is at register_console+0x13c/0x3a4
      | [<c0078788>] (register_console) from [<c02d0340>] (uart_add_one_port+0x3cc/0x420)
      | [<c02d0340>] (uart_add_one_port) from [<c02d38a4>] (serial8250_register_8250_port+0x298/0x39c)
      | [<c02d38a4>] (serial8250_register_8250_port) from [<bf006274>] (omap8250_probe+0x218/0x3dc [8250_omap])
      | [<bf006274>] (omap8250_probe [8250_omap]) from [<c02e3424>] (platform_drv_probe+0x2c/0x5c)
      | [<c02e3424>] (platform_drv_probe) from [<c02e1eac>] (driver_probe_device+0x104/0x228)
      …
      | [<c009fa48>] (SyS_init_module) from [<c000e6e0>] (ret_fast_syscall+0x0/0x30)
      | Code: 7823603b f8314620 051b3013 491ed416 (44792204)
      
      because serial8250_console_setup() is already gone.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f31b5d27
    • S
      tty: serial: 8250: Fix wording in runtime-PM comments · 6a529aba
      Sebastian Andrzej Siewior 提交于
      Frans reworded the two comments with better English for better
      understanding. His review hit the mailing list after the patch got
      applied so here is an incremental update.
      Reported-by: NFrans Klaver <frans.klaver@xsens.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a529aba
    • J
      serial: mxs-auart: add sysrq support · 914d3b17
      Janusz Uzycki 提交于
      When using mxs-auart based console, sometime we need the sysrq function
      to help debugging kernel. The sysrq code is basically there,
      this patch just simply enable it.
      Signed-off-by: NJanusz Uzycki <j.uzycki@elproma.com.pl>
      Reviewed-by: NFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      914d3b17
    • M
      tty: serial: omap: Remove probe error message · d4ac0633
      Markus Pargmann 提交于
      This error message is not necessary. The driver core code will print all
      probe error messages. It also resolves some error codes to proper error
      messages. For example -EPROBE_DEFER will only be printed as an info message.
      
      This patch removes the error message as the core prints the same
      information.
      Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4ac0633
    • P
      serial: core: Fix port count when uart_open() errors · 91b32f54
      Peter Hurley 提交于
      A port count mismatch occurs if mutex_lock_interruptible()
      exits uart_open() and the port has already been opened. This may
      prematurely close a port on an open tty. Since uart_close() is _always_
      called if uart_open() fails, the port count must be corrected if errors
      occur.
      
      Always increment the port count in uart_open(), regardless of errors;
      always decrement the port count in uart_close(). Note that
      tty_port_close_start() decrements the port count when uart_open()
      was successful.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      91b32f54
    • P
      serial: core: Remove extra locking in uart_write() · 64dbee31
      Peter Hurley 提交于
      uart_start() only claims the port->lock to call __uart_start(),
      which does the actual processing. Eliminate the extra acquire/release
      in uart_write(); call __uart_start() directly with port->lock already
      held.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      64dbee31
    • P
      serial: core: Colocate crucial structure linkage · 2b702b9b
      Peter Hurley 提交于
      The key function of uart_add_one_port() is to cross-reference the
      UART driver's port structure with the serial core's state table;
      keep the assignments together and document this crucial association.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b702b9b
    • P
      serial: core: Remove redundant timeout assignments · 1f0afd16
      Peter Hurley 提交于
      tty_port_init() initializes close_delay and closing_wait to these
      same values; remove.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f0afd16
    • P
      serial: core: Unwrap >80 char line in uart_close() · 74866e75
      Peter Hurley 提交于
      The wrapped line looks wrong and out-of-place; leave it as
      >80 char line.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74866e75
    • P
      serial: Fix locking for uart driver set_termios() method · 7c8ab967
      Peter Hurley 提交于
      The low-level uart driver may modify termios settings to override
      settings that are not compatible with the uart, such as CRTSCTS.
      Thus, callers of the low-level uart driver's set_termios() method must
      hold termios_rwsem write lock to prevent concurrent access to termios,
      in case such override occurs.
      
      The termios_rwsem lock requirement does not extend to console setup
      (ie., uart_set_options), as console setup cannot race with tty
      operations. Nor does this lock requirement extend to functions which
      cannot be concurrent with tty ioctls (ie., uart_port_startup() and
      uart_resume_port()).
      
      Further, always claim the port mutex to protect hardware
      re-reprogramming in the set_termios() uart driver method. Note this
      is unnecessary for console initialization in uart_set_options()
      which cannot be concurrent with other uart operations.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c8ab967
    • P
      serial: core: Flush ldisc after dropping port mutex in uart_close() · 2e758910
      Peter Hurley 提交于
      The tty buffers (and any line discipline buffers) must be flushed after
      the UART hardware has shutdown; otherwise, a racing open on the same
      tty may receive data from the previous session, which is a security
      hazard. However, holding the port mutex while flushing the line
      discipline buffers creates a lock inversion if the set_termios()
      handler takes the port mutex (as it does in the followup patch,
      'serial: Fix locking for uart driver set_termios method'.
      
      Flush the ldisc buffers after dropping the port mutex; the tty lock
      is still held which prevents a concurrent open() from advancing while
      flushing. Since no new rx data is possible after uart_shutdown() until
      a new open reinitializes the port, the later flush has no impact on
      what data is being discarded.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e758910
    • P
      serial: Refactor uart_flush_buffer() from uart_close() · 479e9b94
      Peter Hurley 提交于
      In the context of the final tty & port close, flushing the tx
      ring buffer after the hardware has already been shutdown and
      the ring buffer freed is neither required nor desirable.
      
      uart_flush_buffer() performs 3 operations:
      1. Resets tx ring buffer indices, but the tx ring buffer has
         already been freed and the indices are reset if the port is
         re-opened.
      2. Calls uart driver's flush_buffer() method
         5 in-tree uart drivers define flush_buffer() methods:
           amba-pl011, atmel-serial, imx, serial-tegra, timbuart
         These have been refactored into the shutdown() method, if
         required.
      3. Kicks the ldisc for more writing, but this is undesirable.
         The file handle is being released; any waiting writer will
         will be kicked out by tty_release() with a warning. Further,
         the N_TTY ldisc may generate SIGIO for a file handle which
         is no longer valid.
      
      Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Laxman Dewangan <ldewangan@nvidia.com>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      479e9b94
    • M
      8250_pci: Added driver for Endrun Technologies PTP PCIe card. · 1bc8cde4
      Mike Skoog 提交于
      Added recognition of EndRun Technologies PCIe PTP slave card
      and setup two ttySx ports for communication with the card for
      retrieval of PTP based time and to communicate with the card's
      Linux OS.
      Signed-off-by: NMike Skoog <mskoog@endruntechnologies.com>
      Signed-off-by: NMike Korreng <mkorreng@endruntechnologies.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bc8cde4
    • S
      tty: serial: 8250_core: restore the LCR register in set_sleep · edf4edac
      Sudhir Sreedharan 提交于
      In ST16650V2 based serial uarts, while initalizing the PM state,
      LCR registers are being initialized to 0 in serial8250_set_sleep().
      If console port is already initialized and being used, this will
      throws garbage in the console.
      Signed-off-by: NSudhir Sreedharan <ssreedharan@mvista.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Tested-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      edf4edac
    • J
      serial: of-serial: fix up PM ops on no_console_suspend and port type · 513e4385
      Jingchang Lu 提交于
      This patch fixes commit 2dea53bf,
      "serial: of-serial: add PM suspend/resume support", which disables
      the uart clock on suspend, but also causes a hardware hang on register
      access if no_console_suspend command line option is used.
      
      Also, not every of_serial device is an 8250 port, so the serial8250
      suspend/resume functions should only be applied to a real 8250 port.
      Signed-off-by: NJingchang Lu <jingchang.lu@freescale.com>
      Tested-by: NJoseph Lo <josephl@nvidia.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      513e4385
    • P
      serial: Fix sparse warnings in uart_throttle()/uart_unthrottle() · 91f189de
      Peter Hurley 提交于
      The struct uart_port.flags field is type upf_t, as are the matching
      bit definitions. Change local mask variable to type upf_t.
      
      Fixes sparse warnings:
      drivers/tty/serial/serial_core.c:620:22: warning: invalid assignment: |=
      drivers/tty/serial/serial_core.c:620:22:    left side has type unsigned int
      drivers/tty/serial/serial_core.c:620:22:    right side has type restricted upf_t
      drivers/tty/serial/serial_core.c:622:22: warning: invalid assignment: |=
      drivers/tty/serial/serial_core.c:622:22:    left side has type unsigned int
      drivers/tty/serial/serial_core.c:622:22:    right side has type restricted upf_t
      drivers/tty/serial/serial_core.c:624:17: warning: restricted upf_t degrades to integer
      drivers/tty/serial/serial_core.c:626:22: warning: invalid assignment: &=
      drivers/tty/serial/serial_core.c:626:22:    left side has type unsigned int
      drivers/tty/serial/serial_core.c:626:22:    right side has type restricted upf_t
      drivers/tty/serial/serial_core.c:629:20: warning: restricted upf_t degrades to integer
      drivers/tty/serial/serial_core.c:632:20: warning: restricted upf_t degrades to integer
      drivers/tty/serial/serial_core.c:643:22: warning: invalid assignment: |=
      drivers/tty/serial/serial_core.c:643:22:    left side has type unsigned int
      drivers/tty/serial/serial_core.c:643:22:    right side has type restricted upf_t
      drivers/tty/serial/serial_core.c:645:22: warning: invalid assignment: |=
      drivers/tty/serial/serial_core.c:645:22:    left side has type unsigned int
      drivers/tty/serial/serial_core.c:645:22:    right side has type restricted upf_t
      drivers/tty/serial/serial_core.c:647:17: warning: restricted upf_t degrades to integer
      drivers/tty/serial/serial_core.c:649:22: warning: invalid assignment: &=
      drivers/tty/serial/serial_core.c:649:22:    left side has type unsigned int
      drivers/tty/serial/serial_core.c:649:22:    right side has type restricted upf_t
      drivers/tty/serial/serial_core.c:652:20: warning: restricted upf_t degrades to integer
      drivers/tty/serial/serial_core.c:655:20: warning: restricted upf_t degrades to integer
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      91f189de
    • P
      serial: Fix upstat_t sparse warnings · d4260b51
      Peter Hurley 提交于
      Commit 299245a1,
      serial: core: Privatize modem status enable flags, introduced
      the upstat_t type and matching bit definitions. The purpose is to
      produce sparse warnings if the wrong bit definitions are used
      (by warning of implicit integer conversions).
      
      Fix implicit conversion to integer return type from uart_cts_enabled()
      and uart_dcd_enabled().
      
      Fixes the following sparse warnings:
      drivers/tty/serial/serial_core.c:63:30: warning: incorrect type in return expression (different base types)
      drivers/tty/serial/serial_core.c:63:30:    expected int
      drivers/tty/serial/serial_core.c:63:30:    got restricted upstat_t
      include/linux/serial_core.h:364:30: warning: incorrect type in return expression (different base types)
      include/linux/serial_core.h:364:30:    expected bool
      include/linux/serial_core.h:364:30:    got restricted upstat_t
      include/linux/serial_core.h:364:30: warning: incorrect type in return expression (different base types)
      include/linux/serial_core.h:364:30:    expected bool
      include/linux/serial_core.h:364:30:    got restricted upstat_t
      Reported-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4260b51
  2. 16 10月, 2014 2 次提交
  3. 03 10月, 2014 1 次提交
  4. 29 9月, 2014 12 次提交
  5. 27 9月, 2014 5 次提交