Skip to content
Permalink
Yu-Tu/the-UART…
Switch branches/tags

Commits on Jan 10, 2022

  1. tty: serial: meson: Added S4 SOC compatibility.

    Make UART driver compatible with S4 SOC UART.
    
    Signed-off-by: Yu Tu <yu.tu@amlogic.com>
    Yu Tu authored and intel-lab-lkp committed Jan 10, 2022
  2. tty: serial: meson: Make the bit24 and

    The UART_REG5 register defaults to 0. The console port is set in
    ROMCODE. But other UART ports default to 0, so make bit24 and
    bit[26,27] writable so that the UART can choose a more
    appropriate clock.
    
    Signed-off-by: Yu Tu <yu.tu@amlogic.com>
    Yu Tu authored and intel-lab-lkp committed Jan 10, 2022
  3. tty: serial: meson: The UART baud rate

    Using the common Clock code to describe the UART baud rate clock
    makes it easier for the UART driver to be compatible with the
    baud rate requirements of the UART IP on different meson chips.
    
    Signed-off-by: Yu Tu <yu.tu@amlogic.com>
    Yu Tu authored and intel-lab-lkp committed Jan 10, 2022
  4. tty: serial: meson: Request the register

    This simplifies resetting the UART controller during probe and
    will make it easier to integrate the common clock code which
    will require the registers at probe time as well.
    
    Signed-off-by: Yu Tu <yu.tu@amlogic.com>
    Yu Tu authored and intel-lab-lkp committed Jan 10, 2022
  5. dt-bindings: serial: meson: Drop

    Deprecated, don't use anymore because compatible =
    amlogic,meson-gx-uart. Don't differentiate between GXBB, GXL
    and G12A which have different revisions of the UART IP.
    So it's split into GXBB, GXL and G12A.
    
    Signed-off-by: Yu Tu <yu.tu@amlogic.com>
    Yu Tu authored and intel-lab-lkp committed Jan 10, 2022

