1. 10 6月, 2015 1 次提交
  2. 01 6月, 2015 1 次提交
    • S
      serial: 8250_omap: provide complete custom startup & shutdown callbacks · 9809889c
      Sebastian Andrzej Siewior 提交于
      The currently in-use port->startup and port->shutdown are "okay". The
      startup part for instance does the tiny omap extra part and invokes
      serial8250_do_startup() for the remaining pieces. The workflow in
      serial8250_do_startup() is okay except for the part where UART_RX is
      read without a check if there is something to read. I tried to
      workaround it in commit 0aa525d1 ("tty: serial: 8250_core: read only
      RX if there is something in the FIFO") but then reverted it later in
      commit ca8bb4ae ("serial: 8250: Revert "tty: serial: 8250_core: read
      only RX if there is something in the FIFO"").
      
      This is the second attempt to get it to work on older OMAPs without
      breaking other chips this time
      Peter Hurley suggested to pull in the few needed lines from
      serial8250_do_startup() and drop everything else that is not required
      including making it simpler like using just request_irq() instead the
      chain handler like it is doing now.
      So lets try that.
      
      Fixes: ca8bb4ae ("serial: 8250: Revert "tty: serial: 8250_core:
             read only RX if there is something in the FIFO"")
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9809889c
  3. 25 5月, 2015 1 次提交
    • S
      serial: 8250_omap: provide complete custom startup & shutdown callbacks · 9e91597f
      Sebastian Andrzej Siewior 提交于
      The currently in-use port->startup and port->shutdown are "okay". The
      startup part for instance does the tiny omap extra part and invokes
      serial8250_do_startup() for the remaining pieces. The workflow in
      serial8250_do_startup() is okay except for the part where UART_RX is
      read without a check if there is something to read. I tried to
      workaround it in commit 0aa525d1 ("tty: serial: 8250_core: read only
      RX if there is something in the FIFO") but then reverted it later in
      commit ca8bb4ae ("serial: 8250: Revert "tty: serial: 8250_core: read
      only RX if there is something in the FIFO"").
      
      This is the second attempt to get it to work on older OMAPs without
      breaking other chips this time
      Peter Hurley suggested to pull in the few needed lines from
      serial8250_do_startup() and drop everything else that is not required
      including making it simpler like using just request_irq() instead the
      chain handler like it is doing now.
      So lets try that.
      
      Fixes: ca8bb4ae ("serial: 8250: Revert "tty: serial: 8250_core:
             read only RX if there is something in the FIFO"")
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e91597f
  4. 07 5月, 2015 1 次提交
    • J
      tty: serial: 8250: omap: synchronize rx_running · eda0cd35
      John Ogness 提交于
      The rx_running flag should show if DMA is currently active. However
      there is a window between when the flag is set/cleared and when
      the DMA is started/stopped. Because the flag is queried from both
      hard and soft irq contexts, the driver can make incorrect
      decisions and do things like start a DMA transfer using a buffer
      that is already setup to be used for a DMA transfer.
      
      This patch adds a spinlock to synchronize the rx_running flag and
      close the above mentioned window.
      Signed-off-by: NJohn Ogness <john.ogness@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eda0cd35
  5. 27 3月, 2015 1 次提交
  6. 03 2月, 2015 2 次提交
    • P
      serial: 8250_omap: Use UPSTAT_AUTORTS for RTS handling · 9719acce
      Peter Hurley 提交于
      Commit 88838d3112702 ("serial: omap_8250: Fix RTS handling") fixed
      RTS pin control when in autoRTS mode.
      
      New support added in "serial: core: Rework hw-assisted flow control support"
      enables a much simpler approach; rather than masking out autoRTS
      whenever writing the EFR register, use the UPSTAT_* mode to determine if
      autoRTS should be enabled when raising RTS (in omap8250_set_mctrl()).
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9719acce
    • P
      serial: core: Rework hw-assisted flow control support · 391f93f2
      Peter Hurley 提交于
      hw-assisted flow control support was added to the serial core
      in v3.8 with commits,
      dba05832 ("SERIAL: core: add hardware assisted h/w flow control support")
      2cbacafd ("SERIAL: core: add hardware assisted s/w flow control support")
      9aba8d5b ("SERIAL: core: add throttle/unthrottle callbacks for hardware
                      assisted flow control")
      Since then, additional requirements for serial core support have arisen.
      Specifically,
      1. Separate tx and rx flow control settings for UARTs which only support
         tx flow control (ie., autoCTS).
      2. Disable sw-assisted CTS flow control in autoCTS mode
      3. Support for RTS flow control by serial core and userspace in autoRTS mode
      
      Distinguish mode from capability; introduce UPSTAT_AUTORTS, UPSTAT_AUTOCTS
      and UPSTAT_AUTOXOFF which, when set by the uart driver, enable serial core
      support for hw-assisted rx, hw-assisted tx and hw-assisted in-band/IXOFF
      rx flow control, respectively. [Note: hw-assisted in-band/IXON tx flow
      control does not require serial core support/intervention and can be
      enabled by the uart driver when required.]
      
      These modes must be set/reset in the driver's set_termios() method, based
      on termios settings, and thus can be safely queried in any context in which
      one of the port lock, port mutex or termios rwsem are held. Set these modes
      in the 2 in-tree drivers, omap-serial and 8250_omap, which currently
      use UPF_HARD_FLOW/UPF_SOFT_FLOW support.
      
      Retain UPF_HARD_FLOW and UPF_SOFT_FLOW as capabilities; re-define
      UPF_HARD_FLOW as both UPF_AUTO_RTS and UPF_AUTO_CTS to allow for distinct
      and separate rx and tx flow control capabilities.
      
      Disable sw-assisted CTS flow control when UPSTAT_AUTOCTS is enabled.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      391f93f2
  7. 10 1月, 2015 4 次提交
  8. 19 12月, 2014 1 次提交
  9. 26 11月, 2014 1 次提交
  10. 06 11月, 2014 5 次提交
    • S
      tty: serial: 8250: omap: add dma support · 0a0661dd
      Sebastian Andrzej Siewior 提交于
      This patch adds the required pieces to 8250-OMAP UART driver for DMA
      support. The TX burst size is set to 1 so we can send an arbitrary
      amount of bytes.
      
      The RX burst is currently set to 48 which means we receive an DMA
      interrupt every 48 bytes and have to reprogram everything. Less bytes in
      the RX-FIFO mean that no DMA transfer will happen and the UART will send a
      RX-timeout _or_ RDI event at which point the FIFO will be manually purged.
      There is a workaround for TX-DMA on AM33xx where we put the first byte
      into the FIFO to kick start the DMA process. Haven't seen this problem on
      OMAP36xx (beagle board xm) or DRA7xx.
      
      On AM375x there is "Usage Note 2.7: UART: Cannot Acknowledge Idle
      Requests in Smartidle Mode When Configured for DMA Operations" in the
      errata document. This problem persists even after disabling DMA in the
      UART and will be addressed in the HWMOD.
      
      v10:
      	- delay update_registers() from set_termios() until TX-DMA is
      	  done. It has been reported / proved that invoking
      	  update_registers() while TX-DMA is in progress may stall the
      	  DMA operation and it won't finish.
      	- use the new omap DMA-TX-RX hooks and DMA only interrupt
      	  routine.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a0661dd
    • S
      tty: serial: 8250: omap: add custom irq handling · 77285243
      Sebastian Andrzej Siewior 提交于
      We have (or will have) custom DMA callbacks in the omap driver due to
      the different behaviour in the RX and TX case. To make this work
      we need a few changes in the IRQ handler to invoke the rx_handler again
      after the "manual" mode or retry the tx_handler again before falling
      back to the manual mode.
      
      Heikki didn't want to see the extra hacks in the generic / default irq
      handler and Peter wasn't too happy about an OMAP-only IRQ handler. The
      way I planned it is to use this extra IRQ routine only in DMA case. If
      Peter dislike this approach then I hope Heikki doesn't block changes in
      the default IRQ handler :)
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77285243
    • S
      tty: serial: 8250_omap: add custom DMA-RX callback · 0e31c8d1
      Sebastian Andrzej Siewior 提交于
      The omap needs a DMA request pending right away. If it is
      enqueued once the bytes are in the FIFO then nothing will happen
      and the FIFO will be later purged via RX-timeout interrupt.
      This patch enqueues RX-DMA request on completion but not if it
      was aborted on error. The first enqueue will happen in the driver
      in startup.
      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>
      0e31c8d1
    • S
      tty: serial: 8250_omap: add custom DMA-TX callback · 31a17132
      Sebastian Andrzej Siewior 提交于
      This patch provides mostly a copy of serial8250_tx_dma() +
      __dma_tx_complete() with the following extensions:
      
      - DMA bug
        At least on AM335x the following problem exists: Even if the TX FIFO is
        empty and a TX transfer is programmed (and started) the UART does not
        trigger the DMA transfer.
        After $TRESHOLD number of bytes have been written to the FIFO manually the
        UART reevaluates the whole situation and decides that now there is enough
        room in the FIFO and so the transfer begins.
        This problem has not been seen on DRA7 or beagle board xm (OMAP3). I am not
        sure if this is UART-IP core specific or DMA engine.
      
        The workaround is to use a threshold of one byte, program the DMA
        transfer minus one byte and then to put the first byte into the FIFO to
        kick start the transfer.
      
      - support for runtime PM
        RPM is enabled on start_tx(). We can't disable RPM on DMA complete callback
        because there is still data in the FIFO which is being sent. We have to wait
        until the FIFO is empty before we disable it.
        For this to happen we fake a TX sent error and enable THRI. Once the
        FIFO is empty we receive an interrupt and since the TTY-buffer is still
        empty we "put RPM" via __stop_tx(). Should it been filed then in the
        start_tx() path we should program the DMA transfer and remove the error
        flag and the THRI bit.
      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>
      31a17132
    • 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