Commit Graph

2074 Commits

Author SHA1 Message Date
Linux Build Service Account b198cb9af1 Merge "Merge upstream linux-stable v3.10.28 into msm-3.10" 2014-03-26 23:36:07 -07:00
Ian Maund f1b32d4e47 Merge upstream linux-stable v3.10.28 into msm-3.10
The following commits have been reverted from this merge, as they are
known to introduce new bugs and are currently incompatible with our
audio implementation. Investigation of these commits is ongoing, and
they are expected to be brought in at a later time:

86e6de7 ALSA: compress: fix drain calls blocking other compress functions (v6)
16442d4 ALSA: compress: fix drain calls blocking other compress functions

This merge commit also includes a change in block, necessary for
compilation. Upstream has modified elevator_init_fn to prevent race
conditions, requring updates to row_init_queue and test_init_queue.

* commit 'v3.10.28': (1964 commits)
  Linux 3.10.28
  ARM: 7938/1: OMAP4/highbank: Flush L2 cache before disabling
  drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
  serial: amba-pl011: use port lock to guard control register access
  mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL
  md/raid5: Fix possible confusion when multiple write errors occur.
  md/raid10: fix two bugs in handling of known-bad-blocks.
  md/raid10: fix bug when raid10 recovery fails to recover a block.
  md: fix problem when adding device to read-only array with bitmap.
  drm/i915: fix DDI PLLs HW state readout code
  nilfs2: fix segctor bug that causes file system corruption
  thp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only
  ftrace/x86: Load ftrace_ops in parameter not the variable holding it
  SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()
  writeback: Fix data corruption on NFS
  hwmon: (coretemp) Fix truncated name of alarm attributes
  vfs: In d_path don't call d_dname on a mount point
  staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()
  staging: comedi: addi_apci_1032: fix subdevice type/flags bug
  mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully
  GFS2: Increase i_writecount during gfs2_setattr_chown
  perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h
  perf scripting perl: Fix build error on Fedora 12
  ARM: 7815/1: kexec: offline non panic CPUs on Kdump panic
  Linux 3.10.27
  sched: Guarantee new group-entities always have weight
  sched: Fix hrtimer_cancel()/rq->lock deadlock
  sched: Fix cfs_bandwidth misuse of hrtimer_expires_remaining
  sched: Fix race on toggling cfs_bandwidth_used
  x86, fpu, amd: Clear exceptions in AMD FXSAVE workaround
  netfilter: nf_nat: fix access to uninitialized buffer in IRC NAT helper
  SCSI: sd: Reduce buffer size for vpd request
  intel_pstate: Add X86_FEATURE_APERFMPERF to cpu match parameters.
  mac80211: move "bufferable MMPDU" check to fix AP mode scan
  ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS
  ACPI / TPM: fix memory leak when walking ACPI namespace
  mfd: rtsx_pcr: Disable interrupts before cancelling delayed works
  clk: exynos5250: fix sysmmu_mfc{l,r} gate clocks
  clk: samsung: exynos5250: Add CLK_IGNORE_UNUSED flag for the sysreg clock
  clk: samsung: exynos4: Correct SRC_MFC register
  clk: clk-divider: fix divisor > 255 bug
  ahci: add PCI ID for Marvell 88SE9170 SATA controller
  parisc: Ensure full cache coherency for kmap/kunmap
  drm/nouveau/bios: make jump conditional
  ARM: shmobile: mackerel: Fix coherent DMA mask
  ARM: shmobile: armadillo: Fix coherent DMA mask
  ARM: shmobile: kzm9g: Fix coherent DMA mask
  ARM: dts: exynos5250: Fix MDMA0 clock number
  ARM: fix "bad mode in ... handler" message for undefined instructions
  ARM: fix footbridge clockevent device
  net: Loosen constraints for recalculating checksum in skb_segment()
  bridge: use spin_lock_bh() in br_multicast_set_hash_max
  netpoll: Fix missing TXQ unlock and and OOPS.
  net: llc: fix use after free in llc_ui_recvmsg
  virtio-net: fix refill races during restore
  virtio_net: don't leak memory or block when too many frags
  virtio-net: make all RX paths handle errors consistently
  virtio_net: fix error handling for mergeable buffers
  vlan: Fix header ops passthru when doing TX VLAN offload.
  net: rose: restore old recvmsg behavior
  rds: prevent dereference of a NULL device
  ipv6: always set the new created dst's from in ip6_rt_copy
  net: fec: fix potential use after free
  hamradio/yam: fix info leak in ioctl
  drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
  net: inet_diag: zero out uninitialized idiag_{src,dst} fields
  ip_gre: fix msg_name parsing for recvfrom/recvmsg
  net: unix: allow bind to fail on mutex lock
  ipv6: fix illegal mac_header comparison on 32bit
  netvsc: don't flush peers notifying work during setting mtu
  tg3: Initialize REG_BASE_ADDR at PCI config offset 120 to 0
  net: unix: allow set_peek_off to fail
  net: drop_monitor: fix the value of maxattr
  ipv6: don't count addrconf generated routes against gc limit
  packet: fix send path when running with proto == 0
  virtio: delete napi structures from netdev before releasing memory
  macvtap: signal truncated packets
  tun: update file current position
  macvtap: update file current position
  macvtap: Do not double-count received packets
  rds: prevent BUG_ON triggered on congestion update to loopback
  net: do not pretend FRAGLIST support
  IPv6: Fixed support for blackhole and prohibit routes
  HID: Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue""
  gpio-rcar: R-Car GPIO IRQ share interrupt
  clocksource: em_sti: Set cpu_possible_mask to fix SMP broadcast
  irqchip: renesas-irqc: Fix irqc_probe error handling
  Linux 3.10.26
  sh: add EXPORT_SYMBOL(min_low_pfn) and EXPORT_SYMBOL(max_low_pfn) to sh_ksyms_32.c
  ext4: fix bigalloc regression
  arm64: Use Normal NonCacheable memory for writecombine
  arm64: Do not flush the D-cache for anonymous pages
  arm64: Avoid cache flushing in flush_dcache_page()
  ARM: KVM: arch_timers: zero CNTVOFF upon return to host
  ARM: hyp: initialize CNTVOFF to zero
  clocksource: arch_timer: use virtual counters
  arm64: Remove unused cpu_name ascii in arch/arm64/mm/proc.S
  arm64: dts: Reserve the memory used for secondary CPU release address
  arm64: check for number of arguments in syscall_get/set_arguments()
  arm64: fix possible invalid FPSIMD initialization state
  ...

Change-Id: Ia0e5d71b536ab49ec3a1179d59238c05bdd03106
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-03-24 14:28:34 -07:00
Dilip Kota 4d51a8bb3b msm_serial_hs: Programming BCR Register
UART Core is showing inconsistent behaviour in firing
Stale Timeout Interrupt. Stale Timeout is not happening
at some points. After programming the BCR register the
Stale Timeout is happening as expected.
Also fix the BCR register offset to avoid instablilities when
console is disabled.

CRs-Fixed: 590176, 628523
Change-Id: I5a2522b87fe0951cad80e56f8f880c214d2d3bb5
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-03-17 16:42:05 -06:00
Linux Build Service Account 289ecf7b1c Merge "msm_serial_hs: Remove code dependency on flag tty_flush_receive" 2014-03-15 10:08:39 -07:00
Dilip Kota 638b50f3bb msm_serial_hs: Remove code dependency on flag tty_flush_receive
Removing code dependency on the flag and check the
circular buffer directly and make sure that spin lock is taken
appropriately in the tx lower half.

This avoids the condition that can cause
1. tx lower half
2. submit tx command
to race.

CRs-Fixed: 621210
Change-Id: I344a72c3eb9770391576fa0e8f0a8da1ee50ea5b
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-03-14 00:24:22 -06:00
Kiran Gunda df68afb90e msm_serial_hs: Remove extra irq enable/disable
IRQs are disabled/enabled twice in the clock off and
clock on operations. This patch removes the extra irq
operations.

Change-Id: I4325bfe8792b1f97f232ac26c17ab17c4ddffa6e
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-03-13 16:40:30 +05:30
Linux Build Service Account 3493059093 Merge "msm: msm_bus: Move bus scaling to platform drivers" 2014-03-11 22:48:49 -07:00
Dan Sneddon b0da38f02c msm: msm_bus: Move bus scaling to platform drivers
Moves bus scaling code to architecture independant directory
for platform drivers.

Change-Id: Ie0d5b104882d1534fae262af85e99cc09a56ab04
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
2014-03-11 18:00:53 -06:00
Linux Build Service Account a4e64c6c60 Merge "msm_serial_hs: Manage UART irq in clock on/clock off" 2014-03-11 15:42:01 -07:00
Kiran Gunda 7b29dca636 msm_serial_hs: Manage UART irq in clock on/clock off
XO shutdown doesn't happen as long as the
uart port is kept open even though uart clocks
are switched off. This is because the uart core
interrupt is configured in port open and free'd
in port close.

To avoid this issue uart irq is disabled and
enabled in clock off and clock on respectively.

CRs-Fixed: 606931
Change-Id: I8a8b733b860bfc373fc38c9550955d571d3a70bf
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-03-11 14:05:17 +05:30
Linux Build Service Account aa26dc5cd7 Merge "tty: serial: msm_serial_hs: Enable/Disable uart irq over clk on/off" 2014-03-06 07:48:37 -08:00
Steven Cahail ee8da70063 TTY: msm_smd_tty: Fix simultaneous open/close race condition
smd_tty_close currently has a variable that depends on a race
condition with tty_port_open. This causes a null-pointer dereference
when the same port is simultaneously being opened/closed.

Use data from a static array instead of the variable to eliminate
the race condition.

CRs-Fixed: 624398
Change-Id: Ie55d37feaadd3a15f64e18501cd3af19145dbc8e
Signed-off-by: Steven Cahail <scahail@codeaurora.org>
2014-03-04 09:05:17 -07:00
Girish S Ghongdemath a489f45b89 tty: serial: msm_serial_hs: Enable/Disable uart irq over clk on/off
Keeping UART IRQ enabled all the time will gate XO shutdown in idle
power collapse. Instead, handle enable/disable of irq within clk on/off
functions. Also, making sure that wakeup irq is enabled before uart irq
is disabled.

CRs-Fixed: 606758
Change-Id: I5726fe6811e735ff3dac8d88ea86fd50fda0a61e
Signed-off-by: Girish S Ghongdemath <girishsg@codeaurora.org>
2014-02-28 10:15:29 -08:00
Linux Build Service Account 1122b287b9 Merge "msm_serial_hs: Programing the TX FIFO watermark level to 4" 2014-02-26 21:23:30 -08:00
Linux Build Service Account 3afae425bf Merge "msm_serial_hs: Manage wake unlock delay" 2014-02-26 10:04:22 -08:00
Kiran Gunda 9be29f721a msm_serial_hs: Programing the TX FIFO watermark level to 4
As per the Hardware Data Book recommendation the
TX FIFO watermark level should not be zero.
Hence programing the TX FIFO watermark level to
4 to avoid corner cases

CRs-Fixed: 621214
Change-Id: Icee051bd37c389f31a010b51ffaf5d46854306b5
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-02-25 21:25:25 +05:30
Dilip Kota 3876b63f58 msm_serial_hs: Manage wake unlock delay
Current implementation of wake locks wait for
around 500msec while releasing the wakelock. This
prevents the system suspend for that much time after
the rx operation is done to ensure that all the data
delivered to the client before system suspend.
But some clients may take care of this in their
implementation. In this case uart driver no need to
wait before releasing the wakelock.
Hence, given the control to the client as a dtsi entry
to take decision on waiting before releasing the wakelock.

Change-Id: Ie32a0b76899963e7700ba378906fa4f9b3fa3ba4
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-02-25 14:24:01 +05:30
Petr Písař 27f0831c1a vt: Fix secure clear screen
commit 0930b0950a8996aa88b0d2ba4bb2bab27cc36bc7 upstream.