Commits on Jan 6, 2022

  1. serial: core: Keep mctrl register state and cached copy in sync

    struct uart_port contains a cached copy of the Modem Control signals.
    It is used to skip register writes in uart_update_mctrl() if the new
    signal state equals the old signal state.  It also avoids a register
    read to obtain the current state of output signals.
    
    When a uart_port is registered, uart_configure_port() changes signal
    state but neglects to keep the cached copy in sync.  That may cause
    a subsequent register write to be incorrectly skipped.  Fix it before
    it trips somebody up.
    
    This behavior has been present ever since the serial core was introduced
    in 2002:
    https://git.kernel.org/history/history/c/33c0d1b0c3eb
    
    So far it was never an issue because the cached copy is initialized to 0
    by kzalloc() and when uart_configure_port() is executed, at most DTR has
    been set by uart_set_options() or sunsu_console_setup().  Therefore,
    a stable designation seems unnecessary.
    
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/bceeaba030b028ed810272d55d5fc6f3656ddddb.1641129752.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l1k authored and gregkh committed Jan 6, 2022
  2. serial: stm32: correct loop for dma error handling

    In this error handling, "transmit_chars_dma" function will call
    "transmit_chars_pio" once per characters. But "transmit_chars_pio" will
    continue to send characters while xmit buffer is not empty.
    
    Remove this useless loop, one call is sufficient.
    
    Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
    Link: https://lore.kernel.org/r/20220104182445.4195-5-valentin.caron@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Valentin Caron authored and gregkh committed Jan 6, 2022
  3. serial: stm32: fix flow control transfer in DMA mode

    If flow control is enabled, framework will call stop_tx to
    pause transfer and then call start_tx to resume transfer.
    
    Clear USART_CR3_DMAT bit in stop_tx ops to pause DMA transfer.
    
    Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
    Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
    Link: https://lore.kernel.org/r/20220104182445.4195-4-valentin.caron@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Valentin Caron authored and gregkh committed Jan 6, 2022
  4. serial: stm32: rework TX DMA state condition

    TX DMA state condition is handled by tx_dma_busy boolean.
    This boolean is set when dma descriptor is requested and reset when dma
    channel is stopped (dma_terminate).
    
    In stm32_usart_serial_remove(), stm32_usart_stop_tx() and
    stm32_usart_transmit_chars_dma() fallback error case, DMA channel is
    stopped but tx_dma_busy is not handled.
    
    Rework the driver by using two new functions to solve this issue:
    - stm32_usart_tx_dma_started return true if DMA TX have a descriptor.
    - stm32_usart_tx_dma_enabled return true if DMAT bit is set.
    
    stm32_usart_tx_dma_started uses tx_dma_busy flag to prevent dual DMA
    transaction at the same time. This flag is set when a DMA transaction
    begins and is unset when dmaengine_terminate_async function is called.
    A new DMA transaction cannot be created if this flag is set.
    
    Create a new function "stm32_usart_tx_dma_terminate" to be sure the flag
    is unset after each call of dmaengine_terminate_async.
    
    Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
    Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
    Link: https://lore.kernel.org/r/20220104182445.4195-3-valentin.caron@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Valentin Caron authored and gregkh committed Jan 6, 2022
  5. serial: stm32: move tx dma terminate DMA to shutdown

    Terminate DMA transaction and clear CR3_DMAT when shutdown is requested,
    instead of when remove is requested. If DMA transfer is not stopped in
    shutdown ops, driver will fail to start a new DMA transfer after next
    startup ops.
    
    Fixes: 3489187 ("serial: stm32: adding dma support")
    Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
    Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
    Link: https://lore.kernel.org/r/20220104182445.4195-2-valentin.caron@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Valentin Caron authored and gregkh committed Jan 6, 2022
  6. serial: pl011: Drop redundant DTR/RTS preservation on close/open

    Commit d8d8ffa ("amba-pl011: do not disable RTS during shutdown")
    amended the PL011 serial driver to leave DTR/RTS polarity untouched on
    tty close.  That change made sense.
    
    But the commit also added code to save DTR/RTS state to an internal
    variable on tty close and restore it on tty open.  That part of the
    commit makes less sense:  The driver has no ->pm() callback, so the uart
    remains powered after tty close and automatically preserves register
    state, including DTR/RTS.
    
    Saving and restoring registers isn't the job of the ->startup() and
    ->shutdown() callbacks anyway.  Rather, it should happen in ->pm().
    
    Additionally, after pl011_startup() restores the state, the serial core
    overrides it in uart_port_dtr_rts() if a baud rate has been set:
    
    tty_port_open()
      uart_port_activate()
        uart_startup()
          uart_port_startup()
            pl011_startup()       # restores DTR/RTS from uap->old_cr
      tty_port_block_til_ready()
        tty_port_raise_dtr_rts    # if (C_BAUD(tty))
          uart_dtr_rts()
            uart_port_dtr_rts()   # raises DTR/RTS
    
    The serial core also overrides DTR/RTS on tty close in uart_shutdown()
    if C_HUPCL(tty) is set.  So a user-defined DTR/RTS polarity won't
    survive a close/open cycle anyway, unless the user has set the baud rate
    to zero and disabled hupcl on the tty.
    
    Bottom line is, the code to save and restore DTR/RTS has no effect.
    Remove it.
    
    Cc: Linus Walleij <linus.walleij@linaro.org>
    Cc: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/e22089ab49e6e78822c50c8c4db46bf3ee885623.1641129328.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l1k authored and gregkh committed Jan 6, 2022
  7. serial: pl011: Drop CR register reset on set_termios

    pl011_set_termios() briefly resets the CR register to zero, thereby
    glitching DTR/RTS signals.  With rs485 this may result in the bus being
    occupied for no reason.
    
    Where does this register write originate from?
    
    The PL011 driver was forked from the PL010 driver in 2004:
    https://git.kernel.org/history/history/c/157c0342e591
    
    Until this commit, the PL010 driver's IRQ handler ambauart_int()
    modified the CR register without holding the port spinlock.
    
    ambauart_set_termios() also modified that register.  To prevent
    concurrent read-modify-writes by the IRQ handler and to prevent
    transmission while changing baudrate, ambauart_set_termios() had to
    disable interrupts.  On the PL010, that is achieved by writing zero to
    the CR register.
    
    However, on the PL011, interrupts are disabled in the IMSC register,
    not in the CR register.
    
    Additionally, the commit amended both the PL010 and PL011 driver to
    acquire the port spinlock in the IRQ handler, obviating the need to
    disable interrupts in ->set_termios().
    
    So the CR register write is obsolete for two reasons.  Drop it.
    
    Cc: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/f49f945375f5ccb979893c49f1129f51651ac738.1641129062.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l1k authored and gregkh committed Jan 6, 2022
  8. serial: pl010: Drop CR register reset on set_termios

    pl010_set_termios() briefly resets the CR register to zero.
    
    Where does this register write come from?
    
    The PL010 driver's IRQ handler ambauart_int() originally modified the CR
    register without holding the port spinlock.  ambauart_set_termios() also
    modified that register.  To prevent concurrent read-modify-writes by the
    IRQ handler and to prevent transmission while changing baudrate,
    ambauart_set_termios() had to disable interrupts.  That is achieved by
    writing zero to the CR register.
    
    However in 2004 the PL010 driver was amended to acquire the port
    spinlock in the IRQ handler, obviating the need to disable interrupts in
    ->set_termios():
    https://git.kernel.org/history/history/c/157c0342e591
    
    That rendered the CR register write obsolete.  Drop it.
    
    Cc: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/fcaff16e5b1abb4cc3da5a2879ac13f278b99ed0.1641128728.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l1k authored and gregkh committed Jan 6, 2022
  9. serial: liteuart: fix MODULE_ALIAS

    modprobe can't handle spaces in aliases.
    
    Fixes: 1da81e5 ("drivers/tty/serial: add LiteUART driver")
    Signed-off-by: Alyssa Ross <hi@alyssa.is>
    Link: https://lore.kernel.org/r/20220104131030.1674733-1-hi@alyssa.is
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    alyssais authored and gregkh committed Jan 6, 2022
  10. serial: 8250_bcm7271: Fix return error code in case of dma_alloc_cohe…

    …rent() failure
    
    In case of dma_alloc_coherent() failure return -ENOMEM instead of
    returning -EINVAL.
    
    Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20220105180704.8989-1-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Jan 6, 2022

