MASK_RX bit is set to prevent transmitted data from looped back.
Set the TX and RX mode to T=0 mode; not T=1 mode.
Change-Id: Ida78fb56cf4b51c0fa88cb57da58c0dcc5db51c9
Acked-by: Ho Lee <holee@qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Port open call for smux is blocking. There is a 5 seconds default
timeout for the open call. The total number of retries for opening
the port makes the total wait time to be 11 minutes. This timeout
becomes an issue if QSC does not come up in time. Adding a device
attribute lets the user space control/reduce the timeout value.
CRs-Fixed: 372629
Change-Id: Ib20bf05da740c99dbb7e94b4df96d256ecadad34
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
Add GSBI8 device and its related interfaces with their configuration
i.e. clock, ADM, GPIO. GSBI8 UARTDM interface can be used for external
Bluetooth SoC.
CRs-Fixed: 375285
Change-Id: I15819862072c92d8ff6f397fdf081f1b619ec235
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
During a subsystem restart or a line-discipline unload with active data
transfer, the logical channel purge function (smux_lch_purge) could lead
to a deadlock while flushing the workqueues if it is called with
mutex_lha0 locked and one of the worker functions calls a function that
locks mutex_lha0. In addition, the local mode was reset which is not
expected behavior.
This change aborts all work functions in the case of a reset allowing
the flush to be performed without any locks held. Once the flush is
complete, then the appropriate locks can be obtained before the reset
flag is cleared and work items can once again get scheduled.
Change-Id: I2afbcc3885907cd0cc8695f7c7a85b61a999e1fb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Use SR[TXEMT] in addition to ISR[TX_READY] when determining
whether new data can be transmitted to work around a
condition where ISR[TX_READY] may not always give an
accurate indication of the state of the queue.
Change-Id: Ia3a590a485647a005c7c019660f11566208c2667
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
After completing a wakeup, trigger the TX worker to start sending
pending data.
Without the fix, the TX worker will wait until either other activity or
a power-down transmit before sending pending TX data.
Change-Id: Ica90b35d9a3169992db49ff493f783c27a2989da
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Removed the ACK from the protocol when a sleep request is received when
already in the turning-off state to avoid an extra wakeup just to send
the ACK.
This case happens when both the local and remote sides transition to the
turning-off state and send a sleep request. Both sides will then
receive the sleep request at which point they can immediately transition
to the off side without having to perform a wakeup just to send the ACK.
Change-Id: I3fe4a82da34b68ef51ee9aa0c00507361b0717ed
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Temporarily increase the Application processor inactivity timeout to
prevent a local inactivity timeout while the external modem is booting.
This is necessary to allow releasing a power-collapse ACK change without
breaking SMUX until the external modem changes have also been mainlined.
Once the external modem changes have been mainlined, then this timeout
will be reduced to 250ms to improve power consumption when idle.
Change-Id: Ic9e12c849dd53955c6ff4a1eaff0a2ec761ffa35
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Log power packets in addition to power state changes.
Change-Id: I46b8d86df881b328bb9124611bdbf1a0db2928f9
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
The wakeup worker and TX worker both run on the same single-threaded
workqueue, so the wakeup worker needs to reschedule after sending a
wakeup character to allow pending characters to get flushed.
Without this change, a burst of wakeup characters will be sent once the
exponential back-off delay is 32ms after which the wakeup worker
reschedules itself as a delayed work item.
Change-Id: I4260c7f5b2f1f90e87575eac4b407be2bc6adb1d
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
If the receive retry queue size gets too large, then automatically
enable flow control to prevent having to drop buffers.
Change-Id: If27599015b362ce013e177ee350e026933390d72
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Use temporary values to allow using arguments with side effects in the
unit test macros.
Change-Id: Iebe7586e1d3469fcf9729b77ddedc701c71a2bd3
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Clarify test messages for list-empty reporting to avoid confusing
the list-empty flag with an event count value.
Change-Id: I31aeb6feb89ada5f7d5b691432b5d8f4aba64cc8
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Add range checking of the channel ID for packet logging. This prevents
out-of-bounds array access when reading the channel state.
Change-Id: Ic91b29e89ef9997525f6283b8212408cccd646f8
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Hold mutex lock while flushing TTY to avoid race condition with
unloading the line discipline.
Change-Id: I2327be9bd39119d14c3e607e8ace201d51755e08
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Only SMUX_DATA_CTL_0 is currently used from userspace.
Change-Id: Iab9e4fa9b096d34a67fb6662418aec0be1381adb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Disable debug logging that was only necessary for bring-up.
Change-Id: I5a31a982efdd1bb1915571158cc164a3856b097d
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
SMUX_CTL module currently does not handle removal of the driver
gracefully. If there are any pending blocked calls on wait_event,
and the line discipline is removed, this results in accessing
destroyed wake queues.
Add support for aborting wait in response to device removal.
Change-Id: I3213306f6ed401f3abe5770ce324d9329e4dbc3f
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
UIM (User Identity Module) driver makes use of existing MSM serial
driver. It configures UIM clock during startup and shutdown of
UART device.
Change-Id: If1b249639e9969273882ad000ef9b1495b8c7013
Acked-by: Ho Lee <holee@qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Stub out get_console_state if the console feature is turned
off to prevent a compilation warning in debug code.
Change-Id: Iad3d9303850bedd56db0ffc6f08dc5e8c9442373
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Handle below error cases with UART Tx transfer:
1. Application doing I/O to UART port and is being terminated abnormally.
2. Used ADM Channel for UART TX transfer stalls.
In both above conditions, queued Tx command to ADM is not flushed. Hence
restarting of application shows list corruption for queueing next UART
Tx command to ADM. This change fixes it by having state machine for UART
Tx, identifying such condition and flushing the queue Tx command before
closing the UART device.
Change-Id: I4e567a539d890dffed50b5837dde58d5cd62d641
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Reset the power-collapse-enabled flag to allow renegotiation when the
remote modem restarts.
Without this change, the external modem will boot assuming that power
collapse is disabled, but the Apps will have the previous state cached
and may not send the proper power-collapse-enabled handshaking.
Change-Id: I58acbfa51b60fde23d328239fd6b330bf0bcc63f
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
The modem driver that handles subsystem restart uses the name
"external_modem" for the external modem.
Change-Id: I4a8199bd259b1aa2ee9310fc29c55c9db4f4cbab
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Remove power command from list before deleting the packet.
Without this fix, if there is a pending power command during a subsystem
restart or a line-discipline unload, then the code will end up in an
infinite loop until the watchdog kicks in and an access after-free check
fails.
Change-Id: Ib8f24598ce1273411a2674d5d61634ffb1944bb1
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Increase the HSL TX path timeout to account for the fact
that the TX buffer size is specified in words rather than
bytes, and that some implementations may have a larger TX
queue size than what was assumed in the original timeout
calculation.
Change-Id: Ie459a2fcdd8a85c2e97ff3a87d60a9c30ce50ec3
CRs-Fixed: 359256
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Add support for broadcast logical channel ID used with the dedicated
power-control commands.
Without this support, power commands sent on the broadcast channel may
get dropped which is currently only a test case issue.
Change-Id: I798ed8a315b3f864fa9afa20ef073b2ab5cab293
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Add dedicated power logging macro to aid in power-related debugging.
Change-Id: I21d8c8b55a8d7c0645d1241773cb8127a48c58c4
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Remove duplicate setting of the pkt.flags field which is harmless, but
redundant.
Change-Id: I6d2579216a03c4ca5ca3b06092ed8a9208d3e891
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
UART clock rate is set to zero while disabling the uart clock for
subsystem restart feature. It is required to set the uart clock rate
to 7372800 Hz while enabling UART clock. Hence use uart_change_pm in
serial core to call msm_hsl_power api to achieve the same.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
This provides the ability to handle simple debug commands from
an fiq-context uart based debugger.
kmsg - dump printk log
pc - show current PC and mode
regs - show current registers
Other commands are handed off to an IRQ handler which calls the
kernel_debugger() routine provided by KERNEL_DEBUGGER_CORE.
Signed-off-by: Brian Swetland <swetland@google.com>
[ARM] msm_serial_debugger: Better interoperability with shared serial pins.
Introduce debug_enable, debugger will not echo back RX characters until
a CR is received. Other modules can turn off debug_enable via
msm_serial_debug_enable() interface.
Flush when doing TX in FIQ context.
Turn off interrupts and flush when doing TX in IRQ context.
Send a \r with every \n sent by the kernel debugger when processing
console messages.
Signed-off-by: Brian Swetland <swetland@google.com>
[ARM] msm_serial_debugger: irqs command to dump irq count
Signed-off-by: Brian Swetland <swetland@google.com>
[ARM] msm: msm_serial_debugger: Add irq status to 'irqs' fiq debug command.
Also clean up some alignment
Signed-off-by: Nick Pelly <npelly@google.com>
[ARM] msm: fiq_debugger: Add ability to enable / disable debugger at runtime
Signed-off-by: San Mehat <san@android.com>
[ARM] msm_serial_debugger: Support 19.2MHz clock on scorpion.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[ARM] msm_serial_debugger: Add wakeup irq and disable uart clock when idle
The serial debugger is now inactive by default so we can enter low power
modes. Hit enter twice to activate it for 5 seconds.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[ARM] msm_serial_debugger: Keep uart clock on when CONFIG_MSM_SERIAL_DEBUGGER_CONSOLE is enabled
Change-Id: I8c4e3c77d429a8f6fde068672d51e750e0f14c1b
Signed-off-by: Arve Hjønnevåg <arve@android.com>
msm_serial_debugger: fix to build without CONFIG_PREEMPT
Change-Id: I71e115a26142cccd809aa979dfa9541f842ae680
[ARM] msm: serial_debugger: move the clock disable to after we enable the fiq
If the uart fifo is not empty when we enable the fiq, the handler will try to
empty it and hang since the clock disabled prior to enabling the fiq.
Signed-off-by: Dima Zavin <dima@android.com>
[ARM] msm_serial_debugger: Add option to keep serial debugger active from boot.
If msm_serial_debugger.no_sleep=1 is added to the kernel command line, or
MSM_SERIAL_DEBUGGER_NO_SLEEP is selected in the config, the serial debugger
is activated on boot and stays active until it receives a sleep command.
Change-Id: Ibf84435af8203360ee808fd903dd6322cf5d9d17
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[ARM] msm_serial_debugger: Fix startup when no_sleep is set
Change-Id: I7e55567d723e30d3e998d625aa7a53f896b55d61
[ARM] msm_serial_debugger: Add option to never disable wakeup IRQ.
This works better if the radio ignores the uart clock request while
power collapsed.
Change-Id: Ib0989e714e883b3667c9ecc4cfd1ebfe014a35df
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[ARM] msm: Fix register dump in fiq debugger
Change-Id: Iff5cd48291c9b09aace30220c4229c157a7db1d0
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[ARM] msm_serial_debugger: Add some debugger commands
Add allregs to dump registers for all modes.
Add bt to get a stackstrace.
Change-Id: Ia85e72b6c8243eba38a04cf4f6cc9cba5342a6de
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: David Brown <davidb@codeaurora.org>
The current design uses the existing channel queues for sending power
commands along with a command filter in the TX worker that always sends
all command messages for queues as long as the TTY UART link is up.
This can allow open and close events to be sent between a request to
power down the link and before the ACK has been received that actually
powers down the link.
Update the implementation to add a dedicated control channel for
power-control commands and bytes. All power commands and bytes are now
sent by the TX worker that properly prioritizes the power commands over
logical channel commands.
CRs-Fixed: 369044
Change-Id: I05c080885c79c3510d02cc360bdfe879d68a962c
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Support subsystem restart for SMUX which includes being able to load and
unload the SMUX TTY Line Discipline.
The TTY port is shared between SMUX and memory dump collection which
requires support for gracefully disconnecting after a remote modem
crash and then reconnect after the modem has been rebooted.
CRs-Fixed: 368263
Change-Id: I0fea4c5f0f13c88282f33a7677ac5fd16dc690d9
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
If a client is unable to allocate a buffer for an incoming packet, the
current software retries once without a delay and then drops the packet.
This causes issues for some clients that use flip buffers for processing
RX data.
This change changes the get_rx_buffer callback failure handling to do an
exponential-backoff retry giving the client time to free up a buffer for
processing.
Change-Id: I3284824a7d5a1d8a03314eebdb4488aaf560440c
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Only print power-collapse-enabled message when it is first enabled.
Change-Id: I4b645a0eb345f03762fc1e44eaf953511937db56
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
To prevent multiple RX operations from overlapping, locking is currently
used during the entire RX operation which also includes calling the
client get_rx_buffer callback in atomic context.
To reduce locking, the RX processing has been moved to a single-threaded
workqueue which ensures serialization of the RX operations. This
minimizes locking requirements and eliminates locking around
get_rx_buffer allowing the client to use GFP_KERNEL instead of
GFP_ATOMIC for memory allocation.
Change-Id: Ib87523191aa77f899fadb7667def58d94579c547
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Remove power control bit that is no longer used and is no longer part of
the SMUX protocol.
Change-Id: I727eb7d848d5298c146919f2299a86d17643253f
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Unlock spinlock when calling platform_device functions during line
discipline (ldisc) loading an unloading.
This fixes a potential scheduling while atomic condition if the platform
device code needs to allocate memory.
Change-Id: I7dbf15dc62b2276393272392a038c1d846ea2419
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
For development, the local loopback mode was used. Now that
the full system is ready, disable loopback mode to enable
communication with the remote system.
Change-Id: I24bee29b3fa41690ccbaf8992ecb3cb166dc3ffc
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
QMUXD from user-space will use this interface to communicate
control plane QMI messages between APPs and QSC modem in Fusion 4.
Change-Id: I2f51f6927a6f92b106548d22c3965575d4468d5a
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Add new Serial Multiplexer (SMUX) driver.
This driver multiplexes multiple logical channels over a single
physical HSUART channel using the TTY Line Discipline framework.
This driver will be used in Fusion 4 for control plane, data plane
and DIAG traffic between Application processor and QSC modem.
Change-Id: Ibecf6cea872f5baf11fb93ded6124243a37a2085
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Allow modem status bits like RI, DSR and CTS in tiocmset. TTY drivers,
for example USB function serial driver, which talks to DCE on behalf
DTE and running in DCE are interested in these bits.
CRs-fixed: 300912
Change-Id: I322bb4ffe546f0bead5576faa0e62ebbc57214bb
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>