\E[3J console code (secure clear screen) needs to update_screen(vc)
in order to write-through blanks into off-screen video memory.

This has been removed accidentally in 3.6 by:

commit 81732c3b2f
Author: Jean-François Moine <moinejf@free.fr>
Date:   Thu Sep 6 19:24:13 2012 +0200

    tty vt: Fix line garbage in virtual console on command line edition

Signed-off-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-22 12:41:27 -08:00
Lars Poeschel 5e33b2d90a tty: n_gsm: Fix for modems with brk in modem status control
commit 3ac06b905655b3ef2fd2196bab36e4587e1e4e4f upstream.

3GPP TS 07.10 states in section 5.4.6.3.7:
"The length byte contains the value 2 or 3 ... depending on the break
signal." The break byte is optional and if it is sent, the length is
3. In fact the driver was not able to work with modems that send this
break byte in their modem status control message. If the modem just
sends the break byte if it is really set, then weird things might
happen.
The code for deconding the modem status to the internal linux
presentation in gsm_process_modem has already a big comment about
this 2 or 3 byte length thing and it is already able to decode the
brk, but the code calling the gsm_process_modem function in
gsm_control_modem does not encode it and hand it over the right way.
This patch fixes this.
Without this fix if the modem sends the brk byte in it's modem status
control message the driver will hang when opening a muxed channel.

Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-22 12:41:27 -08:00
Linux Build Service Account 526b8cba65 Merge "Merge branch '8916-dev-phase2' into msm-3.10." 2014-02-13 17:19:37 -08:00
Linux Build Service Account 2c11a4eef3 Merge "TTY: msm_smd_tty: Fix driver addition/removal error" 2014-02-13 02:20:33 -08:00
Linux Build Service Account 981dcbfe8f Merge "TTY: msm_smd_tty: Add warning to driver removal function" 2014-02-13 02:20:27 -08:00
Michael Bohan e61e87e40d Merge branch '8916-dev-phase2' into msm-3.10.
Merge the second phase of support needed for the 8916
target into msm-3.10. This includes a couple hundred upstream
patches for ARM64 support, as well as 8916 specific driver
development.

* origin/tmp-branch: (211 commits)
  ARM: dts: msmplutonium: Update the cpu release address
  Revert "arm64: Fix memory shareability attribute for ioremap_wc/cache"
  clocksource: arch_timer: Do not register arch_sys_counter twice
  xtensa: adjust boot parameters address when INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is selected
  sched_clock: Add support for >32 bit sched_clock
  sched_clock: Use an hrtimer instead of timer
  sched_clock: Use seqcount instead of rolling our own
  clocksource: Extract max nsec calculation into separate function
  ARM: sched_clock: Load cycle count after epoch stabilizes
  sched_clock: Make ARM's sched_clock generic for all architectures
  of: move of_get_cpu_node implementation to DT core library
  of: introduce common FDT machine related functions
  of: Introduce common early_init_dt_scan
  mm: allow pgtable_page_ctor() to fail
  of: only include prom.h on sparc
  mm: introduce helper function mem_init_print_info() to simplify mem_init()
  mm: use a dedicated lock to protect totalram_pages and zone->managed_pages
  KVM: Move gfn_to_index to x86 specific code
  ARM: KVM: move GIC/timer code to a common location
  arm64: mm: Fix PMD_SECT_PROT_NONE definition
  ...

Conflicts:
	arch/arm/mach-msm/board-8226.c
	arch/arm/mach-msm/board-8610.c
	arch/arm64/kernel/asm-offsets.c
	arch/arm64/kernel/fpsimd.c
	arch/arm64/kernel/setup.c

Change-Id: I289996bc18d8a2782906e7db1171b48e3ee46a73
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
2014-02-12 19:06:33 -08:00
Eric Holmberg f471d5c8c7 TTY: msm_smd_tty: Fix driver addition/removal error
Currently, the functions smd_tty_add_driver and smd_tty_remove_driver
compare the channel name of the driver being added or removed to the
device name of already-registered drivers before completing the add
or remove. This is incorrect and causes driver removal to fail.

Compare the device name of the driver being added or removed instead
of the channel name in both functions (smd_tty_remove_driver and
smd_tty_add_driver).

Change-Id: I6a844428a57d0934ff9a4d7f7311cc933b2a1b80
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2014-02-12 18:24:50 -07:00
Eric Holmberg 2cad996e0d TTY: msm_smd_tty: Add warning to driver removal function
The current implementation of smd_tty_remove_driver does not check to
see if a matching driver instance is found before attempting to
unregister the driver. This could lead to a silent failure or an attempt
to remove a driver that does not exist.

Add a flag that indicates if a matching driver is found in the list
before removal is attempted. If no drivers are found, an error message
is logged.

Change-Id: I30f067b11dbe736ae065c5d4fbe30ca5c0645bb6
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2014-02-12 18:24:11 -07:00
Jeff Hugo e432f9a642 msm: smd: Support multiplatform
Upstream prefers existing drivers be converted to support multiplatform
kernels.  This requires drivers to be located in generic functionality
directories instead of specific mach directories.

Move the smd and smsm drivers to the drivers/soc/qcom location to support
multiplatform.

Change-Id: I7f2e990341f0f34e336e71bd3b06a7c2a46d8bc1
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
2014-02-12 09:31:06 -07:00
Linux Build Service Account ebe31ae5a8 Merge "msm_serial_hs: Race Condition during Baud Rate Configuration" 2014-02-08 09:39:10 -08:00
Martin Schwidefsky ac7df0d7c4 Remove GENERIC_HARDIRQ config option
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Git-commit: 0244ad004a54e39308d495fee0a2e637f8b5c317
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[imaund@codeaurora.org: resolve merge conflicts]
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-02-07 13:49:47 -08:00
Naveen Kaje dc056616e0 msm_serial_hs_lite: fix platform data handling and move header
of_match_device passes the hardware version
information as a void pointer. Changing the type to
unsigned long to scale to different architectures.
Address the change in location of header files.

Change-Id: I80c6afb8f6c8bfc40b1f3312b9c1797a7ad48340
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-02-07 13:48:05 -08:00
Dilip Kota 6b1a422ae8 msm_serial_hs: Race Condition during Baud Rate Configuration
Race Condition:
==============
CPU 0:
1.) Rx BAM pipe got disconnected during Baud Rate Cnfg
2.) Rx tasklet got scheduled
3.) Tasklet is issuing Rx command to BAM
4.) BAM API aquired spinlock and accessed Null Pointer
This lead to Null Pointer Access and Crash
CPU 1:
5.) As part of baud rate configuration process CPU 1
called BAM Rx Connect API
6.) BAM API is trying acquire Spinlock
7.) Spinlock is not released by CPU0
This lead to BUG ON

Fix:
===
During Baud Rate Configuration, if Rx command is queued
set the flag for not issuing any Rx command to BAM
Adding rx_cmd_exec variable to avoid command getting
queued twice without callback for the first

Change-Id: I800180cba22b1d0326147a21f175d06e4641f6c4
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-02-06 12:36:31 -08:00
Stephen Warren 8d353b6d2f serial: 8250: enable UART_BUG_NOMSR for Tegra
commit 3685f19e07802ec4207b52465c408f185b66490e upstream.

Tegra chips have 4 or 5 identical UART modules embedded. UARTs C..E have
their MODEM-control signals tied off to a static state. However UARTs A
and B can optionally route those signals to/from package pins, depending
on the exact pinmux configuration.

When these signals are not routed to package pins, false interrupts may
trigger either temporarily, or permanently, all while not showing up in
the IIR; it will read as NO_INT. This will eventually lead to the UART
IRQ being disabled due to unhandled interrupts. When this happens, the
kernel may print e.g.:

    irq 68: nobody cared (try booting with the "irqpoll" option)

In order to prevent this, enable UART_BUG_NOMSR. This prevents
UART_IER_MSI from being enabled, which prevents the false interrupts
from triggering.

In practice, this is not needed under any of the following conditions:

* On Tegra chips after Tegra30, since the HW bug has apparently been
  fixed.

* On UARTs C..E since their MODEM control signals are tied to the correct
  static state which doesn't trigger the issue.

* On UARTs A..B if the MODEM control signals are routed out to package
  pins, since they will then carry valid signals.

However, we ignore these exceptions for now, since they are only relevant
if a board actually hooks up more than a 4-wire UART, and no currently
supported board does this. If we ever support a board that does, we can
refine the algorithm that enables UART_BUG_NOMSR to take those exceptions
into account, and/or read a flag from DT/... that indicates that the
board has hooked up and pinmux'd more than a 4-wire UART.

Reported-by: Olof Johansson <olof@lixom.net> # autotester
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-06 11:08:14 -08:00
Jonathan Woithe 2f8cef8c24 serial: 8250: Fix initialisation of Quatech cards with the AMCC PCI chip
commit 9c5320f8d7d9a2cf623e65d50e1113f34d9b9eb1 upstream.

Fix the initialisation of older Quatech serial cards which are fitted with
the AMCC PCI Matchmaker interface chip.

Signed-off-by: Jonathan Woithe (jwoithe@just42.net)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-06 11:08:14 -08:00
Yegor Yefremov 1459439f7c serial: add support for 200 v3 series Titan card
commit 48c0247d7b7bf58abb85a39021099529df365c4d upstream.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-06 11:08:14 -08:00
Marek Roszko 630cf7648c tty/serial: at91: Handle shutdown more safely
commit 0cc7c6c7916b1b6f34350ff1473b80b9f7e459c0 upstream.

Interrupts were being cleaned up late in the shutdown handler, it is possible
that an interrupt can occur and schedule a tasklet that runs after the port is
cleaned up. There is a null dereference due to this race condition with the
following stacktrace:

[<c02092b0>] (atmel_tasklet_func+0x514/0x814) from [<c001fd34>] (tasklet_action+0x70/0xa8)
[<c001fd34>] (tasklet_action+0x70/0xa8) from [<c001f60c>] (__do_softirq+0x90/0x144)
[<c001f60c>] (__do_softirq+0x90/0x144) from [<c001fa18>] (irq_exit+0x40/0x4c)
[<c001fa18>] (irq_exit+0x40/0x4c) from [<c000e298>] (handle_IRQ+0x64/0x84)
[<c000e298>] (handle_IRQ+0x64/0x84) from [<c000d6c0>] (__irq_svc+0x40/0x50)
[<c000d6c0>] (__irq_svc+0x40/0x50) from [<c0208060>] (atmel_rx_dma_release+0x88/0xb8)
[<c0208060>] (atmel_rx_dma_release+0x88/0xb8) from [<c0209740>] (atmel_shutdown+0x104/0x160)
[<c0209740>] (atmel_shutdown+0x104/0x160) from [<c0205e8c>] (uart_port_shutdown+0x2c/0x38)

Signed-off-by: Marek Roszko <mark.roszko@gmail.com>
Acked-by: Leilei Zhao <leilei.zhao@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-06 11:08:14 -08:00
Dipen Parmar 7f918cb5c7 msm: sps: remove sps header file
Remove the sps header file from older location as sps
driver and clients need to use new header file from
new location include/linux.

Resolve the warnings/errors from client drivers due to
new sps header changes.

Change-Id: I1cdb87756abf3425a9bb5d8bf89cd1aa03a01716
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-02-05 15:31:11 -08:00
Xiaocheng Li 78ad20a60d drivers: serial: Fix risky coding style in wait_for_xmitr()
Add inline qualifier for wait_for_xmitr() according to its
declaration.

Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
Change-Id: If1b4754feef743f83e8411e532608223d8c73608
2014-02-05 09:33:56 -08:00
Jeff Hugo 087d698af7 msm: smd: Add probe deferral support
SMD APIs may be called before probe() has a had a chance to initialize
the driver.  In such cases, EPROBE_DEFER should be returned to the caller
to indicate SMD needs more time to probe.

Change the public APIs to detect the current status of probe() and return
EPROBE_DEFER if necessary.