Commits on Dec 31, 2021

  1. Revert "serdev: BREAK/FRAME/PARITY/OVERRUN notification prototype V2"

    This reverts commit d8e9a40.
    
    It needs some future changes as pointed out by Johan and is not ready to
    be merged just yet.
    
    Reported-by: Johan Hovold <johan@kernel.org>
    Cc: Magnus Damm <damm+renesas@opensource.se>
    Link: https://lore.kernel.org/r/Yc7oZ/1tu95Z4wPS@hovoldconsulting.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    gregkh committed Dec 31, 2021

Commits on Dec 30, 2021

  1. tty: goldfish: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224153753.22210-1-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  2. serdev: BREAK/FRAME/PARITY/OVERRUN notification prototype V2

    Allow serdev device drivers get notified by hardware errors such as BREAK,
    FRAME, PARITY and OVERRUN.
    
    With this patch, in the event of an error detected in the UART device driver
    the serdev_device_driver will get the newly introduced ->error() callback
    invoked if serdev_device_set_error_mask() has previously been used to enable
    the type of error. The errors are taken straight from the TTY layer and fed
    into the serdev_device_driver after filtering out only enabled errors.
    
    Without this patch the hardware errors never reach the serdev_device_driver.
    
    Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
    Link: https://lore.kernel.org/r/163931528842.27756.3665040315954968747.sendpatchset@octo
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Magnus Damm authored and gregkh committed Dec 30, 2021
  3. tty: serial: meson: Drop the legacy compatible strings and clock code

    All mainline .dts files have been using the stable UART since Linux
    4.16. Drop the legacy compatible strings and related clock code.
    
    Signed-off-by: Yu Tu <yu.tu@amlogic.com>
    Link: https://lore.kernel.org/r/20211230102110.3861-2-yu.tu@amlogic.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Yu Tu authored and gregkh committed Dec 30, 2021
  4. serial: pmac_zilog: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-11-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  5. serial: bcm63xx: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-10-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  6. serial: ar933x: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-9-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  7. serial: vt8500: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-8-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  8. serial: altera_jtaguart: Use platform_get_irq_optional() to get the i…

    …nterrupt
    
    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq_optional().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-7-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  9. serial: pxa: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-6-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  10. serial: meson: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-5-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  11. serial: 8250_bcm7271: Propagate error codes from brcmuart_probe()

    In case of failures brcmuart_probe() always returned -ENODEV, this
    isn't correct for example platform_get_irq_byname() may return
    -EPROBE_DEFER to handle such cases propagate error codes in
    brcmuart_probe() in case of failures.
    
    Fixes: 41a4694 ("serial: 8250: Add new 8250-core based Broadcom STB driver")
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-4-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  12. serial: 8250_bcm7271: Use platform_get_irq() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-3-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  13. serial: altera: Use platform_get_irq_optional() to get the interrupt

    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq_optional().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-2-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    prabhakarlad authored and gregkh committed Dec 30, 2021
  14. dt-bindings: serial: renesas,sci: Document RZ/V2L SoC

    Add SCI binding documentation for Renesas RZ/V2L SoC. No driver changes
    are required as generic compatible string "renesas,sci" will be used as
    a fallback.
    
    Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Acked-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/20211221094717.16187-8-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Biju Das authored and gregkh committed Dec 30, 2021
  15. dt-bindings: serial: renesas,scif: Document RZ/V2L SoC

    Add SCIF binding documentation for Renesas RZ/V2L SoC. SCIF block on RZ/V2L
    is identical to one found on the RZ/G2L SoC. No driver changes are required
    as RZ/G2L compatible string "renesas,scif-r9a07g044" will be used as a
    fallback.
    
    Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Acked-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/20211221094717.16187-7-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Biju Das authored and gregkh committed Dec 30, 2021
  16. serial: lantiq: store and compare return status correctly

    platform_get_irq() returns signed status. It should be stored and
    compared as signed value before storing to unsigned variable. Implicit
    conversion from signed to unsigned and then comparison with less than
    zero is wrong as unsigned value can never be less than zero.
    
    Fixes: f087f01 ("serial: lantiq: Use platform_get_irq() to get the interrupt")
    Acked-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Link: https://lore.kernel.org/r/YcIf7+oSWWn34ND6@debian-BULLSEYE-live-builder-AMD64
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    musamaanjum authored and gregkh committed Dec 30, 2021
  17. serial: 8250: Move Alpha-specific quirk out of the core

    struct uart_8250_port contains mcr_mask and mcr_force members whose
    sole purpose is to work around an Alpha-specific quirk.  This code
    doesn't belong in the core where it is executed by everyone else,
    so move it to a proper ->set_mctrl callback which is used on the
    affected Alpha machine only.
    
    The quirk was introduced in January 1995:
    https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/diff/drivers/char/serial.c?h=1.1.83
    
    The members in struct uart_8250_port were added in 2002:
    https://git.kernel.org/history/history/c/4524aad27854
    
    The quirk applies to non-PCI Alphas and arch/alpha/Kconfig specifies
    "select FORCE_PCI if !ALPHA_JENSEN".  So apparently the only affected
    machine is the EISA-based Jensen that Linus was working on back then:
    https://lore.kernel.org/all/CAHk-=wj1JWZ3sCrGz16nxEj7=0O+srMg6Ah3iPTDXSPKEws_SA@mail.gmail.com/
    
    Up until now the quirk is not applied unless CONFIG_PCI is disabled.
    If users forget to do that or run a generic Alpha kernel, the serial
    ports aren't usable on Jensen.  Avoid by confining the quirk to
    CONFIG_ALPHA_JENSEN instead of !CONFIG_PCI.  On generic Alpha kernels,
    auto-detect at runtime whether the quirk needs to be applied.
    
    Cc: Russell King <rmk+kernel@armlinux.org.uk>
    Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/b83d069cb516549b8a5420e097bb6bdd806f36fc.1640695609.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l1k authored and gregkh committed Dec 30, 2021
  18. serial: Fix incorrect rs485 polarity on uart open

    Commit a6845e1 ("serial: core: Consider rs485 settings to drive
    RTS") sought to deassert RTS when opening an rs485-enabled uart port.
    That way, the transceiver does not occupy the bus until it transmits
    data.
    
    Unfortunately, the commit mixed up the logic and *asserted* RTS instead
    of *deasserting* it:
    
    The commit amended uart_port_dtr_rts(), which raises DTR and RTS when
    opening an rs232 port.  "Raising" actually means lowering the signal
    that's coming out of the uart, because an rs232 transceiver not only
    changes a signal's voltage level, it also *inverts* the signal.  See
    the simplified schematic in the MAX232 datasheet for an example:
    https://www.ti.com/lit/ds/symlink/max232.pdf
    
    So, to raise RTS on an rs232 port, TIOCM_RTS is *set* in port->mctrl
    and that results in the signal being driven low.
    
    In contrast to rs232, the signal level for rs485 Transmit Enable is the
    identity, not the inversion:  If the transceiver expects a "high" RTS
    signal for Transmit Enable, the signal coming out of the uart must also
    be high, so TIOCM_RTS must be *cleared* in port->mctrl.
    
    The commit did the exact opposite, but it's easy to see why given the
    confusing semantics of rs232 and rs485.  Fix it.
    
    Fixes: a6845e1 ("serial: core: Consider rs485 settings to drive RTS")
    Cc: stable@vger.kernel.org # v4.14+
    Cc: Rafael Gago Castano <rgc@hms.se>
    Cc: Jan Kiszka <jan.kiszka@siemens.com>
    Cc: Su Bao Cheng <baocheng.su@siemens.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Link: https://lore.kernel.org/r/9395767847833f2f3193c49cde38501eeb3b5669.1639821059.git.lukas@wunner.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l1k authored and gregkh committed Dec 30, 2021
  19. tty: serial: Use fifo in 8250 console driver

    Note: I am using a small test app + driver located at [0] for the
    problem description. serco is a driver whose write function dispatches
    to the serial controller. sertest is a user-mode app that writes n bytes
    to the serial console using the serco driver.
    
    While investigating a bug in the RHEL kernel, I noticed that the serial
    console throughput is way below the configured speed of 115200 bps in
    a HP Proliant DL380 Gen9. I was expecting something above 10KB/s, but
    I got 2.5KB/s.
    
    $ time ./sertest -n 2500 /tmp/serco
    
    real    0m0.997s
    user    0m0.000s
    sys     0m0.997s
    
    With the help of the function tracer, I then noticed the serial
    controller was taking around 410us seconds to dispatch one single byte:
    
    $ trace-cmd record -p function_graph -g serial8250_console_write \
       ./sertest -n 1 /tmp/serco
    
    $ trace-cmd report
    
                |  serial8250_console_write() {
     0.384 us   |    _raw_spin_lock_irqsave();
     1.836 us   |    io_serial_in();
     1.667 us   |    io_serial_out();
                |    uart_console_write() {
                |      serial8250_console_putchar() {
                |        wait_for_xmitr() {
     1.870 us   |          io_serial_in();
     2.238 us   |        }
     1.737 us   |        io_serial_out();
     4.318 us   |      }
     4.675 us   |    }
                |    wait_for_xmitr() {
     1.635 us   |      io_serial_in();
                |      __const_udelay() {
     1.125 us   |        delay_tsc();
     1.429 us   |      }
    ...
    ...
    ...
     1.683 us   |      io_serial_in();
                |      __const_udelay() {
     1.248 us   |        delay_tsc();
     1.486 us   |      }
     1.671 us   |      io_serial_in();
     411.342 us |    }
    
    In another machine, I measured a throughput of 11.5KB/s, with the serial
    controller taking between 80-90us to send each byte. That matches the
    expected throughput for a configuration of 115200 bps.
    
    This patch changes the serial8250_console_write to use the 16550 fifo
    if available. In my benchmarks I got around 25% improvement in the slow
    machine, and no performance penalty in the fast machine.
    
    Signed-off-by: Wander Lairson Costa <wander@redhat.com>
    Link: https://lore.kernel.org/r/20211222112831.1968392-2-wander@redhat.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    walac authored and gregkh committed Dec 30, 2021
Older