• Douglas Anderson's avatar
    tty: serial: qcom_geni_serial: Fix serial when not used as console · 1ea4603c
    Douglas Anderson authored
    [ Upstream commit c362272b ]
    
    If you've got the "console" serial port setup to use just as a UART
    (AKA there is no "console=ttyMSMX" on the kernel command line) then
    certain initialization is skipped.  When userspace later tries to do
    something with the port then things go boom (specifically, on my
    system, some sort of exception hit that caused the system to reboot
    itself w/ no error messages).
    
    Let's cleanup / refactor the init so that we always run the same init
    code regardless of whether we're using the console.
    
    To make this work, we make rely on qcom_geni_serial_pm doing its job
    to turn resources on.
    
    For the record, here is a trace of the order of things (after this
    patch) when console= is specified on the command line and we have an
    agetty on the port:
      qcom_geni_serial_pm: 4 (undefined) => 0 (on)
      qcom_geni_console_setup
      qcom_geni_serial_port_setup
      qcom_geni_serial_console_write
      qcom_geni_serial_startup
      qcom_geni_serial_start_tx
    
    ...and here is the order of things (after this patch) when console= is
    _NOT_ specified on the command line and we have an agetty port:
      qcom_geni_serial_pm: 4 => 0
      qcom_geni_serial_pm: 0 => 3
      qcom_geni_serial_pm: 3 => 0
      qcom_geni_serial_startup
      qcom_geni_serial_port_setup
      qcom_geni_serial_pm: 0 => 3
      qcom_geni_serial_pm: 3 => 0
      qcom_geni_serial_startup
      qcom_geni_serial_start_tx
    
    Fixes: c4f52879 ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
    Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
    Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    1ea4603c
qcom_geni_serial.c 38.3 KB