Change-Id: I243f56c3aa6afdce22192f17bcbae9377242d116
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
2014-02-03 15:09:10 -07:00
Linux Build Service Account 8275b303e2 Merge "msm_serial_hs: Disable RX PIPE before sps_disconnect" 2014-01-31 18:04:11 -08:00
Linux Build Service Account 2a1f259a35 Merge "msm_serial_hs: Program RFR to synchronize clock-off sequence with HW" 2014-01-31 18:03:48 -08:00
Linux Build Service Account 755e024a75 Merge "msm_serial_hs: Initialize tty_flush_recieve while Port Open" 2014-01-31 18:03:33 -08:00
Linux Build Service Account 595d37e704 Merge "msm_serial_hs: Avoid RX getting stuck during rapid clock on/off" 2014-01-31 18:03:19 -08:00
Dilip Kota 81ae4135e1 msm_serial_hs: Disable RX PIPE before sps_disconnect
We need to disable RX PIPE interrupt to avoid any
race condition between sps_disconnect and bam_isr

CRs-Fixed: 606112
Change-Id: Id5192668d7001b1e3021b1751e7d818316722d5c
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-01-31 01:48:41 -08:00
Dilip Kota 07929a3e5f msm_serial_hs: Program RFR to synchronize clock-off sequence with HW
Assert the RFR line during clock off and de-assert
it after the clock off is successful. This is to avoid
the data to be coming from the client during clock off.

Change-Id: I6cad22a63ebd3cfaa20c52445584829b382b7e3a
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-01-31 01:48:16 -08:00
Dilip Kota b36b5f078f msm_serial_hs: Initialize tty_flush_recieve while Port Open
Initialize the tty_flush_recieve to default value during
Port Open to avoid a corner case where Tx bytes may get queued
twice by UART in the absence of initialization.

Corner Case:
UART client calls uart_flush_buffer() API to flush the
data on Tx while UART Tx is in middle of operation.
If client immediately calls UART Port close followed by UART Tx
after Port-Open, it may result in queueing same bytes twice

CRs-Fixed: 590459
Change-Id: Ied9d33265060e1fde7fc98e29f58d3eff6ddc3c4
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-01-31 01:47:58 -08:00
Kiran Gunda 62bf76933b msm_serial_hs: Avoid RX getting stuck during rapid clock on/off
Due to race conditions in clock off and clock on sequence
BAM RX descriptor doesn't get queued or may get queued multiple
times. These issues may showup when the client issues rapid clock-on
clock-off operations.
This patch optimizes clock-off sequence while synchronizing clock
off/on with the BAM RX callback (In BAM RX callback, Forcestale
is not issued for every BAM RX callback).

CRs-Fixed: 601140
Change-Id: I882bb57b597f5789daa5fef33a4bc8da174110d0
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-01-31 15:09:41 +05:30
Linux Build Service Account 14fd60c98f Merge "msm_serial_hs: Manage clock path-vote correctly" 2014-01-30 07:23:43 -08:00
Linux Build Service Account 514966a0a0 Merge "msm_serial_hs: Defensive checks" 2014-01-30 07:21:09 -08:00
Linux Build Service Account 54c2cb7d05 Merge "msm_serial_hs:Enable Error/Break Char off" 2014-01-30 07:21:04 -08:00
Linux Build Service Account 204ca460b3 Merge "msm_serial_hs: Implement driver functionality to be closer to HW spec" 2014-01-30 07:21:01 -08:00
Kiran Gunda 84f0796d78 msm_serial_hs: Manage clock path-vote correctly
clock path vote is needed for core and iface vote,
so remove it after these votes are removed, and
make sure clock path vote/unvote are balanced by
removing unnecessary clock path vote

CRs-Fixed: 606403
Change-Id: I2ca2ef1cac3f0aacb7d21eb4da8bed3d39e0158c
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-01-29 16:10:44 -07:00
Kiran Gunda 63627cc2e6 msm_serial_hs: Defensive checks
Add defensive checks in the APIs exposed to clients
and tty layer to avoid unclocked access

CRs-Fixed: 593860
Change-Id: Ibb80b18143a3b90156a7043fd66d4097f7c073e1
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-01-29 21:40:35 +05:30
Dilip Kota 08f7adf16b msm_serial_hs:Enable Error/Break Char off
Follow the hardware sequence of enabling
RX_ERROR_CHAR_OFF and RX_BREAK_ZERO_CHAR_OFF in
MR2 register, for not allowing the Break and
parity/frame Error characters into Rx FIFO.

CRs-Fixed: 538141
Change-Id: I24f73eea456c4cb2a68b1655bcd5426426ca7d97
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-01-29 21:32:43 +05:30
Naveen Kaje 7b2b104adc msm_serial_hs: Implement driver functionality to be closer to HW spec
Implement TX callflow to be in accordance with HW spec and make
sure TXEMT clock off logic is correct. On receiver side, issue
force stale interrupt and make sure upper layer get bytes upto
size of RX buffer

CRs-Fixed: 575119
Change-Id: Iee469b0ba489386b571a86897b62eae84ff34ca5
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-01-29 21:23:24 +05:30
Vikram Mulukutla bd91122223 msm: Move PIL and SSR headers
Architectural changes in the ARM Linux kernel require moving
some MSM specific headers related to the peripheral image
loader and the subsystem restart drivers to include/soc/qcom.

subsystem_restart.h is used by external modules and thus
leave a proxy in include/soc/qcom for now. Once external modules
switch over to this new include path, the header in the
old location can be deleted.

Change-Id: I0680dc34481d09170ce2609259c5318a9e6dbf37
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-01-27 19:08:06 -08:00
Jon Medhurst 3bb0df1b71 serial: amba-pl011: use port lock to guard control register access
commit fe43390702a1b5741fdf217063b05c7612b38303 upstream.

When the pl011 is being used for a console, pl011_console_write forces
the control register (CR) to enable the UART for transmission and then
restores this to the original value afterwards. It does this while
holding the port lock.

Unfortunately, when the uart is started or shutdown - say in response to
userland using the serial device for a terminal - then this updates the
control register without any locking.

This means we can have

  pl011_console_write   Save CR
  pl011_startup         Initialise CR, e.g. enable receive
  pl011_console_write   Restore old CR with receive not enabled

this result is a serial port which doesn't respond to any input.

A similar race in reverse could happen when the device is shutdown.

We can fix these problems by taking the port lock when updating CR.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-25 08:27:12 -08:00
Jeff Hugo 561bf8855b TTY: msm_smd_tty: Clean up includes
msm_smd_tty includes <mach/socinfo.h> but does not use the socinfo API.
msm_smd_tty does use <mach/socinfo.h> as a means to include <linux/of.h>.

Remove the unnecessary socinfo.h include and properly include of.h.

Change-Id: Iddc7a12d42527a7e150600110f6750b044669d14
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
2014-01-18 13:35:28 -07:00
Mika Westerberg a718268abc serial: 8250_dw: add new ACPI IDs
commit d24c195f90cb1adb178d26d84c722d4b9e551e05 upstream.

Newer Intel PCHs with LPSS have the same Designware controllers than
Haswell but ACPI IDs are different. Add these IDs to the driver list.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-09 12:24:20 -08:00
Geert Uytterhoeven fb36b98472 TTY: pmac_zilog, check existence of ports in pmz_console_init()
commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a upstream.

When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0"
on the kernel command line, it crashes with:

Unable to handle kernel NULL pointer dereference at virtual address   (null)
Oops: 00000000
PC: [<0013ad28>] __pmz_startup+0x32/0x2a0
...
Call Trace: [<002c5d3e>] pmz_console_setup+0x64/0xe4

The normal tty driver doesn't crash, because init_pmz() checks
pmz_ports_count again after calling pmz_probe().

In the serial console initialization path, pmz_console_init() doesn't do
this, causing the driver to crash later.

Add a check for pmz_ports_count to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-09 12:24:19 -08:00
Naveen Kaje 867e2964e1 msm_serial_hs: Fix the logic for numbering the serial device
This patch fixes the way the UART nodes are enumerated when
aliases are used to identify the nodes. The atomic variable that
used to hold the next available node number was incorrectly being
incremented and if that number were to hold a number that was also
used in an alias, the probe would fail. This patch corrects it.
It also removes the atomic variable and introduces two apis to set
and get the next device number and this logic is protected by a mutex.

Change-Id: Iaee655603b527f3283e1f12d90b1220e9315b529
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-01-09 21:19:36 +02:00
Dilip Kota c0250c121c msm_serial_hs: Fix the wrong register offset Macro usage
In the msm_hs_tx_empty() API, accessing wrong register offset
macro UARTDM_SR_ADDR.This leading to the unexpected issues
The right register offset macro is UART_DM_SR.
Also the msm_hs_request_clock_off() API is accessing wrong
register macro UARTDM_IMR instead of UART_DM_IMR.

This patch places the right macros at respective points.

CRs-Fixed: 583426
Change-Id: I0eb966adedc44b8e611da318b6d8f4a9279e95a7
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2013-12-17 14:24:21 -07:00
Jeff Hugo 3e7fc08748 msm: smd_tty: Support multiplatform
Upstream prefers existing drivers be converted to support multiplatform
kernels.  This requires drivers to be located in generic functionality
directories instead of specific mach directories.

Move the smd_tty driver to the drivers/tty/serial location to support
multiplatform.

Change-Id: Ia5cb5f98ca07817900470252b21e47622bf23ee9
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
2013-12-12 09:55:48 -07:00
Linux Build Service Account 7589ee9ea8 Merge "msm: ipc_logging: Support multiplatform" 2013-12-11 20:40:02 -08:00
Jeff Hugo 76c62752e2 msm: ipc_logging: Support multiplatform
Upstream prefers existing drivers be converted to support multiplatform
kernels.  This requires drivers to be located in generic functionality
directories instead of specific mach directories.

Move the ipc_logging driver to the kernel/trace location to support
multiplatform.

Change-Id: I8b217f2c13254814e9dfa95f46308150f1fc2a1b
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
2013-12-07 13:33:38 -07:00
Naveen Kaje 06f38a1fcb msm_serial_hs: Dynamic allocation of port structures
This patch allocates the msm_hs_port structures
dynamically during probe and cleans up during exit.
The msm_hs_get_uart_port function now looks up the
uart_state data structure to find the right uart_port.

Change-Id: I3876959eb41173d2115d2c1acfc612b75ca2e46a
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-12-06 16:08:46 -08:00
Linux Build Service Account c673663031 Merge "msm_serial_hs_lite: Remove kernel panic" 2013-12-05 22:28:50 -08:00
Linux Build Service Account 813075d51d Merge "msm_serial_hs: Fix register access issue" 2013-12-04 04:27:34 -08:00
Dilip Kota d58a73e6d6 msm_serial_hs: Fix register access issue
Crash is seen in the dump_uart_hs_registers()
function due to improper array offset passed to
access the registers. This patch corrects the
array index during the register access.

CRs-Fixed: 576874
Change-Id: Iba54b72cefa01ff855b17e981aa4dd2886126003
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2013-11-29 13:33:32 +05:30
Dilip Kota 0e58f48469 msm_serial_hs_lite: Remove kernel panic
Do not use panic() when tx operation timeouts, which
leads to kernel panic causing crash.
Instead of panic which effects the driver stability,
resetting the transmitter will work good and keep
transmitting the data.

CRs-Fixed: 578961
Change-Id: I3449cf152cecb1d557b24f770e4fb71e1f2bde00
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2013-11-29 10:55:00 +05:30
Ian Maund f06163e6d0 msm: reap unused kernel files
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.

A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.

Some files which support planned functionality or are
useful in debugging have been excluded from this reap.

Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2013-11-21 17:45:28 -08:00
Dilip Kota 994bd0a059 msm_serial_hs_lite: Handle Tx request during System Suspend
A corner case is occuring, that performing un-clock register
access and leading to Kernel Crash
Corner Case:
When system is in suspend state, Tx operation is getting called
from the client driver by a fflush system call.
To overcome this case, added a conditional check in the driver
while Tx operation. If system is in suspend state, return back
immediately.

CRs-Fixed: 570113
Change-Id: Idab06cbb49610dd36146fd22714ef20c63000ba5
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2013-11-18 12:48:25 +05:30
Linux Build Service Account ebe37e4722 Merge "msm_serial_hs: Fix return value handling from platform_get_irq_by_name" 2013-11-11 22:16:09 -08:00
Linux Build Service Account 8a8880abef Merge "msm_serial_hs: fix unbalanced clock vote during port close" 2013-11-11 22:15:17 -08:00
Naveen Kaje 26ea36a288 msm_serial_hs: fix unbalanced clock vote during port close
This change fixes the clock voting logic when the port is closed and
prevents the clock votes from going negative. Clocks are voted for when
the port is being closed and the conditional unvote based on the clock
state will always be true if the earlier vote is not downvoted before
this check is done. This change also protects agains erroneous, unbalanced
client votes, leading to instabilities.

CRs-Fixed: 550668
Change-Id: I391ac69601314757821b3ffb931a00647a64c583
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-11-11 15:33:38 -07:00
Naveen Kaje 8ab7a055b1 msm_serial_hs: Fix return value handling from platform_get_irq_by_name
platform_get_irq_by_name function returns -ENXIO upon failure.
The return code should be checked for this error code to detect
failures.

CRs-Fixed: 566710
Change-Id: I95b601edf457a19ad8f617700697fae9b5db0f1f
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-11-06 08:25:11 -08:00
Kumar Gala f629ba6d5b msm: remove include of <asm/mach-types.h> and <asm/system.h>
Upstream has removed <asm/system.h> so remove it from legacy uses.  As all
the platforms we support utilize device tree we no longer need to include
<asm/mach-types.h>.

Change-Id: I8e53b1fd96ad26711fae59f081a8892f8bb184b7
Signed-off-by: Kumar Gala <galak@codeaurora.org>
2013-11-04 13:59:18 -06:00
Roel Kluin bfddde1b40 serial: vt8500: add missing braces
commit d969de8d83401683420638c8107dcfedb2146f37 upstream.

Due to missing braces on an if statement, in presence of a device_node a
port was always assigned -1, regardless of any alias entries in the
device tree. Conversely, if device_node was NULL, an unitialized port
ended up being used.

This patch adds the missing braces, fixing the issues.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-04 04:31:06 -08:00
Linux Build Service Account 46bed3f2bd Merge "msm_serial_hs: Add IPC Logging" 2013-10-25 05:30:30 -07:00
Naveen Kaje d77538f703 msm_serial_hs: Add IPC Logging
This patch enables IPC Logging in the high speed UART driver.
The logs are available under sysfs. Log level can be changed by
changing the mask provided in /sys/module.

This patch prints UART Registers while
1)Port Open
2)Port Configuration
3)Rx/Tx Flow
4)Handling ISR and
Prints Tx/Rx Data and Count

Change-Id: I7540f2c4c981271a72cf5a1ffe313ceb53a60867
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-10-24 10:17:51 -07:00
Naveen Kaje f2b4a9fe4c msm_serial_hs: Disable RFR line and auto RFR in set_termios
This change disables the RFR line during set_termios call so that
the remote side does not send data during this call and thus prevents
data omission and corruption.

CRs-Fixed: 557659
Change-Id: I0708168b858a42d102ad3e5ebcbd6ca33943c8b1
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-10-23 12:41:57 -06:00
David Vrabel 8598a32d43 xen/hvc: allow xenboot console to be used again
commit a9fbf4d591da6cd1d3eaab826c7c15f77fc8f6a3 upstream.

Commit d0380e6c3c (early_printk:
consolidate random copies of identical code) added in 3.10 introduced
a check for con->index == -1 in early_console_register().

Initialize index to -1 for the xenboot console so earlyprintk=xen
works again.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-13 16:08:33 -07:00
Linux Build Service Account ba79fe72fd Merge "msm_serial_hs: Fix race condition with BAM rx pipe" 2013-10-08 02:07:12 -07:00
Johan Hovold 20d7e144c9 serial: pch_uart: fix tty-kref leak in dma-rx path
commit 19b85cfb190eb9980eaf416bff96aef4159a430e upstream.

Fix tty_kref leak when tty_buffer_request room fails in dma-rx path.

Note that the tty ref isn't really needed anymore, but as the leak has
always been there, fixing it before removing should makes it easier to
backport the fix.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 07:13:10 -07:00
Johan Hovold b0a382b5a3 serial: pch_uart: fix tty-kref leak in rx-error path
commit fc0919c68cb2f75bb1af759315f9d7e2a9443c28 upstream.

Fix tty-kref leak introduced by commit 384e301e ("pch_uart: fix a
deadlock when pch_uart as console") which never put its tty reference.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 07:13:10 -07:00
Johan Hovold 64dc8de491 serial: tegra: fix tty-kref leak
commit cfd29aa0e81b791985e8428e6507e80e074e6730 upstream.

Fix potential tty-kref leak in stop_rx path.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 07:13:10 -07:00
Peter Hurley fe0da74501 tty: Fix SIGTTOU not sent with tcflush()
commit 5cec7bf699c61d14f0538345076480bb8c8ebfbb upstream.

Commit 'e7f3880cd9b98c5bf9391ae7acdec82b75403776'
  tty: Fix recursive deadlock in tty_perform_flush()
introduced a regression where tcflush() does not generate
SIGTTOU for background process groups.

Make sure ioctl(TCFLSH) calls tty_check_change() when
invoked from the line discipline.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 07:13:10 -07:00
Naveen Kaje faba187f2a msm_serial_hs: fix compilation warning
Add proper typecasting for the physical address type.

Change-Id: Ibf46360c31f3475123e2fe35b4ae89d8afe82abf
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-09-29 18:41:02 -06:00
Oleg Nesterov d5cc290b92 tty: disassociate_ctty() sends the extra SIGCONT
commit 03e1261778cca782d41a3d8e3945ca88cf93e01e upstream.

Starting from v3.10 (probably commit f91e2590410b: "tty: Signal
foreground group processes in hangup") disassociate_ctty() sends SIGCONT
if tty && on_exit.  This breaks LSB test-suite, in particular test8 in
_exit.c and test40 in sigcon5.c.

Put the "!on_exit" check back to restore the old behaviour.

Review by Peter Hurley:
 "Yes, this regression was introduced by me in that commit.  The effect
  of the regression is that ptys will receive a SIGCONT when, in similar
  circumstances, ttys would not.

  The fact that two test vectors accidentally tripped over this
  regression suggests that some other apps may as well.

  Thanks for catching this"

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Karel Srot <ksrot@redhat.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 17:18:04 -07:00
Kiran Gunda 478fe086cb msm_serial_hs: Fix race condition with BAM rx pipe
Crash observed due to the race condition with bam
rx pipe during sps_disconnect and sps_transfer_one
operations executed at the same time on two CPUs.

Because of this race condition rx bam descriptor
pointer becomes NULL and accessing of this pointer
leads to crash.

This patch waits for sps_transfer_one function to
complete, if it is in progress, before calling
sps_disconnect function from the set_termios.

CRs-Fixed: 534029
Change-Id: I7581062a17a3dc7ede8eb58e4d25e3b517812ab2
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2013-09-20 17:13:40 +05:30
Eugene Surovegin 6f3615326d powerpc/hvsi: Increase handshake timeout from 200ms to 400ms.
commit d220980b701d838560a70de691b53be007e99e78 upstream.

This solves a problem observed in kexec'ed kernel where 200ms timeout is
too short and bootconsole fails to initialize. Console did eventually
become workable but much later into the boot process.

Observed timeout was around 260ms, but I decided to make it a little bigger
for more reliability.

This has been tested on Power7 machine with Petitboot as a primary
bootloader and PowerNV firmware.

Signed-off-by: Eugene Surovegin <surovegin@google.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-07 22:09:58 -07:00
Stephen Boyd 25621f7d86 msm_serial_hs: Mark irq as oneshot
Threaded irqs should be marked IRQF_ONESHOT if they don't have a
hard irq handler.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 17:24:46 -07:00
Stephen Boyd 00e17927f3 Revert "msm: tty: update receive room just before writing data to the ldisc"
This reverts commit e6cb90d673242898da86271f40a3fcd1729ba9d9.

This causes compilation failures because the TTY layer has been
rewritten to hide most of these fields.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 17:23:26 -07:00
dgaribal a8bebb0800 tty: serial: Use "no_log" readl/writel variants in hsl_read/write
hsl_read and hsl_write both directly call ioread32/iowrite32, which
leads to either a __raw_readl or __raw_writel call. These
readl/writel call are logged to the register trace buffer (RTB) by
default and generate a very large amount of output. This patch
directly calls __raw_readl_no_log and __raw_writel_no_log in
hsl_read and hsl_write to avoid logging these events to the RTB.

Change-Id: I9b3253996188f0642a4f6dedf449ec23fa1de05a
Signed-off-by: David Garibaldi <dgaribal@codeaurora.org>
2013-09-04 17:18:29 -07:00
Saket Saurabh b1b28fa9f8 msm_serial_hs: Add runtime support for determining UARTDM register offsets
Currently, HSUART uses a Kconfig option to determine the UARTDM core
version register offsets during compile time. This change adds runtime
configuration support for determining the version of the UARTDM core,
and use the same with appropriate register mappings in HSUART driver.

Also with addition of runtime support for determining the UARTDM core
version register offsets, Kconfig CONFIG_MSM_UARTDM_Core_v14 is no longer
required. This change also does clean up of defconfig files for removing
the config and uart register header files for achieving the same.

CRs-Fixed: 459281
Change-Id: Iff4ad1c37a3b04345d68cbe0a8befa284b49a539
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 17:13:09 -07:00
Arun Kumar Neelakantam 5adcec7f94 tty: n_smux: fix deadlock between RX and TX workers
smux_handle_rx_open_ack function acquires the channel state spin lock
and tries to add the channel into ready list causing spin lock lockup
between smux_rx_worker thread and smux_tx_worker thread running on
two different CPUs.

Add the channel to ready list after releasing the state spin lock.

CRs-Fixed: 514726
Change-Id: I11729290c5c28a13bed66cf7506b8aaf48a32d2a
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2013-09-04 17:12:38 -07:00
Arun Kumar Neelakantam 5e5c417097 tty: n_smux: add separate close notifications
When an SMUX port state is closed, the close request is sent to the
remote system.  The port cannot be re-opened until the remote system
acknowledges the close request.  If the client attempts to re-open the
port during this time, then the -EAGAIN error code is returned and the
client must keep retrying to open the port.  An event-driven approach
would be better, but the client does not receive local state
notifications, so this is not possible.

Add local and remote closed notifications so clients can handle the
closing state transitions without using polling.

CRs-Fixed: 510114
Change-Id: I48008804d23dbfd05df0becd4bc1c695e599a835
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2013-09-04 17:10:05 -07:00
Naveen Kaje ef7b05b66e msm_serial_hs: Vote for clocks during tty close
While BT operation is in progress, it's possible for
client functions to explicitly turn off the
UART clocks without notifying TTY layer.  Then when
TTY layer try to access UART, L2 error happened because
of un-clocked registers.  Since there is no clear way
to notify clients to turn on clocks before TTY access
UART driver will implicilty turn on the clocks.

CRs-Fixed: 505225
Change-Id: Ia9958658465a6c0e5af66cd932e8e694cc12b78c
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-09-04 17:09:14 -07:00
Arun Kumar Neelakantam 8987f78a9a tty: n_smux: After receiving OPEN_ACK flush tx_queue
If a local SMUX client re-opens the channel and tries to send data before
receiving the OPEN_ACK, the transaction will get stuck because the
channel local state is not OPENED.

Add the channel to ready list if tx_queue is not empty after receiving
the OPEN_ACK.

CRs-Fixed: 507379
Change-Id: I357b6edc340c404c890da0c415ed3aeba96dcfe8
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2013-09-04 17:07:43 -07:00
Saket Saurabh 6741657f38 msm_serial_hs: Configure UART RX gpio line as wakeup irq line
UART wakeup can be triggered by RX activity using a wakeup GPIO on the
UART RX pin. This change adds support for configuring the UART RX gpio
line as wakeup irq line.

CRs-Fixed: 482104
Change-Id: I775c17d4d36b08225b32063131473567c2d16f9c
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
2013-09-04 17:05:59 -07:00
Saket Saurabh 179a4c2895 msm_serial_hs: Add ioctl support for UART Clock on/off request
This change adds support for ioctl implementation in HSUART
driver. UART Client application (e.g. Bluetooth) can make
request for UART Clock on/off using the ioctl mechanism.
UART Clock status also can be queried using this mechanism.

CRs-Fixed: 496245
Change-Id: I9531cf2f9eda487082b9719341c5ad84c15ad5f7
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:59:04 -07:00
Arun Kumar Neelakantam 9ef382b2fe tty: smux_ctl: Add new SMUX port Support
smux_ctl exposes only one control port to userspace. Enabling of dual
PDN support requires two SMUX ports.

Add new SMUX control port to enable dual PDN support.

CRs-Fixed: 497343
Change-Id: I2a1d48f1e5d2acd1f67d7673d325c4360b783cf4
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2013-09-04 16:54:01 -07:00
Saket Saurabh 3bc1e1f778 msm_serial_hs: Add check to validate wakeup irq in UART clock on request
Wakeup irq is UART RX GPIO IRQ line to be configured as wakeup source and
is used as an optional property with UART. By default wakeup irq is set as
zero when it is not to be used with UART.
During UART clock on request msm_hs_request_clock_on(), calling
disable_irq_nosync() without validating wakeup irq is causing warning
message.
Hence fixing the issue by adding check to validate the wakeup irq during
UART clock on request.

CRs-Fixed: 490597
Change-Id: Iff014f41428d590117e469c1b470736383a78848
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:45:13 -07:00
Eric Holmberg 1a710dc127 tty: n_smux: Rename SSR unit tests
Running the Subsystem Restart (SSR) unit tests without SSR enabled
causes the system to halt.

Rename SSR unit tests to allow for testing all non-SSR tests
quickly from the command line.

Change-Id: Ib80e9adef8311ebe038f878dfcf2aecd1087a471
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 16:41:34 -07:00
Eric Holmberg 1f6671fd54 tty: n_smux: Add wakeup test case
Reproducing and isolating wakeup issues caused by incorrect UART
configuration and hardware issues currently requires analysis of the
internal logs which is often time consuming.

Add wakeup test case to allow teams to easily reproduce wakeup issues or
verify wakeup functionality.

Change-Id: I614d6ee3eefc6563930c45564b76452e89f65dc8
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 16:41:32 -07:00
Eric Holmberg 9b7b78176f tty: n_smux: fix test pattern validation
Incorrect test pattern code was skipping the test pattern validation
test and not freeing the test buffer resulting a slow memory leak in the
unit test that could lead to out-of-memory failures after several
hundred thousand iterations.

Fix pointer test to properly free memory after test case completion and
fix incorrect test pattern validation code.

Change-Id: If93c2cfd2f82295897b36ffaf98ecaa5b9128cfb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 16:41:31 -07:00
Eric Holmberg 0f7e638469 tty: n_smux: Add throughput metrics to unit tests
Add throughput metrics to unit tests to enable profiling the performance
of SMUX round-trip messaging.

Change-Id: I1eb552ca53358ece9f95a99a340409a4464877fb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 16:41:29 -07:00
Eric Holmberg 6f2f63505d tty: n_smux: Make test functions static
Local test functions should be static to prevent duplicate
symbol collisions with other modules.

Change-Id: I43cf6199fa1fa5fe58e81c9b4e5b5c18f3539341
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 16:41:27 -07:00
Saket Saurabh 6df92d2002 msm_serial_hs: Register UART with BLSP BAM in satellite mode
Execution Environment(EE) enables BLSP BAM and does not allow apps
side to write to BAM CTRL registers any more.

Hence UART driver needs to register BLSP BAM in satellite mode using
SPS_BAM_MGR_DEVICE_REMOTE.

Change-Id: If628eb468893c3e488a5793f129a68bcf57bdf47
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:31:54 -07:00
Vikram Mulukutla 1327042bbf msm_serial_hs_lite: Vote for bus bandwidth before enabling clocks
The UART bus interface clock requires the bus clock
to be on before it can be enabled. Ensure that there
is a vote for the bus before enabling the clock.

Change-Id: I6612d6df1b890a3de39f892439a9c406b9cbdbc7
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2013-09-04 16:26:36 -07:00
Mayank Rana 5373de29e6 msm_serial_hs: Donot register UART device as PM runtime active
Currently UART device is being registered as PM runtime active
in probe() and set as suspended in shutdown(). With this UART
driver PM runtime suspend is being called when system suspend
is invoked and while resuming from the same which invokes UART
driver LPM functionality. It causes UART communication to stop
if both UART Tx and RX FIFO are empty.

This change donot register UART device as PM runtime active
device as UART driver doesn't use PM runtime APIs for its LPM
functionality.

CRs-Fixed: 479966
Change-Id: I33d0c95e4227fdb1b7d6d514498e161e6e4df465
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:25:38 -07:00
Eric Holmberg 489faa2122 tty: smux_ctl: close SMUX port during SSR
If a subsystem restart occurs, the SMUX port needs to be closed when the
platform device is removed and then re-opened when the platform device
is probed again.  Without this functionality, the SMUX port state is not
properly reset resulting in a data stall.

Add code to close the SMUX port when the platform device is removed.

CRs-Fixed: 474388
Change-Id: I00039fa517a5cf6b4d9230114cac7c6c9bbba9d1
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 16:23:48 -07:00
Saket Saurabh 23ca1c37da msm_serial_hs: Improve error handing for SPS API usage
SPS APIs sps_connect() and sps_disconnect() are used multiple time in UART
during transmit and receive path. This change adds error check conditions
in UART with usage of sps_connect() and sps_disconnect() API.

Also add fix for the error message seen during uart clock off request.
During uart clock off request, by the UART client driver, sps_disconnect
API is called two times consecutively, first in msm_hs_check_clock_off()
and then followed by msm_hs_stop_rx_locked() by queing the work
disconnect_rx_endpoint. Due to two consecutive sps_disconnect API call,
below error message is seen :
   sps:BAM device of this pipe is NULL

Hence fixing the same error message by removing sps_disconnect() from the
msm_hs_check_clock_off() as calling sps_disconnect() API single time from
msm_hs_stop_rx_locked() is good enough to achieve uart clock off request
functionality.

CRs-Fixed: 474138
Change-Id: I3bcabe2cb6d6efde087a16de30e5400cda4ad74d
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:20:21 -07:00
Saket Saurabh f990d47ed2 msm_serial_hs: Setting DESC_DONE and INT flags for BAM mode
UART driver queue transfer request to BAM and expect rx callback completion
from BAM for the queued descriptor. With current UART BAM configurations
for rx path, it seen that BAM Hardware did not set EOT flag to the
descriptor processed and hence did not generate any End of Transfer
interrupt. Thus, UART driver did not receive any callback from SPS driver
for that descriptor. This results in issue of Rx stall with UART.

Hence fixing the issue by using option DESC_DONE with sps_config and INT
flag option for queued BAM descriptor. With these configurations, UART
receives rx callback completion for queued transfer request from BAM
and data transfer happens normal without any rx stall with UART.

CRs-Fixed: 473902
Change-Id: I7482d20b4bd0d7d04fe5d1400eff568bc53b1e53
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:20:20 -07:00
Mayank Rana c61fde61cf msm_serial_hs: Add support to get UART port reference using port index
Add support to get reference of UART port using its port index.
i.e. if you want reference of UART port for enumerated device as
/dev/ttyHS10, then use the exported API with argument as 10.

Change-Id: I45fc0f2e0d44b21653fd4c875fa3b2f5735fdf84
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:19:22 -07:00
Saket Saurabh a9a6ee4781 msm_serial_hs_lite : Handle -EPROBE_DEFER with clk_get() API usage
Linux clock driver is moving with device tree based usage. It is not
necessary that when UART driver probe is called, before that Linux clock
driver would be initialized.
Hence this change handles -EPROBE_DEFER if clk_get() API returns that and
mark UART driver Probe as deffered probe.

Change-Id: I501ec48445053d9da147f132f0631e4511ca592f
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:17:57 -07:00
Mayank Rana 5becec5741 msm_serial_hs_lite: Remove usage of PM Runtime for startup and shutdown
If UART application is running and system suspend happens, serial core
suspends the UART port by shuting down UART port. With that
msm_hsl_shutdown is calling pm_runtime_put_sync() from system suspend
context where before calling system suspend routine of UART driver,
it is already incremented UART device's PM refcount. Hence with that
pm_runtime_put_sync() from msm_hsl_shutdown() doesn't call UART driver's
PM runtime suspend routine. Hence UART device's Clock remains in ON state
which doesn't allow XO shutdown.

Serial core uses its own PM ops to enable/disable clock before invoking
any UART driver functionality. Hence remove usage of PM Runtime APIs
from startup() and shutdown() APIs of UART driver which makes sure that
suspend/resume is supported when UART application has opened the port
and not used any other way of preventing system suspend.

CRs-Fixed: 467750
Change-Id: Ie2b6e7eaeed518950674815c48a9ac3fe173d9e1
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:16:25 -07:00
Saket Saurabh 23e3767bb1 msm_serial_hs : Add support for 4 Mbps baud rate for BLSP UART
BLSP based UART supports maximum clock frequency of 63.16 Mhz.
With this (63.16 Mhz) clock frequency, UART can achieve baud
rate of 3.94 Mbps which is equivalent to 4 Mbps. UART hardware
is robust enough to handle this deviation to achieve baud rate
equaivalent to 4 Mbps.

CRs-Fixed: 465893
Change-Id: I507ab79601356a0692aba77e1116438f98ec4f4a
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:11:45 -07:00
Mayank Rana 5f395240b8 msm_serial_hs: Using new programming sequence for BAM Based UART
There are issues seen with current programming sequence implementation
for BLSP based UART with BAM, which may possibly put hardware into
different state which may effect the required UART Tx/Rx functionality.

Hence use exact programming sequence as per the hardware programming
guide for BLSP based UART with BAM for proper UART Tx/Rx functionality.

CRs-Fixed: 464370
CRs-Fixed: 460838
Change-Id: Icc69bb9a782bcd695d3eb050c9667ebdb49eb26e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:11:08 -07:00
Saket Saurabh e3c3e60ca5 msm_serial_hs : Add check for UART type with clock off state machine
UART uses ADM or BAM hardware for data transfer. With clock off state
machine, it is required to wait for ADM flush completion to avoid
ADM stall issue. As this operation is specific with ADM usage with UART,
do not wait for flush completion when BAM is used with UART. Add check
to see BLSP UART and wait only for non BLSP based UART. Device crash is
seen with multiple clock off/on sequence for BLSP based UART without
this change.

Change-Id: Ibeb01a9d7d7d457480f2e93dbf621ed70e15fd6f
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 16:09:24 -07:00
Mayank Rana b9318fc503 msm_serial_hs: Wait for discard flush completion for UART Rx channel
Completion of requested flush command with ADM driver is having more
latency then previously. Hence now it is required to wait for discard
flush complete if there is more events expected with UART driver which
would go out of sync without it. Below are 2 instances where it is must
to wait for discard flush completion requested on UART Rx channel.

1. Changing Baud Rate of UART
UART application can send baud rate change request based on its requirement
of communication with connected device on remote uart. Serial core also
does set by default baud rate when application is opening the uart port. As
Rx command is queued always with ADM driver from UART driver, for above
events it is required to flush the same after setting the baud rate. Not
waiting for completion of Rx flush would allow application to send command
on Tx or any other ioctl which would reach to connected device but response
may not be received as Rx flush completion is not received to queue next Rx
command to ADM. Hence with this there are chances that received data with
UART wil be lost when Rx flush completion is not received in-time. Hence
wait for Rx flush completion from set_termios() with timeout as 300 jiffie.
Rx flush completion time is non-deterministic as it depends on number of
commands queued to ADM driver from ADM client drivers.

2. While going for UART clock off
UART clock off has multiple state machines and before going into last
state it makes sure that there are no pending data in UART Tx and Rx FIFO.
Although there would be one Rx command queued which is flushed before
moving to last state and going ahead with UART clock off. If UART clock is
turned off before Rx flush request is being executed and ADM tried to flush
Rx command, ADM encounters data bus error on UART Rx Channel. Hence with
waiting for Rx flush completion, and then doing UART clock off on receving
the same would resolve ADM data bus error issue on UART Rx channel.

CRs-Fixed: 457769
Change-Id: I7ee4f394180e982f875fe58a6e0aabe152dccfd7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:08:29 -07:00
Mayank Rana 2e2b4a475b msm_serial_hs_lite: Don't set UART clock to zero always
Setting UART clock rate to zero is causing multiple issues
and leading to more confusion with other stability issues.
Setting UART clock rate to zero is invalid operation on
recent platforms and throws multiple error messages. Hence
add platform data set_uart_clk_zero to enable setting uart
clock rate to zero operation on required platform for
specific use case.

Also set set_uart_clk_zero for GSBI9 shared between different
processor.

CRs-Fixed: 455466
Change-Id: Iba04d4cf094885b0eae6a9c49ed06f750bcc1024
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:02:41 -07:00
Mayank Rana 0f0d37baaf msm_serial_hs: Deregister UART bus client in error path
Currently probe() doesn't deregister UART bus client if
trying to get any other resource fails. With that memory
corruption is seen as bus driver is still having reference
to pdata allocated for UART bus client and if same memory
is re-used before msm_bus_debugfs_init is called. Fix this
issue by deregistering UART bus client in error path.

Also correct error path with clock usage.

CRs-Fixed: 455957
Change-Id: Id2f5c1cd759625cf5398c400ec2c5276fe5800cb
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 16:02:09 -07:00
Saket Saurabh e8a4604012 msm_serial_hs : Handle spurious rxstale interrupt during uart port close
Spurious rx stale interrupt is seen during uart port close. With rx stale
interrupt rx.flush state machine is set to FLUSH_DATA_READY, but the
expected rx.flush value is FLUSH_SHUTDOWN during uart port close. Due to
this,state machine is not able to handle the situation and devices crashes
with BUG_ON condition in msm_hs_shutdown().

Hence fixing the same by handling the rx.flush state machine in uart port
close for the spurious rxstale interrupt scenario.

CRs-Fixed: 449227
Change-Id: I9222bb74c80e9892528bc94860e0b11dad8b8c8a
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:59:14 -07:00
Saket Saurabh cbae3f8c3c msm_serial_hs : Disable UART interrupts till set_termios is completed
Set_termios() is called to set required baud rate and UART protocol
configuration. It also flushes previously queued Rx cmd to DMA engine
(i.e. BAM Lite). If any UART interrupts (e.g. Rx Stale ) is received
before flushing Rx cmd to DMA engine, used state machine is not able
to handle the situation and devices crashes with BUG_ON condition in
msm_hs_shutdown(). Hence disable interrupts as set_termios() is called
and enables only when returning from the same.

CRs-Fixed: 449227
Change-Id: I0696d5a26cf644d7793739c8ca1f0ea6e285bf94
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:58:26 -07:00
Mayank Rana ab18fe31c6 msm_serial_hs_lite: Add support to vote for BUS scaling
PNOC Bus client is required to vote for BUS Scaling.
In absent of Bus scaling vote from Bus client and PNOC
clock gating is enabled, access to PNOC bus would be
error fatal. Hence it is required to vote for Bus scaling
for PNOC Bus client. BLSP based UART is PNOC bus client.
Hence add support to vote for PNOC bus scaling.

clk_enable_count is used to make decision about when to
vote/reset Bus scaling. Bus scaling is voted before turning
ON UART clock, where as it is reset when turning OFF UART
clock. Bus voting APIs are not refcounted. Hence this
appoach is used.

This change also uses API provided by bus driver to parse
device tree node for vectors.

CRs-Fixed: 446336
Change-Id: I42cec03443e18d8e23cd609830f5630784d9935e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:55:44 -07:00
Duy Truong 09542bb332 Update copyright to The Linux Foundation
Change-Id: I9d411a9c00b37d0907066dbfa6db3a78c108646f
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-09-04 15:53:09 -07:00
Saket Saurabh 191a760305 msm_serial: Do not configure UART IRQ as wakeup interrupt
Currently UART IRQ is being configured as wakeup interrupt once
UART port is being opened and not unconfigured on closing the port.
It is not required to configure UART IRQ as wakeup interrupt as
wakeup functionality is only supported through UART RX GPIO IRQ line
if it is required and enabled for the use case. Enabling UART IRQ as
wakeup interrupt consumes more power on TCXO state.

CRs-Fixed: 452191
Change-Id: I25f86316fdbd356547e0b6921bde23aff3a56355
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:53:08 -07:00
Saket Saurabh 80ca18779b msm_serial_hs : Add support to configure GPIOs
This change adds support to configure/unconfigure GPIOs connected
to HSUART peripheral if GPIOs related information is provided with
enumerated HSUART port. GPIOs would be configured with active
configuration when HSUART port is opened and would be configured
with suspend configuration when HSUART port is closed by application
provided GPIOMUX settings are available for those GPIOs with platform
specific configuration.

Change-Id: I18dcb46df2bed8f6b1980b789d91abfa4b2898c2
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:53:06 -07:00
Saket Saurabh 0c9acf47cf msm_serial_hs : Add support to select device id with BLSP Based UART
UART device is enumerated as /dev/ttyHS<id>. Currently cell-index
is used as id to enumerated the device. It is not required to
provide any device specific configuration with device tree usage.
Hence use below approaches to select device ID with BLSP based UART:

1. Use auto increment approach for selecting id by default. HSUART
driver would increment id based on HSUART device binding with driver.

2. Add support to provide user defined id for particular HSUART device.
Alias property can be used as user defined id for used HSUART device.
Hence add support for the same. Also check if alias based ID is already
under-used, then fail the probe of driver for the same.

Here it is responsibility of user to use either of above approach.
If hybrid approach is being used,then user shouldn't use those
aliases ID which are already used by previously enumerated HSUART
devices.

Add required documentaion for alias usage for BLSP based UART.

CRs-Fixed: 410636
Change-Id: Ibd5f25c73cd5a08f6bf851a9846fecc780404b2b
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:53:05 -07:00
Mayank Rana 6d8d5c9b0a msm_serial_hs: Update usage of PNOC bus scaling voting
Currently device probe fails, if PNOC bus scaling data for HSUART device
is not available. Fail device probe only if PNOC bus scaling data is
provided and usage of same fails.

- Add PNOC bus voting/unvoting in probe before accessing any HSUART
register.
- Add PNOC bus voting/unvoting in loopback debugfs entry before accessing
any HSUART register.

Change-Id: I80d70cfba90eb73982d80feae0e10bd2d67c5073
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:52:01 -07:00
Eric Holmberg 12c0a2f660 tty: n_smux: Mask power collapse support
If power-collapse is supported locally, then SMUX will always set the
power-collapse supported flag in an OPEN ACK which may cause confusion
for the remote side.

Mask power-collapse enabled with the value in the remote open
acknowledge message.

CRs-Fixed: 443770
Change-Id: I8ceb753e25a53d13fa5b5288457e8b1993452a18
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:51:53 -07:00
Mayank Rana 716ac00145 msm_serial_hs : Add support to vote for BUS scaling
PNOC Bus client is required to vote for BUS Scaling.
In absent of Bus scaling vote from Bus client and PNOC
clock gating is enabled, access to PNOC bus would be
error fatal. Hence it is required to vote for Bus scaling
for PNOC Bus client.

BLSP based HSUART with BAMLite usage is PNOC bus client.
Hence add PNOC bus scaling for BLSP based HSUART using
BAMLite interface.

BUS scaling is voted for below conditions:
1. When UART port is opened by application.
2. When UART clock is turned ON when coming out of
UART LPM Mode.

BUS scaling is reset for below conditions:
1. When UART port is closed by application.
2. When clock OFF request is made by application to put
UART into LPM Mode.

This change also uses API provided by bus driver to parse
device tree node for vectors.

Change-Id: I5788f3c88cfe3ea2ac8fd43a25e058b2657c1e61
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:50:40 -07:00
Saket Saurabh 07d9321266 msm_serial_hs : Fix L2 port errors in HSUART driver
This change fixes below L2 Port errors:

1. From Probe, uart_add_one_port( ) function is registering uart port
with serial core. Serial core calls HSUART driver's registered uart_ops'
config_port and set_mctrl() functions. In msm_hs_set_mctrl_locked()
function, driver is trying to access UART registers without turning
uart clock ON. Hence fix the same by moving clk_disable_unprepare()
after calling uart_add_one_port() which makes sure that there is no
unclocked access to uart registers.

2. msm_hs_set_termios( ) sets the UART_DM_CSR register to get required
baud rate. Due to using wrong UART_DM_CSR register offset for BLSP based
HSUART Core, L2 Cache Error is reported. Fix the same by using correct
UART_DM_CSR register offset.

Change-Id: I71ab339c033089ceb47c9c8218cc46f122a88b1c
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:49:36 -07:00
Saket Saurabh 4f88e3cd5e msm_serial_hs : Add support for using BAM as DMA Engine
ADM HW is not present on some recent SOCs. This implies data
movement between system memory and UART FIFO cannot be
achieved by the existing HSUART driver using the ADM Mode.

On these recent SOCs, there is a new DMA HW engine named BAM
available for data movement between system memory and UART
FIFO. This patch add changes in existing HSUART driver for
using BAM as DMA engine.

Change-Id: I7fb8604c86d2a06598f6f5ccb1a968fe7388f501
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:48:55 -07:00
Mayank Rana a67ac4b144 msm_serial_hs: Add support for device tree for BLSP based UART
This change adds support for device tree for BLSP based UART
Core.

Also document pdata and their usage with device tree in :
Documentation/devicetree/bindings/tty/serial/msm_serial_hs.txt

Change-Id: I72c6bdcf1b22320ef4674b17fab226ae0cac72ac
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:48:55 -07:00
Saket Saurabh 8d7029eca9 msm_serial_hs_hwreg : Add UARTDM Core v1.4 registers support
BLSP Based UART Core(v14) is different compare to GSBI based UART Core(v13)
in terms below features.
1. Existing some of registers offset has been changed.
2. New bits are being added into existing some of registers.
3. ADM interface support has been removed and BAM interface support is
   added.
4. New registers are added to support new features.

Hence this change adds new registers, update existing register offset and
bitmasks.

Select CONFIG_MSM_UARTDM_Core_v14 if BLSP based UART Core is present.

Change-Id: I96cdd837d4a80d266c73e37c97705dbf8c6c7386
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:47:37 -07:00
Mayank Rana 8c18762b4d msm_serial_hs: Correct setting of ignore_status_mask
Termios are used by application to notify UART driver about
what are the events it is interested to be updated (i.e. like
Parity / Break Conditions). Currently while setting IGNBRK bit
previous status of IGNPAR is ignored. Hence correct the same.

Change-Id: I5420c88713de40a20001ce3f3062fd2d8f2fb2e0
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:47:30 -07:00
Mayank Rana 2e0e5b1916 msm_serial_hs_lite: Prevent system suspend when UART port is used.
Currently driver doesn't prevent system suspend if UART port is
being used. This change adds support to prevent system suspend
when UART port is opened/under used. With this feature, wakelock
is acquire when UART port is being opened and release when UART
port is being closed.

To enable this feature, set use_pm platform data with required
UART port.

Also document use_pm pdata usage with device tree binding.

CRs-Fixed: 430726
Change-Id: I441b527af7047d57f6a5366e7c8277f413dc9d4e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:45:09 -07:00
Mayank Rana ed1bb5ecf2 msm_serial_hs_lite: Add support to use 4-wire UART
GSBI based UART is used in shared mode. Hence this driver only
supports configuring Tx and Rx GPIOs with configuring GSBI control
register with I2C/UART Shared mode protocol.
Add support in this driver for 4-wire UART related configuration
i.e.GPIOs (i.e. Tx, Rx, CTS, RFR signal lines) and programming
GSBI control register with UART mode protocol.

4-wire UART related configuration is done based on platform data
variable config_gpio.
For 4-wire UART, set config_gpio as 4 to configre all 4 GPIOs.
For 2-wire UART, set config_gpio as 1 to configure only Tx and Rx
GPIOs.

Also document added new pdata and their usage with device tree.

CRs-Fixed: 430725
Change-Id: I9236c63778406f004a96d782a4614cb5db46755c
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:45:08 -07:00
Mayank Rana 5e255d503b msm_serial_hs: Add support to handle Rx BREAK condition
Currently Rx Break Error condition is not checked using UART_DM_SR
register. Hence by default null-character is being inserted on
receiving Rx Error or Rx Break condition. Application sets termios
c_iflag if it needs any notification related to any Rx Error or
Break condition. Hence add support to handle Rx Break condition and
insert null-character conditionally based on termios.c_iflag.

CRs-Fixed: 412201
Change-Id: I7f496e42757b949f597d5dbe5c1f1ca88ee53c8c
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:45:04 -07:00
Mayank Rana f20f38227f msm_serial_hs_lite: Correct calculation of uartclk rate
UART clock rate is not calculated correctly when lowering uart
baud rate once higher than 460800 bps baud rate is used. UART
clock needs to be set as (16 * baud rate) for baud rate more than
460800 bps otherwise it needs to be 7327800 Hz. UART baud rate is
derived from set uart clock frequency and value programmed into
UART CSR (Clock Selection Register).

Change-Id: Ia9fb06884f89765a789f1ec129a8e920eb43313e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:43:33 -07:00
Mayank Rana 3dd037700c msm_serial_hs_lite: Increase Rx FIFO Watermark and AUTO RFR Value
UARTDM Core is having 64 words of Tx FIFO and 64 words of Rx FIFO.
Currently RFWR (Receive FIFO Watermark) and AUTO RFR values are
programmed as 12 words (i.e. 48 bytes). For better performance,
increase RFWR and AUTO RFR values from 12 words to 48 words
(i.e. 192 bytes).

Change-Id: Ib5a8570d2382c3047e4581acb349f72911bc6de5
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:42:04 -07:00
Mayank Rana cd86f48766 msm_serial_hs_lite: Add support for up to 4 Mbps baud rate
UART Hardware can support Max baud rate of 4 Mbps. Hence add
support for up to 4 Mbps baud rate. With this change UART
hardware can be used with max 4 Mbps baud rate in PIO Mode.

Change-Id: Ifecc20e29916a460038320d59c462cd6556e2903
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:41:19 -07:00
Mayank Rana 1d65a088f5 msm_serial_hs_lite: Use existing uartclk variable for setting clock rate
Currently uartclk rate is hard coded as 7327800 and configured wherever
it is required to get requested baud rate till 460800 bps. To support
higher baud rate above 460800 bps, start using uartclk variable of
uart_port structure which would be having last used uartclk rate value.
Uartclk would be set as ( 16 * required baud rate ) for higher baud rate.
This change doesn't add support for higher baud rate than 460800 bps.

Also do print message cleanup.

Change-Id: Ie3aacf4d334c58d4602f0e412224ca8b4b64d4e7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:41:16 -07:00
Saket Saurabh 21dc99b964 msm : Add support to get user-defined TTY device for uart port
Currently UART port is enumerating with platform device ID. It is not
necessary that TTY<ID> is same as available UART device ID. Provide
optional support which allows to override used platform device ID with
uart port by userid to get TTY based Uart device as /dev/ttyMSM<userid>
instead of /dev/ttyMSM<ID>.This support helps third party application/test
framework to use the same TTY uart device name across different platform
without changing in those applications as it is not necessary that on
different platform used UART device would be having same TTY<ID> name.
The userid value should be from 0 to 256

Change-Id: If24ab20f0e4c5bb947b947ad0811f5a56a2c45db
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:39:14 -07:00
Mayank Rana fb0c36aa80 msm_serial_hs: Don't configure gpios into UART Mode always
UARTDM device is used as interface to connect external devices through
GPIOs. Currently those GPIOs are configured in active mode once driver's
probe() is called and configured in suspend mode once its remove() is
called. Probe() is called once only and remove is not called until UARTDM
platform device is removed. With this current implementation, although
external device (ex. Bluetooth SoC) is not operational mode, used UARTDM
GPIOs are configured in active mode which is causing more leakage current
and more power consumption.

Hence configure those UARTDM GPIOs in active mode only when used UARTDM
device is opened and under used. Configure UARTDM GPIOs back to suspend
mode when UARTDM device is closed and under not used.

CRs-Fixed: 422217
Change-Id: I509d5a1ddf4e1b2c261d31a820fce2de93d0fece
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:37:56 -07:00
Stepan Moskovchenko 17a3e4ee58 msm_serial_hs_lite: Use aliases for setting line number
Using device tree aliases rather than the cell-index
property is the more commonly-used method of setting the
line number of a serial device.

Change-Id: I58a70fa971848cd3e0530fb5786a0aa2243188eb
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:37:26 -07:00
Saket Saurabh ef99fc1f61 msm_serial_hs : handle uart_flush_buffer
Serial core allocates circular buffer for uart tx transfer.
Circular buffer head and tail is updated in serial core and
circular buffer tail is updated in uart driver.While uart
transfer is happening, uart client bluetooth hci_ldisc,calls
uart_flush_buffer in serial core and sets circular buffer
head and tail to zero.As uart driver does not know when
uart_flush_buffer is called in serial core by uart client,it
updates circular buffer tail for the previous ADM Tx completion.
This leads to queueing Tx command to ADM although no data is
there in circular buffer.Because of this,uart client is not
functional.

Hence adding msm_hs_flush_buffer api which notifies to uart driver
that uart_flush_buffer is called in serial core by uart client and
set tty_flush_receive flag to true.In uart interrupt handler ,do
not update circular buffer tail if uart_flush_buffer is already
called in serial core by uart client else update circular buffer
tail on ADM Tx completion.

CRs-Fixed: 419054
Change-Id: Ide13960bd5f9c4c374cadfab2a9860e928ef2e1c
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:35:03 -07:00
Stepan Moskovchenko d5ebec969b msm_serial_hs_lite: Allow setting line number in device tree
Allow the serial device tree node to specify a UART line
number to support explicitly binding an HSL serial port to
a named TTY device.

Change-Id: Icb5b6882c9784ee7676ad849197e9a557f73513c
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:33:24 -07:00
Saket Saurabh 30af5e91d7 msm_serial_hs_hwreg.h: Correcting the even parity and odd parity bits
Currently parity bits are defined to be used with UART_DM_MR2
register with PARITY_MODE Bit as below :
EVEN_PARTIY = 1 and ODD_PARITY = 2
With these values, UART functionality doesn't work after enabling parity.
Hence adding correct used PARITY_MODE bits value as
EVEN_PARITY = 2 and ODD_PARITY = 1
after confirming with UART hardware programming guide.

CRs-Fixed: 410377
Change-Id: I1eeb599504285b4c153ad98f4b49fa2bfe6899b6
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:28:51 -07:00
Eric Holmberg 29fa094aae tty: smux_ctl: Do not set POLLERR if signal received
During the userspace freeze process, a fake signal is sent to userspace
applications.  In the case of SMUX CTL, the smux_ctl_poll() will set the
POLLERR flag if a signal is received.  This incorrectly unblocks the
userspace application that called poll() and the userspace application
will grab a wakelock before doing additional processing which aborts the
freeze process.

Change smux_ctl_poll() to not set POLLERR if a signal is received.

CRs-Fixed: 402651
Change-Id: I3d18552ceff769d302d1536cf5b9345f3aad767b
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:20:51 -07:00
Saket Saurabh 6a0f360436 msm : Add support to get user defined TTY device for Uart port
Currently UART port is enumerating with platform device ID. It is not
necessary that TTY<ID> is same as available UART device ID. Provide
optional support which allows to override used platform device ID with
uart port by userid to get TTY based Uart device as /dev/ttyHS<userid>
instead of /dev/ttyHS<ID>.This support helps third party application/test
framework to use the same TTY uart device name across different platform
without changing in those applications as it is not necessary that on
different platform used UART device would be having same TTY<ID> name.
The userid value should be from 0 to 256

CRs-Fixed: 386736
Change-Id: I50db8a40d4b7758adafc05240fe27af3a95fab28
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
2013-09-04 15:16:02 -07:00
Mayank Rana a6652de483 msm_serial_hs: Call clk_set_rate() from non-atomic context
By default, HSUART Core CLK frequency is set to 7.37MHz. With this
CLK Frequency, it is not possible to get higher baud rate of 3.2 or
4 Mbps. Hence to set higher baud rate, driver calls clk_set_rate()
to set HSUART Core CLK frequency as ( required baud_rate * 16 ).
clk_set_rate() shouldn't be call from atomic context otherwise below
BUG is seen.

BUG: sleeping function called from invalid context at
mutex.c:85 in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: init
[<c00151c4>] (unwind_backtrace+0x0/0x12c) from
		[<c07aebbc>] (mutex_lock+0x18/0x3c)
[<c07aebbc>] (mutex_lock+0x18/0x3c) from
		[<c0021258>] (clk_set_rate+0x2c/0x178)
[<c0021258>] (clk_set_rate+0x2c/0x178) from
		[<c0364a34>] (msm_hs_set_termios+0x820/0xb9c)
[<c0364a34>] (msm_hs_set_termios+0x820/0xb9c)
		from [<c0362170>] (uart_change_speed+0x90/0x94)
[<c0362170>] (uart_change_speed+0x90/0x94)
		from [<c03626c0>] (uart_startup+0xc8/0x1a0)
[<c03626c0>] (uart_startup+0xc8/0x1a0)
		from [<c0363534>] (uart_open+0xe4/0x13c)
[<c0363534>] (uart_open+0xe4/0x13c)
		from [<c0343d64>] (tty_open+0x360/0x4ec)
[<c0343d64>] (tty_open+0x360/0x4ec)
		from [<c013787c>] (chrdev_open+0x114/0x134)
[<c013787c>] (chrdev_open+0x114/0x134)
		from [<c0132844>] (__dentry_open+0x190/0x29c)
[<c0132844>] (__dentry_open+0x190/0x29c)
		from [<c0132a00>] (nameidata_to_filp+0x50/0x5c)
[<c0132a00>] (nameidata_to_filp+0x50/0x5c)
		from [<c0141b08>] (do_last+0x7ec/0x928)
[<c0141b08>] (do_last+0x7ec/0x928)
		from [<c0141d08>] (path_openat+0xc4/0x390)
[<c0141d08>] (path_openat+0xc4/0x390)
		from [<c01420b4>] (do_filp_open+0x30/0x7c)
[<c01420b4>] (do_filp_open+0x30/0x7c)
		from [<c0132518>] (do_sys_open+0xd8/0x174)
[<c0132518>] (do_sys_open+0xd8/0x174)
		from [<c000e380>] (ret_fast_syscall+0x0/0x30)

Hence use mutex to protect msm_set_termios() allowing clk_set_rate()
to be called from non-atomic context.

Change-Id: I92073aaf0c80a9a432c47d42286d9a130cf5172c
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:14:16 -07:00
Rohit Vaswani 51b93992d5 msm_serial: Fix the timing requirement for UIMs
Some commercial SIMS require a longer stop bit. This change
makes the driver confirm to the standard.

Change-Id: I270a101213d7dd31acf2608786541e3f11e2f2b8
Acked-by: Kaushik Sikdar <ksikdar@qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2013-09-04 15:13:59 -07:00
Eric Holmberg 394bcd8d3e tty: n_smux: Increased smux log buffer size
Increase log buffer size to handle the maximum possible log line size.
This prevents passing in a negative buffer size to sprintf() which is
handled gracefully, but generates a warning message in the kernel log.

Change-Id: Ie87fe3a5431757217f4b87338d5af08bc24d84e6
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:48 -07:00
Eric Holmberg 9fd0e42980 tty: n_smux: Update subsystem restart unit tests
For subsystem restart unit tests, add check to make sure the remote
system is back up before continuing with the tests.  This allows
removing fixed wait times in the unit tests and allows stress testing
using a shell script to call tests back-to-back.

Change-Id: I9af2164dd2ff8bc4d8a1e57f8a7aad957528a8c9
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:45 -07:00
Eric Holmberg 2dafe08ee0 tty: n_smux: Add function to determine if remote side is active
For subsystem restart unit tests, we need to know when the remote system
is back up to avoid having to add fixed delays.

Add private function to allow checking to see if the remote side is
active.

Change-Id: Ide2f5e4aba01479c2dc1e8c3b4332da7da6ad0c5
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:43 -07:00
Eric Holmberg 1065741618 tty: n_smux: Adjust receive retry queue parameters
If the remote modem has queued many small packets in the UART FIFO and
the SMUX client cannot provide receive buffers fast enough, then the
auto flow control command may not get processed before the receive queue
has overflowed.  In measured cases, an average of 10 packets are
received after flow control is enabled.  In the failure cases, up to 19
packets are received which is more than the max queue size (32 packets)
minus the high watermark (16 packets) which causes an overflow.

Use a bigger retry queue and more aggressive watermark values to make
auto flow control more responsive and to allow more packets to get
queued before an overflow occurs.

CRs-Fixed: 394198
Change-Id: I53f564a5401ea60f351e2e6b29ec41eb4b806653
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:43 -07:00
Eric Holmberg ca8207e9ba tty: n_smux: Log error messages to internal log
If an error occurs, log to both the kernel log and the internal SMUX log
to aid debugging.

Change-Id: I35f7a8e44401b6c16c0d05fd9ef3368158075b77
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:42 -07:00
Eric Holmberg d234ec0ee9 tty: n_smux: Add flow control state to overflow message
To aid in debugging, print the state of receive flow control if an
overflow condition occurs.

Change-Id: Ic425d8c3f58e22a99b746bc184a8bb62677a944e
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:41 -07:00
Eric Holmberg 3b1d0fe271 tty: n_smux: Add Remote Flow Control Test
Add remote flow control test to verify external modem to Apps flow
control.

Change-Id: Id79201006614885f266a00cca5cb99667ec372b8
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:41 -07:00
Eric Holmberg 4c7e2cb2d3 n_smux: add debugfs node for printing channel states
Add debugfs node that prints detailed state information
for all smux channels.

Change-Id: I727f1c53797ee317856056b8e4d9a8686940ce0f
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:40 -07:00
Eric Holmberg 52f9739bdb tty: n_smux: Fix packet close synchronization issue
If a channel is logical channel open or close ack is pending in the
transmit queue when a logical channel is closed, then they are currently
purged and the remote and local channel states are mismatched and the
port cannot be re-opened.  Note that this issue only occurs during rapid
open/close/open sequences that are typically only seen in remote
loopback stress testing.

Add code to not purge ACK commands from a logical channel unless the
logical channel purge is due to a subsystem restart (at which point the
remote state is known to be power-on default).

Change-Id: I52763323642bb7c505630bb994ecc1e021270d17
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:13:39 -07:00
Angshuman Sarkar 81455cead9 tty: n_smux: Enable IPC logging for SMUX
Using the kernel log for SMUX logging requires users to enable
debug logging and then reproduce the issue.  Enabling all
logging often affects the timing and can make issues harder
to solve.

Add SMUX IPC Logging to enable internal logging that has a
minimum impact on performance and is always on to allow
debugging of an issue either from the command line or from
a memory dump.

CRs-Fixed: 384568
Change-Id: I6f1df407e07760206a7a548c9d3fce228e249155
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
2013-09-04 15:13:39 -07:00
Mayank Rana aaf548c68b msm_serial_hs: Don't destroy mutex from msm_hs_shutdown()
mutex is used uninitialized while unloading N_TTY line discipline
and installing SMUX Line discipline as msm_hs_shutdown() of HSUART
driver is called which is destroying this used mutex. Hence while
SMUX Line discipline is used, and clock off API is called, mutex
slowpath warning is seen. Destroying of mutex shouldn't be done from
msm_hs_shutdown() as initizalition and destroying of the mutex
is done from probe() and remove() of HSUART driver. Hence don't
destroy mutex from msm_hs_shutdown() to fix the issue.

CRs-Fixed: 391551
Change-Id: I74ac1372405e1b893d658ee03e9955858c9e782f
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-09-04 15:12:41 -07:00
Joel King 17151646b9 msm: tty: update receive room just before writing data to the ldisc
There is a corner case in the tty driver where the value of
tty->receive_room is not being updated before writing data to
the line discipline. When this happens, data is lost because
of failure to re-submit any remaining data to the ldisc.

This fix is dependent on a new tty flag that is set only when
the tty driver is used for efs sync betweem the mdm modem and
the applications processor.

CRs-Fixed: 358868
Change-Id: I0ba02980504b4d8187b8c83111c2c883d194efa2
Signed-off-by: Joel King <joelking@codeaurora.org>
2013-09-04 15:09:22 -07:00
Eric Holmberg a5530ccb65 tty: n_smux: Add support for ldisc removal during SSR
If subsystem restart (SSR) is in progress and the line discipline is
removed, then the platform devices may get removed twice leading to a
kernel panic.

Add conditional logic to properly handle platform device removal if line
discipline is removed while a subsystem restart is in progress.

CRs-Fixed: 386491
Change-Id: I1ddc89175509e333098f849b0f76e09660644573
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:08:06 -07:00
Stepan Moskovchenko 35b915625b msm_serial_hs_lite: Unconditionally control UART AHB clock
Control the UART AHB clock regardless of whether a GSBI
resource is present, as the AHB clock is needed to access
the UARTDM core registers in addition to the GSBI
registers.

Change-Id: Idca5ac07c133b67ac7c02ca3304a46794659e010
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-09-04 15:07:47 -07:00
Eric Holmberg e0ab700fc0 tty: n_smux: Add/remove platform devices for SSR
Subsystem restart is handled by sending DISCONNECT notifications to
clients.  In addition, a subsystem restart may trigger the mdm helper to
unload the line discipline to capture a memory dump before reloading the
line discipline.  This requires SMUX clients to handle two different
disconnect cases properly.

To converge the two use cases and simplify client code, both a subsystem
restart and line discipline unload will result in removing the platform
devices.  The platform devices are re-added after the line discipline is
loaded or the subsystem restart has been completed.

CRs-Fixed: 386186
Change-Id: Ic61c97acef2a9909f180ac4c81e944351ba9d348
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:07:42 -07:00
Eric Holmberg d730d26229 tty: smux_ctl: Add support for poll method.
Userspace clients hold a wakelock while calling read.  If data isn't
available, read() blocks preventing the release of the wakelock and
preventing the system from going into low power mode.

Implement poll() method to enable clients to call poll() to block and
wait for data without a wakelock.  Once poll() returns, then a wakelock
can be acquired and read() called without blocking which allows
minimizing the time a wakelock is held.

CRs-fixed: 379519
Change-Id: Icea23783ee2d03e2beac81bdb1b735e4edfd1d22
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 15:07:05 -07:00
Rohit Vaswani 36235a83a4 msm_serial: Fix UIM driver configuration
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>
2013-09-04 15:03:57 -07:00
Angshuman Sarkar edfd2a2821 tty: smux_ctl: add device attribute for open timeout
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>
2013-09-04 15:03:48 -07:00
Mayank Rana 67b0d250da msm: Add configuration required to use GSBI8 into UARTDM Mode
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>
2013-09-04 15:03:19 -07:00
Eric Holmberg 15fa5a8acf tty: n_smux: Fix workqueue flush deadlock and local mode reset
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>
2013-09-04 15:00:41 -07:00
Stepan Moskovchenko e674c7ca8a msm_serial_hs_lite: Check SR[TXEMT] in wait_for_xmitr
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>
2013-09-04 15:00:05 -07:00
Eric Holmberg a82bddd908 tty: n_smux: Trigger TX worker after wakeup
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>
2013-09-04 14:59:51 -07:00
Eric Holmberg 6c5818718c tty: n_smux: Remove Sleep Request ACK when powering down
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>
2013-09-04 14:59:49 -07:00
Eric Holmberg cfb7930912 tty: n_smux: Increase inactivity timeout
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>
2013-09-04 14:59:48 -07:00
Eric Holmberg 218ef6371b tty: n_smux: Add packet-level logging of power commands
Log power packets in addition to power state changes.

Change-Id: I46b8d86df881b328bb9124611bdbf1a0db2928f9
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 14:59:31 -07:00
Eric Holmberg 52da59a978 tty: n_smux: Allow TX work to run while waiting for wakeup
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>
2013-09-04 14:59:30 -07:00
Eric Holmberg ff317cbe1f tty: n_smux: Add retry queue size flow control
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>
2013-09-04 14:59:29 -07:00
Eric Holmberg 6607b32ee8 tty: n_smux: Make unit test macros safe for side-effects
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>
2013-09-04 14:59:28 -07:00
Eric Holmberg 53883ce569 tty: n_smux: Clarify test messages
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>
2013-09-04 14:59:27 -07:00
Eric Holmberg 54a0a44ba6 tty: n_smux: Update logging to handle broadcast ID
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>
2013-09-04 14:59:27 -07:00
Eric Holmberg 3cc4638432 tty: n_smux: Prevent TTY Line Discipline unload during flush
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>
2013-09-04 14:59:26 -07:00
Eric Holmberg 419a608f61 tty: smux_ctl: Remove unused ports
Only SMUX_DATA_CTL_0 is currently used from userspace.

Change-Id: Iab9e4fa9b096d34a67fb6662418aec0be1381adb
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 14:59:17 -07:00
Eric Holmberg 52b59e884a tty: smux_ctl: Disable debug logging
Disable debug logging that was only necessary for bring-up.

Change-Id: I5a31a982efdd1bb1915571158cc164a3856b097d
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 14:59:17 -07:00
Eric Holmberg 152fc55cc1 tty: smux_ctl: Support removing line discipline gracefully
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>
2013-09-04 14:59:16 -07:00
Rohit Vaswani a685352807 msm: UIM driver msm_uim
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>
2013-09-04 14:57:47 -07:00
Stepan Moskovchenko 327831798a msm_serial_hs_lite: Fix compilation with console disabled
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>
2013-09-04 14:57:41 -07:00
Mayank Rana ae797894b7 msm_serial_hs: Add flush state machine for UART Tx Transfer
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>
2013-09-04 14:56:36 -07:00
Eric Holmberg d78cbbb652 tty: n_smux: Reset Power Collapse Enabled Flag
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>
2013-09-04 14:55:05 -07:00
Eric Holmberg 5e9bc4adcd tty: n_smux: Change external modem name for SSR
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>
2013-09-04 14:55:04 -07:00
Eric Holmberg b5d8742563 tty: n_smux: Delete power command from list
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>
2013-09-04 14:55:03 -07:00
Stepan Moskovchenko 4ec26868d1 msm_serial_hs_lite: Increase TX path timeout
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>
2013-09-04 14:55:03 -07:00
Eric Holmberg 10b0f52832 tty: n_smux: Add support for broadcast logical channel ID
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>
2013-09-04 14:55:02 -07:00
Eric Holmberg 134e9fde48 tty: n_smux: Update power logging
Add dedicated power logging macro to aid in power-related debugging.

Change-Id: I21d8c8b55a8d7c0645d1241773cb8127a48c58c4
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 14:55:01 -07:00
Eric Holmberg 3734439f64 tty: n_smux: Remove redundant variable set
Remove duplicate setting of the pkt.flags field which is harmless, but
redundant.

Change-Id: I6d2579216a03c4ca5ca3b06092ed8a9208d3e891
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2013-09-04 14:55:00 -07:00
David Brown e0974f699e tty: hvc_dcc: Remove redundant license clause
Remove the superfluous FSF address from the license text.

Signed-off-by: David Brown <davidb@codeaurora.org>
2013-09-04 14:49:45 -07:00
David Brown 1b63e724cb tty: serial: Add MSM "LITE" UART driver
Non DMA console-type serial driver for the MSM's HS uart, being run in
legacy mode.

Signed-off-by: David Brown <davidb@codeaurora.org>
2013-09-04 14:49:45 -07:00
David Brown 95f9171d51 tty: serial: Add MSM HS serial driver
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-09-04 14:49:44 -07:00